Add more helpers
This commit is contained in:
parent
5f2c062fb5
commit
0ed7585b71
10
irc.go
10
irc.go
@ -73,6 +73,7 @@ func (irc *Connection) writeLoop() {
|
|||||||
if b == "" || irc.socket == nil {
|
if b == "" || irc.socket == nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
irc.log.Printf("--> %s\n", b)
|
||||||
_, err := irc.socket.Write([]byte(b))
|
_, err := irc.socket.Write([]byte(b))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
irc.log.Printf("%s\n", err)
|
irc.log.Printf("%s\n", err)
|
||||||
@ -135,12 +136,19 @@ func (irc *Connection) Notice(target, message string) {
|
|||||||
irc.pwrite <- fmt.Sprintf("NOTICE %s :%s\r\n", target, message)
|
irc.pwrite <- fmt.Sprintf("NOTICE %s :%s\r\n", target, message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (irc *Connection) Noticef(target, format string, a ...interface{}) {
|
||||||
|
irc.Notice(target, fmt.Sprintf(format, a...))
|
||||||
|
}
|
||||||
|
|
||||||
func (irc *Connection) Privmsg(target, message string) {
|
func (irc *Connection) Privmsg(target, message string) {
|
||||||
irc.pwrite <- fmt.Sprintf("PRIVMSG %s :%s\r\n", target, message)
|
irc.pwrite <- fmt.Sprintf("PRIVMSG %s :%s\r\n", target, message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (irc *Connection) Privmsgf(target, format string, a ...interface{}) {
|
||||||
|
irc.Privmsg(target, fmt.Sprintf(format, a...))
|
||||||
|
}
|
||||||
|
|
||||||
func (irc *Connection) SendRaw(message string) {
|
func (irc *Connection) SendRaw(message string) {
|
||||||
irc.log.Printf("--> %s\n", message)
|
|
||||||
irc.pwrite <- fmt.Sprintf("%s\r\n", message)
|
irc.pwrite <- fmt.Sprintf("%s\r\n", message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user