Skip to content

Commit

Permalink
fix(network): display embed color for all connections
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-737 committed Sep 16, 2023
1 parent 69aaacc commit bc047f6
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/Events/messageCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import checks from '../Scripts/message/checks';
import messageContentModifiers from '../Scripts/message/messageContentModifiers';
import cleanup from '../Scripts/message/cleanup';
import { APIMessage, ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder, HexColorString, Message, User, WebhookClient, WebhookMessageCreateOptions } from 'discord.js';
import { getDb, colors } from '../Utils/functions/utils';
import { getDb } from '../Utils/functions/utils';
import { censor } from '../Utils/functions/wordFilter';
import { messageData } from '@prisma/client';
import { HubSettingsBitField } from '../Utils/hubs/hubSettingsBitfield';
Expand Down Expand Up @@ -68,7 +68,7 @@ export default {
const embed = new EmbedBuilder()
.setDescription(message.content || null) // description must be null if message is only an attachment
.setImage(attachmentURL)
.setColor(colors('random'))
.setColor((channelInDb.embedColor as HexColorString) || 'Random')
.setFields(
referredContent
? [{ name: 'Reply to:', value: `> ${referredContent.replaceAll('\n', '\n> ')}` }]
Expand Down Expand Up @@ -136,13 +136,9 @@ export default {
allowedMentions: { parse: [] },
};

if (connection.embedColor && webhookMessage.embeds
&& /^#[0-9A-F]{6}$/i.test(connection.embedColor)
) {
webhookMessage.embeds.push(EmbedBuilder.from(webhookMessage.embeds[0])
.setColor(connection.embedColor as HexColorString),
);
webhookMessage.embeds.splice(0, 1);
if (!channelInDb.embedColor && connection.embedColor && webhookMessage.embeds) {
webhookMessage.embeds[0] = EmbedBuilder.from(webhookMessage.embeds[0])
.setColor(connection.embedColor as HexColorString);
}
}

Expand Down

0 comments on commit bc047f6

Please sign in to comment.