diff options
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) } |