diff options
author | Alexander Kiryukhin <a.kiryukhin@mail.ru> | 2021-02-14 13:23:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-14 13:23:10 +0300 |
commit | c31a53b6a1e5fa0c6966451c5f45e42d1eb822ee (patch) | |
tree | 5d1683dbe87fedbc6c1d7376df7147a8ad0936c2 /examples/example_longpolling.go | |
parent | ee63b08bd7861702123f9c5e83d60f49b1805e85 (diff) | |
parent | e768ef944c88be1b18c995544c76fa931d9c5916 (diff) |
Fix issue #3
Diffstat (limited to 'examples/example_longpolling.go')
-rw-r--r-- | examples/example_longpolling.go | 7 |
1 files changed, 5 insertions, 2 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) } |