♻️ Use new telegram package helpers

This commit is contained in:
Maxim Lebedev 2018-02-03 08:08:59 +05:00
parent 0400833ade
commit 4aaff889ea
No known key found for this signature in database
GPG Key ID: F8978F46FF0FFA4F
2 changed files with 10 additions and 12 deletions

View File

@ -1,8 +1,6 @@
package main
import (
"strings"
log "github.com/kirillDanshin/dlog"
tg "github.com/toby3d/telegram"
)
@ -20,22 +18,22 @@ const (
func commands(msg *tg.Message) {
log.Ln("command:", msg.Command())
switch strings.ToLower(msg.Command()) {
case strings.ToLower(cmdStart):
switch {
case msg.IsCommand(cmdStart):
commandStart(msg)
case strings.ToLower(cmdHelp):
case msg.IsCommand(cmdHelp):
commandHelp(msg)
case strings.ToLower(cmdAddSticker):
case msg.IsCommand(cmdAddSticker):
commandAdd(msg, false)
case strings.ToLower(cmdAddPack):
case msg.IsCommand(cmdAddPack):
commandAdd(msg, true)
case strings.ToLower(cmdDeleteSticker):
case msg.IsCommand(cmdDeleteSticker):
commandDelete(msg, false)
case strings.ToLower(cmdDeletePack):
case msg.IsCommand(cmdDeletePack):
commandDelete(msg, true)
case strings.ToLower(cmdReset):
case msg.IsCommand(cmdReset):
commandReset(msg)
case strings.ToLower(cmdCancel):
case msg.IsCommand(cmdCancel):
commandCancel(msg)
}
}

View File

@ -14,7 +14,7 @@ func updateMessage(msg *tg.Message) {
switch {
case bot.IsCommandToMe(msg):
commands(msg)
case msg.Text != "":
case msg.IsText():
messages(msg)
default:
actions(msg)