Skip to content

Commit

Permalink
fix: error type in any update
Browse files Browse the repository at this point in the history
  • Loading branch information
krau committed Nov 9, 2024
1 parent 1128ee2 commit a91cce9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion bot/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
)

func RegisterHandlers(dispatcher dispatcher.Dispatcher) {
dispatcher.AddHandler(handlers.NewAnyUpdate(checkPermission))
dispatcher.AddHandler(handlers.NewMessage(filters.Message.All, checkPermission))
dispatcher.AddHandler(handlers.NewCommand("start", start))
dispatcher.AddHandler(handlers.NewCommand("help", help))
dispatcher.AddHandler(handlers.NewCommand("silent", silent))
Expand Down Expand Up @@ -325,6 +325,15 @@ func handleFileMessage(ctx *ext.Context, update *ext.Update) error {
}

func AddToQueue(ctx *ext.Context, update *ext.Update) error {
if !slice.Contain(config.Cfg.Telegram.Admins, update.CallbackQuery.UserID) {
ctx.AnswerCallback(&tg.MessagesSetBotCallbackAnswerRequest{
QueryID: update.CallbackQuery.QueryID,
Alert: true,
Message: "你没有权限",
CacheTime: 5,
})
return dispatcher.EndGroups
}
args := strings.Split(string(update.CallbackQuery.Data), " ")
messageID, _ := strconv.Atoi(args[1])
logger.L.Tracef("Got add to queue: chatID: %d, messageID: %d, storage: %s", update.EffectiveChat().GetID(), messageID, args[2])
Expand Down

0 comments on commit a91cce9

Please sign in to comment.