go-telegram-bot-api / telegram-bot-api

Golang bindings for the Telegram Bot API
https://go-telegram-bot-api.dev
MIT License
5.7k stars 879 forks source link

how can i receive channels and groups messages #555

Open no-1imit opened 2 years ago

no-1imit commented 2 years ago

Hi, i use updates := bot.GetUpdatesChan(updateConfig) and loop update := range updates and i get only direct messages, how can i get messages users send in groups or channels?

nickRiNi commented 2 years ago

@no-1imit Did you manage to solve this problem? Thx

appleGun22 commented 2 years ago

to get updates from channels use u := tgbotapi.NewUpdate(0) u.AllowedUpdates = []string{"channel_post"} to access the messages in your for loop use update.ChannelPost