@@ -24,27 +24,27 @@ import (
2424
2525func main () {
2626 bot , err := tgbotapi.NewBotAPI (" MyAwesomeBotToken" )
27- if err != nil {
28- log.Panic (err)
29- }
27+ if err != nil {
28+ log.Panic (err)
29+ }
3030
31- bot.Debug = true
31+ bot.Debug = true
3232
33- log.Printf (" Authorized on account %s " , bot.Self .UserName )
33+ log.Printf (" Authorized on account %s " , bot.Self .UserName )
3434
35- u := tgbotapi.NewUpdate (0 )
36- u.Timeout = 60
35+ u := tgbotapi.NewUpdate (0 )
36+ u.Timeout = 60
3737
38- err = bot.UpdatesChan (u)
38+ updates , err : = bot.GetUpdatesChan (u)
3939
40- for update := range bot. Updates {
41- log.Printf (" [%s ] %s " , update.Message .From .UserName , update.Message .Text )
40+ for update := range updates {
41+ log.Printf (" [%s ] %s " , update.Message .From .UserName , update.Message .Text )
4242
43- msg := tgbotapi.NewMessage (update.Message .Chat .ID , update.Message .Text )
44- msg.ReplyToMessageID = update.Message .MessageID
43+ msg := tgbotapi.NewMessage (update.Message .Chat .ID , update.Message .Text )
44+ msg.ReplyToMessageID = update.Message .MessageID
4545
46- bot.Send (msg)
47- }
46+ bot.Send (msg)
47+ }
4848}
4949```
5050
@@ -74,10 +74,10 @@ func main() {
7474 log.Fatal (err)
7575 }
7676
77- bot.ListenForWebhook (" /" + bot.Token )
77+ updates , _ := bot.ListenForWebhook (" /" + bot.Token )
7878 go http.ListenAndServeTLS (" 0.0.0.0:8443" , " cert.pem" , " key.pem" , nil )
7979
80- for update := range bot. Updates {
80+ for update := range updates {
8181 log.Printf (" %+v \n " , update)
8282 }
8383}
0 commit comments