From 38c7bef71c7a4a79205bd2e5256e5e97b54eec9d Mon Sep 17 00:00:00 2001 From: Akulij Date: Thu, 27 Mar 2025 20:54:33 +0800 Subject: [PATCH] go fmt --- cmd/app/db.go | 4 ++-- cmd/app/main.go | 11 ++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/cmd/app/db.go b/cmd/app/db.go index 3b2e550..f15985d 100644 --- a/cmd/app/db.go +++ b/cmd/app/db.go @@ -1,8 +1,8 @@ package main import ( - "log" "errors" + "log" "gorm.io/driver/sqlite" "gorm.io/gorm" @@ -71,5 +71,5 @@ func (bc BotController) GetUser(UserID int64) User { bc.db.Create(&user) } - return user + return user } diff --git a/cmd/app/main.go b/cmd/app/main.go index 3b43a1c..ac3aee7 100644 --- a/cmd/app/main.go +++ b/cmd/app/main.go @@ -17,11 +17,9 @@ var adminCommands = map[string]func(BotController, tgbotapi.Update){ "/panel": handleMessage, // open bot settings "/usermode": handleMessage, // temporarly disable admin mode to test ui "/id": handleMessage, // to check id of chat - "/setchannelid": handleMessage, // just type it in channel which one is - // supposed to be lined with bot + "/setchannelid": handleMessage, // just type it in channel which one is supposed to be lined with bot } - func main() { var bc = GetBotController() @@ -42,7 +40,7 @@ func ProcessUpdate(bc BotController, update tgbotapi.Update) { func handleMessage(bc BotController, update tgbotapi.Update) { var UserID = update.Message.From.ID - user := bc.GetUser(UserID) + user := bc.GetUser(UserID) bc.db.Model(&user).Update("MsgCounter", user.MsgCounter+1) log.Printf("User[%d] messages: %d", user.ID, user.MsgCounter) @@ -70,7 +68,7 @@ func handleMessage(bc BotController, update tgbotapi.Update) { } func handleCallbackQuery(bc BotController, update tgbotapi.Update) { - user := bc.GetUser(update.CallbackQuery.From.ID) + user := bc.GetUser(update.CallbackQuery.From.ID) if update.CallbackQuery.Data == "leave_ticket_button" { handleLeaveTicketButton(bc, update, user) @@ -347,12 +345,11 @@ func DownloadFile(filepath string, url string) error { func notifyAdminAboutError(bc BotController, errorMessage string) { // Check if AdminID is set in the config - adminID := *bc.cfg.AdminID + adminID := *bc.cfg.AdminID if adminID == 0 { log.Println("AdminID is not set in the configuration.") } - msg := tgbotapi.NewMessage( adminID, fmt.Sprintf("Error occurred: %s", errorMessage),