3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Ran prettier to fix style issues

This commit is contained in:
Lily Bergonzat 2024-05-12 21:34:17 +02:00
parent 893a77d562
commit 1f0c7a4349
170 changed files with 396 additions and 453 deletions

View file

@ -1,12 +1,12 @@
import { PluginOptions, guildPlugin } from "knub"; import { PluginOptions, guildPlugin } from "knub";
import { GuildAutoReactions } from "../../data/GuildAutoReactions"; import { GuildAutoReactions } from "../../data/GuildAutoReactions";
import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { GuildSavedMessages } from "../../data/GuildSavedMessages";
import { CommonPlugin } from "../Common/CommonPlugin";
import { LogsPlugin } from "../Logs/LogsPlugin"; import { LogsPlugin } from "../Logs/LogsPlugin";
import { DisableAutoReactionsCmd } from "./commands/DisableAutoReactionsCmd"; import { DisableAutoReactionsCmd } from "./commands/DisableAutoReactionsCmd";
import { NewAutoReactionsCmd } from "./commands/NewAutoReactionsCmd"; import { NewAutoReactionsCmd } from "./commands/NewAutoReactionsCmd";
import { AddReactionsEvt } from "./events/AddReactionsEvt"; import { AddReactionsEvt } from "./events/AddReactionsEvt";
import { AutoReactionsPluginType, zAutoReactionsConfig } from "./types"; import { AutoReactionsPluginType, zAutoReactionsConfig } from "./types";
import { CommonPlugin } from "../Common/CommonPlugin";
const defaultOptions: PluginOptions<AutoReactionsPluginType> = { const defaultOptions: PluginOptions<AutoReactionsPluginType> = {
config: { config: {
@ -54,5 +54,5 @@ export const AutoReactionsPlugin = guildPlugin<AutoReactionsPluginType>()({
beforeStart(pluginData) { beforeStart(pluginData) {
pluginData.state.common = pluginData.getPlugin(CommonPlugin); pluginData.state.common = pluginData.getPlugin(CommonPlugin);
} },
}); });

View file

@ -1,5 +1,4 @@
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { autoReactionsCmd } from "../types"; import { autoReactionsCmd } from "../types";
export const DisableAutoReactionsCmd = autoReactionsCmd({ export const DisableAutoReactionsCmd = autoReactionsCmd({

View file

@ -4,7 +4,6 @@ import { canUseEmoji, customEmojiRegex, isEmoji } from "../../../utils";
import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions"; import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions";
import { missingPermissionError } from "../../../utils/missingPermissionError"; import { missingPermissionError } from "../../../utils/missingPermissionError";
import { readChannelPermissions } from "../../../utils/readChannelPermissions"; import { readChannelPermissions } from "../../../utils/readChannelPermissions";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { autoReactionsCmd } from "../types"; import { autoReactionsCmd } from "../types";
const requiredPermissions = readChannelPermissions | PermissionsBitField.Flags.AddReactions; const requiredPermissions = readChannelPermissions | PermissionsBitField.Flags.AddReactions;
@ -44,7 +43,10 @@ export const NewAutoReactionsCmd = autoReactionsCmd({
if (customEmojiMatch) { if (customEmojiMatch) {
// Custom emoji // Custom emoji
if (!canUseEmoji(pluginData.client, customEmojiMatch[2])) { 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; return;
} }

View file

@ -8,6 +8,7 @@ import { discardRegExpRunner, getRegExpRunner } from "../../regExpRunners";
import { MINUTES, SECONDS } from "../../utils"; import { MINUTES, SECONDS } from "../../utils";
import { registerEventListenersFromMap } from "../../utils/registerEventListenersFromMap"; import { registerEventListenersFromMap } from "../../utils/registerEventListenersFromMap";
import { unregisterEventListenersFromMap } from "../../utils/unregisterEventListenersFromMap"; import { unregisterEventListenersFromMap } from "../../utils/unregisterEventListenersFromMap";
import { CommonPlugin } from "../Common/CommonPlugin";
import { CountersPlugin } from "../Counters/CountersPlugin"; import { CountersPlugin } from "../Counters/CountersPlugin";
import { InternalPosterPlugin } from "../InternalPoster/InternalPosterPlugin"; import { InternalPosterPlugin } from "../InternalPoster/InternalPosterPlugin";
import { LogsPlugin } from "../Logs/LogsPlugin"; import { LogsPlugin } from "../Logs/LogsPlugin";
@ -32,7 +33,6 @@ import { clearOldRecentNicknameChanges } from "./functions/clearOldNicknameChang
import { clearOldRecentActions } from "./functions/clearOldRecentActions"; import { clearOldRecentActions } from "./functions/clearOldRecentActions";
import { clearOldRecentSpam } from "./functions/clearOldRecentSpam"; import { clearOldRecentSpam } from "./functions/clearOldRecentSpam";
import { AutomodPluginType, zAutomodConfig } from "./types"; import { AutomodPluginType, zAutomodConfig } from "./types";
import { CommonPlugin } from "../Common/CommonPlugin";
const defaultOptions = { const defaultOptions = {
config: { config: {

View file

@ -9,6 +9,7 @@ import { GuildLogs } from "../../data/GuildLogs";
import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { GuildSavedMessages } from "../../data/GuildSavedMessages";
import { SavedMessage } from "../../data/entities/SavedMessage"; import { SavedMessage } from "../../data/entities/SavedMessage";
import { entries, zBoundedRecord, zDelayString } from "../../utils"; import { entries, zBoundedRecord, zDelayString } from "../../utils";
import { CommonPlugin } from "../Common/CommonPlugin";
import { CounterEvents } from "../Counters/types"; import { CounterEvents } from "../Counters/types";
import { ModActionType, ModActionsEvents } from "../ModActions/types"; import { ModActionType, ModActionsEvents } from "../ModActions/types";
import { MutesEvents } from "../Mutes/types"; import { MutesEvents } from "../Mutes/types";
@ -17,7 +18,6 @@ import { RecentActionType } from "./constants";
import { availableTriggers } from "./triggers/availableTriggers"; import { availableTriggers } from "./triggers/availableTriggers";
import Timeout = NodeJS.Timeout; import Timeout = NodeJS.Timeout;
import { CommonPlugin } from "../Common/CommonPlugin";
export type ZTriggersMapHelper = { export type ZTriggersMapHelper = {
[TriggerName in keyof typeof availableTriggers]: (typeof availableTriggers)[TriggerName]["configSchema"]; [TriggerName in keyof typeof availableTriggers]: (typeof availableTriggers)[TriggerName]["configSchema"];

View file

@ -2,7 +2,6 @@ import { ApiPermissions } from "@zeppelinbot/shared";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isStaffPreFilter } from "../../../pluginUtils"; import { isStaffPreFilter } from "../../../pluginUtils";
import { renderUsername } from "../../../utils"; import { renderUsername } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { botControlCmd } from "../types"; import { botControlCmd } from "../types";
export const AddDashboardUserCmd = botControlCmd({ export const AddDashboardUserCmd = botControlCmd({

View file

@ -2,7 +2,6 @@ import { ApiPermissions } from "@zeppelinbot/shared";
import moment from "moment-timezone"; import moment from "moment-timezone";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { DBDateFormat, isGuildInvite, resolveInvite } from "../../../utils"; import { DBDateFormat, isGuildInvite, resolveInvite } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { isEligible } from "../functions/isEligible"; import { isEligible } from "../functions/isEligible";
import { botControlCmd } from "../types"; import { botControlCmd } from "../types";

View file

@ -3,7 +3,6 @@ import moment from "moment-timezone";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isStaffPreFilter } from "../../../pluginUtils"; import { isStaffPreFilter } from "../../../pluginUtils";
import { DBDateFormat, isSnowflake } from "../../../utils"; import { DBDateFormat, isSnowflake } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { botControlCmd } from "../types"; import { botControlCmd } from "../types";
export const AllowServerCmd = botControlCmd({ export const AllowServerCmd = botControlCmd({

View file

@ -1,6 +1,5 @@
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isStaffPreFilter } from "../../../pluginUtils"; import { isStaffPreFilter } from "../../../pluginUtils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { botControlCmd } from "../types"; import { botControlCmd } from "../types";
export const ChannelToServerCmd = botControlCmd({ export const ChannelToServerCmd = botControlCmd({

View file

@ -2,7 +2,6 @@ import { Snowflake } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isStaffPreFilter } from "../../../pluginUtils"; import { isStaffPreFilter } from "../../../pluginUtils";
import { noop } from "../../../utils"; import { noop } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { botControlCmd } from "../types"; import { botControlCmd } from "../types";
export const DisallowServerCmd = botControlCmd({ export const DisallowServerCmd = botControlCmd({

View file

@ -1,6 +1,5 @@
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isGuildInvite, resolveInvite } from "../../../utils"; import { isGuildInvite, resolveInvite } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { isEligible } from "../functions/isEligible"; import { isEligible } from "../functions/isEligible";
import { botControlCmd } from "../types"; import { botControlCmd } from "../types";

View file

@ -1,7 +1,6 @@
import { Snowflake } from "discord.js"; import { Snowflake } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isStaffPreFilter } from "../../../pluginUtils"; import { isStaffPreFilter } from "../../../pluginUtils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { botControlCmd } from "../types"; import { botControlCmd } from "../types";
export const LeaveServerCmd = botControlCmd({ export const LeaveServerCmd = botControlCmd({

View file

@ -2,7 +2,6 @@ import { commandTypeHelpers as ct } from "../../../commandTypes";
import { AllowedGuild } from "../../../data/entities/AllowedGuild"; import { AllowedGuild } from "../../../data/entities/AllowedGuild";
import { ApiPermissionAssignment } from "../../../data/entities/ApiPermissionAssignment"; import { ApiPermissionAssignment } from "../../../data/entities/ApiPermissionAssignment";
import { renderUsername, resolveUser } from "../../../utils"; import { renderUsername, resolveUser } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { botControlCmd } from "../types"; import { botControlCmd } from "../types";
export const ListDashboardPermsCmd = botControlCmd({ export const ListDashboardPermsCmd = botControlCmd({

View file

@ -1,6 +1,5 @@
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { renderUsername, resolveUser } from "../../../utils"; import { renderUsername, resolveUser } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { botControlCmd } from "../types"; import { botControlCmd } from "../types";
export const ListDashboardUsersCmd = botControlCmd({ export const ListDashboardUsersCmd = botControlCmd({

View file

@ -2,7 +2,6 @@ import moment from "moment-timezone";
import { GuildArchives } from "../../../data/GuildArchives"; import { GuildArchives } from "../../../data/GuildArchives";
import { getBaseUrl } from "../../../pluginUtils"; import { getBaseUrl } from "../../../pluginUtils";
import { getRateLimitStats } from "../../../rateLimitStats"; import { getRateLimitStats } from "../../../rateLimitStats";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { botControlCmd } from "../types"; import { botControlCmd } from "../types";
export const RateLimitPerformanceCmd = botControlCmd({ export const RateLimitPerformanceCmd = botControlCmd({

View file

@ -1,5 +1,4 @@
import { isStaffPreFilter } from "../../../pluginUtils"; import { isStaffPreFilter } from "../../../pluginUtils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { getActiveReload, setActiveReload } from "../activeReload"; import { getActiveReload, setActiveReload } from "../activeReload";
import { botControlCmd } from "../types"; import { botControlCmd } from "../types";

View file

@ -1,7 +1,6 @@
import { Snowflake } from "discord.js"; import { Snowflake } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isStaffPreFilter } from "../../../pluginUtils"; import { isStaffPreFilter } from "../../../pluginUtils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { botControlCmd } from "../types"; import { botControlCmd } from "../types";
export const ReloadServerCmd = botControlCmd({ export const ReloadServerCmd = botControlCmd({

View file

@ -1,7 +1,6 @@
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isStaffPreFilter } from "../../../pluginUtils"; import { isStaffPreFilter } from "../../../pluginUtils";
import { renderUsername } from "../../../utils"; import { renderUsername } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { botControlCmd } from "../types"; import { botControlCmd } from "../types";
export const RemoveDashboardUserCmd = botControlCmd({ export const RemoveDashboardUserCmd = botControlCmd({
@ -37,8 +36,6 @@ export const RemoveDashboardUserCmd = botControlCmd({
const userNameList = args.users.map((user) => `<@!${user.id}> (**${renderUsername(user)}**, \`${user.id}\`)`); const userNameList = args.users.map((user) => `<@!${user.id}> (**${renderUsername(user)}**, \`${user.id}\`)`);
msg.channel.send( msg.channel.send(`The following users were removed from the dashboard for **${guild.name}**:\n\n${userNameList}`);
`The following users were removed from the dashboard for **${guild.name}**:\n\n${userNameList}`,
);
}, },
}); });

View file

@ -1,4 +1,4 @@
import { BasePluginType, globalPluginEventListener, globalPluginMessageCommand, pluginUtils } from "knub"; import { BasePluginType, globalPluginEventListener, globalPluginMessageCommand } from "knub";
import z from "zod"; import z from "zod";
import { AllowedGuilds } from "../../data/AllowedGuilds"; import { AllowedGuilds } from "../../data/AllowedGuilds";
import { ApiPermissionAssignments } from "../../data/ApiPermissionAssignments"; import { ApiPermissionAssignments } from "../../data/ApiPermissionAssignments";

View file

@ -1,9 +1,9 @@
import { guildPlugin } from "knub"; import { guildPlugin } from "knub";
import z from "zod"; import z from "zod";
import { CommonPlugin } from "../Common/CommonPlugin";
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin"; import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin";
import { ArchiveChannelCmd } from "./commands/ArchiveChannelCmd"; import { ArchiveChannelCmd } from "./commands/ArchiveChannelCmd";
import { ChannelArchiverPluginType } from "./types"; import { ChannelArchiverPluginType } from "./types";
import { CommonPlugin } from "../Common/CommonPlugin";
export const ChannelArchiverPlugin = guildPlugin<ChannelArchiverPluginType>()({ export const ChannelArchiverPlugin = guildPlugin<ChannelArchiverPluginType>()({
name: "channel_archiver", name: "channel_archiver",
@ -18,5 +18,5 @@ export const ChannelArchiverPlugin = guildPlugin<ChannelArchiverPluginType>()({
beforeStart(pluginData) { beforeStart(pluginData) {
pluginData.state.common = pluginData.getPlugin(CommonPlugin); pluginData.state.common = pluginData.getPlugin(CommonPlugin);
} },
}); });

View file

@ -3,7 +3,6 @@ import moment from "moment-timezone";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { isOwner } from "../../../pluginUtils"; import { isOwner } from "../../../pluginUtils";
import { SECONDS, confirm, noop, renderUsername } from "../../../utils"; import { SECONDS, confirm, noop, renderUsername } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin"; import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { rehostAttachment } from "../rehostAttachment"; import { rehostAttachment } from "../rehostAttachment";
import { channelArchiverCmd } from "../types"; import { channelArchiverCmd } from "../types";

View file

@ -4,7 +4,7 @@ import { CommonPlugin } from "../Common/CommonPlugin";
export interface ChannelArchiverPluginType extends BasePluginType { export interface ChannelArchiverPluginType extends BasePluginType {
state: { state: {
common: pluginUtils.PluginPublicInterface<typeof CommonPlugin>; common: pluginUtils.PluginPublicInterface<typeof CommonPlugin>;
} };
} }
export const channelArchiverCmd = guildPluginMessageCommand<ChannelArchiverPluginType>(); export const channelArchiverCmd = guildPluginMessageCommand<ChannelArchiverPluginType>();

View file

@ -139,7 +139,7 @@ export const CommonPlugin = guildPlugin<CommonPluginType>()({
if (!channel) { if (!channel) {
throw new Error( 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<CommonPluginType>()({
files: attachments.map((a) => a.url), files: attachments.map((a) => a.url),
}); });
}, },
} };
}, },
}); });

View file

@ -9,11 +9,11 @@ import {
} from "discord.js"; } from "discord.js";
import humanizeDuration from "humanize-duration"; import humanizeDuration from "humanize-duration";
import { GuildPluginData } from "knub"; import { GuildPluginData } from "knub";
import { canActOn } from "../../../pluginUtils";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { logger } from "../../../logger"; import { logger } from "../../../logger";
import { canActOn } from "../../../pluginUtils";
import { convertDelayStringToMS, renderUserUsername } from "../../../utils"; import { convertDelayStringToMS, renderUserUsername } from "../../../utils";
import { CaseArgs } from "../../Cases/types"; import { CaseArgs } from "../../Cases/types";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { MODAL_TIMEOUT } from "../commands/ModMenuUserCtxCmd"; import { MODAL_TIMEOUT } from "../commands/ModMenuUserCtxCmd";
import { ContextMenuPluginType, ModMenuActionType } from "../types"; import { ContextMenuPluginType, ModMenuActionType } from "../types";
import { updateAction } from "./update"; import { updateAction } from "./update";

View file

@ -8,13 +8,13 @@ import {
TextInputStyle, TextInputStyle,
} from "discord.js"; } from "discord.js";
import { GuildPluginData } from "knub"; import { GuildPluginData } from "knub";
import { canActOn } from "../../../pluginUtils";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { CaseTypes } from "../../../data/CaseTypes"; import { CaseTypes } from "../../../data/CaseTypes";
import { logger } from "../../../logger"; import { logger } from "../../../logger";
import { canActOn } from "../../../pluginUtils";
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin"; import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin";
import { renderUserUsername } from "../../../utils"; import { renderUserUsername } from "../../../utils";
import { LogsPlugin } from "../../Logs/LogsPlugin"; import { LogsPlugin } from "../../Logs/LogsPlugin";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { MODAL_TIMEOUT } from "../commands/ModMenuUserCtxCmd"; import { MODAL_TIMEOUT } from "../commands/ModMenuUserCtxCmd";
import { ContextMenuPluginType, ModMenuActionType } from "../types"; import { ContextMenuPluginType, ModMenuActionType } from "../types";

View file

@ -8,11 +8,11 @@ import {
TextInputStyle, TextInputStyle,
} from "discord.js"; } from "discord.js";
import { GuildPluginData } from "knub"; import { GuildPluginData } from "knub";
import { canActOn } from "../../../pluginUtils";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { logger } from "../../../logger"; import { logger } from "../../../logger";
import { canActOn } from "../../../pluginUtils";
import { renderUserUsername } from "../../../utils"; import { renderUserUsername } from "../../../utils";
import { CaseArgs } from "../../Cases/types"; import { CaseArgs } from "../../Cases/types";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { MODAL_TIMEOUT } from "../commands/ModMenuUserCtxCmd"; import { MODAL_TIMEOUT } from "../commands/ModMenuUserCtxCmd";
import { ContextMenuPluginType, ModMenuActionType } from "../types"; import { ContextMenuPluginType, ModMenuActionType } from "../types";
import { updateAction } from "./update"; import { updateAction } from "./update";

View file

@ -12,13 +12,12 @@ import {
import { GuildPluginData, guildPluginUserContextMenuCommand } from "knub"; import { GuildPluginData, guildPluginUserContextMenuCommand } from "knub";
import { Case } from "../../../data/entities/Case"; import { Case } from "../../../data/entities/Case";
import { logger } from "../../../logger"; import { logger } from "../../../logger";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { SECONDS, UnknownUser, emptyEmbedValue, renderUserUsername, resolveUser, trimLines } from "../../../utils"; import { SECONDS, UnknownUser, emptyEmbedValue, renderUserUsername, resolveUser, trimLines } from "../../../utils";
import { asyncMap } from "../../../utils/async"; import { asyncMap } from "../../../utils/async";
import { getChunkedEmbedFields } from "../../../utils/getChunkedEmbedFields"; import { getChunkedEmbedFields } from "../../../utils/getChunkedEmbedFields";
import { getGuildPrefix } from "../../../utils/getGuildPrefix"; import { getGuildPrefix } from "../../../utils/getGuildPrefix";
import { CasesPlugin } from "../../Cases/CasesPlugin"; import { CasesPlugin } from "../../Cases/CasesPlugin";
import { UtilityPlugin } from "../../Utility/UtilityPlugin"; import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { getUserInfoEmbed } from "../../Utility/functions/getUserInfoEmbed"; import { getUserInfoEmbed } from "../../Utility/functions/getUserInfoEmbed";
import { launchBanActionModal } from "../actions/ban"; import { launchBanActionModal } from "../actions/ban";
import { launchMuteActionModal } from "../actions/mute"; import { launchMuteActionModal } from "../actions/mute";

View file

@ -4,6 +4,7 @@ import { GuildCounters } from "../../data/GuildCounters";
import { CounterTrigger, parseCounterConditionString } from "../../data/entities/CounterTrigger"; import { CounterTrigger, parseCounterConditionString } from "../../data/entities/CounterTrigger";
import { makePublicFn } from "../../pluginUtils"; import { makePublicFn } from "../../pluginUtils";
import { MINUTES, convertDelayStringToMS, values } from "../../utils"; import { MINUTES, convertDelayStringToMS, values } from "../../utils";
import { CommonPlugin } from "../Common/CommonPlugin";
import { AddCounterCmd } from "./commands/AddCounterCmd"; import { AddCounterCmd } from "./commands/AddCounterCmd";
import { CountersListCmd } from "./commands/CountersListCmd"; import { CountersListCmd } from "./commands/CountersListCmd";
import { ResetAllCounterValuesCmd } from "./commands/ResetAllCounterValuesCmd"; import { ResetAllCounterValuesCmd } from "./commands/ResetAllCounterValuesCmd";
@ -19,7 +20,6 @@ import { offCounterEvent } from "./functions/offCounterEvent";
import { onCounterEvent } from "./functions/onCounterEvent"; import { onCounterEvent } from "./functions/onCounterEvent";
import { setCounterValue } from "./functions/setCounterValue"; import { setCounterValue } from "./functions/setCounterValue";
import { CountersPluginType, zCountersConfig } from "./types"; import { CountersPluginType, zCountersConfig } from "./types";
import { CommonPlugin } from "../Common/CommonPlugin";
const DECAY_APPLY_INTERVAL = 5 * MINUTES; const DECAY_APPLY_INTERVAL = 5 * MINUTES;

View file

@ -3,7 +3,6 @@ import { guildPluginMessageCommand } from "knub";
import { waitForReply } from "knub/helpers"; import { waitForReply } from "knub/helpers";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { UnknownUser, resolveUser } from "../../../utils"; import { UnknownUser, resolveUser } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { changeCounterValue } from "../functions/changeCounterValue"; import { changeCounterValue } from "../functions/changeCounterValue";
import { CountersPluginType } from "../types"; import { CountersPluginType } from "../types";

View file

@ -1,7 +1,6 @@
import { guildPluginMessageCommand } from "knub"; import { guildPluginMessageCommand } from "knub";
import { trimMultilineString, ucfirst } from "../../../utils"; import { trimMultilineString, ucfirst } from "../../../utils";
import { getGuildPrefix } from "../../../utils/getGuildPrefix"; import { getGuildPrefix } from "../../../utils/getGuildPrefix";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { CountersPluginType } from "../types"; import { CountersPluginType } from "../types";
export const CountersListCmd = guildPluginMessageCommand<CountersPluginType>()({ export const CountersListCmd = guildPluginMessageCommand<CountersPluginType>()({

View file

@ -1,7 +1,6 @@
import { guildPluginMessageCommand } from "knub"; import { guildPluginMessageCommand } from "knub";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { confirm, noop, trimMultilineString } from "../../../utils"; import { confirm, noop, trimMultilineString } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { resetAllCounterValues } from "../functions/resetAllCounterValues"; import { resetAllCounterValues } from "../functions/resetAllCounterValues";
import { CountersPluginType } from "../types"; import { CountersPluginType } from "../types";
@ -23,7 +22,10 @@ export const ResetAllCounterValuesCmd = guildPluginMessageCommand<CountersPlugin
} }
if (counter.can_reset_all === false) { if (counter.can_reset_all === false) {
void pluginData.state.common.sendErrorMessage(message, `Missing permissions to reset all of this counter's values`); void pluginData.state.common.sendErrorMessage(
message,
`Missing permissions to reset all of this counter's values`,
);
return; return;
} }
@ -47,7 +49,10 @@ export const ResetAllCounterValuesCmd = guildPluginMessageCommand<CountersPlugin
await resetAllCounterValues(pluginData, args.counterName); await resetAllCounterValues(pluginData, args.counterName);
loadingMessage?.delete().catch(noop); loadingMessage?.delete().catch(noop);
void pluginData.state.common.sendSuccessMessage(message, `All counter values for **${counterName}** have been reset`); void pluginData.state.common.sendSuccessMessage(
message,
`All counter values for **${counterName}** have been reset`,
);
pluginData.getKnubInstance().reloadGuild(pluginData.guild.id); pluginData.getKnubInstance().reloadGuild(pluginData.guild.id);
}, },

View file

@ -3,7 +3,6 @@ import { guildPluginMessageCommand } from "knub";
import { waitForReply } from "knub/helpers"; import { waitForReply } from "knub/helpers";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { UnknownUser, resolveUser } from "../../../utils"; import { UnknownUser, resolveUser } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { setCounterValue } from "../functions/setCounterValue"; import { setCounterValue } from "../functions/setCounterValue";
import { CountersPluginType } from "../types"; import { CountersPluginType } from "../types";

View file

@ -3,7 +3,6 @@ import { guildPluginMessageCommand } from "knub";
import { waitForReply } from "knub/helpers"; import { waitForReply } from "knub/helpers";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { UnknownUser, resolveUser } from "../../../utils"; import { UnknownUser, resolveUser } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { setCounterValue } from "../functions/setCounterValue"; import { setCounterValue } from "../functions/setCounterValue";
import { CountersPluginType } from "../types"; import { CountersPluginType } from "../types";

View file

@ -3,7 +3,6 @@ import { guildPluginMessageCommand } from "knub";
import { waitForReply } from "knub/helpers"; import { waitForReply } from "knub/helpers";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { resolveUser, UnknownUser } from "../../../utils"; import { resolveUser, UnknownUser } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { CountersPluginType } from "../types"; import { CountersPluginType } from "../types";
export const ViewCounterCmd = guildPluginMessageCommand<CountersPluginType>()({ export const ViewCounterCmd = guildPluginMessageCommand<CountersPluginType>()({

View file

@ -9,8 +9,8 @@ import {
parseCounterConditionString, parseCounterConditionString,
} from "../../data/entities/CounterTrigger"; } from "../../data/entities/CounterTrigger";
import { zBoundedCharacters, zBoundedRecord, zDelayString } from "../../utils"; import { zBoundedCharacters, zBoundedRecord, zDelayString } from "../../utils";
import Timeout = NodeJS.Timeout;
import { CommonPlugin } from "../Common/CommonPlugin"; import { CommonPlugin } from "../Common/CommonPlugin";
import Timeout = NodeJS.Timeout;
const MAX_COUNTERS = 5; const MAX_COUNTERS = 5;
const MAX_TRIGGERS_PER_COUNTER = 5; const MAX_TRIGGERS_PER_COUNTER = 5;

View file

@ -11,10 +11,10 @@ import {
messageToTemplateSafeMessage, messageToTemplateSafeMessage,
userToTemplateSafeUser, userToTemplateSafeUser,
} from "../../utils/templateSafeObjects"; } from "../../utils/templateSafeObjects";
import { CommonPlugin } from "../Common/CommonPlugin";
import { LogsPlugin } from "../Logs/LogsPlugin"; import { LogsPlugin } from "../Logs/LogsPlugin";
import { runEvent } from "./functions/runEvent"; import { runEvent } from "./functions/runEvent";
import { CustomEventsPluginType, zCustomEventsConfig } from "./types"; import { CustomEventsPluginType, zCustomEventsConfig } from "./types";
import { CommonPlugin } from "../Common/CommonPlugin";
const defaultOptions = { const defaultOptions = {
config: { config: {

View file

@ -1,7 +1,6 @@
import { Message } from "discord.js"; import { Message } from "discord.js";
import { GuildPluginData } from "knub"; import { GuildPluginData } from "knub";
import { TemplateSafeValueContainer } from "../../../templateFormatter"; import { TemplateSafeValueContainer } from "../../../templateFormatter";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { ActionError } from "../ActionError"; import { ActionError } from "../ActionError";
import { addRoleAction } from "../actions/addRoleAction"; import { addRoleAction } from "../actions/addRoleAction";
import { createCaseAction } from "../actions/createCaseAction"; import { createCaseAction } from "../actions/createCaseAction";

View file

@ -1,6 +1,7 @@
import { BasePluginType, pluginUtils } from "knub"; import { BasePluginType, pluginUtils } from "knub";
import z from "zod"; import z from "zod";
import { zBoundedCharacters, zBoundedRecord } from "../../utils"; import { zBoundedCharacters, zBoundedRecord } from "../../utils";
import { CommonPlugin } from "../Common/CommonPlugin";
import { zAddRoleAction } from "./actions/addRoleAction"; import { zAddRoleAction } from "./actions/addRoleAction";
import { zCreateCaseAction } from "./actions/createCaseAction"; import { zCreateCaseAction } from "./actions/createCaseAction";
import { zMakeRoleMentionableAction } from "./actions/makeRoleMentionableAction"; import { zMakeRoleMentionableAction } from "./actions/makeRoleMentionableAction";
@ -8,7 +9,6 @@ import { zMakeRoleUnmentionableAction } from "./actions/makeRoleUnmentionableAct
import { zMessageAction } from "./actions/messageAction"; import { zMessageAction } from "./actions/messageAction";
import { zMoveToVoiceChannelAction } from "./actions/moveToVoiceChannelAction"; import { zMoveToVoiceChannelAction } from "./actions/moveToVoiceChannelAction";
import { zSetChannelPermissionOverridesAction } from "./actions/setChannelPermissionOverrides"; import { zSetChannelPermissionOverridesAction } from "./actions/setChannelPermissionOverrides";
import { CommonPlugin } from "../Common/CommonPlugin";
const zCommandTrigger = z.strictObject({ const zCommandTrigger = z.strictObject({
type: z.literal("command"), type: z.literal("command"),

View file

@ -1,6 +1,7 @@
import { PluginOptions, guildPlugin } from "knub"; import { PluginOptions, guildPlugin } from "knub";
import { onGuildEvent } from "../../data/GuildEvents"; import { onGuildEvent } from "../../data/GuildEvents";
import { GuildVCAlerts } from "../../data/GuildVCAlerts"; import { GuildVCAlerts } from "../../data/GuildVCAlerts";
import { CommonPlugin } from "../Common/CommonPlugin";
import { FollowCmd } from "./commands/FollowCmd"; import { FollowCmd } from "./commands/FollowCmd";
import { DeleteFollowCmd, ListFollowCmd } from "./commands/ListFollowCmd"; import { DeleteFollowCmd, ListFollowCmd } from "./commands/ListFollowCmd";
import { WhereCmd } from "./commands/WhereCmd"; import { WhereCmd } from "./commands/WhereCmd";
@ -9,7 +10,6 @@ import { VoiceStateUpdateAlertEvt } from "./events/SendAlertsEvts";
import { LocateUserPluginType, zLocateUserConfig } from "./types"; import { LocateUserPluginType, zLocateUserConfig } from "./types";
import { clearExpiredAlert } from "./utils/clearExpiredAlert"; import { clearExpiredAlert } from "./utils/clearExpiredAlert";
import { fillActiveAlertsList } from "./utils/fillAlertsList"; import { fillActiveAlertsList } from "./utils/fillAlertsList";
import { CommonPlugin } from "../Common/CommonPlugin";
const defaultOptions: PluginOptions<LocateUserPluginType> = { const defaultOptions: PluginOptions<LocateUserPluginType> = {
config: { config: {

View file

@ -3,7 +3,6 @@ import moment from "moment-timezone";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { registerExpiringVCAlert } from "../../../data/loops/expiringVCAlertsLoop"; import { registerExpiringVCAlert } from "../../../data/loops/expiringVCAlertsLoop";
import { MINUTES, SECONDS } from "../../../utils"; import { MINUTES, SECONDS } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { locateUserCmd } from "../types"; import { locateUserCmd } from "../types";
export const FollowCmd = locateUserCmd({ export const FollowCmd = locateUserCmd({
@ -47,18 +46,16 @@ export const FollowCmd = locateUserCmd({
if (active) { if (active) {
void pluginData.state.common.sendSuccessMessage( void pluginData.state.common.sendSuccessMessage(
msg, msg,
`Every time <@${args.member.id}> joins or switches VC in the next ${humanizeDuration( `Every time <@${args.member.id}> joins or switches VC in the next ${humanizeDuration(
time, time,
)} i will notify and move you.\nPlease make sure to be in a voice channel, otherwise i cannot move you!`, )} i will notify and move you.\nPlease make sure to be in a voice channel, otherwise i cannot move you!`,
); );
} else { } else {
void pluginData.state.common.sendSuccessMessage( void pluginData.state.common.sendSuccessMessage(
msg, msg,
`Every time <@${args.member.id}> joins or switches VC in the next ${humanizeDuration( `Every time <@${args.member.id}> joins or switches VC in the next ${humanizeDuration(time)} i will notify you`,
time, );
)} i will notify you`,
);
} }
}, },
}); });

View file

@ -1,7 +1,6 @@
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { clearExpiringVCAlert } from "../../../data/loops/expiringVCAlertsLoop"; import { clearExpiringVCAlert } from "../../../data/loops/expiringVCAlertsLoop";
import { createChunkedMessage, sorter } from "../../../utils"; import { createChunkedMessage, sorter } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { locateUserCmd } from "../types"; import { locateUserCmd } from "../types";
export const ListFollowCmd = locateUserCmd({ export const ListFollowCmd = locateUserCmd({

View file

@ -1,6 +1,5 @@
import { GuildMember, GuildTextBasedChannel, Snowflake } from "discord.js"; import { GuildMember, GuildTextBasedChannel, Snowflake } from "discord.js";
import { GuildPluginData } from "knub"; import { GuildPluginData } from "knub";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { LocateUserPluginType } from "../types"; import { LocateUserPluginType } from "../types";
export async function moveMember( export async function moveMember(

View file

@ -1,7 +1,6 @@
import { GuildMember, GuildTextBasedChannel, Invite, VoiceChannel } from "discord.js"; import { GuildMember, GuildTextBasedChannel, Invite, VoiceChannel } from "discord.js";
import { GuildPluginData } from "knub"; import { GuildPluginData } from "knub";
import { getInviteLink } from "knub/helpers"; import { getInviteLink } from "knub/helpers";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { LocateUserPluginType } from "../types"; import { LocateUserPluginType } from "../types";
import { createOrReuseInvite } from "./createOrReuseInvite"; import { createOrReuseInvite } from "./createOrReuseInvite";

View file

@ -1,10 +1,10 @@
import { PluginOptions, guildPlugin } from "knub"; import { PluginOptions, guildPlugin } from "knub";
import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { GuildSavedMessages } from "../../data/GuildSavedMessages";
import { CommonPlugin } from "../Common/CommonPlugin";
import { SaveMessagesToDBCmd } from "./commands/SaveMessagesToDB"; import { SaveMessagesToDBCmd } from "./commands/SaveMessagesToDB";
import { SavePinsToDBCmd } from "./commands/SavePinsToDB"; import { SavePinsToDBCmd } from "./commands/SavePinsToDB";
import { MessageCreateEvt, MessageDeleteBulkEvt, MessageDeleteEvt, MessageUpdateEvt } from "./events/SaveMessagesEvts"; import { MessageCreateEvt, MessageDeleteBulkEvt, MessageDeleteEvt, MessageUpdateEvt } from "./events/SaveMessagesEvts";
import { MessageSaverPluginType, zMessageSaverConfig } from "./types"; import { MessageSaverPluginType, zMessageSaverConfig } from "./types";
import { CommonPlugin } from "../Common/CommonPlugin";
const defaultOptions: PluginOptions<MessageSaverPluginType> = { const defaultOptions: PluginOptions<MessageSaverPluginType> = {
config: { config: {

View file

@ -1,5 +1,4 @@
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { saveMessagesToDB } from "../saveMessagesToDB"; import { saveMessagesToDB } from "../saveMessagesToDB";
import { messageSaverCmd } from "../types"; import { messageSaverCmd } from "../types";
@ -19,9 +18,9 @@ export const SaveMessagesToDBCmd = messageSaverCmd({
if (failed.length) { if (failed.length) {
void pluginData.state.common.sendSuccessMessage( void pluginData.state.common.sendSuccessMessage(
msg, msg,
`Saved ${savedCount} messages. The following messages could not be saved: ${failed.join(", ")}`, `Saved ${savedCount} messages. The following messages could not be saved: ${failed.join(", ")}`,
); );
} else { } else {
void pluginData.state.common.sendSuccessMessage(msg, `Saved ${savedCount} messages!`); void pluginData.state.common.sendSuccessMessage(msg, `Saved ${savedCount} messages!`);
} }

View file

@ -1,5 +1,4 @@
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { saveMessagesToDB } from "../saveMessagesToDB"; import { saveMessagesToDB } from "../saveMessagesToDB";
import { messageSaverCmd } from "../types"; import { messageSaverCmd } from "../types";
@ -20,9 +19,9 @@ export const SavePinsToDBCmd = messageSaverCmd({
if (failed.length) { if (failed.length) {
void pluginData.state.common.sendSuccessMessage( void pluginData.state.common.sendSuccessMessage(
msg, msg,
`Saved ${savedCount} messages. The following messages could not be saved: ${failed.join(", ")}`, `Saved ${savedCount} messages. The following messages could not be saved: ${failed.join(", ")}`,
); );
} else { } else {
void pluginData.state.common.sendSuccessMessage(msg, `Saved ${savedCount} messages!`); void pluginData.state.common.sendSuccessMessage(msg, `Saved ${savedCount} messages!`);
} }

View file

@ -10,6 +10,7 @@ import { GuildTempbans } from "../../data/GuildTempbans";
import { makePublicFn, mapToPublicFn } from "../../pluginUtils"; import { makePublicFn, mapToPublicFn } from "../../pluginUtils";
import { MINUTES } from "../../utils"; import { MINUTES } from "../../utils";
import { CasesPlugin } from "../Cases/CasesPlugin"; import { CasesPlugin } from "../Cases/CasesPlugin";
import { CommonPlugin } from "../Common/CommonPlugin";
import { LogsPlugin } from "../Logs/LogsPlugin"; import { LogsPlugin } from "../Logs/LogsPlugin";
import { MutesPlugin } from "../Mutes/MutesPlugin"; import { MutesPlugin } from "../Mutes/MutesPlugin";
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin"; import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin";
@ -72,7 +73,6 @@ import { onModActionsEvent } from "./functions/onModActionsEvent";
import { updateCase } from "./functions/updateCase"; import { updateCase } from "./functions/updateCase";
import { warnMember } from "./functions/warnMember"; import { warnMember } from "./functions/warnMember";
import { AttachmentLinkReactionType, ModActionsPluginType, modActionsSlashGroup, zModActionsConfig } from "./types"; import { AttachmentLinkReactionType, ModActionsPluginType, modActionsSlashGroup, zModActionsConfig } from "./types";
import { CommonPlugin } from "../Common/CommonPlugin";
const defaultOptions = { const defaultOptions = {
config: { config: {

View file

@ -2,8 +2,8 @@ import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { CaseTypes } from "../../../../data/CaseTypes"; import { CaseTypes } from "../../../../data/CaseTypes";
import { hasPermission } from "../../../../pluginUtils"; import { hasPermission } from "../../../../pluginUtils";
import { resolveUser } from "../../../../utils"; import { resolveUser } from "../../../../utils";
import { actualAddCaseCmd } from "./actualAddCaseCmd";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualAddCaseCmd } from "./actualAddCaseCmd";
const opts = { const opts = {
mod: ct.member({ option: true }), mod: ct.member({ option: true }),

View file

@ -4,9 +4,9 @@ import { CaseTypes } from "../../../../data/CaseTypes";
import { hasPermission } from "../../../../pluginUtils"; import { hasPermission } from "../../../../pluginUtils";
import { resolveMember } from "../../../../utils"; import { resolveMember } from "../../../../utils";
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
import { actualAddCaseCmd } from "./actualAddCaseCmd";
import { modActionsSlashCmd } from "../../types"; import { modActionsSlashCmd } from "../../types";
import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants";
import { actualAddCaseCmd } from "./actualAddCaseCmd";
const opts = [ const opts = [
slashOptions.string({ name: "reason", description: "The reason", required: false }), slashOptions.string({ name: "reason", description: "The reason", required: false }),
@ -48,10 +48,7 @@ export const AddCaseSlashCmd = modActionsSlashCmd({
if (options.mod) { if (options.mod) {
if (!canActAsOther) { if (!canActAsOther) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "You don't have permission to act as another moderator");
interaction,
"You don't have permission to act as another moderator"
);
return; return;
} }

View file

@ -6,9 +6,9 @@ import { canActOn } from "../../../../pluginUtils";
import { UnknownUser, renderUsername, resolveMember } from "../../../../utils"; import { UnknownUser, renderUsername, resolveMember } from "../../../../utils";
import { CasesPlugin } from "../../../Cases/CasesPlugin"; import { CasesPlugin } from "../../../Cases/CasesPlugin";
import { LogsPlugin } from "../../../Logs/LogsPlugin"; import { LogsPlugin } from "../../../Logs/LogsPlugin";
import { ModActionsPluginType } from "../../types";
import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction";
import { formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; import { formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments";
import { ModActionsPluginType } from "../../types";
export async function actualAddCaseCmd( export async function actualAddCaseCmd(
pluginData: GuildPluginData<ModActionsPluginType>, pluginData: GuildPluginData<ModActionsPluginType>,
@ -27,10 +27,7 @@ export async function actualAddCaseCmd(
// If the user exists as a guild member, make sure we can act on them first // 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); const member = await resolveMember(pluginData.client, pluginData.guild, user.id);
if (member && !canActOn(pluginData, author, member)) { if (member && !canActOn(pluginData, author, member)) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(context, "Cannot add case on this user: insufficient permissions");
context,
"Cannot add case on this user: insufficient permissions"
);
return; return;
} }
@ -49,7 +46,7 @@ export async function actualAddCaseCmd(
if (user) { if (user) {
pluginData.state.common.sendSuccessMessage( pluginData.state.common.sendSuccessMessage(
context, context,
`Case #${theCase.case_number} created for **${renderUsername(user)}**` `Case #${theCase.case_number} created for **${renderUsername(user)}**`,
); );
} else { } else {
pluginData.state.common.sendSuccessMessage(context, `Case #${theCase.case_number} created`); pluginData.state.common.sendSuccessMessage(context, `Case #${theCase.case_number} created`);

View file

@ -1,9 +1,9 @@
import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { hasPermission } from "../../../../pluginUtils"; import { hasPermission } from "../../../../pluginUtils";
import { UserNotificationMethod, resolveUser } from "../../../../utils"; import { UserNotificationMethod, resolveUser } from "../../../../utils";
import { actualBanCmd } from "./actualBanCmd";
import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualBanCmd } from "./actualBanCmd";
const opts = { const opts = {
mod: ct.member({ option: true }), mod: ct.member({ option: true }),

View file

@ -3,10 +3,10 @@ import { slashOptions } from "knub";
import { hasPermission } from "../../../../pluginUtils"; import { hasPermission } from "../../../../pluginUtils";
import { UserNotificationMethod, convertDelayStringToMS, resolveMember } from "../../../../utils"; import { UserNotificationMethod, convertDelayStringToMS, resolveMember } from "../../../../utils";
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
import { actualBanCmd } from "./actualBanCmd";
import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs";
import { modActionsSlashCmd } from "../../types"; import { modActionsSlashCmd } from "../../types";
import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants";
import { actualBanCmd } from "./actualBanCmd";
const opts = [ const opts = [
slashOptions.string({ name: "time", description: "The duration of the ban", required: false }), 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"); const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true);
interaction,
"Text or attachment required",
undefined,
undefined,
true
);
return; return;
} }
@ -70,10 +64,7 @@ export const BanSlashCmd = modActionsSlashCmd({
if (options.mod) { if (options.mod) {
if (!canActAsOther) { if (!canActAsOther) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "You don't have permission to act as another moderator");
interaction,
"You don't have permission to act as another moderator"
);
return; return;
} }

View file

@ -10,11 +10,14 @@ import { banLock } from "../../../../utils/lockNameHelpers";
import { waitForButtonConfirm } from "../../../../utils/waitForInteraction"; import { waitForButtonConfirm } from "../../../../utils/waitForInteraction";
import { CasesPlugin } from "../../../Cases/CasesPlugin"; import { CasesPlugin } from "../../../Cases/CasesPlugin";
import { LogsPlugin } from "../../../Logs/LogsPlugin"; import { LogsPlugin } from "../../../Logs/LogsPlugin";
import { ModActionsPluginType } from "../../types";
import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction";
import { banUserId } from "../../functions/banUserId"; import { banUserId } from "../../functions/banUserId";
import { formatReasonWithAttachments, formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; import {
formatReasonWithAttachments,
formatReasonWithMessageLinkForAttachments,
} from "../../functions/formatReasonForAttachments";
import { isBanned } from "../../functions/isBanned"; import { isBanned } from "../../functions/isBanned";
import { ModActionsPluginType } from "../../types";
export async function actualBanCmd( export async function actualBanCmd(
pluginData: GuildPluginData<ModActionsPluginType>, pluginData: GuildPluginData<ModActionsPluginType>,
@ -74,10 +77,7 @@ export async function actualBanCmd(
); );
if (!reply) { if (!reply) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(context, "User already banned, update cancelled by moderator");
context,
"User already banned, update cancelled by moderator"
);
lock.unlock(); lock.unlock();
return; return;
} }
@ -123,9 +123,9 @@ export async function actualBanCmd(
} }
pluginData.state.common.sendSuccessMessage( pluginData.state.common.sendSuccessMessage(
context, context,
`Ban updated to ${time ? "expire in " + humanizeDuration(time) + " from now" : "indefinite"}`, `Ban updated to ${time ? "expire in " + humanizeDuration(time) + " from now" : "indefinite"}`,
); );
lock.unlock(); lock.unlock();
return; return;
} }
@ -138,7 +138,7 @@ export async function actualBanCmd(
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(
context, context,
`Cannot ban: target permission level is equal or higher to yours, ${targetLevel} >= ${ourLevel}`, `Cannot ban: target permission level is equal or higher to yours, ${targetLevel} >= ${ourLevel}`,
); );
lock.unlock(); lock.unlock();
return; return;
} }

View file

@ -1,6 +1,6 @@
import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { actualCaseCmd } from "./actualCaseCmd";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualCaseCmd } from "./actualCaseCmd";
const opts = { const opts = {
show: ct.switchOption({ def: false, shortcut: "sh" }), show: ct.switchOption({ def: false, shortcut: "sh" }),

View file

@ -1,6 +1,6 @@
import { slashOptions } from "knub"; import { slashOptions } from "knub";
import { actualCaseCmd } from "./actualCaseCmd";
import { modActionsSlashCmd } from "../../types"; import { modActionsSlashCmd } from "../../types";
import { actualCaseCmd } from "./actualCaseCmd";
const opts = [ const opts = [
slashOptions.boolean({ name: "show", description: "To make the result visible to everyone", required: false }), slashOptions.boolean({ name: "show", description: "To make the result visible to everyone", required: false }),

View file

@ -1,6 +1,6 @@
import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { actualCasesCmd } from "./actualCasesCmd";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualCasesCmd } from "./actualCasesCmd";
const opts = { const opts = {
mod: ct.userId({ option: true }), mod: ct.userId({ option: true }),

View file

@ -1,7 +1,7 @@
import { GuildMember } from "discord.js"; import { GuildMember } from "discord.js";
import { slashOptions } from "knub"; import { slashOptions } from "knub";
import { actualCasesCmd } from "./actualCasesCmd";
import { modActionsSlashCmd } from "../../types"; import { modActionsSlashCmd } from "../../types";
import { actualCasesCmd } from "./actualCasesCmd";
const opts = [ const opts = [
slashOptions.user({ name: "user", description: "The user to show cases for", required: false }), slashOptions.user({ name: "user", description: "The user to show cases for", required: false }),

View file

@ -1,7 +1,7 @@
import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { resolveMember, resolveUser, UnknownUser } from "../../../../utils"; import { resolveMember, resolveUser, UnknownUser } from "../../../../utils";
import { actualCasesCmd } from "./actualCasesCmd";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualCasesCmd } from "./actualCasesCmd";
const opts = { const opts = {
mod: ct.userId({ option: true }), mod: ct.userId({ option: true }),

View file

@ -159,13 +159,7 @@ async function casesModCmd(
const totalCases = await casesPlugin.getTotalCasesByMod(modId ?? author.id, casesFilters); const totalCases = await casesPlugin.getTotalCasesByMod(modId ?? author.id, casesFilters);
if (totalCases === 0) { if (totalCases === 0) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(context, `No cases by **${modName}**`, undefined, undefined, !show);
context,
`No cases by **${modName}**`,
undefined,
undefined,
!show
);
return; return;
} }

View file

@ -1,7 +1,7 @@
import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { trimLines } from "../../../../utils"; import { trimLines } from "../../../../utils";
import { actualDeleteCaseCmd } from "./actualDeleteCaseCmd";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualDeleteCaseCmd } from "./actualDeleteCaseCmd";
export const DeleteCaseMsgCmd = modActionsMsgCmd({ export const DeleteCaseMsgCmd = modActionsMsgCmd({
trigger: ["delete_case", "deletecase"], trigger: ["delete_case", "deletecase"],

View file

@ -1,7 +1,7 @@
import { GuildMember } from "discord.js"; import { GuildMember } from "discord.js";
import { slashOptions } from "knub"; import { slashOptions } from "knub";
import { actualDeleteCaseCmd } from "./actualDeleteCaseCmd";
import { modActionsSlashCmd } from "../../types"; import { modActionsSlashCmd } from "../../types";
import { actualDeleteCaseCmd } from "./actualDeleteCaseCmd";
const opts = [slashOptions.boolean({ name: "force", description: "Whether or not to force delete", required: false })]; const opts = [slashOptions.boolean({ name: "force", description: "Whether or not to force delete", required: false })];

View file

@ -82,15 +82,12 @@ export async function actualDeleteCaseCmd(
: ""; : "";
const amt = validCases.length - cancelled; const amt = validCases.length - cancelled;
if (amt === 0) { if (amt === 0) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(context, "All deletions were cancelled, no cases were deleted.");
context,
"All deletions were cancelled, no cases were deleted."
);
return; return;
} }
pluginData.state.common.sendSuccessMessage( pluginData.state.common.sendSuccessMessage(
context, context,
`${amt} case${amt === 1 ? " was" : "s were"} deleted!${failedAddendum}` `${amt} case${amt === 1 ? " was" : "s were"} deleted!${failedAddendum}`,
); );
} }

View file

@ -1,9 +1,9 @@
import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { canActOn, hasPermission } from "../../../../pluginUtils"; import { canActOn, hasPermission } from "../../../../pluginUtils";
import { resolveMember, resolveUser } from "../../../../utils"; import { resolveMember, resolveUser } from "../../../../utils";
import { actualForceBanCmd } from "./actualForceBanCmd";
import { isBanned } from "../../functions/isBanned"; import { isBanned } from "../../functions/isBanned";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualForceBanCmd } from "./actualForceBanCmd";
const opts = { const opts = {
mod: ct.member({ option: true }), mod: ct.member({ option: true }),

View file

@ -3,9 +3,9 @@ import { slashOptions } from "knub";
import { hasPermission } from "../../../../pluginUtils"; import { hasPermission } from "../../../../pluginUtils";
import { convertDelayStringToMS, resolveMember } from "../../../../utils"; import { convertDelayStringToMS, resolveMember } from "../../../../utils";
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
import { actualForceBanCmd } from "./actualForceBanCmd";
import { modActionsSlashCmd } from "../../types"; import { modActionsSlashCmd } from "../../types";
import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants";
import { actualForceBanCmd } from "./actualForceBanCmd";
const opts = [ const opts = [
slashOptions.string({ name: "reason", description: "The reason", required: false }), 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"); const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true);
interaction,
"Text or attachment required",
undefined,
undefined,
true
);
return; return;
} }
@ -48,10 +42,7 @@ export const ForceBanSlashCmd = modActionsSlashCmd({
if (options.mod) { if (options.mod) {
if (!canActAsOther) { if (!canActAsOther) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "You don't have permission to act as another moderator");
interaction,
"You don't have permission to act as another moderator"
);
return; return;
} }

View file

@ -5,10 +5,13 @@ import { LogType } from "../../../../data/LogType";
import { DAYS, MINUTES, UnknownUser } from "../../../../utils"; import { DAYS, MINUTES, UnknownUser } from "../../../../utils";
import { CasesPlugin } from "../../../Cases/CasesPlugin"; import { CasesPlugin } from "../../../Cases/CasesPlugin";
import { LogsPlugin } from "../../../Logs/LogsPlugin"; import { LogsPlugin } from "../../../Logs/LogsPlugin";
import { IgnoredEventType, ModActionsPluginType } from "../../types";
import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction";
import { formatReasonWithAttachments, formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; import {
formatReasonWithAttachments,
formatReasonWithMessageLinkForAttachments,
} from "../../functions/formatReasonForAttachments";
import { ignoreEvent } from "../../functions/ignoreEvent"; import { ignoreEvent } from "../../functions/ignoreEvent";
import { IgnoredEventType, ModActionsPluginType } from "../../types";
export async function actualForceBanCmd( export async function actualForceBanCmd(
pluginData: GuildPluginData<ModActionsPluginType>, pluginData: GuildPluginData<ModActionsPluginType>,

View file

@ -1,9 +1,9 @@
import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { canActOn, hasPermission } from "../../../../pluginUtils"; import { canActOn, hasPermission } from "../../../../pluginUtils";
import { resolveMember, resolveUser } from "../../../../utils"; import { resolveMember, resolveUser } from "../../../../utils";
import { actualMuteCmd } from "../mute/actualMuteCmd";
import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualMuteCmd } from "../mute/actualMuteCmd";
const opts = { const opts = {
mod: ct.member({ option: true }), mod: ct.member({ option: true }),

View file

@ -3,10 +3,10 @@ import { slashOptions } from "knub";
import { hasPermission } from "../../../../pluginUtils"; import { hasPermission } from "../../../../pluginUtils";
import { UserNotificationMethod, convertDelayStringToMS, resolveMember } from "../../../../utils"; import { UserNotificationMethod, convertDelayStringToMS, resolveMember } from "../../../../utils";
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
import { actualMuteCmd } from "../mute/actualMuteCmd";
import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs";
import { modActionsSlashCmd } from "../../types"; import { modActionsSlashCmd } from "../../types";
import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants";
import { actualMuteCmd } from "../mute/actualMuteCmd";
const opts = [ const opts = [
slashOptions.string({ name: "time", description: "The duration of the mute", required: false }), 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"); const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true);
interaction,
"Text or attachment required",
undefined,
undefined,
true
);
return; return;
} }
@ -66,10 +60,7 @@ export const ForceMuteSlashCmd = modActionsSlashCmd({
if (options.mod) { if (options.mod) {
if (!canActAsOther) { if (!canActAsOther) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "You don't have permission to act as another moderator");
interaction,
"You don't have permission to act as another moderator"
);
return; return;
} }

View file

@ -1,8 +1,8 @@
import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { canActOn, hasPermission } from "../../../../pluginUtils"; import { canActOn, hasPermission } from "../../../../pluginUtils";
import { resolveMember, resolveUser } from "../../../../utils"; import { resolveMember, resolveUser } from "../../../../utils";
import { actualUnmuteCmd } from "../unmute/actualUnmuteCmd";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualUnmuteCmd } from "../unmute/actualUnmuteCmd";
const opts = { const opts = {
mod: ct.member({ option: true }), mod: ct.member({ option: true }),

View file

@ -3,9 +3,9 @@ import { slashOptions } from "knub";
import { hasPermission } from "../../../../pluginUtils"; import { hasPermission } from "../../../../pluginUtils";
import { convertDelayStringToMS, resolveMember } from "../../../../utils"; import { convertDelayStringToMS, resolveMember } from "../../../../utils";
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
import { actualUnmuteCmd } from "../unmute/actualUnmuteCmd";
import { modActionsSlashCmd } from "../../types"; import { modActionsSlashCmd } from "../../types";
import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants";
import { actualUnmuteCmd } from "../unmute/actualUnmuteCmd";
const opts = [ const opts = [
slashOptions.string({ name: "time", description: "The duration of the unmute", required: false }), 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"); const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true);
interaction,
"Text or attachment required",
undefined,
undefined,
true
);
return; return;
} }
@ -50,10 +44,7 @@ export const ForceUnmuteSlashCmd = modActionsSlashCmd({
if (options.mod) { if (options.mod) {
if (!canActAsOther) { if (!canActAsOther) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "You don't have permission to act as another moderator");
interaction,
"You don't have permission to act as another moderator"
);
return; return;
} }

View file

@ -1,6 +1,6 @@
import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { actualHideCaseCmd } from "./actualHideCaseCmd";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualHideCaseCmd } from "./actualHideCaseCmd";
export const HideCaseMsgCmd = modActionsMsgCmd({ export const HideCaseMsgCmd = modActionsMsgCmd({
trigger: ["hide", "hidecase", "hide_case"], trigger: ["hide", "hidecase", "hide_case"],

View file

@ -1,6 +1,6 @@
import { slashOptions } from "knub"; import { slashOptions } from "knub";
import { actualHideCaseCmd } from "./actualHideCaseCmd";
import { modActionsSlashCmd } from "../../types"; import { modActionsSlashCmd } from "../../types";
import { actualHideCaseCmd } from "./actualHideCaseCmd";
export const HideCaseSlashCmd = modActionsSlashCmd({ export const HideCaseSlashCmd = modActionsSlashCmd({
name: "hidecase", name: "hidecase",

View file

@ -30,7 +30,7 @@ export async function actualHideCaseCmd(
const amt = caseNumbers.length - failed.length; const amt = caseNumbers.length - failed.length;
pluginData.state.common.sendSuccessMessage( pluginData.state.common.sendSuccessMessage(
context, context,
`${amt} case${amt === 1 ? " is" : "s are"} now hidden! Use \`unhidecase\` to unhide them.${failedAddendum}`, `${amt} case${amt === 1 ? " is" : "s are"} now hidden! Use \`unhidecase\` to unhide them.${failedAddendum}`,
); );
} }

View file

@ -1,9 +1,9 @@
import { hasPermission } from "knub/helpers"; import { hasPermission } from "knub/helpers";
import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { resolveUser } from "../../../../utils"; import { resolveUser } from "../../../../utils";
import { actualKickCmd } from "./actualKickCmd";
import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualKickCmd } from "./actualKickCmd";
const opts = { const opts = {
mod: ct.member({ option: true }), mod: ct.member({ option: true }),

View file

@ -3,10 +3,10 @@ import { slashOptions } from "knub";
import { hasPermission } from "../../../../pluginUtils"; import { hasPermission } from "../../../../pluginUtils";
import { UserNotificationMethod, resolveMember } from "../../../../utils"; import { UserNotificationMethod, resolveMember } from "../../../../utils";
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
import { actualKickCmd } from "./actualKickCmd";
import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs";
import { modActionsSlashCmd } from "../../types"; import { modActionsSlashCmd } from "../../types";
import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants";
import { actualKickCmd } from "./actualKickCmd";
const opts = [ const opts = [
slashOptions.string({ name: "reason", description: "The reason", required: false }), 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"); const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true);
interaction,
"Text or attachment required",
undefined,
undefined,
true
);
return; return;
} }
@ -69,10 +63,7 @@ export const KickSlashCmd = modActionsSlashCmd({
if (options.mod) { if (options.mod) {
if (!canActAsOther) { if (!canActAsOther) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "You don't have permission to act as another moderator");
interaction,
"You don't have permission to act as another moderator"
);
return; return;
} }

View file

@ -3,12 +3,15 @@ import { GuildPluginData } from "knub";
import { LogType } from "../../../../data/LogType"; import { LogType } from "../../../../data/LogType";
import { canActOn } from "../../../../pluginUtils"; import { canActOn } from "../../../../pluginUtils";
import { DAYS, SECONDS, UnknownUser, UserNotificationMethod, renderUsername, resolveMember } from "../../../../utils"; import { DAYS, SECONDS, UnknownUser, UserNotificationMethod, renderUsername, resolveMember } from "../../../../utils";
import { IgnoredEventType, ModActionsPluginType } from "../../types";
import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction";
import { formatReasonWithAttachments, formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; import {
formatReasonWithAttachments,
formatReasonWithMessageLinkForAttachments,
} from "../../functions/formatReasonForAttachments";
import { ignoreEvent } from "../../functions/ignoreEvent"; import { ignoreEvent } from "../../functions/ignoreEvent";
import { isBanned } from "../../functions/isBanned"; import { isBanned } from "../../functions/isBanned";
import { kickMember } from "../../functions/kickMember"; import { kickMember } from "../../functions/kickMember";
import { IgnoredEventType, ModActionsPluginType } from "../../types";
export async function actualKickCmd( export async function actualKickCmd(
pluginData: GuildPluginData<ModActionsPluginType>, pluginData: GuildPluginData<ModActionsPluginType>,
@ -71,9 +74,7 @@ export async function actualKickCmd(
try { try {
await pluginData.guild.bans.remove(memberToKick.id, "kick -clean"); await pluginData.guild.bans.remove(memberToKick.id, "kick -clean");
} catch { } catch {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(context, "Failed to unban the user after banning them (-clean)");
context,
"Failed to unban the user after banning them (-clean)");
} }
} }

View file

@ -1,8 +1,8 @@
import { waitForReply } from "knub/helpers"; import { waitForReply } from "knub/helpers";
import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { getContextChannel, sendContextResponse } from "../../../../pluginUtils"; import { getContextChannel, sendContextResponse } from "../../../../pluginUtils";
import { actualMassBanCmd } from "./actualMassBanCmd";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualMassBanCmd } from "./actualMassBanCmd";
export const MassBanMsgCmd = modActionsMsgCmd({ export const MassBanMsgCmd = modActionsMsgCmd({
trigger: "massban", trigger: "massban",

View file

@ -1,9 +1,9 @@
import { GuildMember } from "discord.js"; import { GuildMember } from "discord.js";
import { slashOptions } from "knub"; import { slashOptions } from "knub";
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
import { actualMassBanCmd } from "./actualMassBanCmd";
import { modActionsSlashCmd } from "../../types"; import { modActionsSlashCmd } from "../../types";
import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants";
import { actualMassBanCmd } from "./actualMassBanCmd";
const opts = [ const opts = [
slashOptions.string({ name: "reason", description: "The reason", required: false }), 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"); const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true);
interaction,
"Text or attachment required",
undefined,
undefined,
true
);
return; return;
} }

View file

@ -7,10 +7,13 @@ import { canActOn, getContextChannel, isContextInteraction, sendContextResponse
import { DAYS, MINUTES, SECONDS, noop } from "../../../../utils"; import { DAYS, MINUTES, SECONDS, noop } from "../../../../utils";
import { CasesPlugin } from "../../../Cases/CasesPlugin"; import { CasesPlugin } from "../../../Cases/CasesPlugin";
import { LogsPlugin } from "../../../Logs/LogsPlugin"; import { LogsPlugin } from "../../../Logs/LogsPlugin";
import { IgnoredEventType, ModActionsPluginType } from "../../types";
import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction";
import { formatReasonWithAttachments, formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; import {
formatReasonWithAttachments,
formatReasonWithMessageLinkForAttachments,
} from "../../functions/formatReasonForAttachments";
import { ignoreEvent } from "../../functions/ignoreEvent"; import { ignoreEvent } from "../../functions/ignoreEvent";
import { IgnoredEventType, ModActionsPluginType } from "../../types";
export async function actualMassBanCmd( export async function actualMassBanCmd(
pluginData: GuildPluginData<ModActionsPluginType>, pluginData: GuildPluginData<ModActionsPluginType>,
@ -37,9 +40,7 @@ export async function actualMassBanCmd(
for (const userId of userIds) { for (const userId of userIds) {
const member = pluginData.guild.members.cache.get(userId as Snowflake); // TODO: Get members on demand? const member = pluginData.guild.members.cache.get(userId as Snowflake); // TODO: Get members on demand?
if (member && !canActOn(pluginData, author, member)) { if (member && !canActOn(pluginData, author, member)) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(context, "Cannot massban one or more users: insufficient permissions");
context,
"Cannot massban one or more users: insufficient permissions");
return; return;
} }
} }
@ -157,14 +158,14 @@ export async function actualMassBanCmd(
if (failedBans.length) { if (failedBans.length) {
pluginData.state.common.sendSuccessMessage( pluginData.state.common.sendSuccessMessage(
context, context,
`Banned ${successfulBanCount} users in ${formattedTimeTaken}, ${ `Banned ${successfulBanCount} users in ${formattedTimeTaken}, ${failedBans.length} failed: ${failedBans.join(
failedBans.length " ",
} failed: ${failedBans.join(" ")}`, )}`,
); );
} else { } else {
pluginData.state.common.sendSuccessMessage( pluginData.state.common.sendSuccessMessage(
context, context,
`Banned ${successfulBanCount} users successfully in ${formattedTimeTaken}` `Banned ${successfulBanCount} users successfully in ${formattedTimeTaken}`,
); );
} }
} }

View file

@ -1,8 +1,8 @@
import { waitForReply } from "knub/helpers"; import { waitForReply } from "knub/helpers";
import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { getContextChannel, sendContextResponse } from "../../../../pluginUtils"; import { getContextChannel, sendContextResponse } from "../../../../pluginUtils";
import { actualMassMuteCmd } from "./actualMassMuteCmd";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualMassMuteCmd } from "./actualMassMuteCmd";
export const MassMuteMsgCmd = modActionsMsgCmd({ export const MassMuteMsgCmd = modActionsMsgCmd({
trigger: "massmute", trigger: "massmute",

View file

@ -1,9 +1,9 @@
import { GuildMember } from "discord.js"; import { GuildMember } from "discord.js";
import { slashOptions } from "knub"; import { slashOptions } from "knub";
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
import { actualMassMuteCmd } from "./actualMassMuteCmd";
import { modActionsSlashCmd } from "../../types"; import { modActionsSlashCmd } from "../../types";
import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants";
import { actualMassMuteCmd } from "./actualMassMuteCmd";
const opts = [ const opts = [
slashOptions.string({ name: "reason", description: "The reason", required: false }), 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"); const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true);
interaction,
"Text or attachment required",
undefined,
undefined,
true
);
return; return;
} }

View file

@ -5,9 +5,12 @@ import { logger } from "../../../../logger";
import { canActOn, isContextInteraction, sendContextResponse } from "../../../../pluginUtils"; import { canActOn, isContextInteraction, sendContextResponse } from "../../../../pluginUtils";
import { LogsPlugin } from "../../../Logs/LogsPlugin"; import { LogsPlugin } from "../../../Logs/LogsPlugin";
import { MutesPlugin } from "../../../Mutes/MutesPlugin"; import { MutesPlugin } from "../../../Mutes/MutesPlugin";
import { ModActionsPluginType } from "../../types";
import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; 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( export async function actualMassMuteCmd(
pluginData: GuildPluginData<ModActionsPluginType>, pluginData: GuildPluginData<ModActionsPluginType>,
@ -34,10 +37,7 @@ export async function actualMassMuteCmd(
for (const userId of userIds) { for (const userId of userIds) {
const member = pluginData.guild.members.cache.get(userId as Snowflake); const member = pluginData.guild.members.cache.get(userId as Snowflake);
if (member && !canActOn(pluginData, author, member)) { if (member && !canActOn(pluginData, author, member)) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(context, "Cannot massmute one or more users: insufficient permissions");
context,
"Cannot massmute one or more users: insufficient permissions"
);
return; return;
} }
} }
@ -87,9 +87,9 @@ export async function actualMassMuteCmd(
if (failedMutes.length) { if (failedMutes.length) {
pluginData.state.common.sendSuccessMessage( pluginData.state.common.sendSuccessMessage(
context, context,
`Muted ${successfulMuteCount} users, ${failedMutes.length} failed: ${failedMutes.join(" ")}`, `Muted ${successfulMuteCount} users, ${failedMutes.length} failed: ${failedMutes.join(" ")}`,
); );
} else { } else {
pluginData.state.common.sendSuccessMessage(context, `Muted ${successfulMuteCount} users successfully`); pluginData.state.common.sendSuccessMessage(context, `Muted ${successfulMuteCount} users successfully`);
} }

View file

@ -1,8 +1,8 @@
import { waitForReply } from "knub/helpers"; import { waitForReply } from "knub/helpers";
import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { getContextChannel, sendContextResponse } from "../../../../pluginUtils"; import { getContextChannel, sendContextResponse } from "../../../../pluginUtils";
import { actualMassUnbanCmd } from "./actualMassUnbanCmd";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualMassUnbanCmd } from "./actualMassUnbanCmd";
export const MassUnbanMsgCmd = modActionsMsgCmd({ export const MassUnbanMsgCmd = modActionsMsgCmd({
trigger: "massunban", trigger: "massunban",

View file

@ -1,9 +1,9 @@
import { GuildMember } from "discord.js"; import { GuildMember } from "discord.js";
import { slashOptions } from "knub"; import { slashOptions } from "knub";
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
import { actualMassUnbanCmd } from "./actualMassUnbanCmd";
import { modActionsSlashCmd } from "../../types"; import { modActionsSlashCmd } from "../../types";
import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants";
import { actualMassUnbanCmd } from "./actualMassUnbanCmd";
const opts = [ const opts = [
slashOptions.string({ name: "reason", description: "The reason", required: false }), 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"); const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true);
interaction,
"Text or attachment required",
undefined,
undefined,
true
);
return; return;
} }

View file

@ -6,11 +6,11 @@ import { isContextInteraction, sendContextResponse } from "../../../../pluginUti
import { MINUTES, noop } from "../../../../utils"; import { MINUTES, noop } from "../../../../utils";
import { CasesPlugin } from "../../../Cases/CasesPlugin"; import { CasesPlugin } from "../../../Cases/CasesPlugin";
import { LogsPlugin } from "../../../Logs/LogsPlugin"; import { LogsPlugin } from "../../../Logs/LogsPlugin";
import { IgnoredEventType, ModActionsPluginType } from "../../types";
import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction";
import { formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; import { formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments";
import { ignoreEvent } from "../../functions/ignoreEvent"; import { ignoreEvent } from "../../functions/ignoreEvent";
import { isBanned } from "../../functions/isBanned"; import { isBanned } from "../../functions/isBanned";
import { IgnoredEventType, ModActionsPluginType } from "../../types";
export async function actualMassUnbanCmd( export async function actualMassUnbanCmd(
pluginData: GuildPluginData<ModActionsPluginType>, pluginData: GuildPluginData<ModActionsPluginType>,
@ -75,10 +75,7 @@ export async function actualMassUnbanCmd(
const successfulUnbanCount = userIds.length - failedUnbans.length; const successfulUnbanCount = userIds.length - failedUnbans.length;
if (successfulUnbanCount === 0) { if (successfulUnbanCount === 0) {
// All unbans failed - don't create a log entry and notify the user // All unbans failed - don't create a log entry and notify the user
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(context, "All unbans failed. Make sure the IDs are valid and banned.");
context,
"All unbans failed. Make sure the IDs are valid and banned."
);
} else { } else {
// Some or all unbans were successful. Create a log entry for the mass unban and notify the user. // Some or all unbans were successful. Create a log entry for the mass unban and notify the user.
pluginData.getPlugin(LogsPlugin).logMassUnban({ pluginData.getPlugin(LogsPlugin).logMassUnban({
@ -106,9 +103,9 @@ export async function actualMassUnbanCmd(
} }
pluginData.state.common.sendSuccessMessage( pluginData.state.common.sendSuccessMessage(
context, context,
`Unbanned ${successfulUnbanCount} users, ${failedUnbans.length} failed:\n${failedMsg}`, `Unbanned ${successfulUnbanCount} users, ${failedUnbans.length} failed:\n${failedMsg}`,
); );
} else { } else {
pluginData.state.common.sendSuccessMessage(context, `Unbanned ${successfulUnbanCount} users successfully`); pluginData.state.common.sendSuccessMessage(context, `Unbanned ${successfulUnbanCount} users successfully`);
} }

View file

@ -2,10 +2,10 @@ import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { canActOn, hasPermission } from "../../../../pluginUtils"; import { canActOn, hasPermission } from "../../../../pluginUtils";
import { resolveMember, resolveUser } from "../../../../utils"; import { resolveMember, resolveUser } from "../../../../utils";
import { waitForButtonConfirm } from "../../../../utils/waitForInteraction"; import { waitForButtonConfirm } from "../../../../utils/waitForInteraction";
import { actualMuteCmd } from "./actualMuteCmd";
import { isBanned } from "../../functions/isBanned"; import { isBanned } from "../../functions/isBanned";
import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualMuteCmd } from "./actualMuteCmd";
const opts = { const opts = {
mod: ct.member({ option: true }), mod: ct.member({ option: true }),
@ -49,7 +49,7 @@ export const MuteMsgCmd = modActionsMsgCmd({
if (_isBanned) { if (_isBanned) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(
msg, 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; return;
} else { } else {

View file

@ -4,11 +4,11 @@ import { canActOn, hasPermission } from "../../../../pluginUtils";
import { UserNotificationMethod, convertDelayStringToMS, resolveMember } from "../../../../utils"; import { UserNotificationMethod, convertDelayStringToMS, resolveMember } from "../../../../utils";
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
import { waitForButtonConfirm } from "../../../../utils/waitForInteraction"; import { waitForButtonConfirm } from "../../../../utils/waitForInteraction";
import { actualMuteCmd } from "./actualMuteCmd";
import { isBanned } from "../../functions/isBanned"; import { isBanned } from "../../functions/isBanned";
import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs";
import { modActionsSlashCmd } from "../../types"; import { modActionsSlashCmd } from "../../types";
import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants";
import { actualMuteCmd } from "./actualMuteCmd";
const opts = [ const opts = [
slashOptions.string({ name: "time", description: "The duration of the mute", required: false }), slashOptions.string({ name: "time", description: "The duration of the mute", required: false }),
@ -54,7 +54,7 @@ export const MuteSlashCmd = modActionsSlashCmd({
if (_isBanned) { if (_isBanned) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(
interaction, 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; return;
} else { } else {
@ -66,10 +66,7 @@ export const MuteSlashCmd = modActionsSlashCmd({
); );
if (!reply) { if (!reply) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "User not on server, mute cancelled by moderator");
interaction,
"User not on server, mute cancelled by moderator"
);
return; return;
} }
} }
@ -90,10 +87,7 @@ export const MuteSlashCmd = modActionsSlashCmd({
if (options.mod) { if (options.mod) {
if (!canActAsOther) { if (!canActAsOther) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "You don't have permission to act as another moderator");
interaction,
"You don't have permission to act as another moderator"
);
return; return;
} }

View file

@ -12,9 +12,12 @@ import {
} from "../../../../utils"; } from "../../../../utils";
import { MutesPlugin } from "../../../Mutes/MutesPlugin"; import { MutesPlugin } from "../../../Mutes/MutesPlugin";
import { MuteResult } from "../../../Mutes/types"; import { MuteResult } from "../../../Mutes/types";
import { ModActionsPluginType } from "../../types";
import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; 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. * The actual function run by both !mute and !forcemute.
@ -56,10 +59,7 @@ export async function actualMuteCmd(
}); });
} catch (e) { } catch (e) {
if (e instanceof RecoverablePluginError && e.code === ERRORS.NO_MUTE_ROLE_IN_CONFIG) { if (e instanceof RecoverablePluginError && e.code === ERRORS.NO_MUTE_ROLE_IN_CONFIG) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(context, "Could not mute the user: no mute role set in config");
context,
"Could not mute the user: no mute role set in config"
);
} else if (isDiscordAPIError(e) && e.code === 10007) { } else if (isDiscordAPIError(e) && e.code === 10007) {
pluginData.state.common.sendErrorMessage(context, "Could not mute the user: unknown member"); pluginData.state.common.sendErrorMessage(context, "Could not mute the user: unknown member");
} else { } else {

View file

@ -1,7 +1,7 @@
import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { resolveUser } from "../../../../utils"; import { resolveUser } from "../../../../utils";
import { actualNoteCmd } from "./actualNoteCmd";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualNoteCmd } from "./actualNoteCmd";
export const NoteMsgCmd = modActionsMsgCmd({ export const NoteMsgCmd = modActionsMsgCmd({
trigger: "note", trigger: "note",

View file

@ -1,8 +1,8 @@
import { slashOptions } from "knub"; import { slashOptions } from "knub";
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
import { actualNoteCmd } from "./actualNoteCmd";
import { modActionsSlashCmd } from "../../types"; import { modActionsSlashCmd } from "../../types";
import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants";
import { actualNoteCmd } from "./actualNoteCmd";
const opts = [ const opts = [
slashOptions.string({ name: "note", description: "The note to add to the user", required: false }), 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"); const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
if ((!options.note || options.note.trim() === "") && attachments.length < 1) { if ((!options.note || options.note.trim() === "") && attachments.length < 1) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true);
interaction,
"Text or attachment required",
undefined,
undefined,
true
);
return; return;
} }

View file

@ -4,9 +4,9 @@ import { CaseTypes } from "../../../../data/CaseTypes";
import { UnknownUser, renderUsername } from "../../../../utils"; import { UnknownUser, renderUsername } from "../../../../utils";
import { CasesPlugin } from "../../../Cases/CasesPlugin"; import { CasesPlugin } from "../../../Cases/CasesPlugin";
import { LogsPlugin } from "../../../Logs/LogsPlugin"; import { LogsPlugin } from "../../../Logs/LogsPlugin";
import { ModActionsPluginType } from "../../types";
import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction";
import { formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; import { formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments";
import { ModActionsPluginType } from "../../types";
export async function actualNoteCmd( export async function actualNoteCmd(
pluginData: GuildPluginData<ModActionsPluginType>, pluginData: GuildPluginData<ModActionsPluginType>,
@ -39,12 +39,12 @@ export async function actualNoteCmd(
}); });
pluginData.state.common.sendSuccessMessage( pluginData.state.common.sendSuccessMessage(
context, context,
`Note added on **${userName}** (Case #${createdCase.case_number})`, `Note added on **${userName}** (Case #${createdCase.case_number})`,
undefined, undefined,
undefined, undefined,
true, true,
); );
pluginData.state.events.emit("note", user.id, reason); pluginData.state.events.emit("note", user.id, reason);
} }

View file

@ -1,8 +1,8 @@
import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { hasPermission } from "../../../../pluginUtils"; import { hasPermission } from "../../../../pluginUtils";
import { resolveUser } from "../../../../utils"; import { resolveUser } from "../../../../utils";
import { actualUnbanCmd } from "./actualUnbanCmd";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualUnbanCmd } from "./actualUnbanCmd";
const opts = { const opts = {
mod: ct.member({ option: true }), mod: ct.member({ option: true }),

View file

@ -3,9 +3,9 @@ import { slashOptions } from "knub";
import { hasPermission } from "../../../../pluginUtils"; import { hasPermission } from "../../../../pluginUtils";
import { resolveMember } from "../../../../utils"; import { resolveMember } from "../../../../utils";
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
import { actualUnbanCmd } from "./actualUnbanCmd";
import { modActionsSlashCmd } from "../../types"; import { modActionsSlashCmd } from "../../types";
import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants";
import { actualUnbanCmd } from "./actualUnbanCmd";
const opts = [ const opts = [
slashOptions.string({ name: "reason", description: "The reason", required: false }), 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"); const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true);
interaction,
"Text or attachment required",
undefined,
undefined,
true
);
return; return;
} }
@ -48,10 +42,7 @@ export const UnbanSlashCmd = modActionsSlashCmd({
if (options.mod) { if (options.mod) {
if (!canActAsOther) { if (!canActAsOther) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "You don't have permission to act as another moderator");
interaction,
"You don't have permission to act as another moderator"
);
return; return;
} }

View file

@ -6,10 +6,10 @@ import { clearExpiringTempban } from "../../../../data/loops/expiringTempbansLoo
import { UnknownUser } from "../../../../utils"; import { UnknownUser } from "../../../../utils";
import { CasesPlugin } from "../../../Cases/CasesPlugin"; import { CasesPlugin } from "../../../Cases/CasesPlugin";
import { LogsPlugin } from "../../../Logs/LogsPlugin"; import { LogsPlugin } from "../../../Logs/LogsPlugin";
import { IgnoredEventType, ModActionsPluginType } from "../../types";
import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction";
import { formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; import { formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments";
import { ignoreEvent } from "../../functions/ignoreEvent"; import { ignoreEvent } from "../../functions/ignoreEvent";
import { IgnoredEventType, ModActionsPluginType } from "../../types";
export async function actualUnbanCmd( export async function actualUnbanCmd(
pluginData: GuildPluginData<ModActionsPluginType>, pluginData: GuildPluginData<ModActionsPluginType>,
@ -31,10 +31,7 @@ export async function actualUnbanCmd(
ignoreEvent(pluginData, IgnoredEventType.Unban, user.id); ignoreEvent(pluginData, IgnoredEventType.Unban, user.id);
await pluginData.guild.bans.remove(user.id as Snowflake, formattedReason ?? undefined); await pluginData.guild.bans.remove(user.id as Snowflake, formattedReason ?? undefined);
} catch { } catch {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(context, "Failed to unban member; are you sure they're banned?");
context,
"Failed to unban member; are you sure they're banned?"
);
return; return;
} }

View file

@ -1,6 +1,6 @@
import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { actualHideCaseCmd } from "../hidecase/actualHideCaseCmd";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualHideCaseCmd } from "../hidecase/actualHideCaseCmd";
export const UnhideCaseMsgCmd = modActionsMsgCmd({ export const UnhideCaseMsgCmd = modActionsMsgCmd({
trigger: ["unhide", "unhidecase", "unhide_case"], trigger: ["unhide", "unhidecase", "unhide_case"],

View file

@ -1,6 +1,6 @@
import { slashOptions } from "knub"; import { slashOptions } from "knub";
import { actualUnhideCaseCmd } from "./actualUnhideCaseCmd";
import { modActionsSlashCmd } from "../../types"; import { modActionsSlashCmd } from "../../types";
import { actualUnhideCaseCmd } from "./actualUnhideCaseCmd";
export const UnhideCaseSlashCmd = modActionsSlashCmd({ export const UnhideCaseSlashCmd = modActionsSlashCmd({
name: "unhidecase", name: "unhidecase",

View file

@ -32,6 +32,6 @@ export async function actualUnhideCaseCmd(
const amt = caseNumbers.length - failed.length; const amt = caseNumbers.length - failed.length;
pluginData.state.common.sendSuccessMessage( pluginData.state.common.sendSuccessMessage(
context, context,
`${amt} case${amt === 1 ? " is" : "s are"} no longer hidden!${failedAddendum}` `${amt} case${amt === 1 ? " is" : "s are"} no longer hidden!${failedAddendum}`,
); );
} }

View file

@ -3,9 +3,9 @@ import { canActOn, hasPermission } from "../../../../pluginUtils";
import { resolveMember, resolveUser } from "../../../../utils"; import { resolveMember, resolveUser } from "../../../../utils";
import { waitForButtonConfirm } from "../../../../utils/waitForInteraction"; import { waitForButtonConfirm } from "../../../../utils/waitForInteraction";
import { MutesPlugin } from "../../../Mutes/MutesPlugin"; import { MutesPlugin } from "../../../Mutes/MutesPlugin";
import { actualUnmuteCmd } from "./actualUnmuteCmd";
import { isBanned } from "../../functions/isBanned"; import { isBanned } from "../../functions/isBanned";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualUnmuteCmd } from "./actualUnmuteCmd";
const opts = { const opts = {
mod: ct.member({ option: true }), mod: ct.member({ option: true }),
@ -59,7 +59,7 @@ export const UnmuteMsgCmd = modActionsMsgCmd({
if (banned) { if (banned) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(
msg, msg,
`User is banned. Use \`${prefix}forceunmute\` to unmute them anyway.` `User is banned. Use \`${prefix}forceunmute\` to unmute them anyway.`,
); );
return; return;
} else { } else {

View file

@ -5,10 +5,10 @@ import { convertDelayStringToMS, resolveMember } from "../../../../utils";
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions"; import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
import { waitForButtonConfirm } from "../../../../utils/waitForInteraction"; import { waitForButtonConfirm } from "../../../../utils/waitForInteraction";
import { MutesPlugin } from "../../../Mutes/MutesPlugin"; import { MutesPlugin } from "../../../Mutes/MutesPlugin";
import { actualUnmuteCmd } from "./actualUnmuteCmd";
import { isBanned } from "../../functions/isBanned"; import { isBanned } from "../../functions/isBanned";
import { modActionsSlashCmd } from "../../types"; import { modActionsSlashCmd } from "../../types";
import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants"; import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants";
import { actualUnmuteCmd } from "./actualUnmuteCmd";
const opts = [ const opts = [
slashOptions.string({ name: "time", description: "The duration of the unmute", required: false }), 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"); const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) { if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true);
interaction,
"Text or attachment required",
undefined,
undefined,
true
);
return; return;
} }
@ -64,7 +58,7 @@ export const UnmuteSlashCmd = modActionsSlashCmd({
if (banned) { if (banned) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(
interaction, interaction,
`User is banned. Use \`${prefix}forceunmute\` to unmute them anyway.` `User is banned. Use \`${prefix}forceunmute\` to unmute them anyway.`,
); );
return; return;
} else { } else {
@ -76,10 +70,7 @@ export const UnmuteSlashCmd = modActionsSlashCmd({
); );
if (!reply) { if (!reply) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "User not on server, unmute cancelled by moderator");
interaction,
"User not on server, unmute cancelled by moderator"
);
return; return;
} }
} }
@ -100,10 +91,7 @@ export const UnmuteSlashCmd = modActionsSlashCmd({
if (options.mod) { if (options.mod) {
if (!canActAsOther) { if (!canActAsOther) {
pluginData.state.common.sendErrorMessage( pluginData.state.common.sendErrorMessage(interaction, "You don't have permission to act as another moderator");
interaction,
"You don't have permission to act as another moderator"
);
return; return;
} }

View file

@ -3,9 +3,9 @@ import humanizeDuration from "humanize-duration";
import { GuildPluginData } from "knub"; import { GuildPluginData } from "knub";
import { UnknownUser, asSingleLine, renderUsername } from "../../../../utils"; import { UnknownUser, asSingleLine, renderUsername } from "../../../../utils";
import { MutesPlugin } from "../../../Mutes/MutesPlugin"; import { MutesPlugin } from "../../../Mutes/MutesPlugin";
import { ModActionsPluginType } from "../../types";
import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction";
import { formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments"; import { formatReasonWithMessageLinkForAttachments } from "../../functions/formatReasonForAttachments";
import { ModActionsPluginType } from "../../types";
export async function actualUnmuteCmd( export async function actualUnmuteCmd(
pluginData: GuildPluginData<ModActionsPluginType>, pluginData: GuildPluginData<ModActionsPluginType>,

View file

@ -1,10 +1,10 @@
import { commandTypeHelpers as ct } from "../../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { canActOn, hasPermission } from "../../../../pluginUtils"; import { canActOn, hasPermission } from "../../../../pluginUtils";
import { errorMessage, resolveMember, resolveUser } from "../../../../utils"; import { errorMessage, resolveMember, resolveUser } from "../../../../utils";
import { actualWarnCmd } from "./actualWarnCmd";
import { isBanned } from "../../functions/isBanned"; import { isBanned } from "../../functions/isBanned";
import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs";
import { modActionsMsgCmd } from "../../types"; import { modActionsMsgCmd } from "../../types";
import { actualWarnCmd } from "./actualWarnCmd";
export const WarnMsgCmd = modActionsMsgCmd({ export const WarnMsgCmd = modActionsMsgCmd({
trigger: "warn", trigger: "warn",

Some files were not shown because too many files have changed in this diff Show more