♻️ Use new package helpers
This commit is contained in:
parent
88dc6f7ff5
commit
27611490a5
2
add.go
2
add.go
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
6
main.go
6
main.go
|
@ -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:
|
||||
|
|
2
start.go
2
start.go
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue