From 61214ca40577b20aa6828fd5483f9a87842dd3d0 Mon Sep 17 00:00:00 2001 From: Akulij Date: Fri, 28 Mar 2025 15:32:12 +0800 Subject: [PATCH] add possibilities info to asset handler --- cmd/app/main.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cmd/app/main.go b/cmd/app/main.go index 7fe40b5..0931921 100644 --- a/cmd/app/main.go +++ b/cmd/app/main.go @@ -285,7 +285,7 @@ func handleAdminCallback(bc BotController, update tgbotapi.Update, user User) { } else { bc.db.Model(&user).Update("state", "stringset:"+Label) } - bc.bot.Send(tgbotapi.NewMessage(user.ID, "Send me asset (text or picture (NOT as file))")) + bc.bot.Send(tgbotapi.NewMessage(user.ID, "Send me asset (text or picture (NOT as file)).\nSay `unset` to delete image.\nSay /start to cancel action")) } } @@ -315,6 +315,12 @@ func DownloadFile(filepath string, url string) error { } func notifyAdminAboutError(bc BotController, errorMessage string) { + // admins := getAdmins(bc) + // for _, admin := range admins { + // bc.bot.Send(tgbotapi.NewMessage(admin.ID, "ChannelID is set to "+strconv.FormatInt(post.SenderChat.ID, 10))) + // delcmd := tgbotapi.NewDeleteMessage(post.SenderChat.ID, post.MessageID) + // bc.bot.Send(delcmd) + // } // Check if AdminID is set in the config adminID := *bc.cfg.AdminID if adminID == 0 { @@ -327,3 +333,9 @@ func notifyAdminAboutError(bc BotController, errorMessage string) { ) bc.bot.Send(msg) } + +func getAdmins(bc BotController) []User { + var admins []User + bc.db.Where("role_bitmask & 1 = ?", 1).Find(&admins) + return admins +}