aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arguments/permission.ts2
-rw-r--r--src/arguments/roleWithDuation.ts6
-rw-r--r--src/commands/config/blacklist.ts3
-rw-r--r--src/commands/config/config.ts12
-rw-r--r--src/commands/dev/test.ts22
-rw-r--r--src/commands/info/guildInfo.ts98
-rw-r--r--src/commands/info/help.ts15
-rw-r--r--src/commands/info/links.ts2
-rw-r--r--src/commands/info/snowflake.ts2
-rw-r--r--src/commands/info/userInfo.ts3
-rw-r--r--src/commands/leveling/leaderboard.ts8
-rw-r--r--src/commands/leveling/level.ts8
-rw-r--r--src/commands/leveling/setLevel.ts2
-rw-r--r--src/commands/leveling/setXp.ts2
-rw-r--r--src/commands/moderation/ban.ts18
-rw-r--r--src/commands/moderation/hideCase.ts6
-rw-r--r--src/commands/moderation/kick.ts11
-rw-r--r--src/commands/moderation/modlog.ts2
-rw-r--r--src/commands/moderation/mute.ts61
-rw-r--r--src/commands/moderation/role.ts23
-rw-r--r--src/commands/moderation/slowmode.ts2
-rw-r--r--src/commands/moderation/unban.ts13
-rw-r--r--src/commands/moderation/unmute.ts28
-rw-r--r--src/commands/moderation/warn.ts31
-rw-r--r--src/commands/moulberry-bush/capePerms.ts8
-rw-r--r--src/commands/moulberry-bush/serverStatus.ts2
-rw-r--r--src/commands/utilities/activity.ts2
-rw-r--r--src/commands/utilities/price.ts2
-rw-r--r--src/lib/common/ButtonPaginator.ts9
-rw-r--r--src/lib/common/util/Arg.ts7
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts13
-rw-r--r--src/lib/utils/BushConstants.ts6
-rw-r--r--src/listeners/custom/bushBan.ts3
-rw-r--r--src/listeners/custom/bushKick.ts3
-rw-r--r--src/listeners/custom/bushLevelUpdate.ts3
-rw-r--r--src/listeners/custom/bushMute.ts3
-rw-r--r--src/listeners/custom/bushPunishRole.ts3
-rw-r--r--src/listeners/custom/bushPunishRoleRemove.ts3
-rw-r--r--src/listeners/custom/bushUnban.ts3
-rw-r--r--src/listeners/custom/bushUnmute.ts3
-rw-r--r--src/listeners/custom/bushWarn.ts3
41 files changed, 198 insertions, 258 deletions
diff --git a/src/arguments/permission.ts b/src/arguments/permission.ts
index 8ad0102..3275c49 100644
--- a/src/arguments/permission.ts
+++ b/src/arguments/permission.ts
@@ -4,7 +4,7 @@ import { BushArgumentTypeCaster } from '../lib/extensions/discord-akairo/BushArg
export const permissionTypeCaster: BushArgumentTypeCaster = (_, phrase) => {
if (!phrase) return null;
phrase = phrase.toUpperCase().replace(/ /g, '_');
- if (!Permissions.FLAGS[phrase as keyof typeof Permissions.FLAGS]) {
+ if (!Reflect.has(Permissions.FLAGS, phrase)) {
return null;
} else {
return phrase;
diff --git a/src/arguments/roleWithDuation.ts b/src/arguments/roleWithDuation.ts
index a63026d..50f54e2 100644
--- a/src/arguments/roleWithDuation.ts
+++ b/src/arguments/roleWithDuation.ts
@@ -8,9 +8,7 @@ export const roleWithDurationTypeCaster: BushArgumentTypeCaster = async (
let { duration, contentWithoutTime } = client.util.parseDuration(phrase);
if (contentWithoutTime === null || contentWithoutTime === undefined) return null;
contentWithoutTime = contentWithoutTime.trim();
- const role = await util.arg.cast('role', client.commandHandler.resolver, message, contentWithoutTime);
- if (!role) {
- return null;
- }
+ const role = await util.arg.cast('role', message, contentWithoutTime);
+ if (!role) return null;
return { duration, role };
};
diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts
index 9f3737d..8a575c3 100644
--- a/src/commands/config/blacklist.ts
+++ b/src/commands/config/blacklist.ts
@@ -68,8 +68,7 @@ export default class BlacklistCommand extends BushCommand {
const global = args.global && message.author.isOwner();
const target =
typeof args.target === 'string'
- ? (await util.arg.cast('channel', client.commandHandler.resolver, message as BushMessage, args.target)) ??
- (await util.arg.cast('user', client.commandHandler.resolver, message as BushMessage, args.target))
+ ? (await util.arg.cast('channel', message, args.target)) ?? (await util.arg.cast('user', message, args.target))
: args.target;
if (!target) return await message.util.reply(`${util.emojis.error} Choose a valid channel or user.`);
const targetID = target.id;
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts
index 72ba566..83bcebe 100644
--- a/src/commands/config/config.ts
+++ b/src/commands/config/config.ts
@@ -336,15 +336,9 @@ export default class SettingsCommand extends BushCommand {
);
settingsEmbed.setFooter(
- `Run "${
- message.util.isSlash
- ? '/'
- : client.config.isDevelopment
- ? 'dev '
- : message.util.parsed?.prefix ?? client.config.prefix
- }${message.util.parsed?.alias ?? 'config'} ${message.util.isSlash ? _.snakeCase(setting) : setting} ${
- guildSettingsObj[setting].type.includes('-array') ? 'add/remove' : 'set'
- } <value>" to set this setting.`
+ `Run "${util.prefix(message)}${message.util.parsed?.alias ?? 'config'} ${
+ message.util.isSlash ? _.snakeCase(setting) : setting
+ } ${guildSettingsObj[setting].type.includes('-array') ? 'add/remove' : 'set'} <value>" to set this setting.`
);
settingsEmbed.addField('value', (await generateCurrentValue(guildSettingsObj[setting].type)) || '[No Value Set]');
return { embeds: [settingsEmbed], components: [components] };
diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts
index a1e5052..38ea920 100644
--- a/src/commands/dev/test.ts
+++ b/src/commands/dev/test.ts
@@ -107,19 +107,19 @@ export default class TestCommand extends BushCommand {
fields.push({ name: `Field ${i}`, value: `Field Value ${i}` });
}
const c = util.colors;
- const o = { description, author, footer, fields }!;
+ const o = { description, author, footer, fields, time: Date.now() };
const embeds = [
- new MessageEmbed({ ...o, ...{ title: 'Embed Title 0', color: c.red } }).setTimestamp(),
- new MessageEmbed({ ...o, ...{ title: 'Embed Title 1', color: c.orange } }).setTimestamp(),
- new MessageEmbed({ ...o, ...{ title: 'Embed Title 2', color: c.gold } }).setTimestamp(),
- new MessageEmbed({ ...o, ...{ title: 'Embed Title 3', color: c.yellow } }).setTimestamp(),
- new MessageEmbed({ ...o, ...{ title: 'Embed Title 4', color: c.green } }).setTimestamp(),
- new MessageEmbed({ ...o, ...{ title: 'Embed Title 5', color: c.darkGreen } }).setTimestamp(),
- new MessageEmbed({ ...o, ...{ title: 'Embed Title 6', color: c.aqua } }).setTimestamp(),
- new MessageEmbed({ ...o, ...{ title: 'Embed Title 7', color: c.blue } }).setTimestamp(),
- new MessageEmbed({ ...o, ...{ title: 'Embed Title 8', color: c.purple } }).setTimestamp(),
- new MessageEmbed({ ...o, ...{ title: 'Embed Title 9', color: c.pink } }).setTimestamp()
+ { ...o, title: 'Embed Title 0', color: c.red },
+ { ...o, title: 'Embed Title 1', color: c.orange },
+ { ...o, title: 'Embed Title 2', color: c.gold },
+ { ...o, title: 'Embed Title 3', color: c.yellow },
+ { ...o, title: 'Embed Title 4', color: c.green },
+ { ...o, title: 'Embed Title 5', color: c.darkGreen },
+ { ...o, title: 'Embed Title 6', color: c.aqua },
+ { ...o, title: 'Embed Title 7', color: c.blue },
+ { ...o, title: 'Embed Title 8', color: c.purple },
+ { ...o, title: 'Embed Title 9', color: c.pink }
];
const ButtonRows: MessageActionRow[] = [];
diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts
index 4a79918..44c388d 100644
--- a/src/commands/info/guildInfo.ts
+++ b/src/commands/info/guildInfo.ts
@@ -45,6 +45,7 @@ export default class GuildInfoCommand extends BushCommand {
`${util.emojis.error} You must either provide an server to provide info about or run this command in a server.`
);
}
+ const otherEmojis = client.consts.mappings.otherEmojis;
let isPreview = false;
if (['number', 'string'].includes(typeof args?.guild)) {
const preview = await client.fetchGuildPreview(`${args.guild}` as Snowflake).catch(() => {});
@@ -61,47 +62,27 @@ export default class GuildInfoCommand extends BushCommand {
const guildStats: string[] = [];
const guildSecurity: string[] = [];
const verifiedGuilds = Object.values(client.consts.mappings.guilds);
- if (verifiedGuilds.includes(guild.id)) emojis.push(client.consts.mappings.otherEmojis.BUSH_VERIFIED);
+ if (verifiedGuilds.includes(guild.id)) emojis.push(otherEmojis.BUSH_VERIFIED);
if (!isPreview && guild instanceof Guild) {
- if (guild.premiumTier)
- emojis.push(
- client.consts.mappings.otherEmojis[`BOOST_${guild.premiumTier}` as keyof typeof client.consts.mappings.otherEmojis]
- );
+ if (guild.premiumTier !== 'NONE') emojis.push(otherEmojis[`BOOST_${guild.premiumTier}`]);
await guild.fetch();
+ const channels = guild.channels.cache;
const channelTypes = [
- `${client.consts.mappings.otherEmojis.TEXT} ${guild.channels.cache
- .filter((channel) => channel.type === 'GUILD_TEXT')
- .size.toLocaleString()}`,
- `${client.consts.mappings.otherEmojis.NEWS} ${guild.channels.cache
- .filter((channel) => channel.type === 'GUILD_NEWS')
- .size.toLocaleString()}`,
- `${client.consts.mappings.otherEmojis.VOICE} ${guild.channels.cache
- .filter((channel) => channel.type === 'GUILD_VOICE')
- .size.toLocaleString()}`,
- `${client.consts.mappings.otherEmojis.STAGE} ${guild.channels.cache
- .filter((channel) => channel.type === 'GUILD_STAGE_VOICE')
- .size.toLocaleString()}`,
- `${client.consts.mappings.otherEmojis.STORE} ${guild.channels.cache
- .filter((channel) => channel.type === 'GUILD_STORE')
- .size.toLocaleString()}`,
- `${client.consts.mappings.otherEmojis.CATEGORY} ${guild.channels.cache
- .filter((channel) => channel.type === 'GUILD_CATEGORY')
- .size.toLocaleString()}`,
- `${client.consts.mappings.otherEmojis.THREAD} ${guild.channels.cache
- .filter((channel) =>
- ['GUILD_NEWS_THREAD', 'GUILD_PUBLIC_THREAD', 'GUILD_PRIVATE_THREAD', 'GUILD_STAGE_VOICE'].includes(channel.type)
- )
- .size.toLocaleString()}`
+ `${otherEmojis.TEXT} ${channels.filter((channel) => channel.type === 'GUILD_TEXT').size.toLocaleString()}`,
+ `${otherEmojis.NEWS} ${channels.filter((channel) => channel.type === 'GUILD_NEWS').size.toLocaleString()}`,
+ `${otherEmojis.VOICE} ${channels.filter((channel) => channel.type === 'GUILD_VOICE').size.toLocaleString()}`,
+ `${otherEmojis.STAGE} ${channels.filter((channel) => channel.type === 'GUILD_STAGE_VOICE').size.toLocaleString()}`,
+ `${otherEmojis.STORE} ${channels.filter((channel) => channel.type === 'GUILD_STORE').size.toLocaleString()}`,
+ `${otherEmojis.CATEGORY} ${channels.filter((channel) => channel.type === 'GUILD_CATEGORY').size.toLocaleString()}`,
+ `${otherEmojis.THREAD} ${channels.filter((channel) => channel.type.includes('_THREAD')).size.toLocaleString()}`
];
- const guildRegions: string[] = [];
- guild.channels.cache.forEach((channel) => {
- if (!channel.type.includes('VOICE')) return;
- else if (!guildRegions.includes((channel as BaseGuildVoiceChannel).rtcRegion ?? 'automatic')) {
- guildRegions.push((channel as BaseGuildVoiceChannel).rtcRegion ?? 'automatic');
- }
- });
+ const guildRegions = [
+ ...new Set(
+ guild.channels.cache.filter((c) => c.isVoice()).map((c) => (c as BaseGuildVoiceChannel).rtcRegion ?? 'automatic')
+ )
+ ] as RTCRegion[];
guildAbout.push(
`**Owner:** ${guild.members.cache.get(guild.ownerId)?.user.tag}`,
@@ -109,9 +90,7 @@ export default class GuildInfoCommand extends BushCommand {
`**Members:** ${guild.memberCount.toLocaleString() ?? 0} (${util.emojis.onlineCircle} ${
guild.approximatePresenceCount?.toLocaleString() ?? 0
}, ${util.emojis.offlineCircle} ${(guild.memberCount - (guild.approximatePresenceCount ?? 0)).toLocaleString() ?? 0})`,
- `**Regions:** ${guildRegions
- .map((region) => client.consts.mappings.regions[region as keyof typeof client.consts.mappings.regions] || region)
- .join(', ')}`
+ `**Regions:** ${guildRegions.map((region) => client.consts.mappings.regions[region] || region).join(', ')}`
);
if (guild.premiumSubscriptionCount)
guildAbout.push(
@@ -171,28 +150,21 @@ export default class GuildInfoCommand extends BushCommand {
);
}
+ const features = client.consts.mappings.features;
const guildFeatures = guild.features.sort((a, b): number => {
- const aWeight = client.consts.mappings.features[a]?.weight;
- const bWeight = client.consts.mappings.features[b]?.weight;
+ const aWeight = features[a]?.weight;
+ const bWeight = features[b]?.weight;
- if (aWeight != undefined && bWeight != undefined) {
- return aWeight - bWeight;
- } else if (aWeight == undefined) {
- return 1;
- } else if (bWeight == undefined) {
- return -1;
- }
+ if (aWeight !== undefined && bWeight !== undefined) return aWeight - bWeight;
+ else if (aWeight == undefined) return 1;
+ else if (bWeight == undefined) return -1;
return 0;
});
if (guildFeatures.length) {
guildFeatures.forEach((feature) => {
- if (client.consts.mappings.features[feature]?.emoji) {
- emojis.push(`${client.consts.mappings.features[feature].emoji}`);
- } else if (client.consts.mappings.features[feature]?.name) {
- emojis.push(`\`${client.consts.mappings.features[feature].name}\``);
- } else {
- emojis.push(`\`${feature}\``);
- }
+ if (features[feature]?.emoji) emojis.push(`${features[feature].emoji}`);
+ else if (features[feature]?.name) emojis.push(`\`${features[feature].name}\``);
+ else emojis.push(`\`${feature}\``);
});
}
@@ -204,7 +176,7 @@ export default class GuildInfoCommand extends BushCommand {
.setTitle(guild.name)
.setColor(util.colors.default)
.addField('» About', guildAbout.join('\n'));
- if (guildStats) guildInfoEmbed.addField('» Stats', guildStats.join('\n'));
+ if (guildStats.length) guildInfoEmbed.addField('» Stats', guildStats.join('\n'));
const guildIcon = guild.iconURL({ size: 2048, format: 'png', dynamic: true });
if (guildIcon) {
guildInfoEmbed.setThumbnail(guildIcon);
@@ -218,3 +190,19 @@ export default class GuildInfoCommand extends BushCommand {
return await message.util.reply({ embeds: [guildInfoEmbed] });
}
}
+
+type RTCRegion =
+ | 'us-west'
+ | 'us-east'
+ | 'us-central'
+ | 'us-south'
+ | 'singapore'
+ | 'southafrica'
+ | 'sydney'
+ | 'europe'
+ | 'brazil'
+ | 'hongkong'
+ | 'russia'
+ | 'japan'
+ | 'india'
+ | 'automatic';
diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts
index 5e80199..440bcb2 100644
--- a/src/commands/info/help.ts
+++ b/src/commands/info/help.ts
@@ -22,11 +22,7 @@ export default class HelpCommand extends BushCommand {
optional: true
}
},
- {
- id: 'showHidden',
- match: 'flag',
- flag: '--hidden'
- }
+ { id: 'showHidden', match: 'flag', flag: '--hidden' }
],
slash: true,
slashOptions: [
@@ -46,11 +42,7 @@ export default class HelpCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
args: { command: BushCommand | string; showHidden?: boolean }
): Promise<unknown> {
- const prefix = message.util.isSlash
- ? '/'
- : client.config.isDevelopment
- ? 'dev '
- : message.util.parsed?.prefix ?? client.config.prefix;
+ const prefix = util.prefix(message);
const row = new MessageActionRow();
if (!client.config.isDevelopment && !client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) {
@@ -101,8 +93,7 @@ export default class HelpCommand extends BushCommand {
if (command.superUserOnly && !isSuperUser) {
return false;
}
- // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
- return !(command.restrictedGuilds?.includes(message.guild?.id!) === false && !args.showHidden);
+ return !(command.restrictedGuilds?.includes(message.guild?.id ?? '') === false && !args.showHidden);
});
const categoryNice = category.id
.replace(/(\b\w)/gi, (lc): string => lc.toUpperCase())
diff --git a/src/commands/info/links.ts b/src/commands/info/links.ts
index 569b959..754b22b 100644
--- a/src/commands/info/links.ts
+++ b/src/commands/info/links.ts
@@ -12,8 +12,6 @@ export default class LinksCommand extends BushCommand {
usage: 'links',
examples: ['links']
},
- ratelimit: 4,
- cooldown: 4000,
clientPermissions: (m) => util.clientSendAndPermCheck(m),
userPermissions: [],
slash: true
diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts
index 81b3f9d..083acbf 100644
--- a/src/commands/info/snowflake.ts
+++ b/src/commands/info/snowflake.ts
@@ -22,8 +22,6 @@ export default class SnowflakeCommand extends BushCommand {
super('snowflake', {
aliases: ['snowflake', 'info', 'sf'],
category: 'info',
- ratelimit: 4,
- cooldown: 4000,
description: {
content: 'Provides information about the specified Snowflake.',
usage: 'snowflake <snowflake>',
diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts
index 353d844..17be687 100644
--- a/src/commands/info/userInfo.ts
+++ b/src/commands/info/userInfo.ts
@@ -20,8 +20,7 @@ export default class UserInfoCommand extends BushCommand {
start: 'What user would you like to find information about?',
retry: '{error} Choose a valid user to find information about.',
optional: true
- },
- default: null
+ }
}
],
slash: true,
diff --git a/src/commands/leveling/leaderboard.ts b/src/commands/leveling/leaderboard.ts
index e3344a0..dde2270 100644
--- a/src/commands/leveling/leaderboard.ts
+++ b/src/commands/leveling/leaderboard.ts
@@ -44,13 +44,7 @@ export default class LeaderboardCommand extends BushCommand {
return await message.util.reply(
`${util.emojis.error} This command can only be run in servers with the leveling feature enabled.${
message.member?.permissions.has('MANAGE_GUILD')
- ? ` You can toggle features using the \`${
- message.util.isSlash
- ? '/'
- : client.config.isDevelopment
- ? 'dev '
- : message.util.parsed?.prefix ?? client.config.prefix
- }features\` command.`
+ ? ` You can toggle features using the \`${util.prefix(message)}features\` command.`
: ''
}`
);
diff --git a/src/commands/leveling/level.ts b/src/commands/leveling/level.ts
index 4d7adb3..219aab1 100644
--- a/src/commands/leveling/level.ts
+++ b/src/commands/leveling/level.ts
@@ -56,13 +56,7 @@ export default class LevelCommand extends BushCommand {
return await message.util.reply(
`${util.emojis.error} This command can only be run in servers with the leveling feature enabled.${
message.member?.permissions.has('MANAGE_GUILD')
- ? ` You can toggle features using the \`${
- message.util.isSlash
- ? '/'
- : client.config.isDevelopment
- ? 'dev '
- : message.util.parsed?.prefix ?? client.config.prefix
- }features\` command.`
+ ? ` You can toggle features using the \`${util.prefix(message)}features\` command.`
: ''
}`
);
diff --git a/src/commands/leveling/setLevel.ts b/src/commands/leveling/setLevel.ts
index 9a7337a..d3ee162 100644
--- a/src/commands/leveling/setLevel.ts
+++ b/src/commands/leveling/setLevel.ts
@@ -55,8 +55,6 @@ export default class SetLevelCommand extends BushCommand {
{ user, level }: { user: User; level: number }
): Promise<unknown> {
if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a guild.`);
- if (message.author.id === '496409778822709251')
- return await message.util.reply(`${util.emojis.error} This command is Bestower proof.`);
if (!user.id) throw new Error('user.id is null');
if (isNaN(level))
diff --git a/src/commands/leveling/setXp.ts b/src/commands/leveling/setXp.ts
index a73ae58..a140bfc 100644
--- a/src/commands/leveling/setXp.ts
+++ b/src/commands/leveling/setXp.ts
@@ -58,8 +58,6 @@ export default class SetXpCommand extends BushCommand {
{ user, xp }: { user: User; xp: number }
): Promise<unknown> {
if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a guild.`);
- if (message.author.id === '496409778822709251')
- return await message.util.reply(`${util.emojis.error} This command is Bestower proof.`);
if (!user.id) throw new Error('user.id is null');
if (isNaN(xp)) return await message.util.reply(`${util.emojis.error} Provide a valid number.`);
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts
index b3d97d2..74b1b54 100644
--- a/src/commands/moderation/ban.ts
+++ b/src/commands/moderation/ban.ts
@@ -118,10 +118,7 @@ export default class BanCommand extends BushCommand {
let time: number;
if (reason) {
- time =
- typeof reason === 'string'
- ? await util.arg.cast('duration', client.commandHandler.resolver, message as BushMessage, reason)
- : reason.duration;
+ time = typeof reason === 'string' ? await util.arg.cast('duration', message, reason) : reason.duration;
}
const parsedReason = reason?.contentWithoutTime ?? null;
@@ -141,19 +138,20 @@ export default class BanCommand extends BushCommand {
});
const responseMessage = () => {
+ const victim = util.format.bold(user.tag);
switch (responseCode) {
case 'missing permissions':
- return `${util.emojis.error} Could not ban **${user.tag}** because I do not have permissions`;
+ return `${util.emojis.error} Could not ban ${victim} because I am missing the **Ban Members** permission.`;
case 'error banning':
- return `${util.emojis.error} An error occurred while trying to ban **${user.tag}**.`;
+ return `${util.emojis.error} An error occurred while trying to ban ${victim}.`;
case 'error creating ban entry':
- return `${util.emojis.error} While banning **${user.tag}**, there was an error creating a ban entry, please report this to my developers.`;
+ return `${util.emojis.error} While banning ${victim}, there was an error creating a ban entry, please report this to my developers.`;
case 'error creating modlog entry':
- return `${util.emojis.error} While banning **${user.tag}**, there was an error creating a modlog entry, please report this to my developers.`;
+ return `${util.emojis.error} While banning ${victim}, there was an error creating a modlog entry, please report this to my developers.`;
case 'failed to dm':
- return `${util.emojis.warn} Banned **${user.tag}** however I could not send them a dm.`;
+ return `${util.emojis.warn} Banned ${victim} however I could not send them a dm.`;
case 'success':
- return `${util.emojis.success} Successfully banned **${user.tag}**.`;
+ return `${util.emojis.success} Successfully banned ${victim}.`;
}
};
return await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });
diff --git a/src/commands/moderation/hideCase.ts b/src/commands/moderation/hideCase.ts
index 38cfe31..981a8bc 100644
--- a/src/commands/moderation/hideCase.ts
+++ b/src/commands/moderation/hideCase.ts
@@ -20,8 +20,6 @@ export default class HideCaseCommand extends BushCommand {
}
}
],
- clientPermissions: (m) => util.clientSendAndPermCheck(m),
- userPermissions: (m) => util.userGuildPermCheck(m, ['MANAGE_MESSAGES']),
slash: true,
slashOptions: [
{
@@ -31,6 +29,8 @@ export default class HideCaseCommand extends BushCommand {
required: true
}
],
+ clientPermissions: (m) => util.clientSendAndPermCheck(m),
+ userPermissions: (m) => util.userGuildPermCheck(m, ['MANAGE_MESSAGES']),
channel: 'guild'
});
}
@@ -39,8 +39,6 @@ export default class HideCaseCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
{ case_id: caseID }: { case_id: string }
): Promise<unknown> {
- if (message.author.id === '496409778822709251')
- return await message.util.reply(`${util.emojis.error} This command is Bestower proof.`);
const entry = await ModLog.findByPk(caseID);
if (!entry || entry.pseudo) return message.util.send(`${util.emojis.error} Invalid entry.`);
if (entry.guild !== message.guild!.id)
diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts
index 9bd5658..3238217 100644
--- a/src/commands/moderation/kick.ts
+++ b/src/commands/moderation/kick.ts
@@ -80,17 +80,18 @@ export default class KickCommand extends BushCommand {
});
const responseMessage = () => {
+ const victim = util.format.bold(member.user.tag);
switch (responseCode) {
case 'missing permissions':
- return `${util.emojis.error} Could not kick **${member.user.tag}** because I am missing the \`Kick Members\` permission.`;
+ return `${util.emojis.error} Could not kick ${victim} because I am missing the \`Kick Members\` permission.`;
case 'error kicking':
- return `${util.emojis.error} An error occurred while trying to kick **${member.user.tag}**.`;
+ return `${util.emojis.error} An error occurred while trying to kick ${victim}.`;
case 'error creating modlog entry':
- return `${util.emojis.error} While muting **${member.user.tag}**, there was an error creating a modlog entry, please report this to my developers.`;
+ return `${util.emojis.error} While muting ${victim}, there was an error creating a modlog entry, please report this to my developers.`;
case 'failed to dm':
- return `${util.emojis.warn} Kicked **${member.user.tag}** however I could not send them a dm.`;
+ return `${util.emojis.warn} Kicked ${victim} however I could not send them a dm.`;
case 'success':
- return `${util.emojis.success} Successfully kicked **${member.user.tag}**.`;
+ return `${util.emojis.success} Successfully kicked ${victim}.`;
}
};
return await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });
diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts
index eb37681..4abaa6f 100644
--- a/src/commands/moderation/modlog.ts
+++ b/src/commands/moderation/modlog.ts
@@ -50,7 +50,7 @@ export default class ModlogCommand extends BushCommand {
#generateModlogInfo(log: ModLog, showUser: boolean): string {
const trim = (str: string): string => (str.endsWith('\n') ? str.substring(0, str.length - 1).trim() : str.trim());
- const modLog = [`**Case ID**: ${util.discord.escapeItalic(log.id)}`, `**Type**: ${log.type.toLowerCase()}`];
+ const modLog = [`**Case ID**: ${util.discord.escapeMarkdown(log.id)}`, `**Type**: ${log.type.toLowerCase()}`];
if (showUser) modLog.push(`**User**: <@!${log.user}>`);
modLog.push(`**Moderator**: <@!${log.moderator}>`);
if (log.duration) modLog.push(`**Duration**: ${util.humanizeDuration(log.duration)}`);
diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts
index 03ecf2a..00631ba 100644
--- a/src/commands/moderation/mute.ts
+++ b/src/commands/moderation/mute.ts
@@ -30,11 +30,7 @@ export default class MuteCommand extends BushCommand {
optional: true
}
},
- {
- id: 'force',
- flag: '--force',
- match: 'flag'
- }
+ { id: 'force', flag: '--force', match: 'flag' }
],
slash: true,
slashOptions: [
@@ -59,66 +55,67 @@ export default class MuteCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- {
- user,
- reason,
- force
- }: { user: BushUser; reason?: { duration: number | null; contentWithoutTime: string }; force: boolean }
+ args: { user: BushUser; reason?: { duration: number | null; contentWithoutTime: string } | string; force: boolean }
): Promise<unknown> {
- if (reason?.duration === null) reason.duration = 0;
- const member = await message.guild!.members.fetch(user.id).catch(() => null);
+ const reason: { duration: number | null; contentWithoutTime: string } = args.reason
+ ? typeof args.reason === 'string'
+ ? await util.arg.cast('contentWithDuration', message, args.reason)
+ : args.reason
+ : { duration: null, contentWithoutTime: '' };
+
+ if (reason.duration === null) reason.duration = 0;
+ const member = await message.guild!.members.fetch(args.user.id).catch(() => null);
if (!member)
return await message.util.reply(
`${util.emojis.error} The user you selected is not in the server or is not a valid user.`
);
if (!message.member) throw new Error(`message.member is null`);
- const useForce = force && message.author.isOwner();
+ const useForce = args.force && message.author.isOwner();
const canModerateResponse = await Moderation.permissionCheck(message.member, member, 'mute', true, useForce);
- const victimBoldTag = `**${member.user.tag}**`;
if (canModerateResponse !== true) {
return message.util.reply(canModerateResponse);
}
- let time: number;
- if (reason) {
- time =
- typeof reason === 'string'
- ? await util.arg.cast('duration', client.commandHandler.resolver, message as BushMessage, reason)
- : reason.duration;
- }
+ const time = reason
+ ? typeof reason === 'string'
+ ? ((await util.arg.cast('duration', message, reason)) as number)
+ : reason.duration
+ : undefined;
+
const parsedReason = reason?.contentWithoutTime ?? '';
const responseCode = await member.mute({
reason: parsedReason,
moderator: message.member,
- duration: time! ?? 0
+ duration: time ?? 0
});
- const responseMessage = async () => {
- const prefix = await message.guild!.getSetting('prefix');
+ const responseMessage = () => {
+ const prefix = util.prefix(message);
+ const victim = util.format.bold(member.user.tag);
switch (responseCode) {
case 'missing permissions':
- return `${util.emojis.error} Could not mute ${victimBoldTag} because I am missing the **Manage Roles** permission.`;
+ return `${util.emojis.error} Could not mute ${victim} because I am missing the **Manage Roles** permission.`;
case 'no mute role':
- return `${util.emojis.error} Could not mute ${victimBoldTag}, you must set a mute role with \`${prefix}config muteRole\`.`;
+ return `${util.emojis.error} Could not mute ${victim}, you must set a mute role with \`${prefix}config muteRole\`.`;
case 'invalid mute role':
- return `${util.emojis.error} Could not mute ${victimBoldTag} because the current mute role no longer exists. Please set a new mute role with \`${prefix}config muteRole\`.`;
+ return `${util.emojis.error} Could not mute ${victim} because the current mute role no longer exists. Please set a new mute role with \`${prefix}config muteRole\`.`;
case 'mute role not manageable':
- return `${util.emojis.error} Could not mute ${victimBoldTag} because I cannot assign the current mute role, either change the role's position or set a new mute role with \`${prefix}config muteRole\`.`;
+ return `${util.emojis.error} Could not mute ${victim} because I cannot assign the current mute role, either change the role's position or set a new mute role with \`${prefix}config muteRole\`.`;
case 'error giving mute role':
- return `${util.emojis.error} Could not mute ${victimBoldTag}, there was an error assigning them the mute role.`;
+ return `${util.emojis.error} Could not mute ${victim}, there was an error assigning them the mute role.`;
case 'error creating modlog entry':
return `${util.emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
case 'error creating mute entry':
return `${util.emojis.error} There was an error creating a punishment entry, please report this to my developers.`;
case 'failed to dm':
- return `${util.emojis.warn} Muted **${member.user.tag}** however I could not send them a dm.`;
+ return `${util.emojis.warn} Muted ${victim} however I could not send them a dm.`;
case 'success':
- return `${util.emojis.success} Successfully muted **${member.user.tag}**.`;
+ return `${util.emojis.success} Successfully muted ${victim}.`;
}
};
- return await message.util.reply({ content: await responseMessage(), allowedMentions: AllowedMentions.none() });
+ return await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });
}
}
diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts
index fe34d75..d6a85af 100644
--- a/src/commands/moderation/role.ts
+++ b/src/commands/moderation/role.ts
@@ -18,14 +18,8 @@ export default class RoleCommand extends BushCommand {
description: 'Would you like to add or remove a role?',
type: 'STRING',
choices: [
- {
- name: 'add',
- value: 'add'
- },
- {
- name: 'remove',
- value: 'remove'
- }
+ { name: 'add', value: 'add' },
+ { name: 'remove', value: 'remove' }
],
required: true
},
@@ -97,7 +91,7 @@ export default class RoleCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
{
action,
- user,
+ user: member,
role,
duration
}: { action: 'add' | 'remove'; user: BushGuildMember; role: BushRole; duration?: number | null }
@@ -114,7 +108,7 @@ export default class RoleCommand extends BushCommand {
const a = mappings.roleMap[i];
if (a.id == role.id) mappedRole = a;
}
- if (!mappedRole! || !mappings.roleWhitelist[mappedRole.name as keyof typeof mappings.roleWhitelist]) {
+ if (!mappedRole! || !Reflect.has(mappings.roleWhitelist, mappedRole.name)) {
return await message.util.reply({
content: `${util.emojis.error} <@&${role.id}> is not whitelisted, and you do not have manage roles permission.`,
allowedMentions: AllowedMentions.none()
@@ -138,10 +132,11 @@ export default class RoleCommand extends BushCommand {
const responseCode =
action === 'add'
- ? await user.addRole({ moderator: message.member!, addToModlog: shouldLog, role, duration })
- : await user.removeRole({ moderator: message.member!, addToModlog: shouldLog, role, duration });
+ ? await member.addRole({ moderator: message.member!, addToModlog: shouldLog, role, duration })
+ : await member.removeRole({ moderator: message.member!, addToModlog: shouldLog, role, duration });
const responseMessage = () => {
+ const victim = util.format.bold(member.user.tag);
switch (responseCode) {
case 'user hierarchy':
return `${util.emojis.error} <@&${role.id}> is higher or equal to your highest role.`;
@@ -158,11 +153,11 @@ export default class RoleCommand extends BushCommand {
case 'error adding role' || 'error removing role':
return `${util.emojis.error} An error occurred while trying to ${action} <@&${role.id}> ${
action === 'add' ? 'to' : 'from'
- } **${user.user.tag}**.`;
+ } ${victim}.`;
case 'success':
return `${util.emojis.success} Successfully ${action === 'add' ? 'added' : 'removed'} <@&${role.id}> ${
action === 'add' ? 'to' : 'from'
- } **${user.user.tag}**${duration ? ` for ${util.humanizeDuration(duration)}` : ''}.`;
+ } ${victim}${duration ? ` for ${util.humanizeDuration(duration)}` : ''}.`;
}
};
diff --git a/src/commands/moderation/slowmode.ts b/src/commands/moderation/slowmode.ts
index d90f122..75d795c 100644
--- a/src/commands/moderation/slowmode.ts
+++ b/src/commands/moderation/slowmode.ts
@@ -65,7 +65,7 @@ export default class SlowModeCommand extends BushCommand {
if (length) {
length =
typeof length === 'string' && !['off', 'none', 'disable'].includes(length)
- ? await util.arg.cast('duration', client.commandHandler.resolver, message as BushMessage, length)
+ ? await util.arg.cast('duration', message, length)
: length;
}
diff --git a/src/commands/moderation/unban.ts b/src/commands/moderation/unban.ts
index 61e27cf..9d52dd2 100644
--- a/src/commands/moderation/unban.ts
+++ b/src/commands/moderation/unban.ts
@@ -61,19 +61,20 @@ export default class UnbanCommand extends BushCommand {
});
const responseMessage = () => {
+ const victim = util.format.bold(user.tag);
switch (responseCode) {
case 'missing permissions':
- return `${util.emojis.error} Could not unban **${user.tag}** because I do not have permissions`;
+ return `${util.emojis.error} Could not unban ${victim} because I am missing the **Ban Members** permission.`;
case 'error unbanning':
- return `${util.emojis.error} An error occurred while trying to unban **${user.tag}**.`;
+ return `${util.emojis.error} An error occurred while trying to unban ${victim}.`;
case 'error removing ban entry':
- return `${util.emojis.error} While unbanning **${user.tag}**, there was an error removing their ban entry, please report this to my developers.`;
+ return `${util.emojis.error} While unbanning ${victim}, there was an error removing their ban entry, please report this to my developers.`;
case 'error creating modlog entry':
- return `${util.emojis.error} While unbanning **${user.tag}**, there was an error creating a modlog entry, please report this to my developers.`;
+ return `${util.emojis.error} While unbanning ${victim}, there was an error creating a modlog entry, please report this to my developers.`;
case 'user not banned':
- return `${util.emojis.warn} **${user.tag}** is not banned but I tried to unban them anyways.`;
+ return `${util.emojis.warn} ${victim} is not banned but I tried to unban them anyways.`;
case 'success':
- return `${util.emojis.success} Successfully unbanned **${user.tag}**.`;
+ return `${util.emojis.success} Successfully unbanned ${victim}.`;
}
};
return await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });
diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts
index e430b83..f9335c4 100644
--- a/src/commands/moderation/unmute.ts
+++ b/src/commands/moderation/unmute.ts
@@ -67,11 +67,8 @@ export default class UnmuteCommand extends BushCommand {
if (!message.member) throw new Error(`message.member is null`);
const useForce = force && message.author.isOwner();
-
const canModerateResponse = await Moderation.permissionCheck(message.member, member, 'unmute', true, useForce);
- const victimBoldTag = `**${member.user.tag}**`;
-
if (canModerateResponse !== true) {
return message.util.reply(canModerateResponse);
}
@@ -81,29 +78,30 @@ export default class UnmuteCommand extends BushCommand {
moderator: message.member
});
- const responseMessage = async () => {
- const prefix = await message.guild!.getSetting('prefix');
+ const responseMessage = () => {
+ const prefix = util.prefix(message);
+ const victim = util.format.bold(member.user.tag);
switch (responseCode) {
case 'missing permissions':
- return `${error} Could not unmute ${victimBoldTag} because I am missing the \`Manage Roles\` permission.`;
+ return `${error} Could not unmute ${victim} because I am missing the **Manage Roles** permission.`;
case 'no mute role':
- return `${error} Could not unmute ${victimBoldTag}, you must set a mute role with \`${prefix}muterole\`.`;
+ return `${error} Could not unmute ${victim}, you must set a mute role with \`${prefix}config muteRole\`.`;
case 'invalid mute role':
- return `${error} Could not unmute ${victimBoldTag} because the current mute role no longer exists. Please set a new mute role with \`${prefix}muterole\`.`;
+ return `${error} Could not unmute ${victim} because the current mute role no longer exists. Please set a new mute role with \`${prefix}config muteRole\`.`;
case 'mute role not manageable':
- return `${error} Could not unmute ${victimBoldTag} because I cannot assign the current mute role, either change the role's position or set a new mute role with \`${prefix}muterole\`.`;
+ return `${error} Could not unmute ${victim} because I cannot assign the current mute role, either change the role's position or set a new mute role with \`${prefix}config muteRole\`.`;
case 'error removing mute role':
- return `${error} Could not unmute ${victimBoldTag}, there was an error removing their mute role.`;
+ return `${error} Could not unmute ${victim}, there was an error removing their mute role.`;
case 'error creating modlog entry':
- return `${error} While muting ${victimBoldTag}, there was an error creating a modlog entry, please report this to my developers.`;
+ return `${error} While muting ${victim}, there was an error creating a modlog entry, please report this to my developers.`;
case 'error removing mute entry':
- return `${error} While muting ${victimBoldTag}, there was an error removing their mute entry, please report this to my developers.`;
+ return `${error} While muting ${victim}, there was an error removing their mute entry, please report this to my developers.`;
case 'failed to dm':
- return `${util.emojis.warn} unmuted **${member.user.tag}** however I could not send them a dm.`;
+ return `${util.emojis.warn} unmuted ${victim} however I could not send them a dm.`;
case 'success':
- return `${util.emojis.success} Successfully unmuted **${member.user.tag}**.`;
+ return `${util.emojis.success} Successfully unmuted ${victim}.`;
}
};
- return await message.util.reply({ content: await responseMessage(), allowedMentions: AllowedMentions.none() });
+ return await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });
}
}
diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts
index 6ae8442..c67466b 100644
--- a/src/commands/moderation/warn.ts
+++ b/src/commands/moderation/warn.ts
@@ -1,4 +1,4 @@
-import { BushCommand, BushGuildMember, BushMessage, BushSlashMessage, BushUser } from '@lib';
+import { AllowedMentions, BushCommand, BushGuildMember, BushMessage, BushSlashMessage, BushUser } from '@lib';
import { Moderation } from '../../lib/common/Moderation';
export default class WarnCommand extends BushCommand {
@@ -65,7 +65,6 @@ export default class WarnCommand extends BushCommand {
const useForce = force && message.author.isOwner();
if (!message.member) throw new Error(`message.member is null`);
const canModerateResponse = await Moderation.permissionCheck(message.member, member, 'warn', true, useForce);
- const victimBoldTag = `**${member.user.tag}**`;
if (canModerateResponse !== true) {
return message.util.reply(canModerateResponse);
@@ -76,21 +75,19 @@ export default class WarnCommand extends BushCommand {
moderator: message.member
});
- switch (response) {
- case 'error creating modlog entry':
- return message.util.reply(
- `${util.emojis.error} While warning ${victimBoldTag}, there was an error creating a modlog entry, please report this to my developers.`
- );
- case 'failed to dm':
- return message.util.reply(
- `${util.emojis.warn} **${member.user.tag}** has been warned for the ${util.ordinal(
+ const responseMessage = () => {
+ const victim = util.format.bold(member.user.tag);
+ switch (response) {
+ case 'error creating modlog entry':
+ return `${util.emojis.error} While warning ${victim}, there was an error creating a modlog entry, please report this to my developers.`;
+ case 'failed to dm':
+ return `${util.emojis.warn} ${victim} has been warned for the ${util.ordinal(
caseNum ?? 0
- )} time, however I could not send them a dm.`
- );
- case 'success':
- return message.util.reply(
- `${util.emojis.success} Successfully warned **${member.user.tag}** for the ${util.ordinal(caseNum ?? 0)} time.`
- );
- }
+ )} time, however I could not send them a dm.`;
+ case 'success':
+ return `${util.emojis.success} Successfully warned ${victim} for the ${util.ordinal(caseNum ?? 0)} time.`;
+ }
+ };
+ return await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });
}
}
diff --git a/src/commands/moulberry-bush/capePerms.ts b/src/commands/moulberry-bush/capePerms.ts
index e26a5a4..4b7a3eb 100644
--- a/src/commands/moulberry-bush/capePerms.ts
+++ b/src/commands/moulberry-bush/capePerms.ts
@@ -23,9 +23,6 @@ export default class CapePermissionsCommand extends BushCommand {
}
}
],
- clientPermissions: (m) => util.clientSendAndPermCheck(m, ['EMBED_LINKS'], true),
- userPermissions: [],
- channel: 'guild',
slash: true,
slashOptions: [
{
@@ -34,7 +31,10 @@ export default class CapePermissionsCommand extends BushCommand {
type: 'STRING',
required: true
}
- ]
+ ],
+ clientPermissions: (m) => util.clientSendAndPermCheck(m, ['EMBED_LINKS'], true),
+ userPermissions: [],
+ channel: 'guild'
});
}
diff --git a/src/commands/moulberry-bush/serverStatus.ts b/src/commands/moulberry-bush/serverStatus.ts
index f4a80d4..568dd38 100644
--- a/src/commands/moulberry-bush/serverStatus.ts
+++ b/src/commands/moulberry-bush/serverStatus.ts
@@ -12,8 +12,6 @@ export default class ServerStatusCommand extends BushCommand {
examples: ['serverstatus', 'ss'],
content: "Gives the status of moulberry's server"
},
- ratelimit: 4,
- cooldown: 4000,
clientPermissions: (m) => util.clientSendAndPermCheck(m, ['EMBED_LINKS'], true),
userPermissions: [],
slash: true
diff --git a/src/commands/utilities/activity.ts b/src/commands/utilities/activity.ts
index c3839e5..e2a3352 100644
--- a/src/commands/utilities/activity.ts
+++ b/src/commands/utilities/activity.ts
@@ -15,7 +15,7 @@ const activityMap = {
function map(phase: string) {
if (client.consts.regex.snowflake.test(phase)) return phase;
- else if (Object.keys(activityMap).includes(phase)) return activityMap[phase as keyof typeof activityMap];
+ else if (Reflect.has(activityMap, phase)) return activityMap[phase as keyof typeof activityMap];
else if (['yt', 'youtube'].includes(phase)) return activityMap['Watch Together'];
else if (['chess', 'park'].includes(phase)) return activityMap['Chess in the Park'];
else if (['poker'].includes(phase)) return activityMap['Poker Night'];
diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts
index a012501..be3da8e 100644
--- a/src/commands/utilities/price.ts
+++ b/src/commands/utilities/price.ts
@@ -90,8 +90,6 @@ export default class PriceCommand extends BushCommand {
],
clientPermissions: (m) => util.clientSendAndPermCheck(m, ['EMBED_LINKS'], true),
userPermissions: [],
- ratelimit: 4,
- cooldown: 4000,
typing: true
});
}
diff --git a/src/lib/common/ButtonPaginator.ts b/src/lib/common/ButtonPaginator.ts
index c74f6ad..68955cc 100644
--- a/src/lib/common/ButtonPaginator.ts
+++ b/src/lib/common/ButtonPaginator.ts
@@ -118,15 +118,12 @@ export class ButtonPaginator {
}
protected async end() {
- try {
- return this.sentMessage!.edit({
+ if (!this.deleteOnExit)
+ return await this.sentMessage!.edit({
content: this.text,
embeds: [this.embeds[this.curPage]],
components: [this.getPaginationRow(true)]
- });
- } catch (e) {
- return undefined;
- }
+ }).catch(() => undefined);
}
protected async edit(interaction: MessageComponentInteraction) {
diff --git a/src/lib/common/util/Arg.ts b/src/lib/common/util/Arg.ts
index 84d5aeb..d267eb9 100644
--- a/src/lib/common/util/Arg.ts
+++ b/src/lib/common/util/Arg.ts
@@ -1,4 +1,4 @@
-import { Argument, ArgumentTypeCaster, Flag, ParsedValuePredicate, TypeResolver } from 'discord-akairo';
+import { AkairoMessage, Argument, ArgumentTypeCaster, Flag, ParsedValuePredicate } from 'discord-akairo';
import { Message } from 'discord.js';
import { BushArgumentType } from '../..';
@@ -6,12 +6,11 @@ export class Arg {
/**
* Casts a phrase to this argument's type.
* @param type - The type to cast to.
- * @param resolver - The type resolver.
* @param message - Message that called the command.
* @param phrase - Phrase to process.
*/
- public static cast(type: BushArgumentType, resolver: TypeResolver, message: Message, phrase: string): Promise<any> {
- return Argument.cast(type, resolver, message, phrase);
+ public static cast(type: BushArgumentType, message: Message | AkairoMessage, phrase: string): Promise<any> {
+ return Argument.cast(type, client.commandHandler.resolver, message as Message, phrase);
}
/**
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index 499d2c7..a833c75 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -223,12 +223,11 @@ export class BushClientUtil extends ClientUtil {
* * Embed Description Limit = 4096 characters
* * Embed Field Limit = 1024 characters
*/
- public async codeblock(code: string, length: number, language?: CodeBlockLang, substr = false): Promise<string> {
+ public async codeblock(code: string, length: number, language: CodeBlockLang | '' = '', substr = false): Promise<string> {
let hasteOut = '';
code = this.discord.escapeCodeBlock(code);
const prefix = `\`\`\`${language}\n`;
const suffix = '\n```';
- language = language ?? 'txt';
if (code.length + (prefix + suffix).length >= length) {
const haste = await this.haste(code, substr);
hasteOut = `Too large to display. ${
@@ -322,7 +321,7 @@ export class BushClientUtil extends ClientUtil {
*/
public async inspectCleanRedactCodeblock(
input: any,
- language?: CodeBlockLang,
+ language?: CodeBlockLang | '',
inspectOptions?: BushInspectOptions,
length = 1024
) {
@@ -653,6 +652,14 @@ export class BushClientUtil extends ClientUtil {
return missing.length ? missing : null;
}
+ public prefix(message: BushMessage | BushSlashMessage): string {
+ return message.util.isSlash
+ ? '/'
+ : client.config.isDevelopment
+ ? 'dev '
+ : message.util.parsed?.prefix ?? client.config.prefix;
+ }
+
public get arg() {
return Arg;
}
diff --git a/src/lib/utils/BushConstants.ts b/src/lib/utils/BushConstants.ts
index 0e1388e..3b41c4f 100644
--- a/src/lib/utils/BushConstants.ts
+++ b/src/lib/utils/BushConstants.ts
@@ -301,9 +301,9 @@ export class BushConstants {
SUPERUSER: '<:superUser:848947986326224926>',
DEVELOPER: '<:developer:848954538111139871>',
BUSH_VERIFIED: '<:verfied:853360152090771497>',
- BOOST_1: '<:boostitle:853363736679940127>',
- BOOST_2: '<:boostitle:853363752728789075>',
- BOOST_3: '<:boostitle:853363769132056627>',
+ BOOST_TIER_1: '<:boostitle:853363736679940127>',
+ BOOST_TIER_2: '<:boostitle:853363752728789075>',
+ BOOST_TIER_3: '<:boostitle:853363769132056627>',
TEXT: '<:text:853375537791893524>',
NEWS: '<:announcements:853375553531674644>',
VOICE: '<:voice:853375566735212584>',
diff --git a/src/listeners/custom/bushBan.ts b/src/listeners/custom/bushBan.ts
index df784f2..9282ea5 100644
--- a/src/listeners/custom/bushBan.ts
+++ b/src/listeners/custom/bushBan.ts
@@ -26,7 +26,8 @@ export default class BushBanListener extends BushListener {
.addField('**Action**', `${duration ? 'Temp Ban' : 'Perm Ban'}`)
.addField('**User**', `${user} (${user.tag})`)
.addField('**Moderator**', `${moderator} (${moderator.tag})`)
- .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`);
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
+ .addField('**Reason**', `${reason || '[No Reason Provided]'}`);
if (duration) logEmbed.addField('**Duration**', util.humanizeDuration(duration));
if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.');
return await logChannel.send({ embeds: [logEmbed] });
diff --git a/src/listeners/custom/bushKick.ts b/src/listeners/custom/bushKick.ts
index f622eba..cf7257f 100644
--- a/src/listeners/custom/bushKick.ts
+++ b/src/listeners/custom/bushKick.ts
@@ -26,7 +26,8 @@ export default class BushKickListener extends BushListener {
.addField('**Action**', `${'Kick'}`)
.addField('**User**', `${user} (${user.tag})`)
.addField('**Moderator**', `${moderator} (${moderator.tag})`)
- .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`);
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
+ .addField('**Reason**', `${reason || '[No Reason Provided]'}`);
if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.');
return await logChannel.send({ embeds: [logEmbed] });
}
diff --git a/src/listeners/custom/bushLevelUpdate.ts b/src/listeners/custom/bushLevelUpdate.ts
index 9339a4e..006e57d 100644
--- a/src/listeners/custom/bushLevelUpdate.ts
+++ b/src/listeners/custom/bushLevelUpdate.ts
@@ -11,8 +11,7 @@ export default class BushLevelUpdateListener extends BushListener {
});
}
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- public override async exec(...[member, oldLevel, newLevel, currentXp, message]: BushClientEvents['bushLevelUpdate']) {
+ public override async exec(...[member, _oldLevel, newLevel, _currentXp, message]: BushClientEvents['bushLevelUpdate']) {
if (await message.guild.hasFeature('sendLevelUpMessages')) {
void (async () => {
const channel = ((await message.guild.channels
diff --git a/src/listeners/custom/bushMute.ts b/src/listeners/custom/bushMute.ts
index d0f9e06..f9763c4 100644
--- a/src/listeners/custom/bushMute.ts
+++ b/src/listeners/custom/bushMute.ts
@@ -26,7 +26,8 @@ export default class BushMuteListener extends BushListener {
.addField('**Action**', `${duration ? 'Temp Mute' : 'Perm Mute'}`)
.addField('**User**', `${user} (${user.tag})`)
.addField('**Moderator**', `${moderator} (${moderator.tag})`)
- .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`);
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
+ .addField('**Reason**', `${reason || '[No Reason Provided]'}`);
if (duration) logEmbed.addField('**Duration**', `${util.humanizeDuration(duration) || duration}`);
if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.');
return await logChannel.send({ embeds: [logEmbed] });
diff --git a/src/listeners/custom/bushPunishRole.ts b/src/listeners/custom/bushPunishRole.ts
index ee6c61a..2c004c0 100644
--- a/src/listeners/custom/bushPunishRole.ts
+++ b/src/listeners/custom/bushPunishRole.ts
@@ -26,7 +26,8 @@ export default class BushPunishRoleListener extends BushListener {
.addField('**Action**', `${duration ? 'Temp Punishment Role' : 'Perm Punishment Role'}`)
.addField('**User**', `${user} (${user.tag})`)
.addField('**Moderator**', `${moderator} (${moderator.tag})`)
- .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`);
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
+ .addField('**Reason**', `${reason || '[No Reason Provided]'}`);
if (duration) logEmbed.addField('**Duration**', util.humanizeDuration(duration));
return await logChannel.send({ embeds: [logEmbed] });
}
diff --git a/src/listeners/custom/bushPunishRoleRemove.ts b/src/listeners/custom/bushPunishRoleRemove.ts
index a9d2002..f5260fc 100644
--- a/src/listeners/custom/bushPunishRoleRemove.ts
+++ b/src/listeners/custom/bushPunishRoleRemove.ts
@@ -27,7 +27,8 @@ export default class BushPunishRoleRemoveListener extends BushListener {
.addField('**Role**', `${role}`)
.addField('**User**', `${user} (${user.tag})`)
.addField('**Moderator**', `${moderator} (${moderator.tag})`)
- .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`);
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
+ .addField('**Reason**', `${reason || '[No Reason Provided]'}`);
return await logChannel.send({ embeds: [logEmbed] });
}
diff --git a/src/listeners/custom/bushUnban.ts b/src/listeners/custom/bushUnban.ts
index 1b192f6..c20b686 100644
--- a/src/listeners/custom/bushUnban.ts
+++ b/src/listeners/custom/bushUnban.ts
@@ -26,7 +26,8 @@ export default class BushUnbanListener extends BushListener {
.addField('**Action**', `${'Unban'}`)
.addField('**User**', `${user} (${user.tag})`)
.addField('**Moderator**', `${moderator} (${moderator.tag})`)
- .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`);
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
+ .addField('**Reason**', `${reason || '[No Reason Provided]'}`);
if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.');
return await logChannel.send({ embeds: [logEmbed] });
}
diff --git a/src/listeners/custom/bushUnmute.ts b/src/listeners/custom/bushUnmute.ts
index 9f5d929..795f948 100644
--- a/src/listeners/custom/bushUnmute.ts
+++ b/src/listeners/custom/bushUnmute.ts
@@ -26,7 +26,8 @@ export default class BushUnmuteListener extends BushListener {
.addField('**Action**', `${'Unmute'}`)
.addField('**User**', `${user} (${user.tag})`)
.addField('**Moderator**', `${moderator} (${moderator.tag})`)
- .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`);
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
+ .addField('**Reason**', `${reason || '[No Reason Provided]'}`);
if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.');
return await logChannel.send({ embeds: [logEmbed] });
}
diff --git a/src/listeners/custom/bushWarn.ts b/src/listeners/custom/bushWarn.ts
index d093144..2e72e52 100644
--- a/src/listeners/custom/bushWarn.ts
+++ b/src/listeners/custom/bushWarn.ts
@@ -26,7 +26,8 @@ export default class BushWarnListener extends BushListener {
.addField('**Action**', `${'Warn'}`)
.addField('**User**', `${user} (${user.tag})`)
.addField('**Moderator**', `${moderator} (${moderator.tag})`)
- .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`);
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
+ .addField('**Reason**', `${reason || '[No Reason Provided]'}`);
if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.');
return await logChannel.send({ embeds: [logEmbed] });
}