diff options
author | Alexander Kiryukhin <a.kiryukhin@mail.ru> | 2019-09-05 22:43:32 +0300 |
---|---|---|
committer | Alexander Kiryukhin <a.kiryukhin@mail.ru> | 2019-09-05 22:43:32 +0300 |
commit | 6e4ade909d9b3a0a4a8dd8c11a4b1984b84f09e4 (patch) | |
tree | 11e5e2017501f68ac9b1705edfccd6af3134a3eb /examples/example_webhook.go | |
parent | 29322bf303815d477a83fee0e598006b651599a4 (diff) |
Diffstat (limited to 'examples/example_webhook.go')
-rw-r--r-- | examples/example_webhook.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/example_webhook.go b/examples/example_webhook.go index ad1bdae..b4857c1 100644 --- a/examples/example_webhook.go +++ b/examples/example_webhook.go @@ -39,10 +39,12 @@ func main() { log.Printf("Received: %#v", upd) switch upd := upd.(type) { case tamtam.MessageCreatedUpdate: - res, err := api.Messages.SendMessage(0, upd.Message.Sender.UserId, &tamtam.NewMessageBody{ - Text: fmt.Sprintf("Hello, %s! Your message: %s", upd.Message.Sender.Name, upd.Message.Body.Text), - }) - log.Printf("Answer: %#v %#v", res, err) + err := api.Messages.Send( + tamtam.NewMessage(). + SetUser(upd.Message.Sender.UserId). + SetText(fmt.Sprintf("Hello, %s! Your message: %s", upd.Message.Sender.Name, upd.Message.Body.Text)), + ) + log.Printf("Answer: %#v", err) default: log.Printf("Unknown type: %#v", upd) } |