implement Client.Message() and Client.Messagef()
This commit is contained in:
parent
9a47f38e51
commit
b8c530fd21
@ -11,7 +11,7 @@
|
|||||||
- Focuses on simplicity, yet tries to still be flexible
|
- Focuses on simplicity, yet tries to still be flexible
|
||||||
- Only requires standard packages
|
- Only requires standard packages
|
||||||
- Event based triggering/responses
|
- Event based triggering/responses
|
||||||
- Documentation is actively being worked on
|
- Documentation is mostly on par
|
||||||
|
|
||||||
## Installing
|
## Installing
|
||||||
|
|
||||||
|
13
main.go
13
main.go
@ -13,9 +13,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// TODO's:
|
// TODO's:
|
||||||
// * needs PRIVMSG (Msg?), ACTION (Me? Action?), NOTICE (Notice?), SendRaw?
|
// * needs ACTION (Me? Action?), NOTICE (Notice?), SendRaw?
|
||||||
// * RunCallbacks(Event)
|
// * RunCallbacks(Event)
|
||||||
// * track connection time (conntime? in state)
|
// * 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.
|
// * would be cool to track things like SERVERNAME, VERSION, UMODES, CMODES, etc.
|
||||||
// -- https://github.com/Liamraystanley/Code/blob/master/core/triggers.py#L40-L67
|
// -- https://github.com/Liamraystanley/Code/blob/master/core/triggers.py#L40-L67
|
||||||
// * client should support ping tracking (sending PING's to the server)
|
// * 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}})
|
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...))
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user