Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Commit aede68a

Browse files
committed
feat(blacklist): update Apps > Blacklist embed
1 parent e0ca758 commit aede68a

File tree

3 files changed

+34
-12
lines changed

3 files changed

+34
-12
lines changed

src/InterChat.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ import Logger from './utils/Logger.js';
33
import SuperClient from './core/Client.js';
44
import CommandManager from './managers/CommandManager.js';
55
import { check } from './utils/Profanity.js';
6-
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder, GuildTextBasedChannel } from 'discord.js';
6+
import {
7+
ActionRowBuilder,
8+
ButtonBuilder,
9+
ButtonStyle,
10+
EmbedBuilder,
11+
GuildTextBasedChannel,
12+
} from 'discord.js';
713
import { stripIndents } from 'common-tags';
814
import { LINKS, channels, colors, emojis } from './utils/Constants.js';
915
import { loadLocales, t } from './utils/Locale.js';
@@ -138,14 +144,19 @@ class InterChat extends SuperClient {
138144
// webhook was deleted
139145
if (!webhook) {
140146
// disconnect the channel
141-
await db.connectedList.update({ where: { id: connection.id }, data: { connected: false } });
147+
await db.connectedList.update({
148+
where: { id: connection.id },
149+
data: { connected: false },
150+
});
142151

143152
// send an alert to the channel
144153
const networkChannel = channel.isTextBased()
145154
? channel
146-
: await this.channels.fetch(connection.channelId) as GuildTextBasedChannel;
155+
: ((await this.channels.fetch(connection.channelId)) as GuildTextBasedChannel);
147156

148-
await networkChannel.send(t({ phrase: 'misc.webhookNoLongerExists', locale: 'en' }, { emoji: emojis.info }));
157+
await networkChannel.send(
158+
t({ phrase: 'misc.webhookNoLongerExists', locale: 'en' }, { emoji: emojis.info }),
159+
);
149160
}
150161
}
151162
catch (error) {

src/commands/context-menu/blacklist.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default class Blacklist extends BaseCommand {
4242
(messageInDb.originalMsg?.hub?.ownerId !== interaction.user.id &&
4343
!messageInDb.originalMsg?.hub?.moderators.find((mod) => mod.userId === interaction.user.id))
4444
) {
45-
interaction.reply({
45+
await interaction.reply({
4646
embeds: [
4747
simpleEmbed(
4848
t({ phrase: 'errors.messageNotSentOrExpired', locale }, { emoji: emojis.info }),
@@ -53,13 +53,24 @@ export default class Blacklist extends BaseCommand {
5353
return;
5454
}
5555

56+
const server = await interaction.client.fetchGuild(messageInDb.originalMsg.serverId);
57+
const user = await interaction.client.users.fetch(messageInDb.originalMsg.authorId);
58+
5659
const embed = new EmbedBuilder()
5760
.setTitle('Blacklist')
58-
.setDescription(
59-
// FIXME: either remove or improve this
60-
'Blacklist the server or user of this message from this hub. This will prevent messages by them from being sent.',
61-
)
62-
.setColor(colors.interchatBlue);
61+
.setColor(colors.invisible)
62+
.setFields(
63+
{
64+
name: '🏠 Server',
65+
value: `Blacklist server **${server?.name}** from this hub.`,
66+
inline: true,
67+
},
68+
{
69+
name: '👤 User',
70+
value: `Blacklist user **${user?.username}** from this hub.`,
71+
inline: true,
72+
},
73+
);
6374

6475
const buttons = new ActionRowBuilder<ButtonBuilder>().addComponents(
6576
new ButtonBuilder()

src/utils/Profanity.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ export function censor(string: string, symbol = '\\*'): string {
2828
return string
2929
.split(REGEX.SPLIT_WORDS)
3030
.map((word) => {
31-
const { profanity, slurs } = check(word);
32-
return profanity ?? slurs
31+
const res = check(word);
32+
return res.profanity ?? res.slurs
3333
? word.replace(REGEX.SPECIAL_CHARACTERS, '').replace(REGEX.MATCH_WORD, symbol)
3434
: word;
3535
})

0 commit comments

Comments
 (0)