I'm writing an telegram bot with golang and I have some troubles. I receive chat table from user by updates. But my bot is also in a channel chat, so if someone chat in this channel, the bot will also rep to them. How can I avoid this?
my code:
bot, err := tgbotapi.NewBotAPI("BOT_TOKEN")
if err != nil {
log.Panic(err)
}
var client Client
///////
//bot.Debug = true
///////
log.Printf("Authorized on account %s", bot.Self.UserName)
offset := rand.Intn(10000)
fmt.Println(offset)
u := tgbotapi.NewUpdate(offset)
u.Timeout = 360
//var IDSender int64
updates, err := bot.GetUpdatesChan(u)
for update := range updates {
if update.Message == nil {
continue
}
_IdSender := update.Message.Chat.ID
Greeting := tgbotapi.NewMessage(_IdSender, "Hello!")
bot.Send(Greeting)
}