♻️ Use new package helpers

This commit is contained in:
Maxim Lebedev 2018-01-25 17:24:04 +05:00
parent 88dc6f7ff5
commit 27611490a5
No known key found for this signature in database
GPG Key ID: F8978F46FF0FFA4F
4 changed files with 6 additions and 6 deletions

2
add.go
View File

@ -32,7 +32,7 @@ func commandAdd(msg *tg.Message, pack bool) {
}
func actionAdd(msg *tg.Message, pack bool) {
if msg.Sticker == nil {
if !msg.IsSticker() {
return
}

View File

@ -53,7 +53,7 @@ func commandDelete(msg *tg.Message, pack bool) {
}
func actionDelete(msg *tg.Message, pack bool) {
if msg.Sticker == nil {
if !msg.IsSticker() {
return
}

View File

@ -22,13 +22,13 @@ func main() {
log.Ln("Let's check updates channel!")
for update := range getUpdatesChannel() {
switch {
case update.InlineQuery != nil:
case update.IsInlineQuery():
log.D(update.InlineQuery)
updateInlineQuery(update.InlineQuery)
case update.Message != nil:
case update.IsMessage():
log.D(update.Message)
updateMessage(update.Message)
case update.ChannelPost != nil:
case update.IsChannelPost():
log.D(update.ChannelPost)
updateChannelPost(update.ChannelPost)
default:

View File

@ -14,7 +14,7 @@ func commandStart(msg *tg.Message) {
_, err = bot.SendChatAction(msg.Chat.ID, tg.ActionTyping)
errCheck(err)
if msg.HasArgument() {
if msg.HasCommandArgument() {
log.Ln("Received a", msg.Command(), "command with", msg.CommandArgument(), "argument")
if strings.ToLower(msg.CommandArgument()) == strings.ToLower(cmdHelp) {
commandHelp(msg)