diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/example_longpolling.go | 7 | ||||
-rw-r--r-- | examples/example_webhook.go | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/examples/example_longpolling.go b/examples/example_longpolling.go index 6bb4727..63e0632 100644 --- a/examples/example_longpolling.go +++ b/examples/example_longpolling.go @@ -13,6 +13,7 @@ import ( "os/signal" "github.com/neonxp/tamtam" + "github.com/neonxp/tamtam/schemes" ) func main() { @@ -28,13 +29,15 @@ func main() { for upd := range api.GetUpdates(ctx) { log.Printf("Received: %#v", upd) switch upd := upd.(type) { - case *tamtam.MessageCreatedUpdate: + case *schemes.MessageCreatedUpdate: 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) + if err != nil { + log.Printf("Error: %#v", err) + } default: log.Printf("Unknown type: %#v", upd) } diff --git a/examples/example_webhook.go b/examples/example_webhook.go index b4857c1..2709e6f 100644 --- a/examples/example_webhook.go +++ b/examples/example_webhook.go @@ -12,6 +12,7 @@ import ( "os" "github.com/neonxp/tamtam" + "github.com/neonxp/tamtam/schemes" ) func main() { @@ -38,7 +39,7 @@ func main() { upd := <-ch log.Printf("Received: %#v", upd) switch upd := upd.(type) { - case tamtam.MessageCreatedUpdate: + case *schemes.MessageCreatedUpdate: err := api.Messages.Send( tamtam.NewMessage(). SetUser(upd.Message.Sender.UserId). |