From a61f54e0d1fbf49c71250413f455de9632c29a03 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Thu, 6 Oct 2022 15:16:36 -0400 Subject: some auto publishing changes --- src/listeners/message/autoPublisher.ts | 35 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/listeners/message/autoPublisher.ts b/src/listeners/message/autoPublisher.ts index 46577e4..e74450b 100644 --- a/src/listeners/message/autoPublisher.ts +++ b/src/listeners/message/autoPublisher.ts @@ -11,23 +11,24 @@ export default class autoPublisherListener extends BotListener { public async exec(...[message]: BotClientEvents[Events.MessageCreate]) { if (!message.guild || !(await message.guild.hasFeature('autoPublish'))) return; + const autoPublishChannels = await message.guild.getSetting('autoPublishChannels'); - if (autoPublishChannels) { - if ( - message.channel.type === ChannelType.GuildAnnouncement && - autoPublishChannels.some((x) => message.channel.id.includes(x)) - ) { - await message - .crosspost() - .then( - () => - void this.client.logger.log('autoPublisher', `Published message <<${message.id}>> in <<${message.guild!.name}>>.`) - ) - .catch(() => { - void this.client.console.log('autoPublisher', `Failed to publish <<${message.id}>> in <<${message.guild!.name}>>.`); - void message.guild?.error('autoPublisher', `Unable to publish message id ${message.id} in <#${message.channel.id}>.`); - }); - } - } + if (!autoPublishChannels || message.channel.type !== ChannelType.GuildAnnouncement) return; + + if (!autoPublishChannels.some((x) => message.channel.id.includes(x))) return; + + const onlyEmbeds = [/* #neu-neu-github */ '913500894463688734', /* #item-repo-github */ '782464759165354004']; + + if (onlyEmbeds.includes(message.channel.id) && message.embeds.length === 0) return; + + await message + .crosspost() + .then( + () => void this.client.logger.log('autoPublisher', `Published message <<${message.id}>> in <<${message.guild!.name}>>.`) + ) + .catch(() => { + void this.client.console.log('autoPublisher', `Failed to publish <<${message.id}>> in <<${message.guild!.name}>>.`); + void message.guild?.error('autoPublisher', `Unable to publish message id ${message.id} in <#${message.channel.id}>.`); + }); } } -- cgit