aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-01-23 18:13:05 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-01-23 18:13:05 -0500
commita3f8d3884a1deca5eccfb6d990e2a7b42fbbe08a (patch)
tree9b0f8ed8a93c22c90512751e3f2f5937e1925760 /src/commands
parent5557677f1570eb564a30cfcebb6030235dc84d47 (diff)
downloadtanzanite-a3f8d3884a1deca5eccfb6d990e2a7b42fbbe08a.tar.gz
tanzanite-a3f8d3884a1deca5eccfb6d990e2a7b42fbbe08a.tar.bz2
tanzanite-a3f8d3884a1deca5eccfb6d990e2a7b42fbbe08a.zip
fix discord.js breaking changes, some other stuff
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/_fake-command/ironmoon.ts1
-rw-r--r--src/commands/admin/channelPermissions.ts14
-rw-r--r--src/commands/admin/roleAll.ts12
-rw-r--r--src/commands/config/_customAutomodPhrases.ts7
-rw-r--r--src/commands/config/blacklist.ts8
-rw-r--r--src/commands/config/config.ts69
-rw-r--r--src/commands/config/disable.ts8
-rw-r--r--src/commands/config/features.ts41
-rw-r--r--src/commands/config/log.ts9
-rw-r--r--src/commands/dev/__template.ts5
-rw-r--r--src/commands/dev/debug.ts79
-rw-r--r--src/commands/dev/dm.ts6
-rw-r--r--src/commands/dev/eval.ts39
-rw-r--r--src/commands/dev/javascript.ts10
-rw-r--r--src/commands/dev/reload.ts2
-rw-r--r--src/commands/dev/say.ts3
-rw-r--r--src/commands/dev/sh.ts7
-rw-r--r--src/commands/dev/test.ts75
-rw-r--r--src/commands/fun/eightBall.ts3
-rw-r--r--src/commands/fun/minesweeper.ts11
-rw-r--r--src/commands/info/avatar.ts6
-rw-r--r--src/commands/info/botInfo.ts4
-rw-r--r--src/commands/info/color.ts6
-rw-r--r--src/commands/info/guildInfo.ts88
-rw-r--r--src/commands/info/help.ts46
-rw-r--r--src/commands/info/icon.ts5
-rw-r--r--src/commands/info/links.ts31
-rw-r--r--src/commands/info/ping.ts8
-rw-r--r--src/commands/info/pronouns.ts6
-rw-r--r--src/commands/info/snowflake.ts60
-rw-r--r--src/commands/info/userInfo.ts30
-rw-r--r--src/commands/leveling/leaderboard.ts6
-rw-r--r--src/commands/leveling/level.ts6
-rw-r--r--src/commands/leveling/levelRoles.ts9
-rw-r--r--src/commands/leveling/setLevel.ts7
-rw-r--r--src/commands/leveling/setXp.ts7
-rw-r--r--src/commands/moderation/_activePunishments.ts10
-rw-r--r--src/commands/moderation/ban.ts14
-rw-r--r--src/commands/moderation/block.ts11
-rw-r--r--src/commands/moderation/evidence.ts7
-rw-r--r--src/commands/moderation/hideCase.ts5
-rw-r--r--src/commands/moderation/kick.ts11
-rw-r--r--src/commands/moderation/lockdown.ts16
-rw-r--r--src/commands/moderation/modlog.ts8
-rw-r--r--src/commands/moderation/mute.ts11
-rw-r--r--src/commands/moderation/purge.ts15
-rw-r--r--src/commands/moderation/removeReactionEmoji.ts11
-rw-r--r--src/commands/moderation/role.ts19
-rw-r--r--src/commands/moderation/slowmode.ts17
-rw-r--r--src/commands/moderation/timeout.ts11
-rw-r--r--src/commands/moderation/unban.ts12
-rw-r--r--src/commands/moderation/unblock.ts11
-rw-r--r--src/commands/moderation/unlockdown.ts13
-rw-r--r--src/commands/moderation/unmute.ts11
-rw-r--r--src/commands/moderation/untimeout.ts11
-rw-r--r--src/commands/moderation/warn.ts9
-rw-r--r--src/commands/moulberry-bush/capePermissions.ts6
-rw-r--r--src/commands/moulberry-bush/capes.ts7
-rw-r--r--src/commands/moulberry-bush/giveawayPing.ts15
-rw-r--r--src/commands/moulberry-bush/moulHammer.ts6
-rw-r--r--src/commands/moulberry-bush/report.ts11
-rw-r--r--src/commands/moulberry-bush/rule.ts10
-rw-r--r--src/commands/moulberry-bush/serverStatus.ts5
-rw-r--r--src/commands/utilities/activity.ts10
-rw-r--r--src/commands/utilities/calculator.ts6
-rw-r--r--src/commands/utilities/decode.ts8
-rw-r--r--src/commands/utilities/hash.ts4
-rw-r--r--src/commands/utilities/price.ts9
-rw-r--r--src/commands/utilities/remind.ts3
-rw-r--r--src/commands/utilities/reminders.ts5
-rw-r--r--src/commands/utilities/steal.ts13
-rw-r--r--src/commands/utilities/uuid.ts5
-rw-r--r--src/commands/utilities/viewRaw.ts16
-rw-r--r--src/commands/utilities/whoHasRole.ts5
-rw-r--r--src/commands/utilities/wolframAlpha.ts8
75 files changed, 633 insertions, 486 deletions
diff --git a/src/commands/_fake-command/ironmoon.ts b/src/commands/_fake-command/ironmoon.ts
index 428b554..1f63c06 100644
--- a/src/commands/_fake-command/ironmoon.ts
+++ b/src/commands/_fake-command/ironmoon.ts
@@ -12,6 +12,7 @@ export default class IronmoonCommand extends BushCommand {
userPermissions: []
});
}
+
public override condition(message: BushMessage): boolean {
return false;
if (message.content.toLowerCase().includes('ironmoon')) return true;
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts
index 026f1a6..f0d2c65 100644
--- a/src/commands/admin/channelPermissions.ts
+++ b/src/commands/admin/channelPermissions.ts
@@ -1,5 +1,5 @@
import { BushCommand, ButtonPaginator, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
-import { MessageEmbed } from 'discord.js';
+import { ApplicationCommandOptionType, MessageEmbed, Permissions } from 'discord.js';
export default class ChannelPermissionsCommand extends BushCommand {
public constructor() {
@@ -18,7 +18,7 @@ export default class ChannelPermissionsCommand extends BushCommand {
readableType: 'member|role',
prompt: 'What user/role would you like to change?',
retry: '{error} Choose a valid user/role to change.',
- slashType: 'MENTIONABLE'
+ slashType: ApplicationCommandOptionType.Mentionable
},
{
id: 'permission',
@@ -26,7 +26,7 @@ export default class ChannelPermissionsCommand extends BushCommand {
type: 'permission',
prompt: 'What permission would you like to change?',
retry: '{error} Choose a valid permission.',
- slashType: 'STRING'
+ slashType: ApplicationCommandOptionType.String
},
{
id: 'state',
@@ -39,7 +39,7 @@ export default class ChannelPermissionsCommand extends BushCommand {
readableType: "'enable'|'disable'|'remove'",
prompt: 'What should that permission be set to?',
retry: '{error} Set the state to either `enable`, `disable`, or `remove`.',
- slashType: 'STRING',
+ slashType: ApplicationCommandOptionType.String,
choices: [
{ name: 'Enabled', value: 'true' },
{ name: 'Disabled', value: 'false' },
@@ -47,8 +47,8 @@ export default class ChannelPermissionsCommand extends BushCommand {
]
}
],
- clientPermissions: (m) => util.clientSendAndPermCheck(m, ['MANAGE_CHANNELS']),
- userPermissions: ['ADMINISTRATOR'],
+ clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.MANAGE_CHANNELS]),
+ userPermissions: [Permissions.FLAGS.ADMINISTRATOR],
channel: 'guild',
slash: true
});
@@ -63,7 +63,7 @@ export default class ChannelPermissionsCommand extends BushCommand {
}
) {
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('ADMINISTRATOR') && !message.member!.user.isOwner())
+ if (!message.member!.permissions.has(Permissions.FLAGS.ADMINISTRATOR) && !message.member!.user.isOwner())
return await message.util.reply(`${util.emojis.error} You must have admin perms to use this command.`);
if (message.util.isSlashMessage(message)) await message.interaction.deferReply();
diff --git a/src/commands/admin/roleAll.ts b/src/commands/admin/roleAll.ts
index 6e82011..3b438d9 100644
--- a/src/commands/admin/roleAll.ts
+++ b/src/commands/admin/roleAll.ts
@@ -1,5 +1,5 @@
import { AllowedMentions, BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
-import { type GuildMember } from 'discord.js';
+import { ApplicationCommandOptionType, Permissions, type GuildMember } from 'discord.js';
export default class RoleAllCommand extends BushCommand {
public constructor() {
@@ -16,7 +16,7 @@ export default class RoleAllCommand extends BushCommand {
type: 'role',
prompt: 'What role would you like to give to every member on the server?',
retry: '{error} Pick a valid role.',
- slashType: 'ROLE'
+ slashType: ApplicationCommandOptionType.Role
},
{
id: 'bots',
@@ -25,13 +25,13 @@ export default class RoleAllCommand extends BushCommand {
prompt: 'Would you like to also give roles to bots?',
flag: '--bots',
default: false,
- slashType: 'BOOLEAN',
+ slashType: ApplicationCommandOptionType.Boolean,
optional: true
}
],
channel: 'guild',
- clientPermissions: (m) => util.clientSendAndPermCheck(m, ['MANAGE_ROLES']),
- userPermissions: ['ADMINISTRATOR'],
+ clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.MANAGE_ROLES]),
+ userPermissions: [Permissions.FLAGS.ADMINISTRATOR],
typing: true,
slash: true
});
@@ -39,7 +39,7 @@ export default class RoleAllCommand extends BushCommand {
public override async exec(message: BushMessage | BushSlashMessage, args: { role: ArgType<'role'>; bots: ArgType<'boolean'> }) {
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('ADMINISTRATOR') && !message.member!.user.isOwner())
+ if (!message.member!.permissions.has(Permissions.FLAGS.ADMINISTRATOR) && !message.member!.user.isOwner())
return await message.util.reply(`${util.emojis.error} You must have admin perms to use this command.`);
if (message.util.isSlashMessage(message)) await message.interaction.deferReply();
diff --git a/src/commands/config/_customAutomodPhrases.ts b/src/commands/config/_customAutomodPhrases.ts
index cd59c9a..1c91f28 100644
--- a/src/commands/config/_customAutomodPhrases.ts
+++ b/src/commands/config/_customAutomodPhrases.ts
@@ -1,4 +1,5 @@
// import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+// import { Permissions } from 'discord.js';
// export default class CustomAutomodPhrasesCommand extends BushCommand {
// public constructor() {
@@ -15,7 +16,7 @@
// description: 'This is the first argument.',
// prompt: 'What would you like to set your first argument to be?',
// retry: '{error} Pick a valid argument.',
-// slashType: 'STRING'
+// slashType: ApplicationCommandOptionType.String
// },
// {
// id: 'optional_argument',
@@ -24,13 +25,13 @@
// prompt: 'What would you like to set your second argument to be?',
// retry: '{error} Pick a valid argument.',
// optional: true,
-// slashType: 'STRING'
+// slashType: ApplicationCommandOptionType.String
// }
// ],
// slash: true,
// channel: 'guild',
// clientPermissions: (m) => util.clientSendAndPermCheck(m),
-// userPermissions: ['MANAGE_GUILD']
+// userPermissions: [Permissions.FLAGS.MANAGE_GUILD]
// });
// }
diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts
index d15b8d7..0498b87 100644
--- a/src/commands/config/blacklist.ts
+++ b/src/commands/config/blacklist.ts
@@ -1,5 +1,5 @@
import { AllowedMentions, BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
-import { User } from 'discord.js';
+import { ApplicationCommandOptionType, Permissions, User } from 'discord.js';
export default class BlacklistCommand extends BushCommand {
public constructor() {
@@ -15,7 +15,7 @@ export default class BlacklistCommand extends BushCommand {
description: 'Whether to blacklist or unblacklist the target.',
readableType: "'blacklist'|'unblacklist'",
prompt: 'Would you like to add or remove someone or something from/to the blacklist?',
- slashType: 'STRING',
+ slashType: ApplicationCommandOptionType.String,
choices: ['blacklist', 'unblacklist'].map((c) => ({ name: c, value: c })),
only: 'slash'
},
@@ -26,7 +26,7 @@ export default class BlacklistCommand extends BushCommand {
readableType: 'channel|user',
prompt: 'What channel or user that you would like to blacklist/unblacklist?',
retry: '{error} Pick a valid user or channel.',
- slashType: 'STRING'
+ slashType: ApplicationCommandOptionType.String
},
{
id: 'global',
@@ -42,7 +42,7 @@ export default class BlacklistCommand extends BushCommand {
slash: true,
channel: 'guild',
clientPermissions: (m) => util.clientSendAndPermCheck(m),
- userPermissions: ['MANAGE_GUILD']
+ userPermissions: [Permissions.FLAGS.MANAGE_GUILD]
});
}
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts
index 6e08cc3..41bdc04 100644
--- a/src/commands/config/config.ts
+++ b/src/commands/config/config.ts
@@ -9,16 +9,20 @@ import {
type GuildSettingType
} from '#lib';
import assert from 'assert';
-import { type ArgumentOptions, type Flag } from 'discord-akairo';
+import { SlashOption, type ArgumentOptions, type Flag } from 'discord-akairo';
import {
+ ActionRow,
+ ApplicationCommandOptionType,
+ ButtonComponent,
+ ButtonStyle,
Channel,
Formatters,
GuildMember,
- MessageActionRow,
- MessageButton,
MessageEmbed,
- MessageSelectMenu,
+ Permissions,
Role,
+ SelectMenuComponent,
+ SelectMenuOption,
User,
type Message,
type MessageComponentInteraction,
@@ -37,33 +41,45 @@ export default class ConfigCommand extends BushCommand {
],
examples: ['settings', 'config prefix set -'],
slash: true,
- slashOptions: settingsArr.map((setting) => {
+ slashOptions: settingsArr.map((setting): SlashOption => {
const obj = guildSettingsObj[setting];
const type = obj.type;
const baseTypeUpper = type.replace('-array', '').toUpperCase() as SlashArgType;
const isArray = type.includes('-array');
const loweredName = obj.name.toLowerCase();
+ const enumType =
+ baseTypeUpper === 'CHANNEL'
+ ? ApplicationCommandOptionType.Channel
+ : baseTypeUpper === 'ROLE'
+ ? ApplicationCommandOptionType.Role
+ : baseTypeUpper === 'STRING'
+ ? ApplicationCommandOptionType.String
+ : baseTypeUpper === 'USER'
+ ? ApplicationCommandOptionType.User
+ : new Error(`Unknown type: ${type}`);
+ if (enumType instanceof Error) throw enumType;
+
return {
name: _.snakeCase(setting),
description: `Manage the server's ${loweredName}`,
- type: 'SUB_COMMAND_GROUP',
+ type: ApplicationCommandOptionType.SubcommandGroup,
options: isArray
? [
{
name: 'view',
description: `View the server's ${loweredName}.`,
- type: 'SUB_COMMAND'
+ type: ApplicationCommandOptionType.Subcommand
},
{
name: 'add',
description: `Add a value to the server's ${loweredName}.`,
- type: 'SUB_COMMAND',
+ type: ApplicationCommandOptionType.Subcommand,
options: [
{
name: 'value',
description: `What would you like to add to the server's ${loweredName}?'`,
- type: baseTypeUpper,
+ type: enumType,
channelTypes: baseTypeUpper === 'CHANNEL' && obj.subType ? obj.subType : undefined,
required: true
}
@@ -72,12 +88,12 @@ export default class ConfigCommand extends BushCommand {
{
name: 'remove',
description: `Remove a value from the server's ${loweredName}.`,
- type: 'SUB_COMMAND',
+ type: ApplicationCommandOptionType.Subcommand,
options: [
{
name: 'value',
description: `What would you like to remove from the server's ${loweredName}?'`,
- type: baseTypeUpper,
+ type: enumType,
channelTypes: baseTypeUpper === 'CHANNEL' && obj.subType ? obj.subType : undefined,
required: true
}
@@ -88,17 +104,17 @@ export default class ConfigCommand extends BushCommand {
{
name: 'view',
description: `View the server's ${loweredName}.`,
- type: 'SUB_COMMAND'
+ type: ApplicationCommandOptionType.Subcommand
},
{
name: 'set',
description: `Set the server's ${loweredName}.`,
- type: 'SUB_COMMAND',
+ type: ApplicationCommandOptionType.Subcommand,
options: [
{
name: 'value',
description: `What would you like to set the server's ${loweredName} to?'`,
- type: baseTypeUpper,
+ type: enumType,
channelTypes: baseTypeUpper === 'CHANNEL' && obj.subType ? obj.subType : undefined,
required: true
}
@@ -109,7 +125,7 @@ export default class ConfigCommand extends BushCommand {
}),
channel: 'guild',
clientPermissions: (m) => util.clientSendAndPermCheck(m),
- userPermissions: ['MANAGE_GUILD']
+ userPermissions: [Permissions.FLAGS.MANAGE_GUILD]
});
}
@@ -192,8 +208,8 @@ export default class ConfigCommand extends BushCommand {
}
) {
if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`);
- if (!message.member?.permissions.has('MANAGE_GUILD') && !message.member?.user.isOwner())
- return await message.util.reply(`${util.emojis.error} You must have the **MANAGE_GUILD** permission to run this command.`);
+ if (!message.member?.permissions.has(Permissions.FLAGS.MANAGE_GUILD) && !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!;
const value = args.value;
@@ -278,14 +294,15 @@ export default class ConfigCommand extends BushCommand {
const desc = settingsArr.map((s) => `:wrench: **${guildSettingsObj[s].name}**`).join('\n');
settingsEmbed.setDescription(desc);
- const selMenu = new MessageActionRow().addComponents(
- new MessageSelectMenu()
+ const selMenu = new ActionRow().addComponents(
+ new SelectMenuComponent()
.addOptions(
- ...settingsArr.map((s) => ({
- label: guildSettingsObj[s].name,
- value: s,
- description: guildSettingsObj[s].description
- }))
+ ...settingsArr.map((s) =>
+ new SelectMenuOption()
+ .setLabel(guildSettingsObj[s].name)
+ .setValue(s)
+ .setDescription(guildSettingsObj[s].description)
+ )
)
.setPlaceholder('Select A Setting to View')
.setMaxValues(1)
@@ -335,8 +352,8 @@ export default class ConfigCommand extends BushCommand {
: '[No Value Set]';
};
- const components = new MessageActionRow().addComponents(
- new MessageButton().setStyle('PRIMARY').setCustomId('command_settingsBack').setLabel('Back')
+ const components = new ActionRow().addComponents(
+ new ButtonComponent().setStyle(ButtonStyle.Primary).setCustomId('command_settingsBack').setLabel('Back')
);
settingsEmbed.setDescription(
`${Formatters.italic(guildSettingsObj[setting].description)}\n\n**Type**: ${guildSettingsObj[setting].type}`
diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts
index 564f90f..d59ff55 100644
--- a/src/commands/config/disable.ts
+++ b/src/commands/config/disable.ts
@@ -1,6 +1,6 @@
import { AllowedMentions, BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
import assert from 'assert';
-import { AutocompleteInteraction } from 'discord.js';
+import { ApplicationCommandOptionType, AutocompleteInteraction, Permissions } from 'discord.js';
import Fuse from 'fuse.js';
assert(Fuse);
@@ -20,7 +20,7 @@ export default class DisableCommand extends BushCommand {
description: 'Whether to disable or enable the command.',
readableType: "'disable'|'enable",
prompt: 'Would you like to disable or enable a command?',
- slashType: 'STRING',
+ slashType: ApplicationCommandOptionType.String,
choices: ['disable', 'enable'].map((v) => ({ name: v, value: v })),
only: 'slash'
},
@@ -31,7 +31,7 @@ export default class DisableCommand extends BushCommand {
readableType: 'command|commandAlias',
prompt: 'What command would you like to enable/disabl