aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package.json19
-rw-r--r--src/arguments/globalUser.ts4
-rw-r--r--src/arguments/roleWithDuration.ts8
-rw-r--r--src/commands/admin/channelPermissions.ts7
-rw-r--r--src/commands/config/blacklist.ts7
-rw-r--r--src/commands/config/config.ts16
-rw-r--r--src/commands/config/disable.ts6
-rw-r--r--src/commands/config/features.ts9
-rw-r--r--src/commands/config/log.ts4
-rw-r--r--src/commands/info/icon.ts7
-rw-r--r--src/commands/info/links.ts2
-rw-r--r--src/commands/leveling/leaderboard.ts6
-rw-r--r--src/commands/leveling/level.ts5
-rw-r--r--src/commands/leveling/setLevel.ts8
-rw-r--r--src/commands/leveling/setXp.ts5
-rw-r--r--src/commands/moderation/ban.ts44
-rw-r--r--src/commands/moderation/block.ts30
-rw-r--r--src/commands/moderation/evidence.ts5
-rw-r--r--src/commands/moderation/hideCase.ts5
-rw-r--r--src/commands/moderation/kick.ts7
-rw-r--r--src/commands/moderation/massBan.ts5
-rw-r--r--src/commands/moderation/modlog.ts9
-rw-r--r--src/commands/moderation/mute.ts25
-rw-r--r--src/commands/moderation/purge.ts9
-rw-r--r--src/commands/moderation/removeReactionEmoji.ts18
-rw-r--r--src/commands/moderation/role.ts22
-rw-r--r--src/commands/moderation/slowmode.ts40
-rw-r--r--src/commands/moderation/timeout.ts22
-rw-r--r--src/commands/moderation/unban.ts7
-rw-r--r--src/commands/moderation/unblock.ts15
-rw-r--r--src/commands/moderation/unmute.ts8
-rw-r--r--src/commands/moderation/untimeout.ts3
-rw-r--r--src/commands/moderation/warn.ts8
-rw-r--r--src/commands/moulberry-bush/capePermissions.ts24
-rw-r--r--src/commands/moulberry-bush/capes.ts51
-rw-r--r--src/commands/moulberry-bush/report.ts5
-rw-r--r--src/commands/utilities/activity.ts3
-rw-r--r--src/commands/utilities/remind.ts32
-rw-r--r--src/commands/utilities/viewRaw.ts28
-rw-r--r--src/lib/common/AutoMod.ts1
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts11
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts66
-rw-r--r--src/lib/extensions/discord.js/BushCategoryChannel.ts11
-rw-r--r--src/lib/extensions/discord.js/BushCategoryChannelChildManager.ts52
-rw-r--r--src/lib/extensions/discord.js/other.ts2
-rw-r--r--src/lib/index.ts1
-rw-r--r--src/lib/utils/CanvasProgressBar.ts2
-rw-r--r--src/listeners/ws/INTERACTION_CREATE.ts2
-rw-r--r--yarn.lock223
49 files changed, 475 insertions, 434 deletions
diff --git a/package.json b/package.json
index 424062c..63d1c60 100644
--- a/package.json
+++ b/package.json
@@ -56,14 +56,14 @@
"@notenoughupdates/humanize-duration": "^4.0.1",
"@notenoughupdates/simplify-number": "^1.0.1",
"@notenoughupdates/wolfram-alpha-api": "^1.0.1",
- "@sentry/integrations": "^6.17.8",
- "@sentry/node": "^6.17.8",
- "@sentry/tracing": "^6.17.8",
+ "@sentry/integrations": "^6.17.9",
+ "@sentry/node": "^6.17.9",
+ "@sentry/tracing": "^6.17.9",
"canvas": "^2.9.0",
"chalk": "^5.0.0",
"deep-lock": "^1.0.0",
"discord-akairo": "npm:@notenoughupdates/discord-akairo@dev",
- "discord-api-types": "0.27.1",
+ "discord-api-types": "0.27.2",
"discord-api-types-next": "npm:discord-api-types@next",
"discord.js": "npm:@notenoughupdates/discord.js@dev",
"fuse.js": "^6.5.3",
@@ -71,7 +71,7 @@
"got": "^12.0.1",
"lodash": "^4.17.21",
"mathjs": "^10.1.1",
- "nanoid": "^3.3.0",
+ "nanoid": "^3.3.1",
"node-os-utils": "^1.3.6",
"numeral": "^2.0.6",
"pg": "^8.7.3",
@@ -79,17 +79,18 @@
"prettier": "^2.5.1",
"pretty-bytes": "^6.0.0",
"rimraf": "^3.0.2",
- "sequelize": "6.16.1",
+ "sequelize": "6.16.2",
"tinycolor2": "^1.4.2",
"typescript": "^4.5.5",
- "vm2": "^3.9.7"
+ "vm2": "^3.9.8"
},
"devDependencies": {
"@sapphire/snowflake": "^3.1.0",
- "@sentry/types": "^6.17.8",
+ "@sentry/types": "^6.17.9",
"@types/eslint": "^8.4.1",
"@types/express": "^4.17.13",
"@types/lodash": "^4.14.178",
+ "@types/lodash.snakecase": "^4.1.6",
"@types/node": "^17.0.18",
"@types/node-os-utils": "^1.2.0",
"@types/numeral": "^2.0.2",
@@ -101,7 +102,7 @@
"@typescript-eslint/eslint-plugin": "^5.12.0",
"@typescript-eslint/parser": "^5.12.0",
"eslint": "^8.9.0",
- "eslint-config-prettier": "^8.3.0",
+ "eslint-config-prettier": "^8.4.0",
"eslint-plugin-deprecation": "^1.3.2",
"eslint-plugin-import": "^2.25.4",
"node-fetch": "^3.2.0"
diff --git a/src/arguments/globalUser.ts b/src/arguments/globalUser.ts
index 69d3e89..08350d2 100644
--- a/src/arguments/globalUser.ts
+++ b/src/arguments/globalUser.ts
@@ -2,7 +2,5 @@ import { type BushArgumentTypeCaster, type BushUser } from '#lib';
// resolve non-cached users
export const globalUser: BushArgumentTypeCaster<Promise<BushUser | null>> = async (_, phrase) => {
- return client.users.cache.has(phrase)
- ? client.users.cache.get(`${phrase}`) ?? null
- : await client.users.fetch(`${phrase}`).catch(() => null);
+ return client.users.resolve(phrase) ?? (await client.users.fetch(`${phrase}`).catch(() => null));
};
diff --git a/src/arguments/roleWithDuration.ts b/src/arguments/roleWithDuration.ts
index d619b9e..5f1da98 100644
--- a/src/arguments/roleWithDuration.ts
+++ b/src/arguments/roleWithDuration.ts
@@ -3,10 +3,10 @@ import { type Role } from 'discord.js';
export const roleWithDuration: BushArgumentTypeCaster<Promise<RoleWithDuration | null>> = async (message, phrase) => {
// eslint-disable-next-line prefer-const
- let { duration, contentWithoutTime } = client.util.parseDuration(phrase);
- if (contentWithoutTime === null || contentWithoutTime === undefined) return null;
- contentWithoutTime = contentWithoutTime.trim();
- const role = await util.arg.cast('role', message, contentWithoutTime);
+ let { duration, content } = client.util.parseDuration(phrase);
+ if (content === null || content === undefined) return null;
+ content = content.trim();
+ const role = await util.arg.cast('role', message, content);
if (!role) return null;
return { duration, role };
};
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts
index e12a131..37610b3 100644
--- a/src/commands/admin/channelPermissions.ts
+++ b/src/commands/admin/channelPermissions.ts
@@ -1,4 +1,5 @@
import { BushCommand, ButtonPaginator, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
+import assert from 'assert';
import { ApplicationCommandOptionType, Embed, PermissionFlagsBits } from 'discord.js';
export default class ChannelPermissionsCommand extends BushCommand {
@@ -62,9 +63,7 @@ export default class ChannelPermissionsCommand extends BushCommand {
state: 'true' | 'false' | 'neutral';
}
) {
- if (!message.inGuild()) return await message.util.reply(`${util.emojis.error} This command can only be run in a server.`);
- if (!message.member!.permissions.has(PermissionFlagsBits.Administrator) && !message.member!.user.isOwner())
- return await message.util.reply(`${util.emojis.error} You must have admin perms to use this command.`);
+ assert(message.inGuild());
if (message.util.isSlashMessage(message)) await message.interaction.deferReply();
const permission = message.util.isSlashMessage(message)
@@ -72,7 +71,7 @@ export default class ChannelPermissionsCommand extends BushCommand {
: args.permission;
if (!permission) return await message.util.reply(`${util.emojis.error} Invalid permission.`);
const failedChannels = [];
- for (const [, channel] of message.guild!.channels.cache) {
+ for (const [, channel] of message.guild.channels.cache) {
try {
if (channel.isThread()) return;
if (channel.permissionsLocked) return;
diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts
index d210472..ba2d24a 100644
--- a/src/commands/config/blacklist.ts
+++ b/src/commands/config/blacklist.ts
@@ -1,4 +1,5 @@
import { AllowedMentions, BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
+import assert from 'assert';
import { ApplicationCommandOptionType, PermissionFlagsBits, User } from 'discord.js';
export default class BlacklistCommand extends BushCommand {
@@ -40,7 +41,6 @@ export default class BlacklistCommand extends BushCommand {
}
],
slash: true,
- channel: 'guild',
clientPermissions: (m) => util.clientSendAndPermCheck(m),
userPermissions: [PermissionFlagsBits.ManageGuild]
});
@@ -64,8 +64,11 @@ export default class BlacklistCommand extends BushCommand {
if (!target) return await message.util.reply(`${util.emojis.error} Choose a valid channel or user.`);
const targetID = target.id;
- if (!message.guild && global)
+ if (!message.inGuild() && !global)
return await message.util.reply(`${util.emojis.error} You have to be in a guild to disable commands.`);
+
+ if (!global) assert(message.inGuild());
+
const blacklistedUsers = global
? util.getGlobal('blacklistedUsers')
: (await message.guild!.getSetting('blacklistedChannels')) ?? [];
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts
index 2fae2fd..f860b30 100644
--- a/src/commands/config/config.ts
+++ b/src/commands/config/config.ts
@@ -208,8 +208,10 @@ export default class ConfigCommand extends BushCommand {
value: ArgType<'channel'> | ArgType<'role'> | string;
}
) {
- if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`);
- if (!message.member?.permissions.has(PermissionFlagsBits.ManageGuild) && !message.member?.user.isOwner())
+ assert(message.inGuild());
+ assert(message.member);
+
+ if (!message.member.permissions.has(PermissionFlagsBits.ManageGuild) && !message.member?.user.isOwner())
return await message.util.reply(`${util.emojis.error} You must have the **Manage Server** permission to run this command.`);
const setting = message.util.isSlash ? (_.camelCase(args.subcommandGroup)! as GuildSettings) : args.setting!;
const action = message.util.isSlash ? args.subcommand! : args.action!;
@@ -263,7 +265,8 @@ export default class ConfigCommand extends BushCommand {
collector.on('collect', async (interaction: MessageComponentInteraction) => {
if (interaction.user.id === message.author.id || client.config.owners.includes(interaction.user.id)) {
- if (!message.guild) throw new Error('message.guild is null');
+ assert(message.inGuild());
+
switch (interaction.customId) {
case 'command_settingsSel': {
if (!interaction.isSelectMenu()) return;
@@ -288,10 +291,11 @@ export default class ConfigCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
setting?: undefined | keyof typeof guildSettingsObj
): Promise<MessageOptions & InteractionUpdateOptions> {
- if (!message.guild) throw new Error('message.guild is null');
+ assert(message.inGuild());
+
const settingsEmbed = new Embed().setColor(util.colors.default);
if (!setting) {
- settingsEmbed.setTitle(`${message.guild!.name}'s Settings`);
+ settingsEmbed.setTitle(`${message.guild.name}'s Settings`);
const desc = settingsArr.map((s) => `:wrench: **${guildSettingsObj[s].name}**`).join('\n');
settingsEmbed.setDescription(desc);
@@ -314,7 +318,7 @@ export default class ConfigCommand extends BushCommand {
} else {
settingsEmbed.setTitle(guildSettingsObj[setting].name);
const generateCurrentValue = async (type: GuildSettingType): Promise<string> => {
- const feat = await message.guild!.getSetting(setting);
+ const feat = await message.guild.getSetting(setting);
let func = (v: string) => v;
switch (type.replace('-array', '') as BaseSettingTypes) {
case 'string': {
diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts
index a7ebfa2..db325fc 100644
--- a/src/commands/config/disable.ts
+++ b/src/commands/config/disable.ts
@@ -57,6 +57,8 @@ export default class DisableCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
args: { action?: 'enable' | 'disable'; command: ArgType<'commandAlias'> | string; global: boolean }
) {
+ assert(message.inGuild());
+
let action = (args.action ?? message?.util?.parsed?.alias ?? 'toggle') as 'disable' | 'enable' | 'toggle';
const global = args.global && message.author.isOwner();
const commandID =
@@ -67,13 +69,13 @@ export default class DisableCommand extends BushCommand {
if (DisableCommand.blacklistedCommands.includes(commandID))
return message.util.send(`${util.emojis.error} the ${commandID} command cannot be disabled.`);
- const disabledCommands = global ? util.getGlobal('disabledCommands') : await message.guild!.getSetting('disabledCommands');
+ const disabledCommands = global ? util.getGlobal('disabledCommands') : await message.guild.getSetting('disabledCommands');
if (action === 'toggle') action = disabledCommands.includes(commandID) ? 'disable' : 'enable';
const newValue = util.addOrRemoveFromArray(action === 'disable' ? 'remove' : 'add', disabledCommands, commandID);
const success = global
? await util.setGlobal('disabledCommands', newValue).catch(() => false)
- : await message.guild!.setSetting('disabledCommands', newValue, message.member!).catch(() => false);
+ : await message.guild.setSetting('disabledCommands', newValue, message.member!).catch(() => false);
if (!success)
return await message.util.reply({
content: `${util.emojis.error} There was an error${global ? ' globally' : ''} **${action.substring(
diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts
index 199f201..c9aebd3 100644
--- a/src/commands/config/features.ts
+++ b/src/commands/config/features.ts
@@ -6,6 +6,7 @@ import {
type BushSlashMessage,
type GuildFeatures
} from '#lib';
+import assert from 'assert';
import {
ActionRow,
ComponentType,
@@ -33,11 +34,11 @@ export default class FeaturesCommand extends BushCommand {
}
public override async exec(message: BushMessage | BushSlashMessage) {
- if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`);
+ assert(message.inGuild());
- const featureEmbed = new Embed().setTitle(`${message.guild!.name}'s Features`).setColor(util.colors.default);
+ const featureEmbed = new Embed().setTitle(`${message.guild.name}'s Features`).setColor(util.colors.default);
- const enabledFeatures = await message.guild!.getSetting('enabledFeatures');
+ const enabledFeatures = await message.guild.getSetting('enabledFeatures');
this.generateDescription(guildFeaturesArr, enabledFeatures, featureEmbed);
const components = this.generateComponents(guildFeaturesArr, false);
const msg = (await message.util.reply({ embeds: [featureEmbed], components: [components] })) as Message;
@@ -49,7 +50,7 @@ export default class FeaturesCommand extends BushCommand {
collector.on('collect', async (interaction: SelectMenuInteraction) => {
if (interaction.user.id === message.author.id || client.config.owners.includes(interaction.user.id)) {
- if (!message.guild) throw new Error('message.guild is null');
+ assert(message.inGuild());
const [selected]: GuildFeatures[] = interaction.values as GuildFeatures[];
diff --git a/src/commands/config/log.ts b/src/commands/config/log.ts
index 79f9258..f99f007 100644
--- a/src/commands/config/log.ts
+++ b/src/commands/config/log.ts
@@ -1,4 +1,5 @@
import { BushCommand, guildLogsArr, type ArgType, type BushMessage, type BushSlashMessage, type GuildLogType } from '#lib';
+import assert from 'assert';
import { ArgumentGeneratorReturn } from 'discord-akairo';
import { ApplicationCommandOptionType, ChannelType, PermissionFlagsBits } from 'discord.js';
@@ -72,7 +73,8 @@ export default class LogCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
args: { log_type: GuildLogType; channel: ArgType<'textChannel'> }
) {
- if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`);
+ assert(message.inGuild());
+
const currentLogs = await message.guild.getSetting('logChannels');
const oldChannel = currentLogs[args.log_type] ?? undefined;
diff --git a/src/commands/info/icon.ts b/src/commands/info/icon.ts
index 2b5b8fb..72e82d8 100644
--- a/src/commands/info/icon.ts
+++ b/src/commands/info/icon.ts
@@ -1,4 +1,5 @@
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import assert from 'assert';
import { Embed, PermissionFlagsBits } from 'discord.js';
export default class IconCommand extends BushCommand {
@@ -17,16 +18,18 @@ export default class IconCommand extends BushCommand {
}
public override async exec(message: BushMessage | BushSlashMessage) {
+ assert(message.inGuild());
+
const embed = new Embed()
.setTimestamp()
.setColor(util.colors.default)
.setImage(
- message.guild!.iconURL({
+ message.guild.iconURL({
size: 2048,
extension: 'png'
})!
)
- .setTitle(util.discord.escapeMarkdown(message.guild!.name));
+ .setTitle(util.discord.escapeMarkdown(message.guild.name));
await message.util.reply({ embeds: [embed] });
}
}
diff --git a/src/commands/info/links.ts b/src/commands/info/links.ts
index 25b040c..d91f1e7 100644
--- a/src/commands/info/links.ts
+++ b/src/commands/info/links.ts
@@ -1,5 +1,5 @@
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
-import { assert } from 'console';
+import assert from 'assert';
import { ActionRow, ButtonComponent, ButtonStyle } from 'discord.js';
import packageDotJSON from '../../../package.json' assert { type: 'json' };
diff --git a/src/commands/leveling/leaderboard.ts b/src/commands/leveling/leaderboard.ts
index eb8b90c..0871811 100644
--- a/src/commands/leveling/leaderboard.ts
+++ b/src/commands/leveling/leaderboard.ts
@@ -1,4 +1,5 @@
import { BushCommand, ButtonPaginator, Level, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
+import assert from 'assert';
import { ApplicationCommandOptionType, Embed, PermissionFlagsBits } from 'discord.js';
export default class LeaderboardCommand extends BushCommand {
@@ -28,7 +29,8 @@ export default class LeaderboardCommand extends BushCommand {
}
public override async exec(message: BushMessage | BushSlashMessage, args: { page: ArgType<'integer'> }) {
- if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a server.`);
+ assert(message.inGuild());
+
if (!(await message.guild.hasFeature('leveling')))
return await message.util.reply(
`${util.emojis.error} This command can only be run in servers with the leveling feature enabled.${
@@ -43,7 +45,7 @@ export default class LeaderboardCommand extends BushCommand {
(val, index) => `\`${index + 1}\` <@${val.user}> - Level ${val.level} (${val.xp.toLocaleString()} xp)`
);
const chunked = util.chunk(mappedRanks, 25);
- const embeds = chunked.map((c) => new Embed().setTitle(`${message.guild!.name}'s Leaderboard`).setDescription(c.join('\n')));
+ const embeds = chunked.map((c) => new Embed().setTitle(`${message.guild.name}'s Leaderboard`).setDescription(c.join('\n')));
return await ButtonPaginator.send(message, embeds, undefined, true, args?.page ?? undefined);
}
}
diff --git a/src/commands/leveling/level.ts b/src/commands/leveling/level.ts
index 271c3f6..803703e 100644
--- a/src/commands/leveling/level.ts
+++ b/src/commands/leveling/level.ts
@@ -47,7 +47,8 @@ export default class LevelCommand extends BushCommand {
}
public override async exec(message: BushMessage | BushSlashMessage, args: { user: OptionalArgType<'user'> }) {
- if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a server.`);
+ assert(message.inGuild());
+
if (!(await message.guild.hasFeature('leveling')))
return await message.util.reply(
`${util.emojis.error} This command can only be run in servers with the leveling feature enabled.${
@@ -59,7 +60,7 @@ export default class LevelCommand extends BushCommand {
const user = args.user ?? message.author;
try {
return await message.util.reply({
- files: [new MessageAttachment(await this.getImage(user, message.guild!), 'level.png')]
+ files: [new MessageAttachment(await this.getImage(user, message.guild), 'level.png')]
});
} catch (e) {
if (e instanceof Error && e.message === 'User does not have a level') {
diff --git a/src/commands/leveling/setLevel.ts b/src/commands/leveling/setLevel.ts
index 1016280..e74d885 100644
--- a/src/commands/leveling/setLevel.ts
+++ b/src/commands/leveling/setLevel.ts
@@ -1,4 +1,5 @@
import { AllowedMentions, BushCommand, Level, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
+import assert from 'assert';
import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
export default class SetLevelCommand extends BushCommand {
@@ -38,10 +39,11 @@ export default class SetLevelCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
{ user, level }: { user: ArgType<'user'>; level: ArgType<'integer'> }
) {
- if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a guild.`);
- if (!user.id) throw new Error('user.id is null');
+ assert(message.inGuild());
+ assert(user.id);
- if (isNaN(level)) return await message.util.reply(`${util.emojis.error} Provide a valid number to set the user's level to.`);
+ if (isNaN(level) || !Number.isInteger(level))
+ return await message.util.reply(`${util.emojis.error} Provide a valid number to set the user's level to.`);
if (level > 6553 || level < 0)
return await message.util.reply(`${util.emojis.error} You cannot set a level higher than \`6553\`.`);
diff --git a/src/commands/leveling/setXp.ts b/src/commands/leveling/setXp.ts
index a86c58a..7b1b432 100644
--- a/src/commands/leveling/setXp.ts
+++ b/src/commands/leveling/setXp.ts
@@ -1,4 +1,5 @@
import { AllowedMentions, BushCommand, Level, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
+import assert from 'assert';
import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
export default class SetXpCommand extends BushCommand {
@@ -39,8 +40,8 @@ export default class SetXpCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
{ user, xp }: { user: ArgType<'user'>; xp: ArgType<'abbreviatedNumber'> }
) {
- if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a guild.`);
- if (!user.id) throw new Error('user.id is null');
+ assert(message.inGuild());
+ assert(user.id);
if (isNaN(xp)) return await message.util.reply(`${util.emojis.error} Provide a valid number.`);
if (xp > 2147483647 || xp < 0)
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts
index 5e3350f..25102e0 100644
--- a/src/commands/moderation/ban.ts
+++ b/src/commands/moderation/ban.ts
@@ -8,7 +8,8 @@ import {
type BushSlashMessage,
type OptionalArgType
} from '#lib';
-import { ApplicationCommandOptionType, PermissionFlagsBits, type User } from 'discord.js';
+import assert from 'assert';
+import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
export default class BanCommand extends BushCommand {
public constructor() {
@@ -71,20 +72,21 @@ export default class BanCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
args: {
user: ArgType<'user'> | ArgType<'snowflake'>;
- reason_and_duration: OptionalArgType<'contentWithDuration'>;
+ reason_and_duration: OptionalArgType<'contentWithDuration'> | string;
days: OptionalArgType<'integer'>;
force: boolean;
}
) {
- if (args.reason_and_duration && typeof args.reason_and_duration === 'object') args.reason_and_duration.duration ??= 0;
- args