1
0
mirror of synced 2024-11-22 12:56:06 +03:00

Add Send func for sending a message to a user (#10)

Fixes #6.
This commit is contained in:
Bo-Yi Wu 2016-09-23 05:49:05 +08:00 committed by Harrison Shoebridge
parent f3642f1e87
commit 2db24269ec

View File

@ -264,6 +264,21 @@ func (m *Messenger) Response(to int64) *Response {
} }
} }
// Send will send a textual message to a user. This user must have previously initiated a conversation with the bot.
func (m *Messenger) Send(to Recipient, message string) error {
return m.SendWithReplies(to, message, nil)
}
// SendWithReplies sends a textual message to a user, but gives them the option of numerous quick response options.
func (m *Messenger) SendWithReplies(to Recipient, message string, replies []QuickReply) error {
response := &Response{
token: m.token,
to: to,
}
return response.TextWithReplies(message, replies)
}
// classify determines what type of message a webhook event is. // classify determines what type of message a webhook event is.
func (m *Messenger) classify(info MessageInfo, e Entry) Action { func (m *Messenger) classify(info MessageInfo, e Entry) Action {
if info.Message != nil { if info.Message != nil {