Bot IsMessageToMe method
Gleb Sinyavsky zhulik.gleb@gmail.com
Sat, 21 Nov 2015 16:33:58 +0300
1 files changed,
5 insertions(+),
0 deletions(-)
jump to
M
bot.go
→
bot.go
@@ -14,6 +14,7 @@ "net/url"
"os" "strconv" "time" + "strings" ) // BotAPI has methods for interacting with all of Telegram's Bot API endpoints.@@ -196,6 +197,10 @@ log.Printf("getMe: %+v\n", user)
} 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) {