implement Client.Message() and Client.Messagef()

This commit is contained in:
Liam Stanley 2016-11-13 08:52:16 -05:00
parent 9a47f38e51
commit b8c530fd21
2 changed files with 13 additions and 2 deletions

@ -11,7 +11,7 @@
- Focuses on simplicity, yet tries to still be flexible
- Only requires standard packages
- Event based triggering/responses
- Documentation is actively being worked on
- Documentation is mostly on par
## Installing

13
main.go

@ -13,9 +13,10 @@ import (
)
// TODO's:
// * needs PRIVMSG (Msg?), ACTION (Me? Action?), NOTICE (Notice?), SendRaw?
// * needs ACTION (Me? Action?), NOTICE (Notice?), SendRaw?
// * RunCallbacks(Event)
// * track connection time (conntime? in state)
// * with conntime, find lag. Client.Lag() would be useful
// * would be cool to track things like SERVERNAME, VERSION, UMODES, CMODES, etc.
// -- https://github.com/Liamraystanley/Code/blob/master/core/triggers.py#L40-L67
// * client should support ping tracking (sending PING's to the server)
@ -298,3 +299,13 @@ func (c *Client) Part(channel, message string) {
c.Send(&Event{Command: JOIN, Params: []string{channel}})
}
// Message sends a PRIVMSG to target (either channel, service, or user)
func (c *Client) Message(target, message string) {
c.Send(&Event{Command: PRIVMSG, Params: []string{target}, Trailing: message})
}
// Messagef sends a formated PRIVMSG to target (either channel, service, or user)
func (c *Client) Messagef(target, format string, a ...interface{}) {
c.Message(target, fmt.Sprintf(format, a...))
}