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

bot.IsMessageToMe syntax #562

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hey, guys. can someone explain how to use the IsMessageToMe method correctly? I tried everything.

bot.IsMessageToMe(tgbotapi.Message{})

or

bot.IsMessageToMe(*update.Message)

I will be glad to help. I know it's a stupid question, but I've been sitting with him for days.

ccioloss commented 2 years ago

@greenhell1337bot.IsMessageToMe(*update.Message) is how you should do it. However, note that this method returns true only if the sent message contains @<your_bot_username> in the message text