1
0
mirror of synced 2024-11-29 16:46:09 +03:00

Add comments

This commit is contained in:
Harrison 2016-04-15 10:34:10 +10:00
parent cba1831ce3
commit ceec3c0a6b

View File

@ -23,12 +23,14 @@ func main() {
conf.Parse() conf.Parse()
// Create a new messenger client
client := messenger.New(messenger.Options{ client := messenger.New(messenger.Options{
Verify: *verify, Verify: *verify,
VerifyToken: *verifyToken, VerifyToken: *verifyToken,
Token: *pageToken, Token: *pageToken,
}) })
// Setup a handler to be triggered when a message is received
client.HandleMessage(func(m messenger.Message, r *messenger.Response) { client.HandleMessage(func(m messenger.Message, r *messenger.Response) {
fmt.Printf("%v (Sent, %v)\n", m.Text, m.Time.Format(time.UnixDate)) fmt.Printf("%v (Sent, %v)\n", m.Text, m.Time.Format(time.UnixDate))
@ -40,6 +42,7 @@ func main() {
r.Text(fmt.Sprintf("Hello, %v!", p.FirstName)) r.Text(fmt.Sprintf("Hello, %v!", p.FirstName))
}) })
// Setup a handler to be triggered when a message is read
client.HandleDelivery(func(d messenger.Delivery, r *messenger.Response) { client.HandleDelivery(func(d messenger.Delivery, r *messenger.Response) {
fmt.Println(d.Watermark().Format(time.UnixDate)) fmt.Println(d.Watermark().Format(time.UnixDate))
}) })