diff --git a/backend/src/plugins/AutoReactions/AutoReactionsPlugin.ts b/backend/src/plugins/AutoReactions/AutoReactionsPlugin.ts index df5ebd3a..bd901d49 100644 --- a/backend/src/plugins/AutoReactions/AutoReactionsPlugin.ts +++ b/backend/src/plugins/AutoReactions/AutoReactionsPlugin.ts @@ -1,12 +1,12 @@ import { PluginOptions, guildPlugin } from "knub"; import { GuildAutoReactions } from "../../data/GuildAutoReactions"; import { GuildSavedMessages } from "../../data/GuildSavedMessages"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { LogsPlugin } from "../Logs/LogsPlugin"; import { DisableAutoReactionsCmd } from "./commands/DisableAutoReactionsCmd"; import { NewAutoReactionsCmd } from "./commands/NewAutoReactionsCmd"; import { AddReactionsEvt } from "./events/AddReactionsEvt"; import { AutoReactionsPluginType, zAutoReactionsConfig } from "./types"; -import { CommonPlugin } from "../Common/CommonPlugin"; const defaultOptions: PluginOptions = { config: { @@ -54,5 +54,5 @@ export const AutoReactionsPlugin = guildPlugin()({ beforeStart(pluginData) { pluginData.state.common = pluginData.getPlugin(CommonPlugin); - } + }, }); diff --git a/backend/src/plugins/AutoReactions/commands/DisableAutoReactionsCmd.ts b/backend/src/plugins/AutoReactions/commands/DisableAutoReactionsCmd.ts index f6539174..9d57a0dd 100644 --- a/backend/src/plugins/AutoReactions/commands/DisableAutoReactionsCmd.ts +++ b/backend/src/plugins/AutoReactions/commands/DisableAutoReactionsCmd.ts @@ -1,5 +1,4 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { autoReactionsCmd } from "../types"; export const DisableAutoReactionsCmd = autoReactionsCmd({ diff --git a/backend/src/plugins/AutoReactions/commands/NewAutoReactionsCmd.ts b/backend/src/plugins/AutoReactions/commands/NewAutoReactionsCmd.ts index 7f3355fb..420948cc 100644 --- a/backend/src/plugins/AutoReactions/commands/NewAutoReactionsCmd.ts +++ b/backend/src/plugins/AutoReactions/commands/NewAutoReactionsCmd.ts @@ -4,7 +4,6 @@ import { canUseEmoji, customEmojiRegex, isEmoji } from "../../../utils"; import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions"; import { missingPermissionError } from "../../../utils/missingPermissionError"; import { readChannelPermissions } from "../../../utils/readChannelPermissions"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { autoReactionsCmd } from "../types"; const requiredPermissions = readChannelPermissions | PermissionsBitField.Flags.AddReactions; @@ -44,7 +43,10 @@ export const NewAutoReactionsCmd = autoReactionsCmd({ if (customEmojiMatch) { // Custom emoji if (!canUseEmoji(pluginData.client, customEmojiMatch[2])) { - pluginData.state.common.sendErrorMessage(msg, "I can only use regular emojis and custom emojis from this server"); + pluginData.state.common.sendErrorMessage( + msg, + "I can only use regular emojis and custom emojis from this server", + ); return; } diff --git a/backend/src/plugins/Automod/AutomodPlugin.ts b/backend/src/plugins/Automod/AutomodPlugin.ts index 5da233a1..abe0990c 100644 --- a/backend/src/plugins/Automod/AutomodPlugin.ts +++ b/backend/src/plugins/Automod/AutomodPlugin.ts @@ -8,6 +8,7 @@ import { discardRegExpRunner, getRegExpRunner } from "../../regExpRunners"; import { MINUTES, SECONDS } from "../../utils"; import { registerEventListenersFromMap } from "../../utils/registerEventListenersFromMap"; import { unregisterEventListenersFromMap } from "../../utils/unregisterEventListenersFromMap"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { CountersPlugin } from "../Counters/CountersPlugin"; import { InternalPosterPlugin } from "../InternalPoster/InternalPosterPlugin"; import { LogsPlugin } from "../Logs/LogsPlugin"; @@ -32,7 +33,6 @@ import { clearOldRecentNicknameChanges } from "./functions/clearOldNicknameChang import { clearOldRecentActions } from "./functions/clearOldRecentActions"; import { clearOldRecentSpam } from "./functions/clearOldRecentSpam"; import { AutomodPluginType, zAutomodConfig } from "./types"; -import { CommonPlugin } from "../Common/CommonPlugin"; const defaultOptions = { config: { diff --git a/backend/src/plugins/Automod/types.ts b/backend/src/plugins/Automod/types.ts index 75cd8daa..5028a377 100644 --- a/backend/src/plugins/Automod/types.ts +++ b/backend/src/plugins/Automod/types.ts @@ -9,6 +9,7 @@ import { GuildLogs } from "../../data/GuildLogs"; import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { SavedMessage } from "../../data/entities/SavedMessage"; import { entries, zBoundedRecord, zDelayString } from "../../utils"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { CounterEvents } from "../Counters/types"; import { ModActionType, ModActionsEvents } from "../ModActions/types"; import { MutesEvents } from "../Mutes/types"; @@ -17,7 +18,6 @@ import { RecentActionType } from "./constants"; import { availableTriggers } from "./triggers/availableTriggers"; import Timeout = NodeJS.Timeout; -import { CommonPlugin } from "../Common/CommonPlugin"; export type ZTriggersMapHelper = { [TriggerName in keyof typeof availableTriggers]: (typeof availableTriggers)[TriggerName]["configSchema"]; diff --git a/backend/src/plugins/BotControl/commands/AddDashboardUserCmd.ts b/backend/src/plugins/BotControl/commands/AddDashboardUserCmd.ts index 8e97cf56..abe73595 100644 --- a/backend/src/plugins/BotControl/commands/AddDashboardUserCmd.ts +++ b/backend/src/plugins/BotControl/commands/AddDashboardUserCmd.ts @@ -2,7 +2,6 @@ import { ApiPermissions } from "@zeppelinbot/shared"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { isStaffPreFilter } from "../../../pluginUtils"; import { renderUsername } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { botControlCmd } from "../types"; export const AddDashboardUserCmd = botControlCmd({ diff --git a/backend/src/plugins/BotControl/commands/AddServerFromInviteCmd.ts b/backend/src/plugins/BotControl/commands/AddServerFromInviteCmd.ts index e5245bb3..3dfdaf81 100644 --- a/backend/src/plugins/BotControl/commands/AddServerFromInviteCmd.ts +++ b/backend/src/plugins/BotControl/commands/AddServerFromInviteCmd.ts @@ -2,7 +2,6 @@ import { ApiPermissions } from "@zeppelinbot/shared"; import moment from "moment-timezone"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { DBDateFormat, isGuildInvite, resolveInvite } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { isEligible } from "../functions/isEligible"; import { botControlCmd } from "../types"; diff --git a/backend/src/plugins/BotControl/commands/AllowServerCmd.ts b/backend/src/plugins/BotControl/commands/AllowServerCmd.ts index 9d0a6cea..9580e7e2 100644 --- a/backend/src/plugins/BotControl/commands/AllowServerCmd.ts +++ b/backend/src/plugins/BotControl/commands/AllowServerCmd.ts @@ -3,7 +3,6 @@ import moment from "moment-timezone"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { isStaffPreFilter } from "../../../pluginUtils"; import { DBDateFormat, isSnowflake } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { botControlCmd } from "../types"; export const AllowServerCmd = botControlCmd({ diff --git a/backend/src/plugins/BotControl/commands/ChannelToServerCmd.ts b/backend/src/plugins/BotControl/commands/ChannelToServerCmd.ts index f19a41c9..f2a62213 100644 --- a/backend/src/plugins/BotControl/commands/ChannelToServerCmd.ts +++ b/backend/src/plugins/BotControl/commands/ChannelToServerCmd.ts @@ -1,6 +1,5 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { isStaffPreFilter } from "../../../pluginUtils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { botControlCmd } from "../types"; export const ChannelToServerCmd = botControlCmd({ diff --git a/backend/src/plugins/BotControl/commands/DisallowServerCmd.ts b/backend/src/plugins/BotControl/commands/DisallowServerCmd.ts index 8a31ddf5..43033341 100644 --- a/backend/src/plugins/BotControl/commands/DisallowServerCmd.ts +++ b/backend/src/plugins/BotControl/commands/DisallowServerCmd.ts @@ -2,7 +2,6 @@ import { Snowflake } from "discord.js"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { isStaffPreFilter } from "../../../pluginUtils"; import { noop } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { botControlCmd } from "../types"; export const DisallowServerCmd = botControlCmd({ diff --git a/backend/src/plugins/BotControl/commands/EligibleCmd.ts b/backend/src/plugins/BotControl/commands/EligibleCmd.ts index 60adcea2..f934037f 100644 --- a/backend/src/plugins/BotControl/commands/EligibleCmd.ts +++ b/backend/src/plugins/BotControl/commands/EligibleCmd.ts @@ -1,6 +1,5 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { isGuildInvite, resolveInvite } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { isEligible } from "../functions/isEligible"; import { botControlCmd } from "../types"; diff --git a/backend/src/plugins/BotControl/commands/LeaveServerCmd.ts b/backend/src/plugins/BotControl/commands/LeaveServerCmd.ts index c22a885f..652c049d 100644 --- a/backend/src/plugins/BotControl/commands/LeaveServerCmd.ts +++ b/backend/src/plugins/BotControl/commands/LeaveServerCmd.ts @@ -1,7 +1,6 @@ import { Snowflake } from "discord.js"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { isStaffPreFilter } from "../../../pluginUtils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { botControlCmd } from "../types"; export const LeaveServerCmd = botControlCmd({ diff --git a/backend/src/plugins/BotControl/commands/ListDashboardPermsCmd.ts b/backend/src/plugins/BotControl/commands/ListDashboardPermsCmd.ts index 83f0cc37..ea237ef2 100644 --- a/backend/src/plugins/BotControl/commands/ListDashboardPermsCmd.ts +++ b/backend/src/plugins/BotControl/commands/ListDashboardPermsCmd.ts @@ -2,7 +2,6 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { AllowedGuild } from "../../../data/entities/AllowedGuild"; import { ApiPermissionAssignment } from "../../../data/entities/ApiPermissionAssignment"; import { renderUsername, resolveUser } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { botControlCmd } from "../types"; export const ListDashboardPermsCmd = botControlCmd({ diff --git a/backend/src/plugins/BotControl/commands/ListDashboardUsersCmd.ts b/backend/src/plugins/BotControl/commands/ListDashboardUsersCmd.ts index 2892e6e6..34c98dd2 100644 --- a/backend/src/plugins/BotControl/commands/ListDashboardUsersCmd.ts +++ b/backend/src/plugins/BotControl/commands/ListDashboardUsersCmd.ts @@ -1,6 +1,5 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { renderUsername, resolveUser } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { botControlCmd } from "../types"; export const ListDashboardUsersCmd = botControlCmd({ diff --git a/backend/src/plugins/BotControl/commands/RateLimitPerformanceCmd.ts b/backend/src/plugins/BotControl/commands/RateLimitPerformanceCmd.ts index 9ba9d23c..6114c681 100644 --- a/backend/src/plugins/BotControl/commands/RateLimitPerformanceCmd.ts +++ b/backend/src/plugins/BotControl/commands/RateLimitPerformanceCmd.ts @@ -2,7 +2,6 @@ import moment from "moment-timezone"; import { GuildArchives } from "../../../data/GuildArchives"; import { getBaseUrl } from "../../../pluginUtils"; import { getRateLimitStats } from "../../../rateLimitStats"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { botControlCmd } from "../types"; export const RateLimitPerformanceCmd = botControlCmd({ diff --git a/backend/src/plugins/BotControl/commands/ReloadGlobalPluginsCmd.ts b/backend/src/plugins/BotControl/commands/ReloadGlobalPluginsCmd.ts index 957fca95..dc13a45e 100644 --- a/backend/src/plugins/BotControl/commands/ReloadGlobalPluginsCmd.ts +++ b/backend/src/plugins/BotControl/commands/ReloadGlobalPluginsCmd.ts @@ -1,5 +1,4 @@ import { isStaffPreFilter } from "../../../pluginUtils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { getActiveReload, setActiveReload } from "../activeReload"; import { botControlCmd } from "../types"; diff --git a/backend/src/plugins/BotControl/commands/ReloadServerCmd.ts b/backend/src/plugins/BotControl/commands/ReloadServerCmd.ts index a171af5f..0ea4f59d 100644 --- a/backend/src/plugins/BotControl/commands/ReloadServerCmd.ts +++ b/backend/src/plugins/BotControl/commands/ReloadServerCmd.ts @@ -1,7 +1,6 @@ import { Snowflake } from "discord.js"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { isStaffPreFilter } from "../../../pluginUtils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { botControlCmd } from "../types"; export const ReloadServerCmd = botControlCmd({ diff --git a/backend/src/plugins/BotControl/commands/RemoveDashboardUserCmd.ts b/backend/src/plugins/BotControl/commands/RemoveDashboardUserCmd.ts index 502570a7..4c0ed1d8 100644 --- a/backend/src/plugins/BotControl/commands/RemoveDashboardUserCmd.ts +++ b/backend/src/plugins/BotControl/commands/RemoveDashboardUserCmd.ts @@ -1,7 +1,6 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { isStaffPreFilter } from "../../../pluginUtils"; import { renderUsername } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { botControlCmd } from "../types"; export const RemoveDashboardUserCmd = botControlCmd({ @@ -37,8 +36,6 @@ export const RemoveDashboardUserCmd = botControlCmd({ const userNameList = args.users.map((user) => `<@!${user.id}> (**${renderUsername(user)}**, \`${user.id}\`)`); - msg.channel.send( - `The following users were removed from the dashboard for **${guild.name}**:\n\n${userNameList}`, - ); + msg.channel.send(`The following users were removed from the dashboard for **${guild.name}**:\n\n${userNameList}`); }, }); diff --git a/backend/src/plugins/BotControl/types.ts b/backend/src/plugins/BotControl/types.ts index 592189c1..1c1ccea6 100644 --- a/backend/src/plugins/BotControl/types.ts +++ b/backend/src/plugins/BotControl/types.ts @@ -1,4 +1,4 @@ -import { BasePluginType, globalPluginEventListener, globalPluginMessageCommand, pluginUtils } from "knub"; +import { BasePluginType, globalPluginEventListener, globalPluginMessageCommand } from "knub"; import z from "zod"; import { AllowedGuilds } from "../../data/AllowedGuilds"; import { ApiPermissionAssignments } from "../../data/ApiPermissionAssignments"; diff --git a/backend/src/plugins/ChannelArchiver/ChannelArchiverPlugin.ts b/backend/src/plugins/ChannelArchiver/ChannelArchiverPlugin.ts index b9c310d7..79937321 100644 --- a/backend/src/plugins/ChannelArchiver/ChannelArchiverPlugin.ts +++ b/backend/src/plugins/ChannelArchiver/ChannelArchiverPlugin.ts @@ -1,9 +1,9 @@ import { guildPlugin } from "knub"; import z from "zod"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin"; import { ArchiveChannelCmd } from "./commands/ArchiveChannelCmd"; import { ChannelArchiverPluginType } from "./types"; -import { CommonPlugin } from "../Common/CommonPlugin"; export const ChannelArchiverPlugin = guildPlugin()({ name: "channel_archiver", @@ -18,5 +18,5 @@ export const ChannelArchiverPlugin = guildPlugin()({ beforeStart(pluginData) { pluginData.state.common = pluginData.getPlugin(CommonPlugin); - } + }, }); diff --git a/backend/src/plugins/ChannelArchiver/commands/ArchiveChannelCmd.ts b/backend/src/plugins/ChannelArchiver/commands/ArchiveChannelCmd.ts index 34bdeef7..5e0235a4 100644 --- a/backend/src/plugins/ChannelArchiver/commands/ArchiveChannelCmd.ts +++ b/backend/src/plugins/ChannelArchiver/commands/ArchiveChannelCmd.ts @@ -3,7 +3,6 @@ import moment from "moment-timezone"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { isOwner } from "../../../pluginUtils"; import { SECONDS, confirm, noop, renderUsername } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin"; import { rehostAttachment } from "../rehostAttachment"; import { channelArchiverCmd } from "../types"; diff --git a/backend/src/plugins/ChannelArchiver/types.ts b/backend/src/plugins/ChannelArchiver/types.ts index a560af39..5dffc8d7 100644 --- a/backend/src/plugins/ChannelArchiver/types.ts +++ b/backend/src/plugins/ChannelArchiver/types.ts @@ -4,7 +4,7 @@ import { CommonPlugin } from "../Common/CommonPlugin"; export interface ChannelArchiverPluginType extends BasePluginType { state: { common: pluginUtils.PluginPublicInterface; - } + }; } export const channelArchiverCmd = guildPluginMessageCommand(); diff --git a/backend/src/plugins/Common/CommonPlugin.ts b/backend/src/plugins/Common/CommonPlugin.ts index 144c355c..6482272e 100644 --- a/backend/src/plugins/Common/CommonPlugin.ts +++ b/backend/src/plugins/Common/CommonPlugin.ts @@ -139,7 +139,7 @@ export const CommonPlugin = guildPlugin()({ if (!channel) { throw new Error( - 'Cannot store attachments: no attachment storing channel configured, and no backup channel passed' + "Cannot store attachments: no attachment storing channel configured, and no backup channel passed", ); } @@ -148,6 +148,6 @@ export const CommonPlugin = guildPlugin()({ files: attachments.map((a) => a.url), }); }, - } + }; }, }); diff --git a/backend/src/plugins/ContextMenus/actions/ban.ts b/backend/src/plugins/ContextMenus/actions/ban.ts index 9f7114c6..ab5951b5 100644 --- a/backend/src/plugins/ContextMenus/actions/ban.ts +++ b/backend/src/plugins/ContextMenus/actions/ban.ts @@ -9,11 +9,11 @@ import { } from "discord.js"; import humanizeDuration from "humanize-duration"; import { GuildPluginData } from "knub"; -import { canActOn } from "../../../pluginUtils"; -import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin"; import { logger } from "../../../logger"; +import { canActOn } from "../../../pluginUtils"; import { convertDelayStringToMS, renderUserUsername } from "../../../utils"; import { CaseArgs } from "../../Cases/types"; +import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin"; import { MODAL_TIMEOUT } from "../commands/ModMenuUserCtxCmd"; import { ContextMenuPluginType, ModMenuActionType } from "../types"; import { updateAction } from "./update"; diff --git a/backend/src/plugins/ContextMenus/actions/note.ts b/backend/src/plugins/ContextMenus/actions/note.ts index bbdc6a8e..1065639d 100644 --- a/backend/src/plugins/ContextMenus/actions/note.ts +++ b/backend/src/plugins/ContextMenus/actions/note.ts @@ -8,13 +8,13 @@ import { TextInputStyle, } from "discord.js"; import { GuildPluginData } from "knub"; -import { canActOn } from "../../../pluginUtils"; -import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin"; import { CaseTypes } from "../../../data/CaseTypes"; import { logger } from "../../../logger"; +import { canActOn } from "../../../pluginUtils"; import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin"; import { renderUserUsername } from "../../../utils"; import { LogsPlugin } from "../../Logs/LogsPlugin"; +import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin"; import { MODAL_TIMEOUT } from "../commands/ModMenuUserCtxCmd"; import { ContextMenuPluginType, ModMenuActionType } from "../types"; diff --git a/backend/src/plugins/ContextMenus/actions/warn.ts b/backend/src/plugins/ContextMenus/actions/warn.ts index 1e93f42d..94c094ef 100644 --- a/backend/src/plugins/ContextMenus/actions/warn.ts +++ b/backend/src/plugins/ContextMenus/actions/warn.ts @@ -8,11 +8,11 @@ import { TextInputStyle, } from "discord.js"; import { GuildPluginData } from "knub"; -import { canActOn } from "../../../pluginUtils"; -import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin"; import { logger } from "../../../logger"; +import { canActOn } from "../../../pluginUtils"; import { renderUserUsername } from "../../../utils"; import { CaseArgs } from "../../Cases/types"; +import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin"; import { MODAL_TIMEOUT } from "../commands/ModMenuUserCtxCmd"; import { ContextMenuPluginType, ModMenuActionType } from "../types"; import { updateAction } from "./update"; diff --git a/backend/src/plugins/ContextMenus/commands/ModMenuUserCtxCmd.ts b/backend/src/plugins/ContextMenus/commands/ModMenuUserCtxCmd.ts index fd538997..dab9f87d 100644 --- a/backend/src/plugins/ContextMenus/commands/ModMenuUserCtxCmd.ts +++ b/backend/src/plugins/ContextMenus/commands/ModMenuUserCtxCmd.ts @@ -12,13 +12,12 @@ import { import { GuildPluginData, guildPluginUserContextMenuCommand } from "knub"; import { Case } from "../../../data/entities/Case"; import { logger } from "../../../logger"; -import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin"; import { SECONDS, UnknownUser, emptyEmbedValue, renderUserUsername, resolveUser, trimLines } from "../../../utils"; import { asyncMap } from "../../../utils/async"; import { getChunkedEmbedFields } from "../../../utils/getChunkedEmbedFields"; import { getGuildPrefix } from "../../../utils/getGuildPrefix"; import { CasesPlugin } from "../../Cases/CasesPlugin"; -import { UtilityPlugin } from "../../Utility/UtilityPlugin"; +import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin"; import { getUserInfoEmbed } from "../../Utility/functions/getUserInfoEmbed"; import { launchBanActionModal } from "../actions/ban"; import { launchMuteActionModal } from "../actions/mute"; diff --git a/backend/src/plugins/Counters/CountersPlugin.ts b/backend/src/plugins/Counters/CountersPlugin.ts index dd226865..edee10be 100644 --- a/backend/src/plugins/Counters/CountersPlugin.ts +++ b/backend/src/plugins/Counters/CountersPlugin.ts @@ -4,6 +4,7 @@ import { GuildCounters } from "../../data/GuildCounters"; import { CounterTrigger, parseCounterConditionString } from "../../data/entities/CounterTrigger"; import { makePublicFn } from "../../pluginUtils"; import { MINUTES, convertDelayStringToMS, values } from "../../utils"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { AddCounterCmd } from "./commands/AddCounterCmd"; import { CountersListCmd } from "./commands/CountersListCmd"; import { ResetAllCounterValuesCmd } from "./commands/ResetAllCounterValuesCmd"; @@ -19,7 +20,6 @@ import { offCounterEvent } from "./functions/offCounterEvent"; import { onCounterEvent } from "./functions/onCounterEvent"; import { setCounterValue } from "./functions/setCounterValue"; import { CountersPluginType, zCountersConfig } from "./types"; -import { CommonPlugin } from "../Common/CommonPlugin"; const DECAY_APPLY_INTERVAL = 5 * MINUTES; diff --git a/backend/src/plugins/Counters/commands/AddCounterCmd.ts b/backend/src/plugins/Counters/commands/AddCounterCmd.ts index 558c23de..9df3ea34 100644 --- a/backend/src/plugins/Counters/commands/AddCounterCmd.ts +++ b/backend/src/plugins/Counters/commands/AddCounterCmd.ts @@ -3,7 +3,6 @@ import { guildPluginMessageCommand } from "knub"; import { waitForReply } from "knub/helpers"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { UnknownUser, resolveUser } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { changeCounterValue } from "../functions/changeCounterValue"; import { CountersPluginType } from "../types"; diff --git a/backend/src/plugins/Counters/commands/CountersListCmd.ts b/backend/src/plugins/Counters/commands/CountersListCmd.ts index fc79b62c..70ecb810 100644 --- a/backend/src/plugins/Counters/commands/CountersListCmd.ts +++ b/backend/src/plugins/Counters/commands/CountersListCmd.ts @@ -1,7 +1,6 @@ import { guildPluginMessageCommand } from "knub"; import { trimMultilineString, ucfirst } from "../../../utils"; import { getGuildPrefix } from "../../../utils/getGuildPrefix"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { CountersPluginType } from "../types"; export const CountersListCmd = guildPluginMessageCommand()({ diff --git a/backend/src/plugins/Counters/commands/ResetAllCounterValuesCmd.ts b/backend/src/plugins/Counters/commands/ResetAllCounterValuesCmd.ts index 5f7aa5d4..45b46006 100644 --- a/backend/src/plugins/Counters/commands/ResetAllCounterValuesCmd.ts +++ b/backend/src/plugins/Counters/commands/ResetAllCounterValuesCmd.ts @@ -1,7 +1,6 @@ import { guildPluginMessageCommand } from "knub"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { confirm, noop, trimMultilineString } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { resetAllCounterValues } from "../functions/resetAllCounterValues"; import { CountersPluginType } from "../types"; @@ -23,7 +22,10 @@ export const ResetAllCounterValuesCmd = guildPluginMessageCommand()({ diff --git a/backend/src/plugins/Counters/types.ts b/backend/src/plugins/Counters/types.ts index c75046eb..a323abf4 100644 --- a/backend/src/plugins/Counters/types.ts +++ b/backend/src/plugins/Counters/types.ts @@ -9,8 +9,8 @@ import { parseCounterConditionString, } from "../../data/entities/CounterTrigger"; import { zBoundedCharacters, zBoundedRecord, zDelayString } from "../../utils"; -import Timeout = NodeJS.Timeout; import { CommonPlugin } from "../Common/CommonPlugin"; +import Timeout = NodeJS.Timeout; const MAX_COUNTERS = 5; const MAX_TRIGGERS_PER_COUNTER = 5; diff --git a/backend/src/plugins/CustomEvents/CustomEventsPlugin.ts b/backend/src/plugins/CustomEvents/CustomEventsPlugin.ts index cdb9aae7..41d8c1f2 100644 --- a/backend/src/plugins/CustomEvents/CustomEventsPlugin.ts +++ b/backend/src/plugins/CustomEvents/CustomEventsPlugin.ts @@ -11,10 +11,10 @@ import { messageToTemplateSafeMessage, userToTemplateSafeUser, } from "../../utils/templateSafeObjects"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { LogsPlugin } from "../Logs/LogsPlugin"; import { runEvent } from "./functions/runEvent"; import { CustomEventsPluginType, zCustomEventsConfig } from "./types"; -import { CommonPlugin } from "../Common/CommonPlugin"; const defaultOptions = { config: { diff --git a/backend/src/plugins/CustomEvents/functions/runEvent.ts b/backend/src/plugins/CustomEvents/functions/runEvent.ts index 3f75b894..a2bf0d57 100644 --- a/backend/src/plugins/CustomEvents/functions/runEvent.ts +++ b/backend/src/plugins/CustomEvents/functions/runEvent.ts @@ -1,7 +1,6 @@ import { Message } from "discord.js"; import { GuildPluginData } from "knub"; import { TemplateSafeValueContainer } from "../../../templateFormatter"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { ActionError } from "../ActionError"; import { addRoleAction } from "../actions/addRoleAction"; import { createCaseAction } from "../actions/createCaseAction"; diff --git a/backend/src/plugins/CustomEvents/types.ts b/backend/src/plugins/CustomEvents/types.ts index 0372fd16..df325b98 100644 --- a/backend/src/plugins/CustomEvents/types.ts +++ b/backend/src/plugins/CustomEvents/types.ts @@ -1,6 +1,7 @@ import { BasePluginType, pluginUtils } from "knub"; import z from "zod"; import { zBoundedCharacters, zBoundedRecord } from "../../utils"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { zAddRoleAction } from "./actions/addRoleAction"; import { zCreateCaseAction } from "./actions/createCaseAction"; import { zMakeRoleMentionableAction } from "./actions/makeRoleMentionableAction"; @@ -8,7 +9,6 @@ import { zMakeRoleUnmentionableAction } from "./actions/makeRoleUnmentionableAct import { zMessageAction } from "./actions/messageAction"; import { zMoveToVoiceChannelAction } from "./actions/moveToVoiceChannelAction"; import { zSetChannelPermissionOverridesAction } from "./actions/setChannelPermissionOverrides"; -import { CommonPlugin } from "../Common/CommonPlugin"; const zCommandTrigger = z.strictObject({ type: z.literal("command"), diff --git a/backend/src/plugins/LocateUser/LocateUserPlugin.ts b/backend/src/plugins/LocateUser/LocateUserPlugin.ts index 39057b00..0730919c 100644 --- a/backend/src/plugins/LocateUser/LocateUserPlugin.ts +++ b/backend/src/plugins/LocateUser/LocateUserPlugin.ts @@ -1,6 +1,7 @@ import { PluginOptions, guildPlugin } from "knub"; import { onGuildEvent } from "../../data/GuildEvents"; import { GuildVCAlerts } from "../../data/GuildVCAlerts"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { FollowCmd } from "./commands/FollowCmd"; import { DeleteFollowCmd, ListFollowCmd } from "./commands/ListFollowCmd"; import { WhereCmd } from "./commands/WhereCmd"; @@ -9,7 +10,6 @@ import { VoiceStateUpdateAlertEvt } from "./events/SendAlertsEvts"; import { LocateUserPluginType, zLocateUserConfig } from "./types"; import { clearExpiredAlert } from "./utils/clearExpiredAlert"; import { fillActiveAlertsList } from "./utils/fillAlertsList"; -import { CommonPlugin } from "../Common/CommonPlugin"; const defaultOptions: PluginOptions = { config: { diff --git a/backend/src/plugins/LocateUser/commands/FollowCmd.ts b/backend/src/plugins/LocateUser/commands/FollowCmd.ts index 921ec47f..f0debc59 100644 --- a/backend/src/plugins/LocateUser/commands/FollowCmd.ts +++ b/backend/src/plugins/LocateUser/commands/FollowCmd.ts @@ -3,7 +3,6 @@ import moment from "moment-timezone"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { registerExpiringVCAlert } from "../../../data/loops/expiringVCAlertsLoop"; import { MINUTES, SECONDS } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { locateUserCmd } from "../types"; export const FollowCmd = locateUserCmd({ @@ -47,18 +46,16 @@ export const FollowCmd = locateUserCmd({ if (active) { void pluginData.state.common.sendSuccessMessage( - msg, - `Every time <@${args.member.id}> joins or switches VC in the next ${humanizeDuration( - time, - )} i will notify and move you.\nPlease make sure to be in a voice channel, otherwise i cannot move you!`, - ); + msg, + `Every time <@${args.member.id}> joins or switches VC in the next ${humanizeDuration( + time, + )} i will notify and move you.\nPlease make sure to be in a voice channel, otherwise i cannot move you!`, + ); } else { void pluginData.state.common.sendSuccessMessage( - msg, - `Every time <@${args.member.id}> joins or switches VC in the next ${humanizeDuration( - time, - )} i will notify you`, - ); + msg, + `Every time <@${args.member.id}> joins or switches VC in the next ${humanizeDuration(time)} i will notify you`, + ); } }, }); diff --git a/backend/src/plugins/LocateUser/commands/ListFollowCmd.ts b/backend/src/plugins/LocateUser/commands/ListFollowCmd.ts index c993c5c7..bbe30513 100644 --- a/backend/src/plugins/LocateUser/commands/ListFollowCmd.ts +++ b/backend/src/plugins/LocateUser/commands/ListFollowCmd.ts @@ -1,7 +1,6 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { clearExpiringVCAlert } from "../../../data/loops/expiringVCAlertsLoop"; import { createChunkedMessage, sorter } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { locateUserCmd } from "../types"; export const ListFollowCmd = locateUserCmd({ diff --git a/backend/src/plugins/LocateUser/utils/moveMember.ts b/backend/src/plugins/LocateUser/utils/moveMember.ts index f562fe30..6438bde1 100644 --- a/backend/src/plugins/LocateUser/utils/moveMember.ts +++ b/backend/src/plugins/LocateUser/utils/moveMember.ts @@ -1,6 +1,5 @@ import { GuildMember, GuildTextBasedChannel, Snowflake } from "discord.js"; import { GuildPluginData } from "knub"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { LocateUserPluginType } from "../types"; export async function moveMember( diff --git a/backend/src/plugins/LocateUser/utils/sendWhere.ts b/backend/src/plugins/LocateUser/utils/sendWhere.ts index 78172509..6ce4181f 100644 --- a/backend/src/plugins/LocateUser/utils/sendWhere.ts +++ b/backend/src/plugins/LocateUser/utils/sendWhere.ts @@ -1,7 +1,6 @@ import { GuildMember, GuildTextBasedChannel, Invite, VoiceChannel } from "discord.js"; import { GuildPluginData } from "knub"; import { getInviteLink } from "knub/helpers"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { LocateUserPluginType } from "../types"; import { createOrReuseInvite } from "./createOrReuseInvite"; diff --git a/backend/src/plugins/MessageSaver/MessageSaverPlugin.ts b/backend/src/plugins/MessageSaver/MessageSaverPlugin.ts index 9d62c2c7..9ea040bf 100644 --- a/backend/src/plugins/MessageSaver/MessageSaverPlugin.ts +++ b/backend/src/plugins/MessageSaver/MessageSaverPlugin.ts @@ -1,10 +1,10 @@ import { PluginOptions, guildPlugin } from "knub"; import { GuildSavedMessages } from "../../data/GuildSavedMessages"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { SaveMessagesToDBCmd } from "./commands/SaveMessagesToDB"; import { SavePinsToDBCmd } from "./commands/SavePinsToDB"; import { MessageCreateEvt, MessageDeleteBulkEvt, MessageDeleteEvt, MessageUpdateEvt } from "./events/SaveMessagesEvts"; import { MessageSaverPluginType, zMessageSaverConfig } from "./types"; -import { CommonPlugin } from "../Common/CommonPlugin"; const defaultOptions: PluginOptions = { config: { diff --git a/backend/src/plugins/MessageSaver/commands/SaveMessagesToDB.ts b/backend/src/plugins/MessageSaver/commands/SaveMessagesToDB.ts index a34b103e..6097bf14 100644 --- a/backend/src/plugins/MessageSaver/commands/SaveMessagesToDB.ts +++ b/backend/src/plugins/MessageSaver/commands/SaveMessagesToDB.ts @@ -1,5 +1,4 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { saveMessagesToDB } from "../saveMessagesToDB"; import { messageSaverCmd } from "../types"; @@ -19,9 +18,9 @@ export const SaveMessagesToDBCmd = messageSaverCmd({ if (failed.length) { void pluginData.state.common.sendSuccessMessage( - msg, - `Saved ${savedCount} messages. The following messages could not be saved: ${failed.join(", ")}`, - ); + msg, + `Saved ${savedCount} messages. The following messages could not be saved: ${failed.join(", ")}`, + ); } else { void pluginData.state.common.sendSuccessMessage(msg, `Saved ${savedCount} messages!`); } diff --git a/backend/src/plugins/MessageSaver/commands/SavePinsToDB.ts b/backend/src/plugins/MessageSaver/commands/SavePinsToDB.ts index d2910525..29bc2cbb 100644 --- a/backend/src/plugins/MessageSaver/commands/SavePinsToDB.ts +++ b/backend/src/plugins/MessageSaver/commands/SavePinsToDB.ts @@ -1,5 +1,4 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { saveMessagesToDB } from "../saveMessagesToDB"; import { messageSaverCmd } from "../types"; @@ -20,9 +19,9 @@ export const SavePinsToDBCmd = messageSaverCmd({ if (failed.length) { void pluginData.state.common.sendSuccessMessage( - msg, - `Saved ${savedCount} messages. The following messages could not be saved: ${failed.join(", ")}`, - ); + msg, + `Saved ${savedCount} messages. The following messages could not be saved: ${failed.join(", ")}`, + ); } else { void pluginData.state.common.sendSuccessMessage(msg, `Saved ${savedCount} messages!`); } diff --git a/backend/src/plugins/ModActions/ModActionsPlugin.ts b/backend/src/plugins/ModActions/ModActionsPlugin.ts index bd6aa0c7..a501fbc9 100644 --- a/backend/src/plugins/ModActions/ModActionsPlugin.ts +++ b/backend/src/plugins/ModActions/ModActionsPlugin.ts @@ -10,6 +10,7 @@ import { GuildTempbans } from "../../data/GuildTempbans"; import { makePublicFn, mapToPublicFn } from "../../pluginUtils"; import { MINUTES } from "../../utils"; import { CasesPlugin } from "../Cases/CasesPlugin"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { LogsPlugin } from "../Logs/LogsPlugin"; import { MutesPlugin } from "../Mutes/MutesPlugin"; import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin"; @@ -72,7 +73,6 @@ import { onModActionsEvent } from "./functions/onModActionsEvent"; import { updateCase } from "./functions/updateCase"; import { warnMember } from "./functions/warnMember"; import { AttachmentLinkReactionType, ModActionsPluginType, modActionsSlashGroup, zModActionsConfig } from "./types"; -import { CommonPlugin } from "../Common/CommonPlugin"; const defaultOptions = { config: { diff --git a/backend/src/plugins/ModActions/commands/addcase/AddCaseMsgCmd.ts b/backend/src/plugins/ModActions/commands/addcase/AddCaseMsgCmd.ts index 9f1b819b..bd9d85bf 100644 --- a/backend/src/plugins/ModActions/commands/addcase/AddCaseMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/addcase/AddCaseMsgCmd.ts @@ -2,8 +2,8 @@ import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { CaseTypes } from "../../../../data/CaseTypes"; import { hasPermission } from "../../../../pluginUtils"; import { resolveUser } from "../../../../utils"; -import { actualAddCaseCmd } from "./actualAddCaseCmd"; import { modActionsMsgCmd } from "../../types"; +import { actualAddCaseCmd } from "./actualAddCaseCmd"; const opts = { mod: ct.member({ option: true }), diff --git a/backend/src/plugins/ModActions/commands/addcase/AddCaseSlashCmd.ts b/backend/src/plugins/ModActions/commands/addcase/AddCaseSlashCmd.ts index 828ec742..23bb34a9 100644 --- a/backend/src/plugins/ModActions/commands/addcase/AddCaseSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/addcase/AddCaseSlashCmd.ts @@ -4,9 +4,9 @@ import { CaseTypes } from "../../../../data/CaseTypes"; import { hasPermission } from "../../../../pluginUtils"; import { resolveMember } from "../../../../utils"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; -import { actualAddCaseCmd } from "./actualAddCaseCmd"; import { modActionsSlashCmd } from "../../types"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; +import { actualAddCaseCmd } from "./actualAddCaseCmd"; const opts = [ slashOptions.string({ name: "reason", description: "The reason", required: false }), @@ -48,10 +48,7 @@ export const AddCaseSlashCmd = modActionsSlashCmd({ if (options.mod) { if (!canActAsOther) { - pluginData.state.common.sendErrorMessage( - interaction, - "You don't have permission to act as another moderator" - ); + pluginData.state.common.sendErrorMessage(interaction, "You don't have permission to act as another moderator"); return; } diff --git a/backend/src/plugins/ModActions/commands/addcase/actualAddCaseCmd.ts b/backend/src/plugins/ModActions/commands/addcase/actualAddCaseCmd.ts index 2c67dc2f..ef676083 100644 --- a/backend/src/plugins/ModActions/commands/addcase/actualAddCaseCmd.ts +++ b/backend/src/plugins/ModActions/commands/addcase/actualAddCaseCmd.ts @@ -6,9 +6,9 @@ import { canActOn } from "../../../../pluginUtils"; import { UnknownUser, renderUsername, resolveMember } from "../../../../utils"; import { CasesPlugin } from "../../../Cases/CasesPlugin"; import { LogsPlugin } from "../../../Logs/LogsPlugin"; -import { ModActionsPluginType } from "../../types"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; import { formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; +import { ModActionsPluginType } from "../../types"; export async function actualAddCaseCmd( pluginData: GuildPluginData, @@ -27,10 +27,7 @@ export async function actualAddCaseCmd( // If the user exists as a guild member, make sure we can act on them first const member = await resolveMember(pluginData.client, pluginData.guild, user.id); if (member && !canActOn(pluginData, author, member)) { - pluginData.state.common.sendErrorMessage( - context, - "Cannot add case on this user: insufficient permissions" - ); + pluginData.state.common.sendErrorMessage(context, "Cannot add case on this user: insufficient permissions"); return; } @@ -49,7 +46,7 @@ export async function actualAddCaseCmd( if (user) { pluginData.state.common.sendSuccessMessage( context, - `Case #${theCase.case_number} created for **${renderUsername(user)}**` + `Case #${theCase.case_number} created for **${renderUsername(user)}**`, ); } else { pluginData.state.common.sendSuccessMessage(context, `Case #${theCase.case_number} created`); diff --git a/backend/src/plugins/ModActions/commands/ban/BanMsgCmd.ts b/backend/src/plugins/ModActions/commands/ban/BanMsgCmd.ts index 35b9f737..b218c2e0 100644 --- a/backend/src/plugins/ModActions/commands/ban/BanMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/ban/BanMsgCmd.ts @@ -1,9 +1,9 @@ import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { hasPermission } from "../../../../pluginUtils"; import { UserNotificationMethod, resolveUser } from "../../../../utils"; -import { actualBanCmd } from "./actualBanCmd"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { modActionsMsgCmd } from "../../types"; +import { actualBanCmd } from "./actualBanCmd"; const opts = { mod: ct.member({ option: true }), diff --git a/backend/src/plugins/ModActions/commands/ban/BanSlashCmd.ts b/backend/src/plugins/ModActions/commands/ban/BanSlashCmd.ts index 16bda55b..12ea3f11 100644 --- a/backend/src/plugins/ModActions/commands/ban/BanSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/ban/BanSlashCmd.ts @@ -3,10 +3,10 @@ import { slashOptions } from "knub"; import { hasPermission } from "../../../../pluginUtils"; import { UserNotificationMethod, convertDelayStringToMS, resolveMember } from "../../../../utils"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; -import { actualBanCmd } from "./actualBanCmd"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { modActionsSlashCmd } from "../../types"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; +import { actualBanCmd } from "./actualBanCmd"; const opts = [ slashOptions.string({ name: "time", description: "The duration of the ban", required: false }), @@ -51,13 +51,7 @@ export const BanSlashCmd = modActionsSlashCmd({ const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment"); if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { - pluginData.state.common.sendErrorMessage( - interaction, - "Text or attachment required", - undefined, - undefined, - true - ); + pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true); return; } @@ -70,10 +64,7 @@ export const BanSlashCmd = modActionsSlashCmd({ if (options.mod) { if (!canActAsOther) { - pluginData.state.common.sendErrorMessage( - interaction, - "You don't have permission to act as another moderator" - ); + pluginData.state.common.sendErrorMessage(interaction, "You don't have permission to act as another moderator"); return; } diff --git a/backend/src/plugins/ModActions/commands/ban/actualBanCmd.ts b/backend/src/plugins/ModActions/commands/ban/actualBanCmd.ts index 0b442239..95706e6f 100644 --- a/backend/src/plugins/ModActions/commands/ban/actualBanCmd.ts +++ b/backend/src/plugins/ModActions/commands/ban/actualBanCmd.ts @@ -10,11 +10,14 @@ import { banLock } from "../../../../utils/lockNameHelpers"; import { waitForButtonConfirm } from "../../../../utils/waitForInteraction"; import { CasesPlugin } from "../../../Cases/CasesPlugin"; import { LogsPlugin } from "../../../Logs/LogsPlugin"; -import { ModActionsPluginType } from "../../types"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; import { banUserId } from "../../functions/banUserId"; -import { formatReasonWithAttachments, formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; +import { + formatReasonWithAttachments, + formatReasonWithMessageLinkForAttachments, +} from "../../functions/formatReasonForAttachments"; import { isBanned } from "../../functions/isBanned"; +import { ModActionsPluginType } from "../../types"; export async function actualBanCmd( pluginData: GuildPluginData, @@ -74,10 +77,7 @@ export async function actualBanCmd( ); if (!reply) { - pluginData.state.common.sendErrorMessage( - context, - "User already banned, update cancelled by moderator" - ); + pluginData.state.common.sendErrorMessage(context, "User already banned, update cancelled by moderator"); lock.unlock(); return; } @@ -123,9 +123,9 @@ export async function actualBanCmd( } pluginData.state.common.sendSuccessMessage( - context, - `Ban updated to ${time ? "expire in " + humanizeDuration(time) + " from now" : "indefinite"}`, - ); + context, + `Ban updated to ${time ? "expire in " + humanizeDuration(time) + " from now" : "indefinite"}`, + ); lock.unlock(); return; } @@ -138,7 +138,7 @@ export async function actualBanCmd( pluginData.state.common.sendErrorMessage( context, `Cannot ban: target permission level is equal or higher to yours, ${targetLevel} >= ${ourLevel}`, - ); + ); lock.unlock(); return; } diff --git a/backend/src/plugins/ModActions/commands/case/CaseMsgCmd.ts b/backend/src/plugins/ModActions/commands/case/CaseMsgCmd.ts index 6c727e45..c2e8d8b5 100644 --- a/backend/src/plugins/ModActions/commands/case/CaseMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/case/CaseMsgCmd.ts @@ -1,6 +1,6 @@ import { commandTypeHelpers as ct } from "../../../../commandTypes"; -import { actualCaseCmd } from "./actualCaseCmd"; import { modActionsMsgCmd } from "../../types"; +import { actualCaseCmd } from "./actualCaseCmd"; const opts = { show: ct.switchOption({ def: false, shortcut: "sh" }), diff --git a/backend/src/plugins/ModActions/commands/case/CaseSlashCmd.ts b/backend/src/plugins/ModActions/commands/case/CaseSlashCmd.ts index b86bfb01..220a9697 100644 --- a/backend/src/plugins/ModActions/commands/case/CaseSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/case/CaseSlashCmd.ts @@ -1,6 +1,6 @@ import { slashOptions } from "knub"; -import { actualCaseCmd } from "./actualCaseCmd"; import { modActionsSlashCmd } from "../../types"; +import { actualCaseCmd } from "./actualCaseCmd"; const opts = [ slashOptions.boolean({ name: "show", description: "To make the result visible to everyone", required: false }), diff --git a/backend/src/plugins/ModActions/commands/cases/CasesModMsgCmd.ts b/backend/src/plugins/ModActions/commands/cases/CasesModMsgCmd.ts index d5f5f7fe..e55f1661 100644 --- a/backend/src/plugins/ModActions/commands/cases/CasesModMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/cases/CasesModMsgCmd.ts @@ -1,6 +1,6 @@ import { commandTypeHelpers as ct } from "../../../../commandTypes"; -import { actualCasesCmd } from "./actualCasesCmd"; import { modActionsMsgCmd } from "../../types"; +import { actualCasesCmd } from "./actualCasesCmd"; const opts = { mod: ct.userId({ option: true }), diff --git a/backend/src/plugins/ModActions/commands/cases/CasesSlashCmd.ts b/backend/src/plugins/ModActions/commands/cases/CasesSlashCmd.ts index fe932311..accb2050 100644 --- a/backend/src/plugins/ModActions/commands/cases/CasesSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/cases/CasesSlashCmd.ts @@ -1,7 +1,7 @@ import { GuildMember } from "discord.js"; import { slashOptions } from "knub"; -import { actualCasesCmd } from "./actualCasesCmd"; import { modActionsSlashCmd } from "../../types"; +import { actualCasesCmd } from "./actualCasesCmd"; const opts = [ slashOptions.user({ name: "user", description: "The user to show cases for", required: false }), diff --git a/backend/src/plugins/ModActions/commands/cases/CasesUserMsgCmd.ts b/backend/src/plugins/ModActions/commands/cases/CasesUserMsgCmd.ts index b36b39c7..7d425f2c 100644 --- a/backend/src/plugins/ModActions/commands/cases/CasesUserMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/cases/CasesUserMsgCmd.ts @@ -1,7 +1,7 @@ import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { resolveMember, resolveUser, UnknownUser } from "../../../../utils"; -import { actualCasesCmd } from "./actualCasesCmd"; import { modActionsMsgCmd } from "../../types"; +import { actualCasesCmd } from "./actualCasesCmd"; const opts = { mod: ct.userId({ option: true }), diff --git a/backend/src/plugins/ModActions/commands/cases/actualCasesCmd.ts b/backend/src/plugins/ModActions/commands/cases/actualCasesCmd.ts index 5973bcdb..3e72303d 100644 --- a/backend/src/plugins/ModActions/commands/cases/actualCasesCmd.ts +++ b/backend/src/plugins/ModActions/commands/cases/actualCasesCmd.ts @@ -159,13 +159,7 @@ async function casesModCmd( const totalCases = await casesPlugin.getTotalCasesByMod(modId ?? author.id, casesFilters); if (totalCases === 0) { - pluginData.state.common.sendErrorMessage( - context, - `No cases by **${modName}**`, - undefined, - undefined, - !show - ); + pluginData.state.common.sendErrorMessage(context, `No cases by **${modName}**`, undefined, undefined, !show); return; } diff --git a/backend/src/plugins/ModActions/commands/deletecase/DeleteCaseMsgCmd.ts b/backend/src/plugins/ModActions/commands/deletecase/DeleteCaseMsgCmd.ts index dad54847..396bd73f 100644 --- a/backend/src/plugins/ModActions/commands/deletecase/DeleteCaseMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/deletecase/DeleteCaseMsgCmd.ts @@ -1,7 +1,7 @@ import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { trimLines } from "../../../../utils"; -import { actualDeleteCaseCmd } from "./actualDeleteCaseCmd"; import { modActionsMsgCmd } from "../../types"; +import { actualDeleteCaseCmd } from "./actualDeleteCaseCmd"; export const DeleteCaseMsgCmd = modActionsMsgCmd({ trigger: ["delete_case", "deletecase"], diff --git a/backend/src/plugins/ModActions/commands/deletecase/DeleteCaseSlashCmd.ts b/backend/src/plugins/ModActions/commands/deletecase/DeleteCaseSlashCmd.ts index c9038c74..932f4cad 100644 --- a/backend/src/plugins/ModActions/commands/deletecase/DeleteCaseSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/deletecase/DeleteCaseSlashCmd.ts @@ -1,7 +1,7 @@ import { GuildMember } from "discord.js"; import { slashOptions } from "knub"; -import { actualDeleteCaseCmd } from "./actualDeleteCaseCmd"; import { modActionsSlashCmd } from "../../types"; +import { actualDeleteCaseCmd } from "./actualDeleteCaseCmd"; const opts = [slashOptions.boolean({ name: "force", description: "Whether or not to force delete", required: false })]; diff --git a/backend/src/plugins/ModActions/commands/deletecase/actualDeleteCaseCmd.ts b/backend/src/plugins/ModActions/commands/deletecase/actualDeleteCaseCmd.ts index 707332e4..64c146ee 100644 --- a/backend/src/plugins/ModActions/commands/deletecase/actualDeleteCaseCmd.ts +++ b/backend/src/plugins/ModActions/commands/deletecase/actualDeleteCaseCmd.ts @@ -82,15 +82,12 @@ export async function actualDeleteCaseCmd( : ""; const amt = validCases.length - cancelled; if (amt === 0) { - pluginData.state.common.sendErrorMessage( - context, - "All deletions were cancelled, no cases were deleted." - ); + pluginData.state.common.sendErrorMessage(context, "All deletions were cancelled, no cases were deleted."); return; } pluginData.state.common.sendSuccessMessage( context, - `${amt} case${amt === 1 ? " was" : "s were"} deleted!${failedAddendum}` + `${amt} case${amt === 1 ? " was" : "s were"} deleted!${failedAddendum}`, ); } diff --git a/backend/src/plugins/ModActions/commands/forceban/ForceBanMsgCmd.ts b/backend/src/plugins/ModActions/commands/forceban/ForceBanMsgCmd.ts index 5224e905..3546ee14 100644 --- a/backend/src/plugins/ModActions/commands/forceban/ForceBanMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/forceban/ForceBanMsgCmd.ts @@ -1,9 +1,9 @@ import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { canActOn, hasPermission } from "../../../../pluginUtils"; import { resolveMember, resolveUser } from "../../../../utils"; -import { actualForceBanCmd } from "./actualForceBanCmd"; import { isBanned } from "../../functions/isBanned"; import { modActionsMsgCmd } from "../../types"; +import { actualForceBanCmd } from "./actualForceBanCmd"; const opts = { mod: ct.member({ option: true }), diff --git a/backend/src/plugins/ModActions/commands/forceban/ForceBanSlashCmd.ts b/backend/src/plugins/ModActions/commands/forceban/ForceBanSlashCmd.ts index 8389233b..14e27561 100644 --- a/backend/src/plugins/ModActions/commands/forceban/ForceBanSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/forceban/ForceBanSlashCmd.ts @@ -3,9 +3,9 @@ import { slashOptions } from "knub"; import { hasPermission } from "../../../../pluginUtils"; import { convertDelayStringToMS, resolveMember } from "../../../../utils"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; -import { actualForceBanCmd } from "./actualForceBanCmd"; import { modActionsSlashCmd } from "../../types"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; +import { actualForceBanCmd } from "./actualForceBanCmd"; const opts = [ slashOptions.string({ name: "reason", description: "The reason", required: false }), @@ -29,13 +29,7 @@ export const ForceBanSlashCmd = modActionsSlashCmd({ const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment"); if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { - pluginData.state.common.sendErrorMessage( - interaction, - "Text or attachment required", - undefined, - undefined, - true - ); + pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true); return; } @@ -48,10 +42,7 @@ export const ForceBanSlashCmd = modActionsSlashCmd({ if (options.mod) { if (!canActAsOther) { - pluginData.state.common.sendErrorMessage( - interaction, - "You don't have permission to act as another moderator" - ); + pluginData.state.common.sendErrorMessage(interaction, "You don't have permission to act as another moderator"); return; } diff --git a/backend/src/plugins/ModActions/commands/forceban/actualForceBanCmd.ts b/backend/src/plugins/ModActions/commands/forceban/actualForceBanCmd.ts index 448f4134..6b84901c 100644 --- a/backend/src/plugins/ModActions/commands/forceban/actualForceBanCmd.ts +++ b/backend/src/plugins/ModActions/commands/forceban/actualForceBanCmd.ts @@ -5,10 +5,13 @@ import { LogType } from "../../../../data/LogType"; import { DAYS, MINUTES, UnknownUser } from "../../../../utils"; import { CasesPlugin } from "../../../Cases/CasesPlugin"; import { LogsPlugin } from "../../../Logs/LogsPlugin"; -import { IgnoredEventType, ModActionsPluginType } from "../../types"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; -import { formatReasonWithAttachments, formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; +import { + formatReasonWithAttachments, + formatReasonWithMessageLinkForAttachments, +} from "../../functions/formatReasonForAttachments"; import { ignoreEvent } from "../../functions/ignoreEvent"; +import { IgnoredEventType, ModActionsPluginType } from "../../types"; export async function actualForceBanCmd( pluginData: GuildPluginData, diff --git a/backend/src/plugins/ModActions/commands/forcemute/ForceMuteMsgCmd.ts b/backend/src/plugins/ModActions/commands/forcemute/ForceMuteMsgCmd.ts index 833fb181..384b34e8 100644 --- a/backend/src/plugins/ModActions/commands/forcemute/ForceMuteMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/forcemute/ForceMuteMsgCmd.ts @@ -1,9 +1,9 @@ import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { canActOn, hasPermission } from "../../../../pluginUtils"; import { resolveMember, resolveUser } from "../../../../utils"; -import { actualMuteCmd } from "../mute/actualMuteCmd"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { modActionsMsgCmd } from "../../types"; +import { actualMuteCmd } from "../mute/actualMuteCmd"; const opts = { mod: ct.member({ option: true }), diff --git a/backend/src/plugins/ModActions/commands/forcemute/ForceMuteSlashCmd.ts b/backend/src/plugins/ModActions/commands/forcemute/ForceMuteSlashCmd.ts index ba262835..05505bab 100644 --- a/backend/src/plugins/ModActions/commands/forcemute/ForceMuteSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/forcemute/ForceMuteSlashCmd.ts @@ -3,10 +3,10 @@ import { slashOptions } from "knub"; import { hasPermission } from "../../../../pluginUtils"; import { UserNotificationMethod, convertDelayStringToMS, resolveMember } from "../../../../utils"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; -import { actualMuteCmd } from "../mute/actualMuteCmd"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { modActionsSlashCmd } from "../../types"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; +import { actualMuteCmd } from "../mute/actualMuteCmd"; const opts = [ slashOptions.string({ name: "time", description: "The duration of the mute", required: false }), @@ -46,13 +46,7 @@ export const ForceMuteSlashCmd = modActionsSlashCmd({ const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment"); if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { - pluginData.state.common.sendErrorMessage( - interaction, - "Text or attachment required", - undefined, - undefined, - true - ); + pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true); return; } @@ -66,10 +60,7 @@ export const ForceMuteSlashCmd = modActionsSlashCmd({ if (options.mod) { if (!canActAsOther) { - pluginData.state.common.sendErrorMessage( - interaction, - "You don't have permission to act as another moderator" - ); + pluginData.state.common.sendErrorMessage(interaction, "You don't have permission to act as another moderator"); return; } diff --git a/backend/src/plugins/ModActions/commands/forceunmute/ForceUnmuteMsgCmd.ts b/backend/src/plugins/ModActions/commands/forceunmute/ForceUnmuteMsgCmd.ts index 396052fd..439bc877 100644 --- a/backend/src/plugins/ModActions/commands/forceunmute/ForceUnmuteMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/forceunmute/ForceUnmuteMsgCmd.ts @@ -1,8 +1,8 @@ import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { canActOn, hasPermission } from "../../../../pluginUtils"; import { resolveMember, resolveUser } from "../../../../utils"; -import { actualUnmuteCmd } from "../unmute/actualUnmuteCmd"; import { modActionsMsgCmd } from "../../types"; +import { actualUnmuteCmd } from "../unmute/actualUnmuteCmd"; const opts = { mod: ct.member({ option: true }), diff --git a/backend/src/plugins/ModActions/commands/forceunmute/ForceUnmuteSlashCmd.ts b/backend/src/plugins/ModActions/commands/forceunmute/ForceUnmuteSlashCmd.ts index bb03ee89..1ddd4962 100644 --- a/backend/src/plugins/ModActions/commands/forceunmute/ForceUnmuteSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/forceunmute/ForceUnmuteSlashCmd.ts @@ -3,9 +3,9 @@ import { slashOptions } from "knub"; import { hasPermission } from "../../../../pluginUtils"; import { convertDelayStringToMS, resolveMember } from "../../../../utils"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; -import { actualUnmuteCmd } from "../unmute/actualUnmuteCmd"; import { modActionsSlashCmd } from "../../types"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; +import { actualUnmuteCmd } from "../unmute/actualUnmuteCmd"; const opts = [ slashOptions.string({ name: "time", description: "The duration of the unmute", required: false }), @@ -30,13 +30,7 @@ export const ForceUnmuteSlashCmd = modActionsSlashCmd({ const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment"); if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { - pluginData.state.common.sendErrorMessage( - interaction, - "Text or attachment required", - undefined, - undefined, - true - ); + pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true); return; } @@ -50,10 +44,7 @@ export const ForceUnmuteSlashCmd = modActionsSlashCmd({ if (options.mod) { if (!canActAsOther) { - pluginData.state.common.sendErrorMessage( - interaction, - "You don't have permission to act as another moderator" - ); + pluginData.state.common.sendErrorMessage(interaction, "You don't have permission to act as another moderator"); return; } diff --git a/backend/src/plugins/ModActions/commands/hidecase/HideCaseMsgCmd.ts b/backend/src/plugins/ModActions/commands/hidecase/HideCaseMsgCmd.ts index c04bf9a1..8b427275 100644 --- a/backend/src/plugins/ModActions/commands/hidecase/HideCaseMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/hidecase/HideCaseMsgCmd.ts @@ -1,6 +1,6 @@ import { commandTypeHelpers as ct } from "../../../../commandTypes"; -import { actualHideCaseCmd } from "./actualHideCaseCmd"; import { modActionsMsgCmd } from "../../types"; +import { actualHideCaseCmd } from "./actualHideCaseCmd"; export const HideCaseMsgCmd = modActionsMsgCmd({ trigger: ["hide", "hidecase", "hide_case"], diff --git a/backend/src/plugins/ModActions/commands/hidecase/HideCaseSlashCmd.ts b/backend/src/plugins/ModActions/commands/hidecase/HideCaseSlashCmd.ts index b6261d73..0485c5de 100644 --- a/backend/src/plugins/ModActions/commands/hidecase/HideCaseSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/hidecase/HideCaseSlashCmd.ts @@ -1,6 +1,6 @@ import { slashOptions } from "knub"; -import { actualHideCaseCmd } from "./actualHideCaseCmd"; import { modActionsSlashCmd } from "../../types"; +import { actualHideCaseCmd } from "./actualHideCaseCmd"; export const HideCaseSlashCmd = modActionsSlashCmd({ name: "hidecase", diff --git a/backend/src/plugins/ModActions/commands/hidecase/actualHideCaseCmd.ts b/backend/src/plugins/ModActions/commands/hidecase/actualHideCaseCmd.ts index 49bee81b..d38e099c 100644 --- a/backend/src/plugins/ModActions/commands/hidecase/actualHideCaseCmd.ts +++ b/backend/src/plugins/ModActions/commands/hidecase/actualHideCaseCmd.ts @@ -30,7 +30,7 @@ export async function actualHideCaseCmd( const amt = caseNumbers.length - failed.length; pluginData.state.common.sendSuccessMessage( - context, - `${amt} case${amt === 1 ? " is" : "s are"} now hidden! Use \`unhidecase\` to unhide them.${failedAddendum}`, - ); + context, + `${amt} case${amt === 1 ? " is" : "s are"} now hidden! Use \`unhidecase\` to unhide them.${failedAddendum}`, + ); } diff --git a/backend/src/plugins/ModActions/commands/kick/KickMsgCmd.ts b/backend/src/plugins/ModActions/commands/kick/KickMsgCmd.ts index c494a7c7..d895bba4 100644 --- a/backend/src/plugins/ModActions/commands/kick/KickMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/kick/KickMsgCmd.ts @@ -1,9 +1,9 @@ import { hasPermission } from "knub/helpers"; import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { resolveUser } from "../../../../utils"; -import { actualKickCmd } from "./actualKickCmd"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { modActionsMsgCmd } from "../../types"; +import { actualKickCmd } from "./actualKickCmd"; const opts = { mod: ct.member({ option: true }), diff --git a/backend/src/plugins/ModActions/commands/kick/KickSlashCmd.ts b/backend/src/plugins/ModActions/commands/kick/KickSlashCmd.ts index 5bd94f30..4f9bf392 100644 --- a/backend/src/plugins/ModActions/commands/kick/KickSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/kick/KickSlashCmd.ts @@ -3,10 +3,10 @@ import { slashOptions } from "knub"; import { hasPermission } from "../../../../pluginUtils"; import { UserNotificationMethod, resolveMember } from "../../../../utils"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; -import { actualKickCmd } from "./actualKickCmd"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { modActionsSlashCmd } from "../../types"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; +import { actualKickCmd } from "./actualKickCmd"; const opts = [ slashOptions.string({ name: "reason", description: "The reason", required: false }), @@ -50,13 +50,7 @@ export const KickSlashCmd = modActionsSlashCmd({ const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment"); if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { - pluginData.state.common.sendErrorMessage( - interaction, - "Text or attachment required", - undefined, - undefined, - true - ); + pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true); return; } @@ -69,10 +63,7 @@ export const KickSlashCmd = modActionsSlashCmd({ if (options.mod) { if (!canActAsOther) { - pluginData.state.common.sendErrorMessage( - interaction, - "You don't have permission to act as another moderator" - ); + pluginData.state.common.sendErrorMessage(interaction, "You don't have permission to act as another moderator"); return; } diff --git a/backend/src/plugins/ModActions/commands/kick/actualKickCmd.ts b/backend/src/plugins/ModActions/commands/kick/actualKickCmd.ts index 4a6b22a4..3ee204cc 100644 --- a/backend/src/plugins/ModActions/commands/kick/actualKickCmd.ts +++ b/backend/src/plugins/ModActions/commands/kick/actualKickCmd.ts @@ -3,12 +3,15 @@ import { GuildPluginData } from "knub"; import { LogType } from "../../../../data/LogType"; import { canActOn } from "../../../../pluginUtils"; import { DAYS, SECONDS, UnknownUser, UserNotificationMethod, renderUsername, resolveMember } from "../../../../utils"; -import { IgnoredEventType, ModActionsPluginType } from "../../types"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; -import { formatReasonWithAttachments, formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; +import { + formatReasonWithAttachments, + formatReasonWithMessageLinkForAttachments, +} from "../../functions/formatReasonForAttachments"; import { ignoreEvent } from "../../functions/ignoreEvent"; import { isBanned } from "../../functions/isBanned"; import { kickMember } from "../../functions/kickMember"; +import { IgnoredEventType, ModActionsPluginType } from "../../types"; export async function actualKickCmd( pluginData: GuildPluginData, @@ -71,9 +74,7 @@ export async function actualKickCmd( try { await pluginData.guild.bans.remove(memberToKick.id, "kick -clean"); } catch { - pluginData.state.common.sendErrorMessage( - context, - "Failed to unban the user after banning them (-clean)"); + pluginData.state.common.sendErrorMessage(context, "Failed to unban the user after banning them (-clean)"); } } diff --git a/backend/src/plugins/ModActions/commands/massban/MassBanMsgCmd.ts b/backend/src/plugins/ModActions/commands/massban/MassBanMsgCmd.ts index d47c61d5..3267bf28 100644 --- a/backend/src/plugins/ModActions/commands/massban/MassBanMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/massban/MassBanMsgCmd.ts @@ -1,8 +1,8 @@ import { waitForReply } from "knub/helpers"; import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { getContextChannel, sendContextResponse } from "../../../../pluginUtils"; -import { actualMassBanCmd } from "./actualMassBanCmd"; import { modActionsMsgCmd } from "../../types"; +import { actualMassBanCmd } from "./actualMassBanCmd"; export const MassBanMsgCmd = modActionsMsgCmd({ trigger: "massban", diff --git a/backend/src/plugins/ModActions/commands/massban/MassBanSlashCmd.ts b/backend/src/plugins/ModActions/commands/massban/MassBanSlashCmd.ts index a358893e..805a3d63 100644 --- a/backend/src/plugins/ModActions/commands/massban/MassBanSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/massban/MassBanSlashCmd.ts @@ -1,9 +1,9 @@ import { GuildMember } from "discord.js"; import { slashOptions } from "knub"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; -import { actualMassBanCmd } from "./actualMassBanCmd"; import { modActionsSlashCmd } from "../../types"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; +import { actualMassBanCmd } from "./actualMassBanCmd"; const opts = [ slashOptions.string({ name: "reason", description: "The reason", required: false }), @@ -30,13 +30,7 @@ export const MassBanSlashCmd = modActionsSlashCmd({ const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment"); if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { - pluginData.state.common.sendErrorMessage( - interaction, - "Text or attachment required", - undefined, - undefined, - true - ); + pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true); return; } diff --git a/backend/src/plugins/ModActions/commands/massban/actualMassBanCmd.ts b/backend/src/plugins/ModActions/commands/massban/actualMassBanCmd.ts index 207194df..27706105 100644 --- a/backend/src/plugins/ModActions/commands/massban/actualMassBanCmd.ts +++ b/backend/src/plugins/ModActions/commands/massban/actualMassBanCmd.ts @@ -7,10 +7,13 @@ import { canActOn, getContextChannel, isContextInteraction, sendContextResponse import { DAYS, MINUTES, SECONDS, noop } from "../../../../utils"; import { CasesPlugin } from "../../../Cases/CasesPlugin"; import { LogsPlugin } from "../../../Logs/LogsPlugin"; -import { IgnoredEventType, ModActionsPluginType } from "../../types"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; -import { formatReasonWithAttachments, formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; +import { + formatReasonWithAttachments, + formatReasonWithMessageLinkForAttachments, +} from "../../functions/formatReasonForAttachments"; import { ignoreEvent } from "../../functions/ignoreEvent"; +import { IgnoredEventType, ModActionsPluginType } from "../../types"; export async function actualMassBanCmd( pluginData: GuildPluginData, @@ -37,9 +40,7 @@ export async function actualMassBanCmd( for (const userId of userIds) { const member = pluginData.guild.members.cache.get(userId as Snowflake); // TODO: Get members on demand? if (member && !canActOn(pluginData, author, member)) { - pluginData.state.common.sendErrorMessage( - context, - "Cannot massban one or more users: insufficient permissions"); + pluginData.state.common.sendErrorMessage(context, "Cannot massban one or more users: insufficient permissions"); return; } } @@ -157,14 +158,14 @@ export async function actualMassBanCmd( if (failedBans.length) { pluginData.state.common.sendSuccessMessage( context, - `Banned ${successfulBanCount} users in ${formattedTimeTaken}, ${ - failedBans.length - } failed: ${failedBans.join(" ")}`, + `Banned ${successfulBanCount} users in ${formattedTimeTaken}, ${failedBans.length} failed: ${failedBans.join( + " ", + )}`, ); } else { pluginData.state.common.sendSuccessMessage( context, - `Banned ${successfulBanCount} users successfully in ${formattedTimeTaken}` + `Banned ${successfulBanCount} users successfully in ${formattedTimeTaken}`, ); } } diff --git a/backend/src/plugins/ModActions/commands/massmute/MassMuteMsgCmd.ts b/backend/src/plugins/ModActions/commands/massmute/MassMuteMsgCmd.ts index bbcfd715..0ff53ab1 100644 --- a/backend/src/plugins/ModActions/commands/massmute/MassMuteMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/massmute/MassMuteMsgCmd.ts @@ -1,8 +1,8 @@ import { waitForReply } from "knub/helpers"; import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { getContextChannel, sendContextResponse } from "../../../../pluginUtils"; -import { actualMassMuteCmd } from "./actualMassMuteCmd"; import { modActionsMsgCmd } from "../../types"; +import { actualMassMuteCmd } from "./actualMassMuteCmd"; export const MassMuteMsgCmd = modActionsMsgCmd({ trigger: "massmute", diff --git a/backend/src/plugins/ModActions/commands/massmute/MassMuteSlashCmd.ts b/backend/src/plugins/ModActions/commands/massmute/MassMuteSlashCmd.ts index d7ad927a..cb02ceee 100644 --- a/backend/src/plugins/ModActions/commands/massmute/MassMuteSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/massmute/MassMuteSlashCmd.ts @@ -1,9 +1,9 @@ import { GuildMember } from "discord.js"; import { slashOptions } from "knub"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; -import { actualMassMuteCmd } from "./actualMassMuteCmd"; import { modActionsSlashCmd } from "../../types"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; +import { actualMassMuteCmd } from "./actualMassMuteCmd"; const opts = [ slashOptions.string({ name: "reason", description: "The reason", required: false }), @@ -30,13 +30,7 @@ export const MassMuteSlashSlashCmd = modActionsSlashCmd({ const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment"); if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { - pluginData.state.common.sendErrorMessage( - interaction, - "Text or attachment required", - undefined, - undefined, - true - ); + pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true); return; } diff --git a/backend/src/plugins/ModActions/commands/massmute/actualMassMuteCmd.ts b/backend/src/plugins/ModActions/commands/massmute/actualMassMuteCmd.ts index e8ed7111..e7615044 100644 --- a/backend/src/plugins/ModActions/commands/massmute/actualMassMuteCmd.ts +++ b/backend/src/plugins/ModActions/commands/massmute/actualMassMuteCmd.ts @@ -5,9 +5,12 @@ import { logger } from "../../../../logger"; import { canActOn, isContextInteraction, sendContextResponse } from "../../../../pluginUtils"; import { LogsPlugin } from "../../../Logs/LogsPlugin"; import { MutesPlugin } from "../../../Mutes/MutesPlugin"; -import { ModActionsPluginType } from "../../types"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; -import { formatReasonWithAttachments, formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; +import { + formatReasonWithAttachments, + formatReasonWithMessageLinkForAttachments, +} from "../../functions/formatReasonForAttachments"; +import { ModActionsPluginType } from "../../types"; export async function actualMassMuteCmd( pluginData: GuildPluginData, @@ -34,10 +37,7 @@ export async function actualMassMuteCmd( for (const userId of userIds) { const member = pluginData.guild.members.cache.get(userId as Snowflake); if (member && !canActOn(pluginData, author, member)) { - pluginData.state.common.sendErrorMessage( - context, - "Cannot massmute one or more users: insufficient permissions" - ); + pluginData.state.common.sendErrorMessage(context, "Cannot massmute one or more users: insufficient permissions"); return; } } @@ -87,9 +87,9 @@ export async function actualMassMuteCmd( if (failedMutes.length) { pluginData.state.common.sendSuccessMessage( - context, - `Muted ${successfulMuteCount} users, ${failedMutes.length} failed: ${failedMutes.join(" ")}`, - ); + context, + `Muted ${successfulMuteCount} users, ${failedMutes.length} failed: ${failedMutes.join(" ")}`, + ); } else { pluginData.state.common.sendSuccessMessage(context, `Muted ${successfulMuteCount} users successfully`); } diff --git a/backend/src/plugins/ModActions/commands/massunban/MassUnbanMsgCmd.ts b/backend/src/plugins/ModActions/commands/massunban/MassUnbanMsgCmd.ts index c10df41f..2d2dd306 100644 --- a/backend/src/plugins/ModActions/commands/massunban/MassUnbanMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/massunban/MassUnbanMsgCmd.ts @@ -1,8 +1,8 @@ import { waitForReply } from "knub/helpers"; import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { getContextChannel, sendContextResponse } from "../../../../pluginUtils"; -import { actualMassUnbanCmd } from "./actualMassUnbanCmd"; import { modActionsMsgCmd } from "../../types"; +import { actualMassUnbanCmd } from "./actualMassUnbanCmd"; export const MassUnbanMsgCmd = modActionsMsgCmd({ trigger: "massunban", diff --git a/backend/src/plugins/ModActions/commands/massunban/MassUnbanSlashCmd.ts b/backend/src/plugins/ModActions/commands/massunban/MassUnbanSlashCmd.ts index 4a733552..acf6a975 100644 --- a/backend/src/plugins/ModActions/commands/massunban/MassUnbanSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/massunban/MassUnbanSlashCmd.ts @@ -1,9 +1,9 @@ import { GuildMember } from "discord.js"; import { slashOptions } from "knub"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; -import { actualMassUnbanCmd } from "./actualMassUnbanCmd"; import { modActionsSlashCmd } from "../../types"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; +import { actualMassUnbanCmd } from "./actualMassUnbanCmd"; const opts = [ slashOptions.string({ name: "reason", description: "The reason", required: false }), @@ -30,13 +30,7 @@ export const MassUnbanSlashCmd = modActionsSlashCmd({ const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment"); if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { - pluginData.state.common.sendErrorMessage( - interaction, - "Text or attachment required", - undefined, - undefined, - true - ); + pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true); return; } diff --git a/backend/src/plugins/ModActions/commands/massunban/actualMassUnbanCmd.ts b/backend/src/plugins/ModActions/commands/massunban/actualMassUnbanCmd.ts index 6f4a0ebf..e67e7066 100644 --- a/backend/src/plugins/ModActions/commands/massunban/actualMassUnbanCmd.ts +++ b/backend/src/plugins/ModActions/commands/massunban/actualMassUnbanCmd.ts @@ -6,11 +6,11 @@ import { isContextInteraction, sendContextResponse } from "../../../../pluginUti import { MINUTES, noop } from "../../../../utils"; import { CasesPlugin } from "../../../Cases/CasesPlugin"; import { LogsPlugin } from "../../../Logs/LogsPlugin"; -import { IgnoredEventType, ModActionsPluginType } from "../../types"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; import { formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; import { ignoreEvent } from "../../functions/ignoreEvent"; import { isBanned } from "../../functions/isBanned"; +import { IgnoredEventType, ModActionsPluginType } from "../../types"; export async function actualMassUnbanCmd( pluginData: GuildPluginData, @@ -75,10 +75,7 @@ export async function actualMassUnbanCmd( const successfulUnbanCount = userIds.length - failedUnbans.length; if (successfulUnbanCount === 0) { // All unbans failed - don't create a log entry and notify the user - pluginData.state.common.sendErrorMessage( - context, - "All unbans failed. Make sure the IDs are valid and banned." - ); + pluginData.state.common.sendErrorMessage(context, "All unbans failed. Make sure the IDs are valid and banned."); } else { // Some or all unbans were successful. Create a log entry for the mass unban and notify the user. pluginData.getPlugin(LogsPlugin).logMassUnban({ @@ -106,9 +103,9 @@ export async function actualMassUnbanCmd( } pluginData.state.common.sendSuccessMessage( - context, - `Unbanned ${successfulUnbanCount} users, ${failedUnbans.length} failed:\n${failedMsg}`, - ); + context, + `Unbanned ${successfulUnbanCount} users, ${failedUnbans.length} failed:\n${failedMsg}`, + ); } else { pluginData.state.common.sendSuccessMessage(context, `Unbanned ${successfulUnbanCount} users successfully`); } diff --git a/backend/src/plugins/ModActions/commands/mute/MuteMsgCmd.ts b/backend/src/plugins/ModActions/commands/mute/MuteMsgCmd.ts index d6aeb284..0135b3e3 100644 --- a/backend/src/plugins/ModActions/commands/mute/MuteMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/mute/MuteMsgCmd.ts @@ -2,10 +2,10 @@ import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { canActOn, hasPermission } from "../../../../pluginUtils"; import { resolveMember, resolveUser } from "../../../../utils"; import { waitForButtonConfirm } from "../../../../utils/waitForInteraction"; -import { actualMuteCmd } from "./actualMuteCmd"; import { isBanned } from "../../functions/isBanned"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { modActionsMsgCmd } from "../../types"; +import { actualMuteCmd } from "./actualMuteCmd"; const opts = { mod: ct.member({ option: true }), @@ -49,7 +49,7 @@ export const MuteMsgCmd = modActionsMsgCmd({ if (_isBanned) { pluginData.state.common.sendErrorMessage( msg, - `User is banned. Use \`${prefix}forcemute\` if you want to mute them anyway.` + `User is banned. Use \`${prefix}forcemute\` if you want to mute them anyway.`, ); return; } else { diff --git a/backend/src/plugins/ModActions/commands/mute/MuteSlashCmd.ts b/backend/src/plugins/ModActions/commands/mute/MuteSlashCmd.ts index b662b33d..d791b9d8 100644 --- a/backend/src/plugins/ModActions/commands/mute/MuteSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/mute/MuteSlashCmd.ts @@ -4,11 +4,11 @@ import { canActOn, hasPermission } from "../../../../pluginUtils"; import { UserNotificationMethod, convertDelayStringToMS, resolveMember } from "../../../../utils"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; import { waitForButtonConfirm } from "../../../../utils/waitForInteraction"; -import { actualMuteCmd } from "./actualMuteCmd"; import { isBanned } from "../../functions/isBanned"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { modActionsSlashCmd } from "../../types"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; +import { actualMuteCmd } from "./actualMuteCmd"; const opts = [ slashOptions.string({ name: "time", description: "The duration of the mute", required: false }), @@ -54,7 +54,7 @@ export const MuteSlashCmd = modActionsSlashCmd({ if (_isBanned) { pluginData.state.common.sendErrorMessage( interaction, - `User is banned. Use \`${prefix}forcemute\` if you want to mute them anyway.` + `User is banned. Use \`${prefix}forcemute\` if you want to mute them anyway.`, ); return; } else { @@ -66,10 +66,7 @@ export const MuteSlashCmd = modActionsSlashCmd({ ); if (!reply) { - pluginData.state.common.sendErrorMessage( - interaction, - "User not on server, mute cancelled by moderator" - ); + pluginData.state.common.sendErrorMessage(interaction, "User not on server, mute cancelled by moderator"); return; } } @@ -90,10 +87,7 @@ export const MuteSlashCmd = modActionsSlashCmd({ if (options.mod) { if (!canActAsOther) { - pluginData.state.common.sendErrorMessage( - interaction, - "You don't have permission to act as another moderator" - ); + pluginData.state.common.sendErrorMessage(interaction, "You don't have permission to act as another moderator"); return; } diff --git a/backend/src/plugins/ModActions/commands/mute/actualMuteCmd.ts b/backend/src/plugins/ModActions/commands/mute/actualMuteCmd.ts index 6500d072..0a938d06 100644 --- a/backend/src/plugins/ModActions/commands/mute/actualMuteCmd.ts +++ b/backend/src/plugins/ModActions/commands/mute/actualMuteCmd.ts @@ -12,9 +12,12 @@ import { } from "../../../../utils"; import { MutesPlugin } from "../../../Mutes/MutesPlugin"; import { MuteResult } from "../../../Mutes/types"; -import { ModActionsPluginType } from "../../types"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; -import { formatReasonWithAttachments, formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; +import { + formatReasonWithAttachments, + formatReasonWithMessageLinkForAttachments, +} from "../../functions/formatReasonForAttachments"; +import { ModActionsPluginType } from "../../types"; /** * The actual function run by both !mute and !forcemute. @@ -56,10 +59,7 @@ export async function actualMuteCmd( }); } catch (e) { if (e instanceof RecoverablePluginError && e.code === ERRORS.NO_MUTE_ROLE_IN_CONFIG) { - pluginData.state.common.sendErrorMessage( - context, - "Could not mute the user: no mute role set in config" - ); + pluginData.state.common.sendErrorMessage(context, "Could not mute the user: no mute role set in config"); } else if (isDiscordAPIError(e) && e.code === 10007) { pluginData.state.common.sendErrorMessage(context, "Could not mute the user: unknown member"); } else { diff --git a/backend/src/plugins/ModActions/commands/note/NoteMsgCmd.ts b/backend/src/plugins/ModActions/commands/note/NoteMsgCmd.ts index 2cccbd6d..4ef15c2e 100644 --- a/backend/src/plugins/ModActions/commands/note/NoteMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/note/NoteMsgCmd.ts @@ -1,7 +1,7 @@ import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { resolveUser } from "../../../../utils"; -import { actualNoteCmd } from "./actualNoteCmd"; import { modActionsMsgCmd } from "../../types"; +import { actualNoteCmd } from "./actualNoteCmd"; export const NoteMsgCmd = modActionsMsgCmd({ trigger: "note", diff --git a/backend/src/plugins/ModActions/commands/note/NoteSlashCmd.ts b/backend/src/plugins/ModActions/commands/note/NoteSlashCmd.ts index c13bbb60..e9069cc8 100644 --- a/backend/src/plugins/ModActions/commands/note/NoteSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/note/NoteSlashCmd.ts @@ -1,8 +1,8 @@ import { slashOptions } from "knub"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; -import { actualNoteCmd } from "./actualNoteCmd"; import { modActionsSlashCmd } from "../../types"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; +import { actualNoteCmd } from "./actualNoteCmd"; const opts = [ slashOptions.string({ name: "note", description: "The note to add to the user", required: false }), @@ -25,13 +25,7 @@ export const NoteSlashCmd = modActionsSlashCmd({ const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment"); if ((!options.note || options.note.trim() === "") && attachments.length < 1) { - pluginData.state.common.sendErrorMessage( - interaction, - "Text or attachment required", - undefined, - undefined, - true - ); + pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true); return; } diff --git a/backend/src/plugins/ModActions/commands/note/actualNoteCmd.ts b/backend/src/plugins/ModActions/commands/note/actualNoteCmd.ts index 5c70cb04..b34f8821 100644 --- a/backend/src/plugins/ModActions/commands/note/actualNoteCmd.ts +++ b/backend/src/plugins/ModActions/commands/note/actualNoteCmd.ts @@ -4,9 +4,9 @@ import { CaseTypes } from "../../../../data/CaseTypes"; import { UnknownUser, renderUsername } from "../../../../utils"; import { CasesPlugin } from "../../../Cases/CasesPlugin"; import { LogsPlugin } from "../../../Logs/LogsPlugin"; -import { ModActionsPluginType } from "../../types"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; import { formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; +import { ModActionsPluginType } from "../../types"; export async function actualNoteCmd( pluginData: GuildPluginData, @@ -39,12 +39,12 @@ export async function actualNoteCmd( }); pluginData.state.common.sendSuccessMessage( - context, - `Note added on **${userName}** (Case #${createdCase.case_number})`, - undefined, - undefined, - true, - ); + context, + `Note added on **${userName}** (Case #${createdCase.case_number})`, + undefined, + undefined, + true, + ); pluginData.state.events.emit("note", user.id, reason); } diff --git a/backend/src/plugins/ModActions/commands/unban/UnbanMsgCmd.ts b/backend/src/plugins/ModActions/commands/unban/UnbanMsgCmd.ts index ec346acc..8720fadc 100644 --- a/backend/src/plugins/ModActions/commands/unban/UnbanMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/unban/UnbanMsgCmd.ts @@ -1,8 +1,8 @@ import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { hasPermission } from "../../../../pluginUtils"; import { resolveUser } from "../../../../utils"; -import { actualUnbanCmd } from "./actualUnbanCmd"; import { modActionsMsgCmd } from "../../types"; +import { actualUnbanCmd } from "./actualUnbanCmd"; const opts = { mod: ct.member({ option: true }), diff --git a/backend/src/plugins/ModActions/commands/unban/UnbanSlashCmd.ts b/backend/src/plugins/ModActions/commands/unban/UnbanSlashCmd.ts index a5b0124b..8c4ef63a 100644 --- a/backend/src/plugins/ModActions/commands/unban/UnbanSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/unban/UnbanSlashCmd.ts @@ -3,9 +3,9 @@ import { slashOptions } from "knub"; import { hasPermission } from "../../../../pluginUtils"; import { resolveMember } from "../../../../utils"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; -import { actualUnbanCmd } from "./actualUnbanCmd"; import { modActionsSlashCmd } from "../../types"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; +import { actualUnbanCmd } from "./actualUnbanCmd"; const opts = [ slashOptions.string({ name: "reason", description: "The reason", required: false }), @@ -29,13 +29,7 @@ export const UnbanSlashCmd = modActionsSlashCmd({ const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment"); if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { - pluginData.state.common.sendErrorMessage( - interaction, - "Text or attachment required", - undefined, - undefined, - true - ); + pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true); return; } @@ -48,10 +42,7 @@ export const UnbanSlashCmd = modActionsSlashCmd({ if (options.mod) { if (!canActAsOther) { - pluginData.state.common.sendErrorMessage( - interaction, - "You don't have permission to act as another moderator" - ); + pluginData.state.common.sendErrorMessage(interaction, "You don't have permission to act as another moderator"); return; } diff --git a/backend/src/plugins/ModActions/commands/unban/actualUnbanCmd.ts b/backend/src/plugins/ModActions/commands/unban/actualUnbanCmd.ts index e49b5b21..5baa31ea 100644 --- a/backend/src/plugins/ModActions/commands/unban/actualUnbanCmd.ts +++ b/backend/src/plugins/ModActions/commands/unban/actualUnbanCmd.ts @@ -6,10 +6,10 @@ import { clearExpiringTempban } from "../../../../data/loops/expiringTempbansLoo import { UnknownUser } from "../../../../utils"; import { CasesPlugin } from "../../../Cases/CasesPlugin"; import { LogsPlugin } from "../../../Logs/LogsPlugin"; -import { IgnoredEventType, ModActionsPluginType } from "../../types"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; import { formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; import { ignoreEvent } from "../../functions/ignoreEvent"; +import { IgnoredEventType, ModActionsPluginType } from "../../types"; export async function actualUnbanCmd( pluginData: GuildPluginData, @@ -31,10 +31,7 @@ export async function actualUnbanCmd( ignoreEvent(pluginData, IgnoredEventType.Unban, user.id); await pluginData.guild.bans.remove(user.id as Snowflake, formattedReason ?? undefined); } catch { - pluginData.state.common.sendErrorMessage( - context, - "Failed to unban member; are you sure they're banned?" - ); + pluginData.state.common.sendErrorMessage(context, "Failed to unban member; are you sure they're banned?"); return; } diff --git a/backend/src/plugins/ModActions/commands/unhidecase/UnhideCaseMsgCmd.ts b/backend/src/plugins/ModActions/commands/unhidecase/UnhideCaseMsgCmd.ts index 308c34f2..fe573ba1 100644 --- a/backend/src/plugins/ModActions/commands/unhidecase/UnhideCaseMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/unhidecase/UnhideCaseMsgCmd.ts @@ -1,6 +1,6 @@ import { commandTypeHelpers as ct } from "../../../../commandTypes"; -import { actualHideCaseCmd } from "../hidecase/actualHideCaseCmd"; import { modActionsMsgCmd } from "../../types"; +import { actualHideCaseCmd } from "../hidecase/actualHideCaseCmd"; export const UnhideCaseMsgCmd = modActionsMsgCmd({ trigger: ["unhide", "unhidecase", "unhide_case"], diff --git a/backend/src/plugins/ModActions/commands/unhidecase/UnhideCaseSlashCmd.ts b/backend/src/plugins/ModActions/commands/unhidecase/UnhideCaseSlashCmd.ts index f4b4b80f..3bf4b61c 100644 --- a/backend/src/plugins/ModActions/commands/unhidecase/UnhideCaseSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/unhidecase/UnhideCaseSlashCmd.ts @@ -1,6 +1,6 @@ import { slashOptions } from "knub"; -import { actualUnhideCaseCmd } from "./actualUnhideCaseCmd"; import { modActionsSlashCmd } from "../../types"; +import { actualUnhideCaseCmd } from "./actualUnhideCaseCmd"; export const UnhideCaseSlashCmd = modActionsSlashCmd({ name: "unhidecase", diff --git a/backend/src/plugins/ModActions/commands/unhidecase/actualUnhideCaseCmd.ts b/backend/src/plugins/ModActions/commands/unhidecase/actualUnhideCaseCmd.ts index f1e8405e..b1af7433 100644 --- a/backend/src/plugins/ModActions/commands/unhidecase/actualUnhideCaseCmd.ts +++ b/backend/src/plugins/ModActions/commands/unhidecase/actualUnhideCaseCmd.ts @@ -32,6 +32,6 @@ export async function actualUnhideCaseCmd( const amt = caseNumbers.length - failed.length; pluginData.state.common.sendSuccessMessage( context, - `${amt} case${amt === 1 ? " is" : "s are"} no longer hidden!${failedAddendum}` + `${amt} case${amt === 1 ? " is" : "s are"} no longer hidden!${failedAddendum}`, ); } diff --git a/backend/src/plugins/ModActions/commands/unmute/UnmuteMsgCmd.ts b/backend/src/plugins/ModActions/commands/unmute/UnmuteMsgCmd.ts index a0654d13..925a90a6 100644 --- a/backend/src/plugins/ModActions/commands/unmute/UnmuteMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/unmute/UnmuteMsgCmd.ts @@ -3,9 +3,9 @@ import { canActOn, hasPermission } from "../../../../pluginUtils"; import { resolveMember, resolveUser } from "../../../../utils"; import { waitForButtonConfirm } from "../../../../utils/waitForInteraction"; import { MutesPlugin } from "../../../Mutes/MutesPlugin"; -import { actualUnmuteCmd } from "./actualUnmuteCmd"; import { isBanned } from "../../functions/isBanned"; import { modActionsMsgCmd } from "../../types"; +import { actualUnmuteCmd } from "./actualUnmuteCmd"; const opts = { mod: ct.member({ option: true }), @@ -59,7 +59,7 @@ export const UnmuteMsgCmd = modActionsMsgCmd({ if (banned) { pluginData.state.common.sendErrorMessage( msg, - `User is banned. Use \`${prefix}forceunmute\` to unmute them anyway.` + `User is banned. Use \`${prefix}forceunmute\` to unmute them anyway.`, ); return; } else { diff --git a/backend/src/plugins/ModActions/commands/unmute/UnmuteSlashCmd.ts b/backend/src/plugins/ModActions/commands/unmute/UnmuteSlashCmd.ts index 609c7451..5420892c 100644 --- a/backend/src/plugins/ModActions/commands/unmute/UnmuteSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/unmute/UnmuteSlashCmd.ts @@ -5,10 +5,10 @@ import { convertDelayStringToMS, resolveMember } from "../../../../utils"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; import { waitForButtonConfirm } from "../../../../utils/waitForInteraction"; import { MutesPlugin } from "../../../Mutes/MutesPlugin"; -import { actualUnmuteCmd } from "./actualUnmuteCmd"; import { isBanned } from "../../functions/isBanned"; import { modActionsSlashCmd } from "../../types"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; +import { actualUnmuteCmd } from "./actualUnmuteCmd"; const opts = [ slashOptions.string({ name: "time", description: "The duration of the unmute", required: false }), @@ -33,13 +33,7 @@ export const UnmuteSlashCmd = modActionsSlashCmd({ const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment"); if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { - pluginData.state.common.sendErrorMessage( - interaction, - "Text or attachment required", - undefined, - undefined, - true - ); + pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true); return; } @@ -64,7 +58,7 @@ export const UnmuteSlashCmd = modActionsSlashCmd({ if (banned) { pluginData.state.common.sendErrorMessage( interaction, - `User is banned. Use \`${prefix}forceunmute\` to unmute them anyway.` + `User is banned. Use \`${prefix}forceunmute\` to unmute them anyway.`, ); return; } else { @@ -76,10 +70,7 @@ export const UnmuteSlashCmd = modActionsSlashCmd({ ); if (!reply) { - pluginData.state.common.sendErrorMessage( - interaction, - "User not on server, unmute cancelled by moderator" - ); + pluginData.state.common.sendErrorMessage(interaction, "User not on server, unmute cancelled by moderator"); return; } } @@ -100,10 +91,7 @@ export const UnmuteSlashCmd = modActionsSlashCmd({ if (options.mod) { if (!canActAsOther) { - pluginData.state.common.sendErrorMessage( - interaction, - "You don't have permission to act as another moderator" - ); + pluginData.state.common.sendErrorMessage(interaction, "You don't have permission to act as another moderator"); return; } diff --git a/backend/src/plugins/ModActions/commands/unmute/actualUnmuteCmd.ts b/backend/src/plugins/ModActions/commands/unmute/actualUnmuteCmd.ts index 3e3be312..da34ed43 100644 --- a/backend/src/plugins/ModActions/commands/unmute/actualUnmuteCmd.ts +++ b/backend/src/plugins/ModActions/commands/unmute/actualUnmuteCmd.ts @@ -3,9 +3,9 @@ import humanizeDuration from "humanize-duration"; import { GuildPluginData } from "knub"; import { UnknownUser, asSingleLine, renderUsername } from "../../../../utils"; import { MutesPlugin } from "../../../Mutes/MutesPlugin"; -import { ModActionsPluginType } from "../../types"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; import { formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; +import { ModActionsPluginType } from "../../types"; export async function actualUnmuteCmd( pluginData: GuildPluginData, diff --git a/backend/src/plugins/ModActions/commands/warn/WarnMsgCmd.ts b/backend/src/plugins/ModActions/commands/warn/WarnMsgCmd.ts index 1d9e331f..99309c22 100644 --- a/backend/src/plugins/ModActions/commands/warn/WarnMsgCmd.ts +++ b/backend/src/plugins/ModActions/commands/warn/WarnMsgCmd.ts @@ -1,10 +1,10 @@ import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { canActOn, hasPermission } from "../../../../pluginUtils"; import { errorMessage, resolveMember, resolveUser } from "../../../../utils"; -import { actualWarnCmd } from "./actualWarnCmd"; import { isBanned } from "../../functions/isBanned"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { modActionsMsgCmd } from "../../types"; +import { actualWarnCmd } from "./actualWarnCmd"; export const WarnMsgCmd = modActionsMsgCmd({ trigger: "warn", diff --git a/backend/src/plugins/ModActions/commands/warn/WarnSlashCmd.ts b/backend/src/plugins/ModActions/commands/warn/WarnSlashCmd.ts index 82f80ba0..af7449f1 100644 --- a/backend/src/plugins/ModActions/commands/warn/WarnSlashCmd.ts +++ b/backend/src/plugins/ModActions/commands/warn/WarnSlashCmd.ts @@ -3,11 +3,11 @@ import { slashOptions } from "knub"; import { canActOn, hasPermission } from "../../../../pluginUtils"; import { UserNotificationMethod, resolveMember } from "../../../../utils"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; -import { actualWarnCmd } from "./actualWarnCmd"; import { isBanned } from "../../functions/isBanned"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { modActionsSlashCmd } from "../../types"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; +import { actualWarnCmd } from "./actualWarnCmd"; const opts = [ slashOptions.string({ name: "reason", description: "The reason", required: false }), @@ -51,7 +51,7 @@ export const WarnSlashCmd = modActionsSlashCmd({ "Text or attachment required", undefined, undefined, - true + true, ); return; @@ -86,7 +86,7 @@ export const WarnSlashCmd = modActionsSlashCmd({ if (!canActAsOther) { await pluginData.state.common.sendErrorMessage( interaction, - "You don't have permission to act as another moderator" + "You don't have permission to act as another moderator", ); return; } diff --git a/backend/src/plugins/ModActions/commands/warn/actualWarnCmd.ts b/backend/src/plugins/ModActions/commands/warn/actualWarnCmd.ts index c764d29d..b505434a 100644 --- a/backend/src/plugins/ModActions/commands/warn/actualWarnCmd.ts +++ b/backend/src/plugins/ModActions/commands/warn/actualWarnCmd.ts @@ -4,10 +4,13 @@ import { CaseTypes } from "../../../../data/CaseTypes"; import { UserNotificationMethod, renderUsername } from "../../../../utils"; import { waitForButtonConfirm } from "../../../../utils/waitForInteraction"; import { CasesPlugin } from "../../../Cases/CasesPlugin"; -import { ModActionsPluginType } from "../../types"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; -import { formatReasonWithAttachments, formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; +import { + formatReasonWithAttachments, + formatReasonWithMessageLinkForAttachments, +} from "../../functions/formatReasonForAttachments"; import { warnMember } from "../../functions/warnMember"; +import { ModActionsPluginType } from "../../types"; export async function actualWarnCmd( pluginData: GuildPluginData, @@ -62,7 +65,7 @@ export async function actualWarnCmd( const messageResultText = warnResult.notifyResult.text ? ` (${warnResult.notifyResult.text})` : ""; await pluginData.state.common.sendSuccessMessage( - context, - `Warned **${renderUsername(memberToWarn.user)}** (Case #${warnResult.case.case_number})${messageResultText}`, - ); + context, + `Warned **${renderUsername(memberToWarn.user)}** (Case #${warnResult.case.case_number})${messageResultText}`, + ); } diff --git a/backend/src/plugins/ModActions/types.ts b/backend/src/plugins/ModActions/types.ts index a3f36c11..14388ea9 100644 --- a/backend/src/plugins/ModActions/types.ts +++ b/backend/src/plugins/ModActions/types.ts @@ -1,11 +1,12 @@ import { ChatInputCommandInteraction, Message } from "discord.js"; import { EventEmitter } from "events"; import { - BasePluginType, pluginUtils, + BasePluginType, guildPluginEventListener, guildPluginMessageCommand, guildPluginSlashCommand, - guildPluginSlashGroup + guildPluginSlashGroup, + pluginUtils, } from "knub"; import z from "zod"; import { Queue } from "../../Queue"; diff --git a/backend/src/plugins/Mutes/MutesPlugin.ts b/backend/src/plugins/Mutes/MutesPlugin.ts index c1a8c84b..eeae16df 100644 --- a/backend/src/plugins/Mutes/MutesPlugin.ts +++ b/backend/src/plugins/Mutes/MutesPlugin.ts @@ -8,6 +8,7 @@ import { GuildLogs } from "../../data/GuildLogs"; import { GuildMutes } from "../../data/GuildMutes"; import { makePublicFn } from "../../pluginUtils"; import { CasesPlugin } from "../Cases/CasesPlugin"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { LogsPlugin } from "../Logs/LogsPlugin"; import { RoleManagerPlugin } from "../RoleManager/RoleManagerPlugin.js"; import { ClearBannedMutesCmd } from "./commands/ClearBannedMutesCmd"; @@ -24,7 +25,6 @@ import { onMutesEvent } from "./functions/onMutesEvent"; import { renewTimeoutMute } from "./functions/renewTimeoutMute"; import { unmuteUser } from "./functions/unmuteUser"; import { MutesPluginType, zMutesConfig } from "./types"; -import { CommonPlugin } from "../Common/CommonPlugin"; const defaultOptions = { config: { diff --git a/backend/src/plugins/Mutes/commands/ClearBannedMutesCmd.ts b/backend/src/plugins/Mutes/commands/ClearBannedMutesCmd.ts index 64b77233..43d2c58a 100644 --- a/backend/src/plugins/Mutes/commands/ClearBannedMutesCmd.ts +++ b/backend/src/plugins/Mutes/commands/ClearBannedMutesCmd.ts @@ -1,5 +1,4 @@ import { Snowflake } from "discord.js"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { mutesCmd } from "../types"; export const ClearBannedMutesCmd = mutesCmd({ diff --git a/backend/src/plugins/Mutes/commands/ClearMutesCmd.ts b/backend/src/plugins/Mutes/commands/ClearMutesCmd.ts index b8f75022..43062754 100644 --- a/backend/src/plugins/Mutes/commands/ClearMutesCmd.ts +++ b/backend/src/plugins/Mutes/commands/ClearMutesCmd.ts @@ -1,5 +1,4 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { mutesCmd } from "../types"; export const ClearMutesCmd = mutesCmd({ @@ -23,14 +22,17 @@ export const ClearMutesCmd = mutesCmd({ } if (failed.length !== args.userIds.length) { - void pluginData.state.common.sendSuccessMessage(msg, `**${args.userIds.length - failed.length} active mute(s) cleared**`); + void pluginData.state.common.sendSuccessMessage( + msg, + `**${args.userIds.length - failed.length} active mute(s) cleared**`, + ); } if (failed.length) { void pluginData.state.common.sendErrorMessage( - msg, - `**${failed.length}/${args.userIds.length} IDs failed**, they are not muted: ${failed.join(" ")}`, - ); + msg, + `**${failed.length}/${args.userIds.length} IDs failed**, they are not muted: ${failed.join(" ")}`, + ); } }, }); diff --git a/backend/src/plugins/Mutes/commands/ClearMutesWithoutRoleCmd.ts b/backend/src/plugins/Mutes/commands/ClearMutesWithoutRoleCmd.ts index c5f7be13..b73d3b41 100644 --- a/backend/src/plugins/Mutes/commands/ClearMutesWithoutRoleCmd.ts +++ b/backend/src/plugins/Mutes/commands/ClearMutesWithoutRoleCmd.ts @@ -1,6 +1,5 @@ import { Snowflake } from "discord.js"; import { resolveMember } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { mutesCmd } from "../types"; export const ClearMutesWithoutRoleCmd = mutesCmd({ @@ -26,6 +25,9 @@ export const ClearMutesWithoutRoleCmd = mutesCmd({ } } - void pluginData.state.common.sendSuccessMessage(msg, `Cleared ${cleared} mutes from members that don't have the mute role`); + void pluginData.state.common.sendSuccessMessage( + msg, + `Cleared ${cleared} mutes from members that don't have the mute role`, + ); }, }); diff --git a/backend/src/plugins/NameHistory/NameHistoryPlugin.ts b/backend/src/plugins/NameHistory/NameHistoryPlugin.ts index f8d5f990..617ce019 100644 --- a/backend/src/plugins/NameHistory/NameHistoryPlugin.ts +++ b/backend/src/plugins/NameHistory/NameHistoryPlugin.ts @@ -2,9 +2,9 @@ import { PluginOptions, guildPlugin } from "knub"; import { Queue } from "../../Queue"; import { GuildNicknameHistory } from "../../data/GuildNicknameHistory"; import { UsernameHistory } from "../../data/UsernameHistory"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { NamesCmd } from "./commands/NamesCmd"; import { NameHistoryPluginType, zNameHistoryConfig } from "./types"; -import { CommonPlugin } from "../Common/CommonPlugin"; const defaultOptions: PluginOptions = { config: { diff --git a/backend/src/plugins/NameHistory/commands/NamesCmd.ts b/backend/src/plugins/NameHistory/commands/NamesCmd.ts index 9f3bb418..3fadaadd 100644 --- a/backend/src/plugins/NameHistory/commands/NamesCmd.ts +++ b/backend/src/plugins/NameHistory/commands/NamesCmd.ts @@ -5,7 +5,6 @@ import { MAX_NICKNAME_ENTRIES_PER_USER } from "../../../data/GuildNicknameHistor import { MAX_USERNAME_ENTRIES_PER_USER } from "../../../data/UsernameHistory"; import { NICKNAME_RETENTION_PERIOD } from "../../../data/cleanup/nicknames"; import { DAYS, renderUsername } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { nameHistoryCmd } from "../types"; export const NamesCmd = nameHistoryCmd({ diff --git a/backend/src/plugins/PingableRoles/PingableRolesPlugin.ts b/backend/src/plugins/PingableRoles/PingableRolesPlugin.ts index 118cf044..380a2a25 100644 --- a/backend/src/plugins/PingableRoles/PingableRolesPlugin.ts +++ b/backend/src/plugins/PingableRoles/PingableRolesPlugin.ts @@ -1,9 +1,9 @@ import { PluginOptions, guildPlugin } from "knub"; import { GuildPingableRoles } from "../../data/GuildPingableRoles"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { PingableRoleDisableCmd } from "./commands/PingableRoleDisableCmd"; import { PingableRoleEnableCmd } from "./commands/PingableRoleEnableCmd"; import { PingableRolesPluginType, zPingableRolesConfig } from "./types"; -import { CommonPlugin } from "../Common/CommonPlugin"; const defaultOptions: PluginOptions = { config: { diff --git a/backend/src/plugins/PingableRoles/commands/PingableRoleDisableCmd.ts b/backend/src/plugins/PingableRoles/commands/PingableRoleDisableCmd.ts index 3bc1ad58..a66d41a7 100644 --- a/backend/src/plugins/PingableRoles/commands/PingableRoleDisableCmd.ts +++ b/backend/src/plugins/PingableRoles/commands/PingableRoleDisableCmd.ts @@ -1,5 +1,4 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { pingableRolesCmd } from "../types"; export const PingableRoleDisableCmd = pingableRolesCmd({ @@ -14,13 +13,19 @@ export const PingableRoleDisableCmd = pingableRolesCmd({ async run({ message: msg, args, pluginData }) { const pingableRole = await pluginData.state.pingableRoles.getByChannelAndRoleId(args.channelId, args.role.id); if (!pingableRole) { - void pluginData.state.common.sendErrorMessage(msg, `**${args.role.name}** is not set as pingable in <#${args.channelId}>`); + void pluginData.state.common.sendErrorMessage( + msg, + `**${args.role.name}** is not set as pingable in <#${args.channelId}>`, + ); return; } await pluginData.state.pingableRoles.delete(args.channelId, args.role.id); pluginData.state.cache.delete(args.channelId); - void pluginData.state.common.sendSuccessMessage(msg, `**${args.role.name}** is no longer set as pingable in <#${args.channelId}>`); + void pluginData.state.common.sendSuccessMessage( + msg, + `**${args.role.name}** is no longer set as pingable in <#${args.channelId}>`, + ); }, }); diff --git a/backend/src/plugins/PingableRoles/commands/PingableRoleEnableCmd.ts b/backend/src/plugins/PingableRoles/commands/PingableRoleEnableCmd.ts index 004c0741..31218b5d 100644 --- a/backend/src/plugins/PingableRoles/commands/PingableRoleEnableCmd.ts +++ b/backend/src/plugins/PingableRoles/commands/PingableRoleEnableCmd.ts @@ -1,5 +1,4 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { pingableRolesCmd } from "../types"; export const PingableRoleEnableCmd = pingableRolesCmd({ @@ -17,13 +16,19 @@ export const PingableRoleEnableCmd = pingableRolesCmd({ args.role.id, ); if (existingPingableRole) { - void pluginData.state.common.sendErrorMessage(msg, `**${args.role.name}** is already set as pingable in <#${args.channelId}>`); + void pluginData.state.common.sendErrorMessage( + msg, + `**${args.role.name}** is already set as pingable in <#${args.channelId}>`, + ); return; } await pluginData.state.pingableRoles.add(args.channelId, args.role.id); pluginData.state.cache.delete(args.channelId); - void pluginData.state.common.sendSuccessMessage(msg, `**${args.role.name}** has been set as pingable in <#${args.channelId}>`); + void pluginData.state.common.sendSuccessMessage( + msg, + `**${args.role.name}** has been set as pingable in <#${args.channelId}>`, + ); }, }); diff --git a/backend/src/plugins/Post/PostPlugin.ts b/backend/src/plugins/Post/PostPlugin.ts index 93376dcf..a96d21b4 100644 --- a/backend/src/plugins/Post/PostPlugin.ts +++ b/backend/src/plugins/Post/PostPlugin.ts @@ -3,6 +3,7 @@ import { onGuildEvent } from "../../data/GuildEvents"; import { GuildLogs } from "../../data/GuildLogs"; import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { GuildScheduledPosts } from "../../data/GuildScheduledPosts"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { LogsPlugin } from "../Logs/LogsPlugin"; import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin"; import { EditCmd } from "./commands/EditCmd"; @@ -14,7 +15,6 @@ import { ScheduledPostsListCmd } from "./commands/ScheduledPostsListCmd"; import { ScheduledPostsShowCmd } from "./commands/ScheduledPostsShowCmd"; import { PostPluginType, zPostConfig } from "./types"; import { postScheduledPost } from "./util/postScheduledPost"; -import { CommonPlugin } from "../Common/CommonPlugin"; const defaultOptions: PluginOptions = { config: { diff --git a/backend/src/plugins/Post/commands/EditCmd.ts b/backend/src/plugins/Post/commands/EditCmd.ts index fb785929..9dc7d2d0 100644 --- a/backend/src/plugins/Post/commands/EditCmd.ts +++ b/backend/src/plugins/Post/commands/EditCmd.ts @@ -1,5 +1,4 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { postCmd } from "../types"; import { formatContent } from "../util/formatContent"; diff --git a/backend/src/plugins/Post/commands/EditEmbedCmd.ts b/backend/src/plugins/Post/commands/EditEmbedCmd.ts index 4cdfdd8b..3ceff537 100644 --- a/backend/src/plugins/Post/commands/EditEmbedCmd.ts +++ b/backend/src/plugins/Post/commands/EditEmbedCmd.ts @@ -3,7 +3,6 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { isValidEmbed, trimLines } from "../../../utils"; import { parseColor } from "../../../utils/parseColor"; import { rgbToInt } from "../../../utils/rgbToInt"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { postCmd } from "../types"; import { formatContent } from "../util/formatContent"; diff --git a/backend/src/plugins/Post/commands/PostEmbedCmd.ts b/backend/src/plugins/Post/commands/PostEmbedCmd.ts index e54649e6..4a71d8af 100644 --- a/backend/src/plugins/Post/commands/PostEmbedCmd.ts +++ b/backend/src/plugins/Post/commands/PostEmbedCmd.ts @@ -3,7 +3,6 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { isValidEmbed, trimLines } from "../../../utils"; import { parseColor } from "../../../utils/parseColor"; import { rgbToInt } from "../../../utils/rgbToInt"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { postCmd } from "../types"; import { actualPostCmd } from "../util/actualPostCmd"; import { formatContent } from "../util/formatContent"; diff --git a/backend/src/plugins/Post/commands/ScheduledPostsDeleteCmd.ts b/backend/src/plugins/Post/commands/ScheduledPostsDeleteCmd.ts index d3c6063a..75602f54 100644 --- a/backend/src/plugins/Post/commands/ScheduledPostsDeleteCmd.ts +++ b/backend/src/plugins/Post/commands/ScheduledPostsDeleteCmd.ts @@ -1,7 +1,6 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { clearUpcomingScheduledPost } from "../../../data/loops/upcomingScheduledPostsLoop"; import { sorter } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { postCmd } from "../types"; export const ScheduledPostsDeleteCmd = postCmd({ diff --git a/backend/src/plugins/Post/commands/ScheduledPostsShowCmd.ts b/backend/src/plugins/Post/commands/ScheduledPostsShowCmd.ts index a990e6d9..38e450fc 100644 --- a/backend/src/plugins/Post/commands/ScheduledPostsShowCmd.ts +++ b/backend/src/plugins/Post/commands/ScheduledPostsShowCmd.ts @@ -1,6 +1,5 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { sorter } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { postCmd } from "../types"; import { postMessage } from "../util/postMessage"; diff --git a/backend/src/plugins/Post/util/actualPostCmd.ts b/backend/src/plugins/Post/util/actualPostCmd.ts index b75bcc53..987be772 100644 --- a/backend/src/plugins/Post/util/actualPostCmd.ts +++ b/backend/src/plugins/Post/util/actualPostCmd.ts @@ -4,7 +4,6 @@ import { GuildPluginData } from "knub"; import moment from "moment-timezone"; import { registerUpcomingScheduledPost } from "../../../data/loops/upcomingScheduledPostsLoop"; import { DBDateFormat, MINUTES, StrictMessageContent, errorMessage, renderUsername } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { LogsPlugin } from "../../Logs/LogsPlugin"; import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin"; import { PostPluginType } from "../types"; @@ -40,11 +39,17 @@ export async function actualPostCmd( if (opts.repeat) { if (opts.repeat < MIN_REPEAT_TIME) { - void pluginData.state.common.sendErrorMessage(msg, `Minimum time for -repeat is ${humanizeDuration(MIN_REPEAT_TIME)}`); + void pluginData.state.common.sendErrorMessage( + msg, + `Minimum time for -repeat is ${humanizeDuration(MIN_REPEAT_TIME)}`, + ); return; } if (opts.repeat > MAX_REPEAT_TIME) { - void pluginData.state.common.sendErrorMessage(msg, `Max time for -repeat is ${humanizeDuration(MAX_REPEAT_TIME)}`); + void pluginData.state.common.sendErrorMessage( + msg, + `Max time for -repeat is ${humanizeDuration(MAX_REPEAT_TIME)}`, + ); return; } } @@ -95,12 +100,18 @@ export async function actualPostCmd( } if (repeatUntil && repeatTimes) { - void pluginData.state.common.sendErrorMessage(msg, "You can only use one of -repeat-until or -repeat-times at once"); + void pluginData.state.common.sendErrorMessage( + msg, + "You can only use one of -repeat-until or -repeat-times at once", + ); return; } if (opts.repeat && !repeatUntil && !repeatTimes) { - void pluginData.state.common.sendErrorMessage(msg, "You must specify -repeat-until or -repeat-times for repeated messages"); + void pluginData.state.common.sendErrorMessage( + msg, + "You must specify -repeat-until or -repeat-times for repeated messages", + ); return; } diff --git a/backend/src/plugins/ReactionRoles/ReactionRolesPlugin.ts b/backend/src/plugins/ReactionRoles/ReactionRolesPlugin.ts index 1848e663..79bcbef0 100644 --- a/backend/src/plugins/ReactionRoles/ReactionRolesPlugin.ts +++ b/backend/src/plugins/ReactionRoles/ReactionRolesPlugin.ts @@ -2,6 +2,7 @@ import { PluginOptions, guildPlugin } from "knub"; import { Queue } from "../../Queue"; import { GuildReactionRoles } from "../../data/GuildReactionRoles"; import { GuildSavedMessages } from "../../data/GuildSavedMessages"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { LogsPlugin } from "../Logs/LogsPlugin"; import { ClearReactionRolesCmd } from "./commands/ClearReactionRolesCmd"; import { InitReactionRolesCmd } from "./commands/InitReactionRolesCmd"; @@ -9,7 +10,6 @@ import { RefreshReactionRolesCmd } from "./commands/RefreshReactionRolesCmd"; import { AddReactionRoleEvt } from "./events/AddReactionRoleEvt"; import { MessageDeletedEvt } from "./events/MessageDeletedEvt"; import { ReactionRolesPluginType, zReactionRolesConfig } from "./types"; -import { CommonPlugin } from "../Common/CommonPlugin"; const MIN_AUTO_REFRESH = 1000 * 60 * 15; // 15min minimum, let's not abuse the API diff --git a/backend/src/plugins/ReactionRoles/commands/ClearReactionRolesCmd.ts b/backend/src/plugins/ReactionRoles/commands/ClearReactionRolesCmd.ts index 18baef48..44f22c99 100644 --- a/backend/src/plugins/ReactionRoles/commands/ClearReactionRolesCmd.ts +++ b/backend/src/plugins/ReactionRoles/commands/ClearReactionRolesCmd.ts @@ -1,7 +1,6 @@ import { Message } from "discord.js"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { isDiscordAPIError } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { reactionRolesCmd } from "../types"; export const ClearReactionRolesCmd = reactionRolesCmd({ diff --git a/backend/src/plugins/ReactionRoles/commands/InitReactionRolesCmd.ts b/backend/src/plugins/ReactionRoles/commands/InitReactionRolesCmd.ts index 1c166039..35d23865 100644 --- a/backend/src/plugins/ReactionRoles/commands/InitReactionRolesCmd.ts +++ b/backend/src/plugins/ReactionRoles/commands/InitReactionRolesCmd.ts @@ -2,7 +2,6 @@ import { Snowflake } from "discord.js"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { canUseEmoji, isDiscordAPIError, isValidEmoji, noop, trimPluginDescription } from "../../../utils"; import { canReadChannel } from "../../../utils/canReadChannel"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { TReactionRolePair, reactionRolesCmd } from "../types"; import { applyReactionRoleReactionsToMessage } from "../util/applyReactionRoleReactionsToMessage"; @@ -34,7 +33,10 @@ export const InitReactionRolesCmd = reactionRolesCmd({ async run({ message: msg, args, pluginData }) { if (!canReadChannel(args.message.channel, msg.member)) { - void pluginData.state.common.sendErrorMessage(msg, "You can't add reaction roles to channels you can't see yourself"); + void pluginData.state.common.sendErrorMessage( + msg, + "You can't add reaction roles to channels you can't see yourself", + ); return; } @@ -71,7 +73,10 @@ export const InitReactionRolesCmd = reactionRolesCmd({ // Verify the specified emojis and roles are valid and usable for (const pair of emojiRolePairs) { if (pair[0] === CLEAR_ROLES_EMOJI) { - void pluginData.state.common.sendErrorMessage(msg, `The emoji for clearing roles (${CLEAR_ROLES_EMOJI}) is reserved and cannot be used`); + void pluginData.state.common.sendErrorMessage( + msg, + `The emoji for clearing roles (${CLEAR_ROLES_EMOJI}) is reserved and cannot be used`, + ); return; } @@ -81,7 +86,10 @@ export const InitReactionRolesCmd = reactionRolesCmd({ } if (!canUseEmoji(pluginData.client, pair[0])) { - void pluginData.state.common.sendErrorMessage(msg, "I can only use regular emojis and custom emojis from servers I'm on"); + void pluginData.state.common.sendErrorMessage( + msg, + "I can only use regular emojis and custom emojis from servers I'm on", + ); return; } diff --git a/backend/src/plugins/ReactionRoles/commands/RefreshReactionRolesCmd.ts b/backend/src/plugins/ReactionRoles/commands/RefreshReactionRolesCmd.ts index fa0e8ac1..ad2e0c47 100644 --- a/backend/src/plugins/ReactionRoles/commands/RefreshReactionRolesCmd.ts +++ b/backend/src/plugins/ReactionRoles/commands/RefreshReactionRolesCmd.ts @@ -1,5 +1,4 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { reactionRolesCmd } from "../types"; import { refreshReactionRoles } from "../util/refreshReactionRoles"; diff --git a/backend/src/plugins/Reminders/RemindersPlugin.ts b/backend/src/plugins/Reminders/RemindersPlugin.ts index a6070112..0a4d723f 100644 --- a/backend/src/plugins/Reminders/RemindersPlugin.ts +++ b/backend/src/plugins/Reminders/RemindersPlugin.ts @@ -1,13 +1,13 @@ import { PluginOptions, guildPlugin } from "knub"; import { onGuildEvent } from "../../data/GuildEvents"; import { GuildReminders } from "../../data/GuildReminders"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin"; import { RemindCmd } from "./commands/RemindCmd"; import { RemindersCmd } from "./commands/RemindersCmd"; import { RemindersDeleteCmd } from "./commands/RemindersDeleteCmd"; import { postReminder } from "./functions/postReminder"; import { RemindersPluginType, zRemindersConfig } from "./types"; -import { CommonPlugin } from "../Common/CommonPlugin"; const defaultOptions: PluginOptions = { config: { diff --git a/backend/src/plugins/Reminders/commands/RemindCmd.ts b/backend/src/plugins/Reminders/commands/RemindCmd.ts index d0fb4eb0..7999ad5a 100644 --- a/backend/src/plugins/Reminders/commands/RemindCmd.ts +++ b/backend/src/plugins/Reminders/commands/RemindCmd.ts @@ -3,7 +3,6 @@ import moment from "moment-timezone"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { registerUpcomingReminder } from "../../../data/loops/upcomingRemindersLoop"; import { convertDelayStringToMS, messageLink } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin"; import { remindersCmd } from "../types"; @@ -67,6 +66,9 @@ export const RemindCmd = remindersCmd({ pluginData.getPlugin(TimeAndDatePlugin).getDateFormat("pretty_datetime"), ); - void pluginData.state.common.sendSuccessMessage(msg, `I will remind you in **${timeUntilReminder}** at **${prettyReminderTime}**`); + void pluginData.state.common.sendSuccessMessage( + msg, + `I will remind you in **${timeUntilReminder}** at **${prettyReminderTime}**`, + ); }, }); diff --git a/backend/src/plugins/Reminders/commands/RemindersCmd.ts b/backend/src/plugins/Reminders/commands/RemindersCmd.ts index 9f6dacc7..393c5b24 100644 --- a/backend/src/plugins/Reminders/commands/RemindersCmd.ts +++ b/backend/src/plugins/Reminders/commands/RemindersCmd.ts @@ -1,7 +1,6 @@ import humanizeDuration from "humanize-duration"; import moment from "moment-timezone"; import { createChunkedMessage, DBDateFormat, sorter } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin"; import { remindersCmd } from "../types"; diff --git a/backend/src/plugins/Reminders/commands/RemindersDeleteCmd.ts b/backend/src/plugins/Reminders/commands/RemindersDeleteCmd.ts index 7a57f79b..5e40f692 100644 --- a/backend/src/plugins/Reminders/commands/RemindersDeleteCmd.ts +++ b/backend/src/plugins/Reminders/commands/RemindersDeleteCmd.ts @@ -1,7 +1,6 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { clearUpcomingReminder } from "../../../data/loops/upcomingRemindersLoop"; import { sorter } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { remindersCmd } from "../types"; export const RemindersDeleteCmd = remindersCmd({ diff --git a/backend/src/plugins/RoleButtons/RoleButtonsPlugin.ts b/backend/src/plugins/RoleButtons/RoleButtonsPlugin.ts index ecd25e8d..e71c7ed0 100644 --- a/backend/src/plugins/RoleButtons/RoleButtonsPlugin.ts +++ b/backend/src/plugins/RoleButtons/RoleButtonsPlugin.ts @@ -1,12 +1,12 @@ import { guildPlugin } from "knub"; import { GuildRoleButtons } from "../../data/GuildRoleButtons"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { LogsPlugin } from "../Logs/LogsPlugin"; import { RoleManagerPlugin } from "../RoleManager/RoleManagerPlugin"; import { resetButtonsCmd } from "./commands/resetButtons"; import { onButtonInteraction } from "./events/buttonInteraction"; import { applyAllRoleButtons } from "./functions/applyAllRoleButtons"; import { RoleButtonsPluginType, zRoleButtonsConfig } from "./types"; -import { CommonPlugin } from "../Common/CommonPlugin"; export const RoleButtonsPlugin = guildPlugin()({ name: "role_buttons", diff --git a/backend/src/plugins/RoleButtons/commands/resetButtons.ts b/backend/src/plugins/RoleButtons/commands/resetButtons.ts index 78b3e6a2..49add73f 100644 --- a/backend/src/plugins/RoleButtons/commands/resetButtons.ts +++ b/backend/src/plugins/RoleButtons/commands/resetButtons.ts @@ -1,6 +1,5 @@ import { guildPluginMessageCommand } from "knub"; import { commandTypeHelpers as ct } from "../../../commandTypes"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { applyAllRoleButtons } from "../functions/applyAllRoleButtons"; import { RoleButtonsPluginType } from "../types"; diff --git a/backend/src/plugins/RoleButtons/types.ts b/backend/src/plugins/RoleButtons/types.ts index 42fa6bf9..b863e7bc 100644 --- a/backend/src/plugins/RoleButtons/types.ts +++ b/backend/src/plugins/RoleButtons/types.ts @@ -3,9 +3,9 @@ import { BasePluginType, pluginUtils } from "knub"; import z from "zod"; import { GuildRoleButtons } from "../../data/GuildRoleButtons"; import { zBoundedCharacters, zBoundedRecord, zMessageContent, zSnowflake } from "../../utils"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { TooManyComponentsError } from "./functions/TooManyComponentsError"; import { createButtonComponents } from "./functions/createButtonComponents"; -import { CommonPlugin } from "../Common/CommonPlugin"; const zRoleButtonOption = z.strictObject({ role_id: zSnowflake, diff --git a/backend/src/plugins/Roles/RolesPlugin.ts b/backend/src/plugins/Roles/RolesPlugin.ts index 4d4bdbb9..117339b8 100644 --- a/backend/src/plugins/Roles/RolesPlugin.ts +++ b/backend/src/plugins/Roles/RolesPlugin.ts @@ -1,5 +1,6 @@ import { PluginOptions, guildPlugin } from "knub"; import { GuildLogs } from "../../data/GuildLogs"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { LogsPlugin } from "../Logs/LogsPlugin"; import { RoleManagerPlugin } from "../RoleManager/RoleManagerPlugin"; import { AddRoleCmd } from "./commands/AddRoleCmd"; @@ -7,7 +8,6 @@ import { MassAddRoleCmd } from "./commands/MassAddRoleCmd"; import { MassRemoveRoleCmd } from "./commands/MassRemoveRoleCmd"; import { RemoveRoleCmd } from "./commands/RemoveRoleCmd"; import { RolesPluginType, zRolesConfig } from "./types"; -import { CommonPlugin } from "../Common/CommonPlugin"; const defaultOptions: PluginOptions = { config: { diff --git a/backend/src/plugins/Roles/commands/AddRoleCmd.ts b/backend/src/plugins/Roles/commands/AddRoleCmd.ts index 66506c9e..9ce16346 100644 --- a/backend/src/plugins/Roles/commands/AddRoleCmd.ts +++ b/backend/src/plugins/Roles/commands/AddRoleCmd.ts @@ -2,7 +2,6 @@ import { GuildChannel } from "discord.js"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { canActOn } from "../../../pluginUtils"; import { resolveRoleId, verboseUserMention } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { LogsPlugin } from "../../Logs/LogsPlugin"; import { RoleManagerPlugin } from "../../RoleManager/RoleManagerPlugin"; import { rolesCmd } from "../types"; @@ -58,6 +57,9 @@ export const AddRoleCmd = rolesCmd({ roles: [role], }); - void pluginData.state.common.sendSuccessMessage(msg, `Added role **${role.name}** to ${verboseUserMention(args.member.user)}!`); + void pluginData.state.common.sendSuccessMessage( + msg, + `Added role **${role.name}** to ${verboseUserMention(args.member.user)}!`, + ); }, }); diff --git a/backend/src/plugins/Roles/commands/MassAddRoleCmd.ts b/backend/src/plugins/Roles/commands/MassAddRoleCmd.ts index 991cdcdb..4a73eaa9 100644 --- a/backend/src/plugins/Roles/commands/MassAddRoleCmd.ts +++ b/backend/src/plugins/Roles/commands/MassAddRoleCmd.ts @@ -3,7 +3,6 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { logger } from "../../../logger"; import { canActOn } from "../../../pluginUtils"; import { resolveMember, resolveRoleId, successMessage } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { LogsPlugin } from "../../Logs/LogsPlugin"; import { RoleManagerPlugin } from "../../RoleManager/RoleManagerPlugin"; import { rolesCmd } from "../types"; @@ -30,7 +29,10 @@ export const MassAddRoleCmd = rolesCmd({ for (const member of members) { if (!canActOn(pluginData, msg.member, member, true)) { - void pluginData.state.common.sendErrorMessage(msg, "Cannot add roles to 1 or more specified members: insufficient permissions"); + void pluginData.state.common.sendErrorMessage( + msg, + "Cannot add roles to 1 or more specified members: insufficient permissions", + ); return; } } diff --git a/backend/src/plugins/Roles/commands/MassRemoveRoleCmd.ts b/backend/src/plugins/Roles/commands/MassRemoveRoleCmd.ts index 6ba75d53..bc0d3233 100644 --- a/backend/src/plugins/Roles/commands/MassRemoveRoleCmd.ts +++ b/backend/src/plugins/Roles/commands/MassRemoveRoleCmd.ts @@ -2,7 +2,6 @@ import { GuildMember } from "discord.js"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { canActOn } from "../../../pluginUtils"; import { resolveMember, resolveRoleId, successMessage } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { LogsPlugin } from "../../Logs/LogsPlugin"; import { RoleManagerPlugin } from "../../RoleManager/RoleManagerPlugin"; import { rolesCmd } from "../types"; @@ -29,7 +28,10 @@ export const MassRemoveRoleCmd = rolesCmd({ for (const member of members) { if (!canActOn(pluginData, msg.member, member, true)) { - void pluginData.state.common.sendErrorMessage(msg, "Cannot add roles to 1 or more specified members: insufficient permissions"); + void pluginData.state.common.sendErrorMessage( + msg, + "Cannot add roles to 1 or more specified members: insufficient permissions", + ); return; } } diff --git a/backend/src/plugins/Roles/commands/RemoveRoleCmd.ts b/backend/src/plugins/Roles/commands/RemoveRoleCmd.ts index d1b8a7fa..a8b12479 100644 --- a/backend/src/plugins/Roles/commands/RemoveRoleCmd.ts +++ b/backend/src/plugins/Roles/commands/RemoveRoleCmd.ts @@ -2,7 +2,6 @@ import { GuildChannel } from "discord.js"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { canActOn } from "../../../pluginUtils"; import { resolveRoleId, verboseUserMention } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { LogsPlugin } from "../../Logs/LogsPlugin"; import { RoleManagerPlugin } from "../../RoleManager/RoleManagerPlugin"; import { rolesCmd } from "../types"; @@ -19,7 +18,10 @@ export const RemoveRoleCmd = rolesCmd({ async run({ message: msg, args, pluginData }) { if (!canActOn(pluginData, msg.member, args.member, true)) { - void pluginData.state.common.sendErrorMessage(msg, "Cannot remove roles from this user: insufficient permissions"); + void pluginData.state.common.sendErrorMessage( + msg, + "Cannot remove roles from this user: insufficient permissions", + ); return; } @@ -57,6 +59,9 @@ export const RemoveRoleCmd = rolesCmd({ roles: [role], }); - void pluginData.state.common.sendSuccessMessage(msg, `Removed role **${role.name}** from ${verboseUserMention(args.member.user)}!`); + void pluginData.state.common.sendSuccessMessage( + msg, + `Removed role **${role.name}** from ${verboseUserMention(args.member.user)}!`, + ); }, }); diff --git a/backend/src/plugins/SelfGrantableRoles/SelfGrantableRolesPlugin.ts b/backend/src/plugins/SelfGrantableRoles/SelfGrantableRolesPlugin.ts index a6a823d8..e7fbe875 100644 --- a/backend/src/plugins/SelfGrantableRoles/SelfGrantableRolesPlugin.ts +++ b/backend/src/plugins/SelfGrantableRoles/SelfGrantableRolesPlugin.ts @@ -1,9 +1,9 @@ import { CooldownManager, PluginOptions, guildPlugin } from "knub"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { RoleAddCmd } from "./commands/RoleAddCmd"; import { RoleHelpCmd } from "./commands/RoleHelpCmd"; import { RoleRemoveCmd } from "./commands/RoleRemoveCmd"; import { SelfGrantableRolesPluginType, zSelfGrantableRolesConfig } from "./types"; -import { CommonPlugin } from "../Common/CommonPlugin"; const defaultOptions: PluginOptions = { config: { diff --git a/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts b/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts index 4dfcacba..f4e718aa 100644 --- a/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts +++ b/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts @@ -1,7 +1,6 @@ import { Role, Snowflake } from "discord.js"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { memberRolesLock } from "../../../utils/lockNameHelpers"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { selfGrantableRolesCmd } from "../types"; import { findMatchingRoles } from "../util/findMatchingRoles"; import { getApplyingEntries } from "../util/getApplyingEntries"; @@ -39,9 +38,13 @@ export const RoleAddCmd = selfGrantableRolesCmd({ }, new Map()); if (!rolesToAdd.size) { - void pluginData.state.common.sendErrorMessage(msg, `<@!${msg.author.id}> Unknown ${args.roleNames.length === 1 ? "role" : "roles"}`, { - users: [msg.author.id], - }); + void pluginData.state.common.sendErrorMessage( + msg, + `<@!${msg.author.id}> Unknown ${args.roleNames.length === 1 ? "role" : "roles"}`, + { + users: [msg.author.id], + }, + ); lock.unlock(); return; } @@ -81,9 +84,13 @@ export const RoleAddCmd = selfGrantableRolesCmd({ roles: Array.from(newRoleIds) as Snowflake[], }); } catch { - void pluginData.state.common.sendErrorMessage(msg, `<@!${msg.author.id}> Got an error while trying to grant you the roles`, { - users: [msg.author.id], - }); + void pluginData.state.common.sendErrorMessage( + msg, + `<@!${msg.author.id}> Got an error while trying to grant you the roles`, + { + users: [msg.author.id], + }, + ); return; } diff --git a/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts b/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts index 11e4a4cd..1ca76b4d 100644 --- a/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts +++ b/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts @@ -1,7 +1,6 @@ import { Snowflake } from "discord.js"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { memberRolesLock } from "../../../utils/lockNameHelpers"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { selfGrantableRolesCmd } from "../types"; import { findMatchingRoles } from "../util/findMatchingRoles"; import { getApplyingEntries } from "../util/getApplyingEntries"; @@ -53,19 +52,31 @@ export const RoleRemoveCmd = selfGrantableRolesCmd({ { users: [msg.author.id] }, ); } else { - void pluginData.state.common.sendSuccessMessage(msg, `<@!${msg.author.id}> Removed ${removedRolesStr.join(", ")} ${removedRolesWord}`, { - users: [msg.author.id], - }); + void pluginData.state.common.sendSuccessMessage( + msg, + `<@!${msg.author.id}> Removed ${removedRolesStr.join(", ")} ${removedRolesWord}`, + { + users: [msg.author.id], + }, + ); } } catch { - void pluginData.state.common.sendSuccessMessage(msg, `<@!${msg.author.id}> Got an error while trying to remove the roles`, { - users: [msg.author.id], - }); + void pluginData.state.common.sendSuccessMessage( + msg, + `<@!${msg.author.id}> Got an error while trying to remove the roles`, + { + users: [msg.author.id], + }, + ); } } else { - void pluginData.state.common.sendErrorMessage(msg, `<@!${msg.author.id}> Unknown ${args.roleNames.length === 1 ? "role" : "roles"}`, { - users: [msg.author.id], - }); + void pluginData.state.common.sendErrorMessage( + msg, + `<@!${msg.author.id}> Unknown ${args.roleNames.length === 1 ? "role" : "roles"}`, + { + users: [msg.author.id], + }, + ); } lock.unlock(); diff --git a/backend/src/plugins/Slowmode/SlowmodePlugin.ts b/backend/src/plugins/Slowmode/SlowmodePlugin.ts index 8a0b7de9..e82d6d62 100644 --- a/backend/src/plugins/Slowmode/SlowmodePlugin.ts +++ b/backend/src/plugins/Slowmode/SlowmodePlugin.ts @@ -3,6 +3,7 @@ import { GuildLogs } from "../../data/GuildLogs"; import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { GuildSlowmodes } from "../../data/GuildSlowmodes"; import { SECONDS } from "../../utils"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { LogsPlugin } from "../Logs/LogsPlugin"; import { SlowmodeClearCmd } from "./commands/SlowmodeClearCmd"; import { SlowmodeDisableCmd } from "./commands/SlowmodeDisableCmd"; @@ -12,7 +13,6 @@ import { SlowmodeSetCmd } from "./commands/SlowmodeSetCmd"; import { SlowmodePluginType, zSlowmodeConfig } from "./types"; import { clearExpiredSlowmodes } from "./util/clearExpiredSlowmodes"; import { onMessageCreate } from "./util/onMessageCreate"; -import { CommonPlugin } from "../Common/CommonPlugin"; const BOT_SLOWMODE_CLEAR_INTERVAL = 60 * SECONDS; diff --git a/backend/src/plugins/Slowmode/commands/SlowmodeClearCmd.ts b/backend/src/plugins/Slowmode/commands/SlowmodeClearCmd.ts index 29465e79..c00f1ad9 100644 --- a/backend/src/plugins/Slowmode/commands/SlowmodeClearCmd.ts +++ b/backend/src/plugins/Slowmode/commands/SlowmodeClearCmd.ts @@ -3,7 +3,6 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { asSingleLine, renderUsername } from "../../../utils"; import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions"; import { missingPermissionError } from "../../../utils/missingPermissionError"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { BOT_SLOWMODE_CLEAR_PERMISSIONS } from "../requiredPermissions"; import { slowmodeCmd } from "../types"; import { clearBotSlowmodeFromUserId } from "../util/clearBotSlowmodeFromUserId"; @@ -29,7 +28,10 @@ export const SlowmodeClearCmd = slowmodeCmd({ const me = pluginData.guild.members.cache.get(pluginData.client.user!.id)!; const missingPermissions = getMissingChannelPermissions(me, args.channel, BOT_SLOWMODE_CLEAR_PERMISSIONS); if (missingPermissions) { - void pluginData.state.common.sendErrorMessage(msg, `Unable to clear slowmode. ${missingPermissionError(missingPermissions)}`); + void pluginData.state.common.sendErrorMessage( + msg, + `Unable to clear slowmode. ${missingPermissionError(missingPermissions)}`, + ); return; } @@ -57,6 +59,9 @@ export const SlowmodeClearCmd = slowmodeCmd({ return; } - void pluginData.state.common.sendSuccessMessage(msg, `Slowmode cleared from **${renderUsername(args.user)}** in <#${args.channel.id}>`); + void pluginData.state.common.sendSuccessMessage( + msg, + `Slowmode cleared from **${renderUsername(args.user)}** in <#${args.channel.id}>`, + ); }, }); diff --git a/backend/src/plugins/Slowmode/commands/SlowmodeSetCmd.ts b/backend/src/plugins/Slowmode/commands/SlowmodeSetCmd.ts index 6f951084..84cf6baa 100644 --- a/backend/src/plugins/Slowmode/commands/SlowmodeSetCmd.ts +++ b/backend/src/plugins/Slowmode/commands/SlowmodeSetCmd.ts @@ -4,7 +4,6 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { asSingleLine, DAYS, HOURS, MINUTES } from "../../../utils"; import { getMissingPermissions } from "../../../utils/getMissingPermissions"; import { missingPermissionError } from "../../../utils/missingPermissionError"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { BOT_SLOWMODE_PERMISSIONS, NATIVE_SLOWMODE_PERMISSIONS } from "../requiredPermissions"; import { slowmodeCmd } from "../types"; import { actualDisableSlowmodeCmd } from "../util/actualDisableSlowmodeCmd"; @@ -67,7 +66,10 @@ export const SlowmodeSetCmd = slowmodeCmd({ } if (mode === "bot" && args.time > MAX_BOT_SLOWMODE) { - void pluginData.state.common.sendErrorMessage(msg, `Sorry, bot managed slowmodes can be at most 100 years long. Maybe 99 would be enough?`); + void pluginData.state.common.sendErrorMessage( + msg, + `Sorry, bot managed slowmodes can be at most 100 years long. Maybe 99 would be enough?`, + ); return; } @@ -91,7 +93,10 @@ export const SlowmodeSetCmd = slowmodeCmd({ NATIVE_SLOWMODE_PERMISSIONS, ); if (missingPermissions) { - void pluginData.state.common.sendErrorMessage(msg, `Unable to set native slowmode. ${missingPermissionError(missingPermissions)}`); + void pluginData.state.common.sendErrorMessage( + msg, + `Unable to set native slowmode. ${missingPermissionError(missingPermissions)}`, + ); return; } } @@ -102,7 +107,10 @@ export const SlowmodeSetCmd = slowmodeCmd({ BOT_SLOWMODE_PERMISSIONS, ); if (missingPermissions) { - void pluginData.state.common.sendErrorMessage(msg, `Unable to set bot managed slowmode. ${missingPermissionError(missingPermissions)}`); + void pluginData.state.common.sendErrorMessage( + msg, + `Unable to set bot managed slowmode. ${missingPermissionError(missingPermissions)}`, + ); return; } } @@ -121,7 +129,10 @@ export const SlowmodeSetCmd = slowmodeCmd({ try { await channel.setRateLimitPerUser(rateLimitSeconds); } catch (e) { - void pluginData.state.common.sendErrorMessage(msg, `Failed to set native slowmode: ${escapeInlineCode(e.message)}`); + void pluginData.state.common.sendErrorMessage( + msg, + `Failed to set native slowmode: ${escapeInlineCode(e.message)}`, + ); return; } } else { @@ -140,6 +151,9 @@ export const SlowmodeSetCmd = slowmodeCmd({ const humanizedSlowmodeTime = humanizeDuration(args.time); const slowmodeType = mode === "native" ? "native slowmode" : "bot-maintained slowmode"; - void pluginData.state.common.sendSuccessMessage(msg, `Set ${humanizedSlowmodeTime} slowmode for <#${channel.id}> (${slowmodeType})`); + void pluginData.state.common.sendSuccessMessage( + msg, + `Set ${humanizedSlowmodeTime} slowmode for <#${channel.id}> (${slowmodeType})`, + ); }, }); diff --git a/backend/src/plugins/Slowmode/util/actualDisableSlowmodeCmd.ts b/backend/src/plugins/Slowmode/util/actualDisableSlowmodeCmd.ts index da245eb4..64298763 100644 --- a/backend/src/plugins/Slowmode/util/actualDisableSlowmodeCmd.ts +++ b/backend/src/plugins/Slowmode/util/actualDisableSlowmodeCmd.ts @@ -2,7 +2,6 @@ import { Message } from "discord.js"; import { noop } from "../../../utils"; import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions"; import { missingPermissionError } from "../../../utils/missingPermissionError"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { BOT_SLOWMODE_DISABLE_PERMISSIONS } from "../requiredPermissions"; import { disableBotSlowmodeForChannel } from "./disableBotSlowmodeForChannel"; @@ -18,7 +17,10 @@ export async function actualDisableSlowmodeCmd(msg: Message, args, pluginData) { const me = pluginData.guild.members.cache.get(pluginData.client.user!.id); const missingPermissions = getMissingChannelPermissions(me, args.channel, BOT_SLOWMODE_DISABLE_PERMISSIONS); if (missingPermissions) { - void pluginData.state.common.sendErrorMessage(msg, `Unable to disable slowmode. ${missingPermissionError(missingPermissions)}`); + void pluginData.state.common.sendErrorMessage( + msg, + `Unable to disable slowmode. ${missingPermissionError(missingPermissions)}`, + ); return; } diff --git a/backend/src/plugins/Starboard/StarboardPlugin.ts b/backend/src/plugins/Starboard/StarboardPlugin.ts index 9888b013..37ac2397 100644 --- a/backend/src/plugins/Starboard/StarboardPlugin.ts +++ b/backend/src/plugins/Starboard/StarboardPlugin.ts @@ -2,12 +2,12 @@ import { PluginOptions, guildPlugin } from "knub"; import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { GuildStarboardMessages } from "../../data/GuildStarboardMessages"; import { GuildStarboardReactions } from "../../data/GuildStarboardReactions"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { MigratePinsCmd } from "./commands/MigratePinsCmd"; import { StarboardReactionAddEvt } from "./events/StarboardReactionAddEvt"; import { StarboardReactionRemoveAllEvt, StarboardReactionRemoveEvt } from "./events/StarboardReactionRemoveEvts"; import { StarboardPluginType, zStarboardConfig } from "./types"; import { onMessageDelete } from "./util/onMessageDelete"; -import { CommonPlugin } from "../Common/CommonPlugin"; const defaultOptions: PluginOptions = { config: { diff --git a/backend/src/plugins/Starboard/commands/MigratePinsCmd.ts b/backend/src/plugins/Starboard/commands/MigratePinsCmd.ts index 114b293f..448ba465 100644 --- a/backend/src/plugins/Starboard/commands/MigratePinsCmd.ts +++ b/backend/src/plugins/Starboard/commands/MigratePinsCmd.ts @@ -1,6 +1,5 @@ import { Snowflake, TextChannel } from "discord.js"; import { commandTypeHelpers as ct } from "../../../commandTypes"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { starboardCmd } from "../types"; import { saveMessageToStarboard } from "../util/saveMessageToStarboard"; @@ -43,6 +42,9 @@ export const MigratePinsCmd = starboardCmd({ await saveMessageToStarboard(pluginData, pin, starboard); } - void pluginData.state.common.sendSuccessMessage(msg, `Pins migrated from <#${args.pinChannel.id}> to <#${starboardChannel.id}>!`); + void pluginData.state.common.sendSuccessMessage( + msg, + `Pins migrated from <#${args.pinChannel.id}> to <#${starboardChannel.id}>!`, + ); }, }); diff --git a/backend/src/plugins/Tags/TagsPlugin.ts b/backend/src/plugins/Tags/TagsPlugin.ts index 97d667c4..cf82440e 100644 --- a/backend/src/plugins/Tags/TagsPlugin.ts +++ b/backend/src/plugins/Tags/TagsPlugin.ts @@ -8,6 +8,7 @@ import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { GuildTags } from "../../data/GuildTags"; import { makePublicFn } from "../../pluginUtils"; import { convertDelayStringToMS } from "../../utils"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { LogsPlugin } from "../Logs/LogsPlugin"; import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin"; import { TagCreateCmd } from "./commands/TagCreateCmd"; @@ -20,7 +21,6 @@ import { findTagByName } from "./util/findTagByName"; import { onMessageCreate } from "./util/onMessageCreate"; import { onMessageDelete } from "./util/onMessageDelete"; import { renderTagBody } from "./util/renderTagBody"; -import { CommonPlugin } from "../Common/CommonPlugin"; const defaultOptions: PluginOptions = { config: { diff --git a/backend/src/plugins/Tags/commands/TagCreateCmd.ts b/backend/src/plugins/Tags/commands/TagCreateCmd.ts index 8aab9647..872c63bd 100644 --- a/backend/src/plugins/Tags/commands/TagCreateCmd.ts +++ b/backend/src/plugins/Tags/commands/TagCreateCmd.ts @@ -1,6 +1,5 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { TemplateParseError, parseTemplate } from "../../../templateFormatter"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { tagsCmd } from "../types"; export const TagCreateCmd = tagsCmd({ diff --git a/backend/src/plugins/Tags/commands/TagDeleteCmd.ts b/backend/src/plugins/Tags/commands/TagDeleteCmd.ts index 618b6796..66913a5e 100644 --- a/backend/src/plugins/Tags/commands/TagDeleteCmd.ts +++ b/backend/src/plugins/Tags/commands/TagDeleteCmd.ts @@ -1,5 +1,4 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { tagsCmd } from "../types"; export const TagDeleteCmd = tagsCmd({ diff --git a/backend/src/plugins/Tags/commands/TagEvalCmd.ts b/backend/src/plugins/Tags/commands/TagEvalCmd.ts index 9cdab774..3cc045e6 100644 --- a/backend/src/plugins/Tags/commands/TagEvalCmd.ts +++ b/backend/src/plugins/Tags/commands/TagEvalCmd.ts @@ -3,7 +3,6 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { logger } from "../../../logger"; import { TemplateParseError } from "../../../templateFormatter"; import { memberToTemplateSafeMember, userToTemplateSafeUser } from "../../../utils/templateSafeObjects"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { tagsCmd } from "../types"; import { renderTagBody } from "../util/renderTagBody"; diff --git a/backend/src/plugins/Tags/commands/TagSourceCmd.ts b/backend/src/plugins/Tags/commands/TagSourceCmd.ts index 0a16c41b..35be3515 100644 --- a/backend/src/plugins/Tags/commands/TagSourceCmd.ts +++ b/backend/src/plugins/Tags/commands/TagSourceCmd.ts @@ -1,7 +1,6 @@ import moment from "moment-timezone"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { getBaseUrl } from "../../../pluginUtils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { tagsCmd } from "../types"; export const TagSourceCmd = tagsCmd({ diff --git a/backend/src/plugins/TimeAndDate/TimeAndDatePlugin.ts b/backend/src/plugins/TimeAndDate/TimeAndDatePlugin.ts index 4c84c4ff..daeaa2ad 100644 --- a/backend/src/plugins/TimeAndDate/TimeAndDatePlugin.ts +++ b/backend/src/plugins/TimeAndDate/TimeAndDatePlugin.ts @@ -1,6 +1,7 @@ import { PluginOptions, guildPlugin } from "knub"; import { GuildMemberTimezones } from "../../data/GuildMemberTimezones"; import { makePublicFn } from "../../pluginUtils"; +import { CommonPlugin } from "../Common/CommonPlugin"; import { ResetTimezoneCmd } from "./commands/ResetTimezoneCmd"; import { SetTimezoneCmd } from "./commands/SetTimezoneCmd"; import { ViewTimezoneCmd } from "./commands/ViewTimezoneCmd"; @@ -11,7 +12,6 @@ import { getMemberTz } from "./functions/getMemberTz"; import { inGuildTz } from "./functions/inGuildTz"; import { inMemberTz } from "./functions/inMemberTz"; import { TimeAndDatePluginType, zTimeAndDateConfig } from "./types"; -import { CommonPlugin } from "../Common/CommonPlugin"; const defaultOptions: PluginOptions = { config: { diff --git a/backend/src/plugins/TimeAndDate/commands/ResetTimezoneCmd.ts b/backend/src/plugins/TimeAndDate/commands/ResetTimezoneCmd.ts index 88eddd18..1a9c1daf 100644 --- a/backend/src/plugins/TimeAndDate/commands/ResetTimezoneCmd.ts +++ b/backend/src/plugins/TimeAndDate/commands/ResetTimezoneCmd.ts @@ -1,4 +1,3 @@ -import { CommonPlugin } from "../../Common/CommonPlugin"; import { getGuildTz } from "../functions/getGuildTz"; import { timeAndDateCmd } from "../types"; @@ -11,6 +10,9 @@ export const ResetTimezoneCmd = timeAndDateCmd({ async run({ pluginData, message }) { await pluginData.state.memberTimezones.reset(message.author.id); const serverTimezone = getGuildTz(pluginData); - void pluginData.state.common.sendSuccessMessage(message, `Your timezone has been reset to server default, **${serverTimezone}**`); + void pluginData.state.common.sendSuccessMessage( + message, + `Your timezone has been reset to server default, **${serverTimezone}**`, + ); }, }); diff --git a/backend/src/plugins/TimeAndDate/commands/SetTimezoneCmd.ts b/backend/src/plugins/TimeAndDate/commands/SetTimezoneCmd.ts index 684f60f7..092edadc 100644 --- a/backend/src/plugins/TimeAndDate/commands/SetTimezoneCmd.ts +++ b/backend/src/plugins/TimeAndDate/commands/SetTimezoneCmd.ts @@ -2,7 +2,6 @@ import { escapeInlineCode } from "discord.js"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { trimLines } from "../../../utils"; import { parseFuzzyTimezone } from "../../../utils/parseFuzzyTimezone"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { timeAndDateCmd } from "../types"; export const SetTimezoneCmd = timeAndDateCmd({ diff --git a/backend/src/plugins/TimeAndDate/types.ts b/backend/src/plugins/TimeAndDate/types.ts index 5bb5253d..1890e3d4 100644 --- a/backend/src/plugins/TimeAndDate/types.ts +++ b/backend/src/plugins/TimeAndDate/types.ts @@ -4,8 +4,8 @@ import z from "zod"; import { GuildMemberTimezones } from "../../data/GuildMemberTimezones"; import { keys } from "../../utils"; import { zValidTimezone } from "../../utils/zValidTimezone"; -import { defaultDateFormats } from "./defaultDateFormats"; import { CommonPlugin } from "../Common/CommonPlugin"; +import { defaultDateFormats } from "./defaultDateFormats"; const zDateFormatKeys = z.enum(keys(defaultDateFormats) as U.ListOf); diff --git a/backend/src/plugins/Utility/commands/AvatarCmd.ts b/backend/src/plugins/Utility/commands/AvatarCmd.ts index b0b7ce7e..4fb146e7 100644 --- a/backend/src/plugins/Utility/commands/AvatarCmd.ts +++ b/backend/src/plugins/Utility/commands/AvatarCmd.ts @@ -1,7 +1,6 @@ import { APIEmbed, ImageFormat } from "discord.js"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { UnknownUser, renderUsername } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { utilityCmd } from "../types"; export const AvatarCmd = utilityCmd({ diff --git a/backend/src/plugins/Utility/commands/ChannelInfoCmd.ts b/backend/src/plugins/Utility/commands/ChannelInfoCmd.ts index dc0901bc..d39d5364 100644 --- a/backend/src/plugins/Utility/commands/ChannelInfoCmd.ts +++ b/backend/src/plugins/Utility/commands/ChannelInfoCmd.ts @@ -1,5 +1,4 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { getChannelInfoEmbed } from "../functions/getChannelInfoEmbed"; import { utilityCmd } from "../types"; diff --git a/backend/src/plugins/Utility/commands/CleanCmd.ts b/backend/src/plugins/Utility/commands/CleanCmd.ts index 6eac645e..fb06f689 100644 --- a/backend/src/plugins/Utility/commands/CleanCmd.ts +++ b/backend/src/plugins/Utility/commands/CleanCmd.ts @@ -8,7 +8,6 @@ import { humanizeDurationShort } from "../../../humanizeDurationShort"; import { getBaseUrl } from "../../../pluginUtils"; import { ModActionsPlugin } from "../../../plugins/ModActions/ModActionsPlugin"; import { DAYS, SECONDS, chunkArray, getInviteCodesInString, noop } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { LogsPlugin } from "../../Logs/LogsPlugin"; import { UtilityPluginType, utilityCmd } from "../types"; @@ -94,7 +93,12 @@ export async function cleanCmd(pluginData: GuildPluginData, a const targetChannel = args.channel ? pluginData.guild.channels.cache.get(args.channel as Snowflake) : msg.channel; if (!targetChannel?.isTextBased()) { - void pluginData.state.common.sendErrorMessage(msg, `Invalid channel specified`, undefined, args["response-interaction"]); + void pluginData.state.common.sendErrorMessage( + msg, + `Invalid channel specified`, + undefined, + args["response-interaction"], + ); return; } @@ -217,10 +221,20 @@ export async function cleanCmd(pluginData: GuildPluginData, a } } - responseMsg = await pluginData.state.common.sendSuccessMessage(msg, responseText, undefined, args["response-interaction"]); + responseMsg = await pluginData.state.common.sendSuccessMessage( + msg, + responseText, + undefined, + args["response-interaction"], + ); } else { const responseText = `Found no messages to clean${note ? ` (${note})` : ""}!`; - responseMsg = await pluginData.state.common.sendErrorMessage(msg, responseText, undefined, args["response-interaction"]); + responseMsg = await pluginData.state.common.sendErrorMessage( + msg, + responseText, + undefined, + args["response-interaction"], + ); } cleaningMessage?.delete(); diff --git a/backend/src/plugins/Utility/commands/ContextCmd.ts b/backend/src/plugins/Utility/commands/ContextCmd.ts index 9db76606..0bbb8d68 100644 --- a/backend/src/plugins/Utility/commands/ContextCmd.ts +++ b/backend/src/plugins/Utility/commands/ContextCmd.ts @@ -2,7 +2,6 @@ import { Snowflake, TextChannel } from "discord.js"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { messageLink } from "../../../utils"; import { canReadChannel } from "../../../utils/canReadChannel"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { utilityCmd } from "../types"; export const ContextCmd = utilityCmd({ diff --git a/backend/src/plugins/Utility/commands/EmojiInfoCmd.ts b/backend/src/plugins/Utility/commands/EmojiInfoCmd.ts index e5806aec..ff1a8fa7 100644 --- a/backend/src/plugins/Utility/commands/EmojiInfoCmd.ts +++ b/backend/src/plugins/Utility/commands/EmojiInfoCmd.ts @@ -1,5 +1,4 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { getCustomEmojiId } from "../functions/getCustomEmojiId"; import { getEmojiInfoEmbed } from "../functions/getEmojiInfoEmbed"; import { utilityCmd } from "../types"; diff --git a/backend/src/plugins/Utility/commands/InfoCmd.ts b/backend/src/plugins/Utility/commands/InfoCmd.ts index 9314dbce..75f12197 100644 --- a/backend/src/plugins/Utility/commands/InfoCmd.ts +++ b/backend/src/plugins/Utility/commands/InfoCmd.ts @@ -4,7 +4,6 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { isValidSnowflake, noop, parseInviteCodeInput, resolveInvite, resolveUser } from "../../../utils"; import { canReadChannel } from "../../../utils/canReadChannel"; import { resolveMessageTarget } from "../../../utils/resolveMessageTarget"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { getChannelInfoEmbed } from "../functions/getChannelInfoEmbed"; import { getCustomEmojiId } from "../functions/getCustomEmojiId"; import { getEmojiInfoEmbed } from "../functions/getEmojiInfoEmbed"; diff --git a/backend/src/plugins/Utility/commands/InviteInfoCmd.ts b/backend/src/plugins/Utility/commands/InviteInfoCmd.ts index bbecd794..37d8493b 100644 --- a/backend/src/plugins/Utility/commands/InviteInfoCmd.ts +++ b/backend/src/plugins/Utility/commands/InviteInfoCmd.ts @@ -1,6 +1,5 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { parseInviteCodeInput } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { getInviteInfoEmbed } from "../functions/getInviteInfoEmbed"; import { utilityCmd } from "../types"; diff --git a/backend/src/plugins/Utility/commands/JumboCmd.ts b/backend/src/plugins/Utility/commands/JumboCmd.ts index d29dc608..11d42a04 100644 --- a/backend/src/plugins/Utility/commands/JumboCmd.ts +++ b/backend/src/plugins/Utility/commands/JumboCmd.ts @@ -4,7 +4,6 @@ import fs from "fs"; import twemoji from "twemoji"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { downloadFile, isEmoji, SECONDS } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { utilityCmd } from "../types"; const fsp = fs.promises; diff --git a/backend/src/plugins/Utility/commands/MessageInfoCmd.ts b/backend/src/plugins/Utility/commands/MessageInfoCmd.ts index 4ea7da69..1b4496b8 100644 --- a/backend/src/plugins/Utility/commands/MessageInfoCmd.ts +++ b/backend/src/plugins/Utility/commands/MessageInfoCmd.ts @@ -1,6 +1,5 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { canReadChannel } from "../../../utils/canReadChannel"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { getMessageInfoEmbed } from "../functions/getMessageInfoEmbed"; import { utilityCmd } from "../types"; diff --git a/backend/src/plugins/Utility/commands/NicknameCmd.ts b/backend/src/plugins/Utility/commands/NicknameCmd.ts index fd33a755..ec274703 100644 --- a/backend/src/plugins/Utility/commands/NicknameCmd.ts +++ b/backend/src/plugins/Utility/commands/NicknameCmd.ts @@ -2,7 +2,6 @@ import { escapeBold } from "discord.js"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { canActOn } from "../../../pluginUtils"; import { errorMessage } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { utilityCmd } from "../types"; export const NicknameCmd = utilityCmd({ diff --git a/backend/src/plugins/Utility/commands/NicknameResetCmd.ts b/backend/src/plugins/Utility/commands/NicknameResetCmd.ts index 8fd23c84..34ae2cbb 100644 --- a/backend/src/plugins/Utility/commands/NicknameResetCmd.ts +++ b/backend/src/plugins/Utility/commands/NicknameResetCmd.ts @@ -1,7 +1,6 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { canActOn } from "../../../pluginUtils"; import { errorMessage } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { utilityCmd } from "../types"; export const NicknameResetCmd = utilityCmd({ diff --git a/backend/src/plugins/Utility/commands/RolesCmd.ts b/backend/src/plugins/Utility/commands/RolesCmd.ts index 08ec5dc1..a9d9dc1d 100644 --- a/backend/src/plugins/Utility/commands/RolesCmd.ts +++ b/backend/src/plugins/Utility/commands/RolesCmd.ts @@ -1,7 +1,6 @@ import { Role } from "discord.js"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { chunkArray, sorter, trimLines } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { refreshMembersIfNeeded } from "../refreshMembers"; import { utilityCmd } from "../types"; diff --git a/backend/src/plugins/Utility/commands/ServerInfoCmd.ts b/backend/src/plugins/Utility/commands/ServerInfoCmd.ts index 0388d8cd..94a9c91d 100644 --- a/backend/src/plugins/Utility/commands/ServerInfoCmd.ts +++ b/backend/src/plugins/Utility/commands/ServerInfoCmd.ts @@ -1,5 +1,4 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { getServerInfoEmbed } from "../functions/getServerInfoEmbed"; import { utilityCmd } from "../types"; diff --git a/backend/src/plugins/Utility/commands/SourceCmd.ts b/backend/src/plugins/Utility/commands/SourceCmd.ts index 5fccc109..e51f94d3 100644 --- a/backend/src/plugins/Utility/commands/SourceCmd.ts +++ b/backend/src/plugins/Utility/commands/SourceCmd.ts @@ -2,7 +2,6 @@ import moment from "moment-timezone"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { getBaseUrl } from "../../../pluginUtils"; import { canReadChannel } from "../../../utils/canReadChannel"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { utilityCmd } from "../types"; export const SourceCmd = utilityCmd({ diff --git a/backend/src/plugins/Utility/commands/UserInfoCmd.ts b/backend/src/plugins/Utility/commands/UserInfoCmd.ts index 9f2698a9..274fbbbc 100644 --- a/backend/src/plugins/Utility/commands/UserInfoCmd.ts +++ b/backend/src/plugins/Utility/commands/UserInfoCmd.ts @@ -1,5 +1,4 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { getUserInfoEmbed } from "../functions/getUserInfoEmbed"; import { utilityCmd } from "../types"; diff --git a/backend/src/plugins/Utility/commands/VcdisconnectCmd.ts b/backend/src/plugins/Utility/commands/VcdisconnectCmd.ts index 797f5dda..299b27a6 100644 --- a/backend/src/plugins/Utility/commands/VcdisconnectCmd.ts +++ b/backend/src/plugins/Utility/commands/VcdisconnectCmd.ts @@ -2,7 +2,6 @@ import { VoiceChannel } from "discord.js"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { canActOn } from "../../../pluginUtils"; import { renderUsername } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { LogsPlugin } from "../../Logs/LogsPlugin"; import { utilityCmd } from "../types"; @@ -43,7 +42,7 @@ export const VcdisconnectCmd = utilityCmd({ pluginData.state.common.sendSuccessMessage( msg, - `**${renderUsername(args.member)}** disconnected from **${channel.name}**` + `**${renderUsername(args.member)}** disconnected from **${channel.name}**`, ); }, }); diff --git a/backend/src/plugins/Utility/commands/VcmoveCmd.ts b/backend/src/plugins/Utility/commands/VcmoveCmd.ts index eee432c7..a037d379 100644 --- a/backend/src/plugins/Utility/commands/VcmoveCmd.ts +++ b/backend/src/plugins/Utility/commands/VcmoveCmd.ts @@ -2,7 +2,6 @@ import { ChannelType, Snowflake, VoiceChannel } from "discord.js"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { canActOn } from "../../../pluginUtils"; import { channelMentionRegex, isSnowflake, renderUsername, simpleClosestStringMatch } from "../../../utils"; -import { CommonPlugin } from "../../Common/CommonPlugin"; import { LogsPlugin } from "../../Logs/LogsPlugin"; import { utilityCmd } from "../types"; @@ -81,7 +80,10 @@ export const VcmoveCmd = utilityCmd({ newChannel: channel, }); - void pluginData.state.common.sendSuccessMessage(msg, `**${renderUsername(args.member)}** moved to **${channel.name}**`); + void pluginData.state.common.sendSuccessMessage( + msg, + `**${renderUsername(args.member)}** moved to **${channel.name}**`, + ); }, }); @@ -168,7 +170,10 @@ export const VcmoveAllCmd = utilityCmd({ void pluginData.state.common.sendErrorMessage(msg, "Unknown error when trying to move members"); return; } - void pluginData.state.common.sendErrorMessage(msg, `Failed to move ${renderUsername(currMember)} (${currMember.id})`); + void pluginData.state.common.sendErrorMessage( + msg, + `Failed to move ${renderUsername(currMember)} (${currMember.id})`, + ); errAmt++; continue; }