1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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.`);
}
}
}
|