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
|
import { AllowedMentions, BushCommand, colors, emojis, Highlight, type CommandMessage, type SlashMessage } from '#lib';
import assert from 'assert/strict';
import { EmbedBuilder } 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.description,
usage: [],
examples: [],
clientPermissions: [],
userPermissions: []
});
}
public override async exec(message: CommandMessage | SlashMessage) {
assert(message.inGuild());
const [highlight] = await Highlight.findOrCreate({ where: { guild: message.guild.id, user: message.author.id } });
void this.client.highlightManager.syncCache();
if (!highlight.words.length) return message.util.reply(`${emojis.error} You are not highlighting any words.`);
const embed = new EmbedBuilder()
.setTitle('Highlight List')
.setDescription(
highlight.words
.map((hl) => (hl.regex ? `/${hl.word}/gi` : hl.word))
.join('\n')
.substring(0, 4096)
)
.setColor(colors.default);
if (highlight.blacklistedChannels.length)
embed.addFields({
name: 'Ignored Channels',
value: highlight.blacklistedChannels
.map((c) => `<#${c}>`)
.join('\n')
.substring(0, 1024),
inline: true
});
if (highlight.blacklistedUsers.length)
embed.addFields({
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() });
}
}
|