From af029c366ce76c9e394ff18c43a5174314e0ce2e Mon Sep 17 00:00:00 2001 From: Gleb Sinyavsky Date: Sat, 21 Nov 2015 16:33:58 +0300 Subject: [PATCH] Bot IsMessageToMe method --- bot.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bot.go b/bot.go index 0789082..157f966 100644 --- a/bot.go +++ b/bot.go @@ -14,6 +14,7 @@ import ( "os" "strconv" "time" + "strings" ) // BotAPI has methods for interacting with all of Telegram's Bot API endpoints. @@ -198,6 +199,10 @@ func (bot *BotAPI) GetMe() (User, error) { return user, nil } +func (bot *BotAPI) IsMessageToMe(message Message) (bool) { + return strings.Contains(message.Text, "@"+bot.Self.UserName) +} + func (bot *BotAPI) Send(c Chattable) (Message, error) { switch c.(type) { case Fileable: