Bot IsMessageToMe method

pull/29/head
Gleb Sinyavsky 10 years ago
parent 399d665b0a
commit af029c366c
  1. 5
      bot.go

@ -14,6 +14,7 @@ import (
"os" "os"
"strconv" "strconv"
"time" "time"
"strings"
) )
// BotAPI has methods for interacting with all of Telegram's Bot API endpoints. // 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 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) { func (bot *BotAPI) Send(c Chattable) (Message, error) {
switch c.(type) { switch c.(type) {
case Fileable: case Fileable: