Skip to content

Commit af029c3

Browse files
committed
Bot IsMessageToMe method
1 parent 399d665 commit af029c3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

bot.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"os"
1515
"strconv"
1616
"time"
17+
"strings"
1718
)
1819

1920
// BotAPI has methods for interacting with all of Telegram's Bot API endpoints.
@@ -198,6 +199,10 @@ func (bot *BotAPI) GetMe() (User, error) {
198199
return user, nil
199200
}
200201

202+
func (bot *BotAPI) IsMessageToMe(message Message) (bool) {
203+
return strings.Contains(message.Text, "@"+bot.Self.UserName)
204+
}
205+
201206
func (bot *BotAPI) Send(c Chattable) (Message, error) {
202207
switch c.(type) {
203208
case Fileable:

0 commit comments

Comments
 (0)