aboutsummaryrefslogtreecommitdiff
path: root/src/commands/config/punishmentFooter.ts
blob: eeac6c1c88ef12aa32bc9f09c14c601911f1b47d (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
48
49
50
51
52
import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage } from '@lib';
import { Util } from 'discord.js';

export default class PunishmentFooterCommand extends BushCommand {
	public constructor() {
		super('punishmentFooter', {
			aliases: ['punishmentfooter'],
			category: 'config',
			description: {
				content: 'Configure or reset what should follow all punishment related dms.',
				usage: 'punishmentfooter [message]',
				examples: ['punishmentfooter', 'prefix you can appeal at https://example.com.']
			},
			args: [
				{
					id: 'ending',
					type: 'string',
					match: 'restContent',
					prompt: {
						start: 'What message would you like to follow punishment dms?',
						retry: '{error} Choose a valid role.',
						optional: true
					}
				}
			],
			slash: true,
			slashOptions: [
				{
					name: 'ending',
					description: 'What message would you like to follow punishment dms?',
					type: 'STRING',
					required: false
				}
			],
			channel: 'guild',
			clientPermissions: ['SEND_MESSAGES'],
			userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD']
		});
	}

	async exec(message: BushMessage | BushSlashMessage, args: { ending: string }): Promise<unknown> {
		await message.guild.setSetting('punishmentEnding', args.ending || null);
		if (args.ending)
			return await message.util.send({
				content: `${util.emojis.success} Changed the server's punishment footer to \n\`\`\`${Util.cleanCodeBlockContent(
					args.ending
				)}\`\`\`.`,
				allowedMentions: AllowedMentions.none()
			});
		else return await message.util.send(`${util.emojis.success} Removed he server's punishment footer.`);
	}
}