aboutsummaryrefslogtreecommitdiff
path: root/src/commands/config/muteRole.ts
blob: 9074a1d8b27c3073487118ac20ea78f17de6638c (plain)
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
43
44
45
46
47
import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage } from '@lib';
import { Role } from 'discord.js';

export default class MuteRoleCommand extends BushCommand {
	public constructor() {
		super('muteRole', {
			aliases: ['muterole'],
			category: 'config',
			description: {
				content: 'Configure what role to use when muting users.',
				usage: 'muterole <role>',
				examples: ['muterole 748912426581229690']
			},
			args: [
				{
					id: 'role',
					type: 'role',
					prompt: {
						start: "What would you like to set the server's mute role to?",
						retry: '{error} Choose a valid role.',
						optional: false
					}
				}
			],
			slash: true,
			slashOptions: [
				{
					name: 'role',
					description: "What would you like to set the server's mute role to?",
					type: 'ROLE',
					required: true
				}
			],
			channel: 'guild',
			clientPermissions: ['SEND_MESSAGES'],
			userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD']
		});
	}

	async exec(message: BushMessage | BushSlashMessage, args: { role: Role }): Promise<void> {
		await message.guild.setSetting('muteRole', args.role.id);
		await message.util.send({
			content: `${this.client.util.emojis.success} Changed the server's mute role to <@&${args.role.id}>.`,
			allowedMentions: AllowedMentions.none()
		});
	}
}