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
53
54
55
56
57
58
59
60
61
62
63
64
65
|
import { AllowedMentions, BushCommand, Highlight, type BushMessage, type BushSlashMessage } from '#lib';
import assert from 'assert';
import { Embed } from 'discord.js';
import { highlightSubcommands } from './highlight-!.js';
export default class HighlightShowCommand extends BushCommand {
public constructor() {
super('highlight-show', {
aliases: [],
category: 'utilities',
description: highlightSubcommands.show,
usage: [],
examples: [],
clientPermissions: [],
userPermissions: []
});
}
public override async exec(message: BushMessage | BushSlashMessage) {
assert(message.inGuild());
const [highlight] = await Highlight.findOrCreate({
where: {
guild: message.guild.id,
user: message.author.id
}
});
if (!highlight.words.length) return message.util.reply(`${util.emojis.error} You are not highlighting any words.`);
const embed = new Embed()
.setTitle('Highlight List')
.setDescription(
highlight.words
.map((hl) => (hl.regex ? `/${hl.word}/gi` : hl.word))
.join('\n')
.substring(0, 4096)
)
.setColor(util.colors.default);
if (highlight.blacklistedChannels.length)
embed.addField({
name: 'Ignored Channels',
value: highlight.blacklistedChannels
.map((c) => `<#${c}>`)
.join('\n')
.substring(0, 1024),
inline: true
});
if (highlight.blacklistedUsers.length)
embed.addField({
name: 'Ignored Users',
value: highlight.blacklistedUsers
.map((u) => `<@!${u}>`)
.join('\n')
.substring(0, 1024),
inline: true
});
return await message.util.reply({
embeds: [embed],
allowedMentions: AllowedMentions.none()
});
}
}
|