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
|
import { AllowedMentions, BotCommand, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib';
import assert from 'assert/strict';
import { highlightSubcommands } from './highlight-!.js';
export default class HighlightRemoveCommand extends BotCommand {
public constructor() {
super('highlight-remove', {
aliases: [],
category: 'utilities',
description: highlightSubcommands.remove.description,
args: [
{
id: 'word',
description: highlightSubcommands.remove.options[0].description,
type: 'string',
match: 'rest',
prompt: highlightSubcommands.remove.options[0].description,
retry: highlightSubcommands.remove.options[0].retry,
optional: !highlightSubcommands.remove.options[0].required,
only: 'text',
slashType: false
}
],
usage: [],
examples: [],
clientPermissions: [],
userPermissions: []
});
}
public override async exec(message: CommandMessage | SlashMessage, args: { word: ArgType<'string'> }) {
assert(message.inGuild());
const res = await this.client.highlightManager.removeHighlight(message.guild.id, message.author.id, args.word);
if (typeof res === 'string')
return await message.util.reply({ content: `${emojis.error} ${res}`, allowedMentions: AllowedMentions.none() });
else if (!res)
return await message.util.reply({
content: `${emojis.error} There was an error unhighlighting "${args.word}".`,
allowedMentions: AllowedMentions.none()
});
return await message.util.reply({
content: `${emojis.success} Successfully removed "${args.word}" from your highlight list.`,
allowedMentions: AllowedMentions.none()
});
}
}
|