From d1f0081b82bcf19f7b851ed6122d315eac601ac0 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sun, 11 Jun 2023 17:18:27 +0530 Subject: [PATCH] fix unused method receiver (#382) * refactor: fix unused method receiver Methods with unused receivers can be a symptom of unfinished refactoring or a bug. To keep the same method signature, omit the receiver name or '_' as it is unused. * style: Format code with gofumpt --------- Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> Co-authored-by: Divanshu Chauhan --- alita/modules/admin.go | 4 ++-- alita/modules/antiflood.go | 2 +- alita/modules/antispam.go | 4 ++-- alita/modules/bans.go | 8 ++++---- alita/modules/connections.go | 4 ++-- alita/modules/dbclean.go | 4 ++-- alita/modules/devs.go | 18 +++++++++--------- alita/modules/disabling.go | 10 +++++----- alita/modules/filters.go | 10 +++++----- alita/modules/formatting.go | 4 ++-- alita/modules/greetings.go | 32 ++++++++++++++++---------------- alita/modules/help.go | 12 ++++++------ alita/modules/language.go | 4 ++-- alita/modules/locks.go | 10 +++++----- alita/modules/misc.go | 16 ++++++++-------- alita/modules/mute.go | 10 +++++----- alita/modules/notes.go | 12 ++++++------ alita/modules/pin.go | 18 +++++++++--------- alita/modules/purges.go | 8 ++++---- alita/modules/reports.go | 6 +++--- alita/modules/rules.go | 8 ++++---- alita/modules/users.go | 2 +- alita/modules/warns.go | 18 +++++++++--------- 23 files changed, 112 insertions(+), 112 deletions(-) diff --git a/alita/modules/admin.go b/alita/modules/admin.go index 7421edc4..f4551364 100644 --- a/alita/modules/admin.go +++ b/alita/modules/admin.go @@ -368,7 +368,7 @@ func (m adminModuleStruct) promote(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m adminModuleStruct) getinvitelink(b *gotgbot.Bot, ctx *ext.Context) error { +func (adminModuleStruct) getinvitelink(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat msg := ctx.EffectiveMessage @@ -572,7 +572,7 @@ func (m adminModuleStruct) anonAdmin(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m adminModuleStruct) adminCache(b *gotgbot.Bot, ctx *ext.Context) error { +func (adminModuleStruct) adminCache(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat msg := ctx.EffectiveMessage user := ctx.EffectiveSender.User diff --git a/alita/modules/antiflood.go b/alita/modules/antiflood.go index 8dc6245a..a08c32d2 100644 --- a/alita/modules/antiflood.go +++ b/alita/modules/antiflood.go @@ -41,7 +41,7 @@ var antifloodModule = antifloodModuleStruct{ floodMap: sync.Map{}, } -func (m *antifloodModuleStruct) updateFlood(chatId, userId, msgId int64) (returnVar bool, floodCrc floodControl) { +func (*antifloodModuleStruct) updateFlood(chatId, userId, msgId int64) (returnVar bool, floodCrc floodControl) { floodSrc := db.GetFlood(chatId) if floodSrc.Limit != 0 { diff --git a/alita/modules/antispam.go b/alita/modules/antispam.go index 9c116ef7..589a4ed4 100644 --- a/alita/modules/antispam.go +++ b/alita/modules/antispam.go @@ -31,7 +31,7 @@ type antiSpamLevel struct { Spammed bool } -func (m antispamModuleStruct) checkSpammed(chatId int64, levels []antiSpamLevel) bool { +func (antispamModuleStruct) checkSpammed(chatId int64, levels []antiSpamLevel) bool { _asInfo, ok := antispamModule.antiSpam[chatId] if !ok { // Assign a new AntiSpamInfo to the chatId because not found @@ -65,7 +65,7 @@ func (m antispamModuleStruct) checkSpammed(chatId int64, levels []antiSpamLevel) return spammed } -func (m antispamModuleStruct) spamCheck(chatId int64) bool { +func (antispamModuleStruct) spamCheck(chatId int64) bool { // if sql.IsUserSudo(chatId) { // return false // } diff --git a/alita/modules/bans.go b/alita/modules/bans.go index 87a2ffe8..142077c9 100644 --- a/alita/modules/bans.go +++ b/alita/modules/bans.go @@ -696,7 +696,7 @@ func (m bansModuleStruct) unban(b *gotgbot.Bot, ctx *ext.Context) error { /* Used to Restrict members from a chat Shows an inline keyboard menu which shows options to kick, ban and mute */ -func (m bansModuleStruct) restrict(b *gotgbot.Bot, ctx *ext.Context) error { +func (bansModuleStruct) restrict(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat user := ctx.EffectiveSender.User msg := ctx.EffectiveMessage @@ -775,7 +775,7 @@ func (m bansModuleStruct) restrict(b *gotgbot.Bot, ctx *ext.Context) error { } // Handles the queries fore restrict command -func (m bansModuleStruct) restrictButtonHandler(b *gotgbot.Bot, ctx *ext.Context) error { +func (bansModuleStruct) restrictButtonHandler(b *gotgbot.Bot, ctx *ext.Context) error { query := ctx.Update.CallbackQuery chat := ctx.EffectiveChat user := ctx.EffectiveSender.User @@ -876,7 +876,7 @@ func (m bansModuleStruct) restrictButtonHandler(b *gotgbot.Bot, ctx *ext.Context /* Used to Unrestrict members from a chat Shows an inline keyboard menu which shows options to unban and unmute */ -func (m bansModuleStruct) unrestrict(b *gotgbot.Bot, ctx *ext.Context) error { +func (bansModuleStruct) unrestrict(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat user := ctx.EffectiveSender.User msg := ctx.EffectiveMessage @@ -954,7 +954,7 @@ func (m bansModuleStruct) unrestrict(b *gotgbot.Bot, ctx *ext.Context) error { } // Handles queries for unrestrict command -func (m bansModuleStruct) unrestrictButtonHandler(b *gotgbot.Bot, ctx *ext.Context) error { +func (bansModuleStruct) unrestrictButtonHandler(b *gotgbot.Bot, ctx *ext.Context) error { query := ctx.Update.CallbackQuery chat := ctx.EffectiveChat user := ctx.EffectiveSender.User diff --git a/alita/modules/connections.go b/alita/modules/connections.go index 98b755cc..1a9acec1 100644 --- a/alita/modules/connections.go +++ b/alita/modules/connections.go @@ -362,11 +362,11 @@ func (m connectionsModuleStruct) reconnect(b *gotgbot.Bot, ctx *ext.Context) err return ext.EndGroups } -func (m connectionsModuleStruct) adminCmdConnString() string { +func (connectionsModuleStruct) adminCmdConnString() string { return "\n - /" + strings.Join(misc.AdminCmds, "\n - /") } -func (m connectionsModuleStruct) userCmdConnString() string { +func (connectionsModuleStruct) userCmdConnString() string { return "\n - /" + strings.Join(misc.UserCmds, "\n - /") } diff --git a/alita/modules/dbclean.go b/alita/modules/dbclean.go index ac6baaab..745d7b78 100644 --- a/alita/modules/dbclean.go +++ b/alita/modules/dbclean.go @@ -14,7 +14,7 @@ import ( log "github.com/sirupsen/logrus" ) -func (m devsModuleStruct) dbClean(b *gotgbot.Bot, ctx *ext.Context) error { +func (devsModuleStruct) dbClean(b *gotgbot.Bot, ctx *ext.Context) error { user := ctx.EffectiveSender.User memStatus := db.GetTeamMemInfo(user.Id) @@ -45,7 +45,7 @@ func (m devsModuleStruct) dbClean(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m devsModuleStruct) buttonHandler(b *gotgbot.Bot, ctx *ext.Context) error { +func (devsModuleStruct) buttonHandler(b *gotgbot.Bot, ctx *ext.Context) error { query := ctx.Update.CallbackQuery user := ctx.EffectiveSender.User msg := query.Message diff --git a/alita/modules/devs.go b/alita/modules/devs.go index b6066349..ad4f640d 100644 --- a/alita/modules/devs.go +++ b/alita/modules/devs.go @@ -30,7 +30,7 @@ var devsModule = devsModuleStruct{modname: "Dev"} // for general purposes for strings in functions below var txt string -func (m devsModuleStruct) chatInfo(b *gotgbot.Bot, ctx *ext.Context) error { +func (devsModuleStruct) chatInfo(b *gotgbot.Bot, ctx *ext.Context) error { user := ctx.EffectiveSender.User memStatus := db.GetTeamMemInfo(user.Id) @@ -67,7 +67,7 @@ func (m devsModuleStruct) chatInfo(b *gotgbot.Bot, ctx *ext.Context) error { return ext.ContinueGroups } -func (m devsModuleStruct) chatList(b *gotgbot.Bot, ctx *ext.Context) error { +func (devsModuleStruct) chatList(b *gotgbot.Bot, ctx *ext.Context) error { user := ctx.EffectiveSender.User memStatus := db.GetTeamMemInfo(user.Id) @@ -141,7 +141,7 @@ func (m devsModuleStruct) chatList(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m devsModuleStruct) leaveChat(b *gotgbot.Bot, ctx *ext.Context) error { +func (devsModuleStruct) leaveChat(b *gotgbot.Bot, ctx *ext.Context) error { user := ctx.EffectiveSender.User memStatus := db.GetTeamMemInfo(user.Id) @@ -174,7 +174,7 @@ func (m devsModuleStruct) leaveChat(b *gotgbot.Bot, ctx *ext.Context) error { Can only be used by OWNER */ -func (m devsModuleStruct) addSudo(b *gotgbot.Bot, ctx *ext.Context) error { +func (devsModuleStruct) addSudo(b *gotgbot.Bot, ctx *ext.Context) error { user := ctx.EffectiveSender.User if user.Id != config.OwnerId { return ext.ContinueGroups @@ -214,7 +214,7 @@ func (m devsModuleStruct) addSudo(b *gotgbot.Bot, ctx *ext.Context) error { Can only be used by OWNER */ -func (m devsModuleStruct) addDev(b *gotgbot.Bot, ctx *ext.Context) error { +func (devsModuleStruct) addDev(b *gotgbot.Bot, ctx *ext.Context) error { user := ctx.EffectiveSender.User if user.Id != config.OwnerId { return ext.ContinueGroups @@ -254,7 +254,7 @@ func (m devsModuleStruct) addDev(b *gotgbot.Bot, ctx *ext.Context) error { Can only be used by OWNER */ -func (m devsModuleStruct) remSudo(b *gotgbot.Bot, ctx *ext.Context) error { +func (devsModuleStruct) remSudo(b *gotgbot.Bot, ctx *ext.Context) error { user := ctx.EffectiveSender.User if user.Id != config.OwnerId { return ext.ContinueGroups @@ -294,7 +294,7 @@ func (m devsModuleStruct) remSudo(b *gotgbot.Bot, ctx *ext.Context) error { Can only be used by OWNER */ -func (m devsModuleStruct) remDev(b *gotgbot.Bot, ctx *ext.Context) error { +func (devsModuleStruct) remDev(b *gotgbot.Bot, ctx *ext.Context) error { user := ctx.EffectiveSender.User if user.Id != config.OwnerId { return ext.ContinueGroups @@ -334,7 +334,7 @@ func (m devsModuleStruct) remDev(b *gotgbot.Bot, ctx *ext.Context) error { Can only be used by existing team members */ -func (m devsModuleStruct) listTeam(b *gotgbot.Bot, ctx *ext.Context) error { +func (devsModuleStruct) listTeam(b *gotgbot.Bot, ctx *ext.Context) error { user := ctx.EffectiveSender.User teamUsers := db.GetTeamMembers() @@ -401,7 +401,7 @@ func (m devsModuleStruct) listTeam(b *gotgbot.Bot, ctx *ext.Context) error { Can only be used by OWNER */ -func (m devsModuleStruct) getStats(b *gotgbot.Bot, ctx *ext.Context) error { +func (devsModuleStruct) getStats(b *gotgbot.Bot, ctx *ext.Context) error { user := ctx.EffectiveSender.User memStatus := db.GetTeamMemInfo(user.Id) diff --git a/alita/modules/disabling.go b/alita/modules/disabling.go index 096a27d5..aa862bc8 100644 --- a/alita/modules/disabling.go +++ b/alita/modules/disabling.go @@ -32,7 +32,7 @@ var disablingModule = disablingModuleStruct{modname: "Disabling"} Only Admin can use this command to disable usage of a command in the chat */ -func (m disablingModuleStruct) disable(b *gotgbot.Bot, ctx *ext.Context) error { +func (disablingModuleStruct) disable(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // connection status connectedChat := helpers.IsUserConnected(b, ctx, true, true) @@ -87,7 +87,7 @@ func (m disablingModuleStruct) disable(b *gotgbot.Bot, ctx *ext.Context) error { Anyone can use this command to check the disableable commands */ -func (m disablingModuleStruct) disableable(b *gotgbot.Bot, ctx *ext.Context) error { +func (disablingModuleStruct) disableable(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage text := "The following commands can be disabled:" @@ -111,7 +111,7 @@ func (m disablingModuleStruct) disableable(b *gotgbot.Bot, ctx *ext.Context) err Any user in can use this command to check the disabled commands in the current chat. */ -func (m disablingModuleStruct) disabled(b *gotgbot.Bot, ctx *ext.Context) error { +func (disablingModuleStruct) disabled(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // if command is disabled, return if chat_status.CheckDisabledCmd(b, msg, "adminlist") { @@ -171,7 +171,7 @@ func (m disablingModuleStruct) disabled(b *gotgbot.Bot, ctx *ext.Context) error Only admins can use this command to either choose to delete the disabled command or not to. If no argument is given, the current chat setting is returned */ -func (m disablingModuleStruct) disabledel(b *gotgbot.Bot, ctx *ext.Context) error { +func (disablingModuleStruct) disabledel(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // connection status connectedChat := helpers.IsUserConnected(b, ctx, true, true) @@ -220,7 +220,7 @@ func (m disablingModuleStruct) disabledel(b *gotgbot.Bot, ctx *ext.Context) erro Only Admin can use this command to re-enable usage of a disabled command in the chat */ -func (m disablingModuleStruct) enable(b *gotgbot.Bot, ctx *ext.Context) error { +func (disablingModuleStruct) enable(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // connection status connectedChat := helpers.IsUserConnected(b, ctx, true, true) diff --git a/alita/modules/filters.go b/alita/modules/filters.go index 6c6c43f5..a6802c23 100644 --- a/alita/modules/filters.go +++ b/alita/modules/filters.go @@ -164,7 +164,7 @@ func (m filtersModuleStruct) addFilter(b *gotgbot.Bot, ctx *ext.Context) error { Only admin can remove filters in the chat */ -func (m filtersModuleStruct) rmFilter(b *gotgbot.Bot, ctx *ext.Context) error { +func (filtersModuleStruct) rmFilter(b *gotgbot.Bot, ctx *ext.Context) error { // connection status connectedChat := helpers.IsUserConnected(b, ctx, true, false) if connectedChat == nil { @@ -216,7 +216,7 @@ func (m filtersModuleStruct) rmFilter(b *gotgbot.Bot, ctx *ext.Context) error { Any user can view users in a chat */ -func (m filtersModuleStruct) filtersList(b *gotgbot.Bot, ctx *ext.Context) error { +func (filtersModuleStruct) filtersList(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // if command is disabled, return if chat_status.CheckDisabledCmd(b, msg, "filters") { @@ -272,7 +272,7 @@ func (m filtersModuleStruct) filtersList(b *gotgbot.Bot, ctx *ext.Context) error Only owner can remove all filters from the chat */ -func (m filtersModuleStruct) rmAllFilters(b *gotgbot.Bot, ctx *ext.Context) error { +func (filtersModuleStruct) rmAllFilters(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat user := ctx.EffectiveSender.User msg := ctx.EffectiveMessage @@ -311,7 +311,7 @@ func (m filtersModuleStruct) rmAllFilters(b *gotgbot.Bot, ctx *ext.Context) erro } // CallbackQuery handler for rmAllFilters -func (m filtersModuleStruct) buttonHandler(b *gotgbot.Bot, ctx *ext.Context) error { +func (filtersModuleStruct) buttonHandler(b *gotgbot.Bot, ctx *ext.Context) error { query := ctx.Update.CallbackQuery user := query.From chat := ctx.EffectiveChat @@ -408,7 +408,7 @@ func (m filtersModuleStruct) filterOverWriteHandler(b *gotgbot.Bot, ctx *ext.Con Replies with appropriate data to the filter. */ -func (m filtersModuleStruct) filtersWatcher(b *gotgbot.Bot, ctx *ext.Context) error { +func (filtersModuleStruct) filtersWatcher(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat msg := ctx.EffectiveMessage user := ctx.EffectiveSender.User diff --git a/alita/modules/formatting.go b/alita/modules/formatting.go index 3b5eb5ec..9dd0fb19 100644 --- a/alita/modules/formatting.go +++ b/alita/modules/formatting.go @@ -83,7 +83,7 @@ func (m formattingModuleStruct) markdownHelp(b *gotgbot.Bot, ctx *ext.Context) e return ext.EndGroups } -func (m formattingModuleStruct) genFormattingKb() [][]gotgbot.InlineKeyboardButton { +func (formattingModuleStruct) genFormattingKb() [][]gotgbot.InlineKeyboardButton { fxt := "formatting.%s" keyboard := [][]gotgbot.InlineKeyboardButton{ @@ -110,7 +110,7 @@ func (m formattingModuleStruct) genFormattingKb() [][]gotgbot.InlineKeyboardButt return keyboard } -func (m formattingModuleStruct) getMarkdownHelp(module string) string { +func (formattingModuleStruct) getMarkdownHelp(module string) string { var helpTxt string tr := i18n.I18n{LangCode: "en"} if module == "md_formatting" { diff --git a/alita/modules/greetings.go b/alita/modules/greetings.go index f3c04824..52d481f8 100644 --- a/alita/modules/greetings.go +++ b/alita/modules/greetings.go @@ -28,7 +28,7 @@ type greetingsModuleStruct struct { var greetingsModule = greetingsModuleStruct{modname: "Greetings"} -func (m greetingsModuleStruct) welcome(bot *gotgbot.Bot, ctx *ext.Context) error { +func (greetingsModuleStruct) welcome(bot *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // connection status connectedChat := helpers.IsUserConnected(bot, ctx, true, false) @@ -99,7 +99,7 @@ func (m greetingsModuleStruct) welcome(bot *gotgbot.Bot, ctx *ext.Context) error return ext.EndGroups } -func (m greetingsModuleStruct) setWelcome(bot *gotgbot.Bot, ctx *ext.Context) error { +func (greetingsModuleStruct) setWelcome(bot *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // connection status connectedChat := helpers.IsUserConnected(bot, ctx, true, false) @@ -135,7 +135,7 @@ func (m greetingsModuleStruct) setWelcome(bot *gotgbot.Bot, ctx *ext.Context) er return ext.EndGroups } -func (m greetingsModuleStruct) resetWelcome(bot *gotgbot.Bot, ctx *ext.Context) error { +func (greetingsModuleStruct) resetWelcome(bot *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // connection status connectedChat := helpers.IsUserConnected(bot, ctx, true, false) @@ -160,7 +160,7 @@ func (m greetingsModuleStruct) resetWelcome(bot *gotgbot.Bot, ctx *ext.Context) return ext.EndGroups } -func (m greetingsModuleStruct) goodbye(bot *gotgbot.Bot, ctx *ext.Context) error { +func (greetingsModuleStruct) goodbye(bot *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // connection status connectedChat := helpers.IsUserConnected(bot, ctx, true, false) @@ -229,7 +229,7 @@ func (m greetingsModuleStruct) goodbye(bot *gotgbot.Bot, ctx *ext.Context) error return ext.EndGroups } -func (m greetingsModuleStruct) setGoodbye(bot *gotgbot.Bot, ctx *ext.Context) error { +func (greetingsModuleStruct) setGoodbye(bot *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // connection status connectedChat := helpers.IsUserConnected(bot, ctx, true, false) @@ -263,7 +263,7 @@ func (m greetingsModuleStruct) setGoodbye(bot *gotgbot.Bot, ctx *ext.Context) er return ext.EndGroups } -func (m greetingsModuleStruct) resetGoodbye(bot *gotgbot.Bot, ctx *ext.Context) error { +func (greetingsModuleStruct) resetGoodbye(bot *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // connection status connectedChat := helpers.IsUserConnected(bot, ctx, true, false) @@ -291,7 +291,7 @@ func (m greetingsModuleStruct) resetGoodbye(bot *gotgbot.Bot, ctx *ext.Context) return ext.EndGroups } -func (m greetingsModuleStruct) cleanWelcome(bot *gotgbot.Bot, ctx *ext.Context) error { +func (greetingsModuleStruct) cleanWelcome(bot *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // connection status connectedChat := helpers.IsUserConnected(bot, ctx, true, false) @@ -341,7 +341,7 @@ func (m greetingsModuleStruct) cleanWelcome(bot *gotgbot.Bot, ctx *ext.Context) return ext.EndGroups } -func (m greetingsModuleStruct) cleanGoodbye(bot *gotgbot.Bot, ctx *ext.Context) error { +func (greetingsModuleStruct) cleanGoodbye(bot *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage args := ctx.Args()[1:] var err error @@ -391,7 +391,7 @@ func (m greetingsModuleStruct) cleanGoodbye(bot *gotgbot.Bot, ctx *ext.Context) return ext.EndGroups } -func (m greetingsModuleStruct) delJoined(bot *gotgbot.Bot, ctx *ext.Context) error { +func (greetingsModuleStruct) delJoined(bot *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage args := ctx.Args()[1:] var err error @@ -440,7 +440,7 @@ func (m greetingsModuleStruct) delJoined(bot *gotgbot.Bot, ctx *ext.Context) err return ext.EndGroups } -func (m greetingsModuleStruct) newMember(bot *gotgbot.Bot, ctx *ext.Context) error { +func (greetingsModuleStruct) newMember(bot *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat newMember := ctx.ChatMember.NewChatMember.MergeChatMember().User greetPrefs := db.GetGreetingSettings(chat.Id) @@ -479,7 +479,7 @@ func (m greetingsModuleStruct) newMember(bot *gotgbot.Bot, ctx *ext.Context) err return ext.EndGroups } -func (m greetingsModuleStruct) leftMember(bot *gotgbot.Bot, ctx *ext.Context) error { +func (greetingsModuleStruct) leftMember(bot *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat leftMember := ctx.ChatMember.OldChatMember.MergeChatMember().User greetPrefs := db.GetGreetingSettings(chat.Id) @@ -515,7 +515,7 @@ func (m greetingsModuleStruct) leftMember(bot *gotgbot.Bot, ctx *ext.Context) er return ext.EndGroups } -func (m greetingsModuleStruct) cleanService(bot *gotgbot.Bot, ctx *ext.Context) error { +func (greetingsModuleStruct) cleanService(bot *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage chat := ctx.EffectiveChat user := ctx.EffectiveSender.User @@ -591,7 +591,7 @@ func (m greetingsModuleStruct) pendingJoins(bot *gotgbot.Bot, ctx *ext.Context) return ext.ContinueGroups } -func (m greetingsModuleStruct) joinRequestHandler(b *gotgbot.Bot, ctx *ext.Context) error { +func (greetingsModuleStruct) joinRequestHandler(b *gotgbot.Bot, ctx *ext.Context) error { query := ctx.Update.CallbackQuery user := query.From chat := ctx.EffectiveChat @@ -650,7 +650,7 @@ func (m greetingsModuleStruct) joinRequestHandler(b *gotgbot.Bot, ctx *ext.Conte return ext.EndGroups } -func (m greetingsModuleStruct) autoApprove(bot *gotgbot.Bot, ctx *ext.Context) error { +func (greetingsModuleStruct) autoApprove(bot *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage args := ctx.Args()[1:] var err error @@ -701,7 +701,7 @@ func (m greetingsModuleStruct) autoApprove(bot *gotgbot.Bot, ctx *ext.Context) e return ext.EndGroups } -func (m greetingsModuleStruct) loadPendingJoins(chatId, userId int64) bool { +func (greetingsModuleStruct) loadPendingJoins(chatId, userId int64) bool { alreadyAsked, _ := cache.Marshal.Get(cache.Context, fmt.Sprintf("pendingJoins.%d.%d", chatId, userId), new(bool)) if alreadyAsked == nil || !alreadyAsked.(bool) { return false @@ -709,7 +709,7 @@ func (m greetingsModuleStruct) loadPendingJoins(chatId, userId int64) bool { return true } -func (m greetingsModuleStruct) setPendingJoins(chatId, userId int64) { +func (greetingsModuleStruct) setPendingJoins(chatId, userId int64) { _ = cache.Marshal.Set(cache.Context, fmt.Sprintf("pendingJoins.%d.%d", chatId, userId), true, store.WithExpiration(5*time.Minute)) } diff --git a/alita/modules/help.go b/alita/modules/help.go index 9bd4fa7b..3ade67c5 100644 --- a/alita/modules/help.go +++ b/alita/modules/help.go @@ -156,7 +156,7 @@ func (m *moduleEnabled) LoadModules() []string { return modules } -func (m helpModuleStruct) about(b *gotgbot.Bot, ctx *ext.Context) error { +func (helpModuleStruct) about(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage tr := i18n.I18n{LangCode: db.GetLanguage(ctx)} @@ -240,7 +240,7 @@ func (m helpModuleStruct) about(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m helpModuleStruct) buttonHandler(b *gotgbot.Bot, ctx *ext.Context) error { +func (helpModuleStruct) buttonHandler(b *gotgbot.Bot, ctx *ext.Context) error { query := ctx.Update.CallbackQuery args := strings.Split(query.Data, ".") module := args[1] @@ -293,7 +293,7 @@ func (m helpModuleStruct) buttonHandler(b *gotgbot.Bot, ctx *ext.Context) error } // start introduces the bot -func (m helpModuleStruct) start(b *gotgbot.Bot, ctx *ext.Context) error { +func (helpModuleStruct) start(b *gotgbot.Bot, ctx *ext.Context) error { user := ctx.EffectiveSender.User msg := ctx.EffectiveMessage args := ctx.Args() @@ -331,7 +331,7 @@ func (m helpModuleStruct) start(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m helpModuleStruct) donate(b *gotgbot.Bot, ctx *ext.Context) error { +func (helpModuleStruct) donate(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage chat := ctx.EffectiveChat @@ -351,7 +351,7 @@ func (m helpModuleStruct) donate(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m helpModuleStruct) botConfig(b *gotgbot.Bot, ctx *ext.Context) error { +func (helpModuleStruct) botConfig(b *gotgbot.Bot, ctx *ext.Context) error { query := ctx.CallbackQuery msg := query.Message @@ -436,7 +436,7 @@ func (m helpModuleStruct) botConfig(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m helpModuleStruct) help(b *gotgbot.Bot, ctx *ext.Context) error { +func (helpModuleStruct) help(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat msg := ctx.EffectiveMessage args := ctx.Args() diff --git a/alita/modules/language.go b/alita/modules/language.go index 1c435d30..082391ff 100644 --- a/alita/modules/language.go +++ b/alita/modules/language.go @@ -23,7 +23,7 @@ type languagesModuleStruct struct { var languagesModule = languagesModuleStruct{modname: "Languages"} -func (m languagesModuleStruct) genFullLanguageKb() [][]gotgbot.InlineKeyboardButton { +func (languagesModuleStruct) genFullLanguageKb() [][]gotgbot.InlineKeyboardButton { keyboard := helpers.MakeLanguageKeyboard() keyboard = append( keyboard, @@ -75,7 +75,7 @@ func (m languagesModuleStruct) changeLanguage(b *gotgbot.Bot, ctx *ext.Context) return ext.EndGroups } -func (m languagesModuleStruct) langBtnHandler(b *gotgbot.Bot, ctx *ext.Context) error { +func (languagesModuleStruct) langBtnHandler(b *gotgbot.Bot, ctx *ext.Context) error { query := ctx.Update.CallbackQuery chat := query.Message.Chat user := query.From diff --git a/alita/modules/locks.go b/alita/modules/locks.go index 4689d6db..723a58e4 100644 --- a/alita/modules/locks.go +++ b/alita/modules/locks.go @@ -89,7 +89,7 @@ var ( } ) -func (m locksModuleStruct) getLockMapAsArray() (lockTypes []string) { +func (locksModuleStruct) getLockMapAsArray() (lockTypes []string) { tmpMap := map[string]filters.Message{} for r, rk := range restrMap { @@ -108,7 +108,7 @@ func (m locksModuleStruct) getLockMapAsArray() (lockTypes []string) { return } -func (m locksModuleStruct) buildLockTypesMessage(chatID int64) (res string) { +func (locksModuleStruct) buildLockTypesMessage(chatID int64) (res string) { chatLocks := db.GetChatLocks(chatID) newMapLocks := db.MapLockType(*chatLocks) @@ -286,7 +286,7 @@ func (m locksModuleStruct) unlockPerm(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m locksModuleStruct) restHandler(b *gotgbot.Bot, ctx *ext.Context) error { +func (locksModuleStruct) restHandler(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat msg := ctx.EffectiveMessage user := ctx.EffectiveSender.User @@ -321,7 +321,7 @@ func (m locksModuleStruct) restHandler(b *gotgbot.Bot, ctx *ext.Context) error { return ext.ContinueGroups } -func (m locksModuleStruct) permHandler(b *gotgbot.Bot, ctx *ext.Context) error { +func (locksModuleStruct) permHandler(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat msg := ctx.EffectiveMessage user := ctx.EffectiveSender.User @@ -349,7 +349,7 @@ func (m locksModuleStruct) permHandler(b *gotgbot.Bot, ctx *ext.Context) error { return ext.ContinueGroups } -func (m locksModuleStruct) botLockHandler(b *gotgbot.Bot, ctx *ext.Context) error { +func (locksModuleStruct) botLockHandler(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat user := ctx.EffectiveSender.User mem := ctx.ChatMember.NewChatMember.MergeChatMember().User diff --git a/alita/modules/misc.go b/alita/modules/misc.go index 4e4df85f..99e5569e 100644 --- a/alita/modules/misc.go +++ b/alita/modules/misc.go @@ -34,7 +34,7 @@ type miscModuleStruct struct { var miscModule = miscModuleStruct{modname: "Misc"} -func (m miscModuleStruct) echomsg(b *gotgbot.Bot, ctx *ext.Context) error { +func (miscModuleStruct) echomsg(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage args := ctx.Args()[1:] @@ -72,7 +72,7 @@ func (m miscModuleStruct) echomsg(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m miscModuleStruct) getId(b *gotgbot.Bot, ctx *ext.Context) error { +func (miscModuleStruct) getId(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage userId := extraction.ExtractUser(b, ctx) if userId == -1 { @@ -153,7 +153,7 @@ func (m miscModuleStruct) getId(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m miscModuleStruct) paste(b *gotgbot.Bot, ctx *ext.Context) error { +func (miscModuleStruct) paste(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage args := ctx.Args() @@ -256,7 +256,7 @@ func (m miscModuleStruct) paste(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m miscModuleStruct) ping(b *gotgbot.Bot, ctx *ext.Context) error { +func (miscModuleStruct) ping(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // if command is disabled, return if chat_status.CheckDisabledCmd(b, msg, "ping") { @@ -272,7 +272,7 @@ func (m miscModuleStruct) ping(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m miscModuleStruct) info(b *gotgbot.Bot, ctx *ext.Context) error { +func (miscModuleStruct) info(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage sender := ctx.EffectiveSender userId := extraction.ExtractUser(b, ctx) @@ -341,7 +341,7 @@ func (m miscModuleStruct) info(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m miscModuleStruct) translate(b *gotgbot.Bot, ctx *ext.Context) error { +func (miscModuleStruct) translate(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage args := ctx.Args()[1:] @@ -413,7 +413,7 @@ func (m miscModuleStruct) translate(b *gotgbot.Bot, ctx *ext.Context) error { } // This function removes the stuck bot keyboard from your chat! -func (m miscModuleStruct) removeBotKeyboard(b *gotgbot.Bot, ctx *ext.Context) error { +func (miscModuleStruct) removeBotKeyboard(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage rMsg, err := msg.Reply(b, "Removing the stuck bot keyboard...", @@ -438,7 +438,7 @@ func (m miscModuleStruct) removeBotKeyboard(b *gotgbot.Bot, ctx *ext.Context) er return ext.EndGroups } -func (m miscModuleStruct) stat(b *gotgbot.Bot, ctx *ext.Context) error { +func (miscModuleStruct) stat(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage chat := ctx.EffectiveChat if !chat_status.RequireGroup(b, ctx, chat, false) { diff --git a/alita/modules/mute.go b/alita/modules/mute.go index 6d3db280..7ab24d81 100644 --- a/alita/modules/mute.go +++ b/alita/modules/mute.go @@ -25,7 +25,7 @@ var mutesModule = mutesModuleStruct{modname: "Mutes"} The Bot, Muter should be admin with restrict permissions in order to use this */ -func (m mutesModuleStruct) tMute(b *gotgbot.Bot, ctx *ext.Context) error { +func (mutesModuleStruct) tMute(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat user := ctx.EffectiveSender.User msg := ctx.EffectiveMessage @@ -156,7 +156,7 @@ func (m mutesModuleStruct) tMute(b *gotgbot.Bot, ctx *ext.Context) error { The Bot, Muter should be admin with restrict permissions in order to use this */ -func (m mutesModuleStruct) mute(b *gotgbot.Bot, ctx *ext.Context) error { +func (mutesModuleStruct) mute(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat user := ctx.EffectiveSender.User msg := ctx.EffectiveMessage @@ -287,7 +287,7 @@ The Bot, Muter should be admin with restrict permissions in order to use this The message of muter will be deleted after sending this command */ -func (m mutesModuleStruct) sMute(b *gotgbot.Bot, ctx *ext.Context) error { +func (mutesModuleStruct) sMute(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat user := ctx.EffectiveSender.User msg := ctx.EffectiveMessage @@ -387,7 +387,7 @@ The Bot, Muter should be admin with restrict permissions in order to use this Used as a reply to a message and delete the replied message*/ -func (m mutesModuleStruct) dMute(b *gotgbot.Bot, ctx *ext.Context) error { +func (mutesModuleStruct) dMute(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat user := ctx.EffectiveSender.User msg := ctx.EffectiveMessage @@ -526,7 +526,7 @@ func (m mutesModuleStruct) dMute(b *gotgbot.Bot, ctx *ext.Context) error { The Bot, Unmuter should be admin with restrict permissions in order to use this */ -func (m mutesModuleStruct) unmute(b *gotgbot.Bot, ctx *ext.Context) error { +func (mutesModuleStruct) unmute(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat user := ctx.EffectiveSender.User msg := ctx.EffectiveMessage diff --git a/alita/modules/notes.go b/alita/modules/notes.go index f4d6d622..d2c7e013 100644 --- a/alita/modules/notes.go +++ b/alita/modules/notes.go @@ -157,7 +157,7 @@ func (m notesModuleStruct) addNote(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m notesModuleStruct) rmNote(b *gotgbot.Bot, ctx *ext.Context) error { +func (notesModuleStruct) rmNote(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // connection status connectedChat := helpers.IsUserConnected(b, ctx, true, true) @@ -207,7 +207,7 @@ func (m notesModuleStruct) rmNote(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m notesModuleStruct) privNote(b *gotgbot.Bot, ctx *ext.Context) error { +func (notesModuleStruct) privNote(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage chat := ctx.EffectiveChat args := ctx.Args()[1:] @@ -241,7 +241,7 @@ func (m notesModuleStruct) privNote(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m notesModuleStruct) notesList(b *gotgbot.Bot, ctx *ext.Context) error { +func (notesModuleStruct) notesList(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // if command is disabled, return if chat_status.CheckDisabledCmd(b, msg, "notes") { @@ -323,7 +323,7 @@ func (m notesModuleStruct) notesList(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m notesModuleStruct) rmAllNotes(b *gotgbot.Bot, ctx *ext.Context) error { +func (notesModuleStruct) rmAllNotes(b *gotgbot.Bot, ctx *ext.Context) error { user := ctx.EffectiveSender.User msg := ctx.EffectiveMessage chat := ctx.EffectiveChat @@ -431,7 +431,7 @@ func (m notesModuleStruct) noteOverWriteHandler(b *gotgbot.Bot, ctx *ext.Context return ext.EndGroups } -func (m notesModuleStruct) buttonHandler(b *gotgbot.Bot, ctx *ext.Context) error { +func (notesModuleStruct) buttonHandler(b *gotgbot.Bot, ctx *ext.Context) error { query := ctx.Update.CallbackQuery user := query.From @@ -679,7 +679,7 @@ func (m notesModuleStruct) getNotes(b *gotgbot.Bot, ctx *ext.Context) error { } // returns the note in non-formatted text -func (m notesModuleStruct) sendNoFormatNote(b *gotgbot.Bot, ctx *ext.Context, replyMsgId int64, noteData *db.ChatNotes) error { +func (notesModuleStruct) sendNoFormatNote(b *gotgbot.Bot, ctx *ext.Context, replyMsgId int64, noteData *db.ChatNotes) error { user := ctx.EffectiveSender.User // check if user is admin or not diff --git a/alita/modules/pin.go b/alita/modules/pin.go index 7274bb07..a11d5aef 100644 --- a/alita/modules/pin.go +++ b/alita/modules/pin.go @@ -47,7 +47,7 @@ type pinType struct { This a watcher for 2 functions described above */ -func (m pinsModuleStruct) checkPinned(b *gotgbot.Bot, ctx *ext.Context) error { +func (pinsModuleStruct) checkPinned(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat msg := ctx.EffectiveMessage pinprefs := db.GetPinData(chat.Id) @@ -85,7 +85,7 @@ func (m pinsModuleStruct) checkPinned(b *gotgbot.Bot, ctx *ext.Context) error { This function unpins the latest pinned message or message to which user replied */ -func (m pinsModuleStruct) unpin(b *gotgbot.Bot, ctx *ext.Context) error { +func (pinsModuleStruct) unpin(b *gotgbot.Bot, ctx *ext.Context) error { user := ctx.EffectiveSender.User chat := ctx.EffectiveChat msg := ctx.EffectiveMessage @@ -159,7 +159,7 @@ func (m pinsModuleStruct) unpin(b *gotgbot.Bot, ctx *ext.Context) error { } // Callback Query Handler for Unpinall command -func (m pinsModuleStruct) unpinallCallback(b *gotgbot.Bot, ctx *ext.Context) error { +func (pinsModuleStruct) unpinallCallback(b *gotgbot.Bot, ctx *ext.Context) error { query := ctx.Update.CallbackQuery chat := ctx.EffectiveChat @@ -188,7 +188,7 @@ func (m pinsModuleStruct) unpinallCallback(b *gotgbot.Bot, ctx *ext.Context) err Can only be used by owner to unpin all message in a chat. */ -func (m pinsModuleStruct) unpinAll(b *gotgbot.Bot, ctx *ext.Context) error { +func (pinsModuleStruct) unpinAll(b *gotgbot.Bot, ctx *ext.Context) error { user := ctx.EffectiveSender.User if !chat_status.RequireGroup(b, ctx, nil, false) { @@ -316,7 +316,7 @@ func (m pinsModuleStruct) permaPin(b *gotgbot.Bot, ctx *ext.Context) error { Normally pins message without tagging users but tag can be enabled by entering 'notify'/'violent'/'loud' in front of command */ -func (m pinsModuleStruct) pin(b *gotgbot.Bot, ctx *ext.Context) error { +func (pinsModuleStruct) pin(b *gotgbot.Bot, ctx *ext.Context) error { user := ctx.EffectiveSender.User chat := ctx.EffectiveChat msg := ctx.EffectiveMessage @@ -395,7 +395,7 @@ connection - true, true Sets Preference for checkPinned function to check message for unpinning or not */ -func (m pinsModuleStruct) antichannelpin(b *gotgbot.Bot, ctx *ext.Context) error { +func (pinsModuleStruct) antichannelpin(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // connection status connectedChat := helpers.IsUserConnected(b, ctx, true, true) @@ -468,7 +468,7 @@ connection - true, true Sets Preference for checkPinned function to check message for cleaning or not */ -func (m pinsModuleStruct) cleanlinked(b *gotgbot.Bot, ctx *ext.Context) error { +func (pinsModuleStruct) cleanlinked(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // connection status connectedChat := helpers.IsUserConnected(b, ctx, true, true) @@ -541,7 +541,7 @@ connection - false, true User can get the link to latest pinned message of chat using this */ -func (m pinsModuleStruct) pinned(b *gotgbot.Bot, ctx *ext.Context) error { +func (pinsModuleStruct) pinned(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat msg := ctx.EffectiveMessage @@ -707,7 +707,7 @@ var PinsEnumFuncMap = map[int]func(b *gotgbot.Bot, ctx *ext.Context, pinT pinTyp }, } -func (m pinsModuleStruct) GetPinType(msg *gotgbot.Message) (fileid, text string, dataType int, buttons []tgmd2html.ButtonV2) { +func (pinsModuleStruct) GetPinType(msg *gotgbot.Message) (fileid, text string, dataType int, buttons []tgmd2html.ButtonV2) { dataType = -1 // not defined datatype; invalid filter var ( rawText string diff --git a/alita/modules/purges.go b/alita/modules/purges.go index f1e53e09..86c94533 100644 --- a/alita/modules/purges.go +++ b/alita/modules/purges.go @@ -27,7 +27,7 @@ var ( delMsgs = map[int64]int64{} ) -func (m purgesModuleStruct) purgeMsgs(bot *gotgbot.Bot, chat *gotgbot.Chat, pFrom bool, msgId, deleteTo int64) bool { +func (purgesModuleStruct) purgeMsgs(bot *gotgbot.Bot, chat *gotgbot.Chat, pFrom bool, msgId, deleteTo int64) bool { if !pFrom { _, err := bot.DeleteMessage(chat.Id, msgId, nil) if err != nil { @@ -139,7 +139,7 @@ func (m purgesModuleStruct) purge(bot *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m purgesModuleStruct) delCmd(bot *gotgbot.Bot, ctx *ext.Context) error { +func (purgesModuleStruct) delCmd(bot *gotgbot.Bot, ctx *ext.Context) error { user := ctx.EffectiveSender.User // Permission checks @@ -199,7 +199,7 @@ func (m purgesModuleStruct) delCmd(bot *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m purgesModuleStruct) deleteButtonHandler(b *gotgbot.Bot, ctx *ext.Context) error { +func (purgesModuleStruct) deleteButtonHandler(b *gotgbot.Bot, ctx *ext.Context) error { query := ctx.Update.CallbackQuery chat := ctx.EffectiveChat user := ctx.EffectiveSender.User @@ -238,7 +238,7 @@ func (m purgesModuleStruct) deleteButtonHandler(b *gotgbot.Bot, ctx *ext.Context return ext.EndGroups } -func (m purgesModuleStruct) purgeFrom(bot *gotgbot.Bot, ctx *ext.Context) error { +func (purgesModuleStruct) purgeFrom(bot *gotgbot.Bot, ctx *ext.Context) error { user := ctx.EffectiveSender.User // Permission checks diff --git a/alita/modules/reports.go b/alita/modules/reports.go index 0feee885..f7b498e2 100644 --- a/alita/modules/reports.go +++ b/alita/modules/reports.go @@ -32,7 +32,7 @@ var reportsModule = reportsModuleStruct{ handlerGroup: 8, } -func (m reportsModuleStruct) report(b *gotgbot.Bot, ctx *ext.Context) error { +func (reportsModuleStruct) report(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat user := ctx.EffectiveSender.User msg := ctx.EffectiveMessage @@ -196,7 +196,7 @@ func (m reportsModuleStruct) report(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m reportsModuleStruct) reports(b *gotgbot.Bot, ctx *ext.Context) error { +func (reportsModuleStruct) reports(b *gotgbot.Bot, ctx *ext.Context) error { // connection status connectedChat := helpers.IsUserConnected(b, ctx, true, true) if connectedChat == nil { @@ -312,7 +312,7 @@ func (m reportsModuleStruct) reports(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m reportsModuleStruct) markResolvedButtonHandler(b *gotgbot.Bot, ctx *ext.Context) error { +func (reportsModuleStruct) markResolvedButtonHandler(b *gotgbot.Bot, ctx *ext.Context) error { query := ctx.Update.CallbackQuery chat := ctx.EffectiveChat user := ctx.EffectiveSender.User diff --git a/alita/modules/rules.go b/alita/modules/rules.go index 60119924..1dbb3edb 100644 --- a/alita/modules/rules.go +++ b/alita/modules/rules.go @@ -30,7 +30,7 @@ var rulesModule = rulesModuleStruct{ defaultRulesBtn: "Rules", } -func (m rulesModuleStruct) clearRules(bot *gotgbot.Bot, ctx *ext.Context) error { +func (rulesModuleStruct) clearRules(bot *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage chat := ctx.EffectiveChat @@ -44,7 +44,7 @@ func (m rulesModuleStruct) clearRules(bot *gotgbot.Bot, ctx *ext.Context) error return ext.EndGroups } -func (m rulesModuleStruct) privaterules(bot *gotgbot.Bot, ctx *ext.Context) error { +func (rulesModuleStruct) privaterules(bot *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // connection status connectedChat := helpers.IsUserConnected(bot, ctx, true, true) @@ -154,7 +154,7 @@ func (m rulesModuleStruct) sendRules(bot *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m rulesModuleStruct) setRules(bot *gotgbot.Bot, ctx *ext.Context) error { +func (rulesModuleStruct) setRules(bot *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // connection status connectedChat := helpers.IsUserConnected(bot, ctx, true, true) @@ -231,7 +231,7 @@ func (m rulesModuleStruct) rulesBtn(bot *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m rulesModuleStruct) resetRulesBtn(bot *gotgbot.Bot, ctx *ext.Context) error { +func (rulesModuleStruct) resetRulesBtn(bot *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // connection status connectedChat := helpers.IsUserConnected(bot, ctx, true, true) diff --git a/alita/modules/users.go b/alita/modules/users.go index 52000744..8068d86b 100644 --- a/alita/modules/users.go +++ b/alita/modules/users.go @@ -23,7 +23,7 @@ var usersModule = usersModuleStruct{ handlerGroup: -1, } -func (m usersModuleStruct) logUsers(bot *gotgbot.Bot, ctx *ext.Context) error { +func (usersModuleStruct) logUsers(bot *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage chat := ctx.EffectiveChat user := ctx.EffectiveSender diff --git a/alita/modules/warns.go b/alita/modules/warns.go index 3674dd23..8aafd209 100644 --- a/alita/modules/warns.go +++ b/alita/modules/warns.go @@ -27,7 +27,7 @@ type warnsModuleStruct struct { var warnsModule = warnsModuleStruct{modname: "Warns"} -func (m warnsModuleStruct) setWarnMode(b *gotgbot.Bot, ctx *ext.Context) error { +func (warnsModuleStruct) setWarnMode(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // connection status connectedChat := helpers.IsUserConnected(b, ctx, true, true) @@ -75,7 +75,7 @@ func (m warnsModuleStruct) setWarnMode(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m warnsModuleStruct) warnThisUser(b *gotgbot.Bot, ctx *ext.Context, userId int64, reason, warnType string) (err error) { +func (warnsModuleStruct) warnThisUser(b *gotgbot.Bot, ctx *ext.Context, userId int64, reason, warnType string) (err error) { var ( reply string keyboard gotgbot.InlineKeyboardMarkup @@ -378,7 +378,7 @@ func (m warnsModuleStruct) dWarnUser(b *gotgbot.Bot, ctx *ext.Context) error { return m.warnThisUser(b, ctx, warnusr, reason, "dwarn") } -func (m warnsModuleStruct) warnings(b *gotgbot.Bot, ctx *ext.Context) error { +func (warnsModuleStruct) warnings(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat msg := ctx.EffectiveMessage user := ctx.EffectiveSender.User @@ -409,7 +409,7 @@ func (m warnsModuleStruct) warnings(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m warnsModuleStruct) warns(b *gotgbot.Bot, ctx *ext.Context) error { +func (warnsModuleStruct) warns(b *gotgbot.Bot, ctx *ext.Context) error { chat := ctx.EffectiveChat msg := ctx.EffectiveMessage @@ -474,7 +474,7 @@ func (m warnsModuleStruct) warns(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m warnsModuleStruct) rmWarnButton(b *gotgbot.Bot, ctx *ext.Context) error { +func (warnsModuleStruct) rmWarnButton(b *gotgbot.Bot, ctx *ext.Context) error { query := ctx.Update.CallbackQuery user := ctx.EffectiveSender.User chat := ctx.EffectiveChat @@ -520,7 +520,7 @@ func (m warnsModuleStruct) rmWarnButton(b *gotgbot.Bot, ctx *ext.Context) error return ext.EndGroups } -func (m warnsModuleStruct) setWarnLimit(b *gotgbot.Bot, ctx *ext.Context) error { +func (warnsModuleStruct) setWarnLimit(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage // connection status connectedChat := helpers.IsUserConnected(b, ctx, true, true) @@ -567,7 +567,7 @@ func (m warnsModuleStruct) setWarnLimit(b *gotgbot.Bot, ctx *ext.Context) error return ext.EndGroups } -func (m warnsModuleStruct) resetWarns(b *gotgbot.Bot, ctx *ext.Context) error { +func (warnsModuleStruct) resetWarns(b *gotgbot.Bot, ctx *ext.Context) error { msg := ctx.EffectiveMessage chat := ctx.EffectiveChat user := ctx.EffectiveSender.User @@ -613,7 +613,7 @@ func (m warnsModuleStruct) resetWarns(b *gotgbot.Bot, ctx *ext.Context) error { return ext.EndGroups } -func (m warnsModuleStruct) resetAllWarns(b *gotgbot.Bot, ctx *ext.Context) error { +func (warnsModuleStruct) resetAllWarns(b *gotgbot.Bot, ctx *ext.Context) error { user := ctx.EffectiveSender.User msg := ctx.EffectiveMessage chat := ctx.EffectiveChat @@ -654,7 +654,7 @@ func (m warnsModuleStruct) resetAllWarns(b *gotgbot.Bot, ctx *ext.Context) error return ext.EndGroups } -func (m warnsModuleStruct) buttonHandler(b *gotgbot.Bot, ctx *ext.Context) error { +func (warnsModuleStruct) buttonHandler(b *gotgbot.Bot, ctx *ext.Context) error { query := ctx.Update.CallbackQuery user := query.From