aboutsummaryrefslogtreecommitdiff
path: root/examples/example_longpolling.go
diff options
context:
space:
mode:
Diffstat (limited to 'examples/example_longpolling.go')
-rw-r--r--examples/example_longpolling.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/example_longpolling.go b/examples/example_longpolling.go
index 3dbc66b..6bb4727 100644
--- a/examples/example_longpolling.go
+++ b/examples/example_longpolling.go
@@ -29,9 +29,11 @@ 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),
- })
+ 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 %#v", res, err)
default:
log.Printf("Unknown type: %#v", upd)