aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moulberry-bush/gimmeRole.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/moulberry-bush/gimmeRole.ts')
-rw-r--r--src/commands/moulberry-bush/gimmeRole.ts42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/commands/moulberry-bush/gimmeRole.ts b/src/commands/moulberry-bush/gimmeRole.ts
new file mode 100644
index 0000000..2e3cc77
--- /dev/null
+++ b/src/commands/moulberry-bush/gimmeRole.ts
@@ -0,0 +1,42 @@
+import { BotCommand, emojis, mappings, type CommandMessage, type SlashMessage } from '#lib';
+import assert from 'assert/strict';
+
+export default class GimmeRole extends BotCommand {
+ public constructor() {
+ super('gimmeRole', {
+ aliases: ['gimme-role', 'gimme'],
+ category: "Moulberry's Bush",
+ description: 'Gives you role.',
+ usage: ['gimme-role'],
+ examples: ['gimme-role'],
+ slash: false,
+ channel: 'guild',
+ clientPermissions: [],
+ userPermissions: [],
+ restrictedGuilds: [mappings.guilds["Moulberry's Bush"]]
+ });
+ }
+
+ public override async exec(message: CommandMessage | SlashMessage) {
+ assert(message.inGuild() && message.member);
+ assert(message.guildId === mappings.guilds["Moulberry's Bush"]);
+
+ const roleId = '1016149863651622923';
+
+ try {
+ if (!message.guild.roles.cache.has(roleId)) {
+ return await message.util.reply(`${emojis.error} Fucky wucky, the role does not exist.`);
+ }
+
+ if (message.member.roles.cache.has(roleId)) {
+ await message.member.roles.remove(roleId);
+ return await message.util.reply(`${emojis.success} Removed role.`);
+ } else {
+ await message.member.roles.add(roleId);
+ return await message.util.reply(`${emojis.success} Added role.`);
+ }
+ } catch {
+ return message.util.reply(`${emojis.error} Fucky wucky, an error occurred.`);
+ }
+ }
+}