diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-10-06 15:16:36 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-10-06 15:16:36 -0400 |
commit | a61f54e0d1fbf49c71250413f455de9632c29a03 (patch) | |
tree | 1baaad13adb1bcc877fcea4ce33c20e26250786e | |
parent | 612ed820a0600ec11ed642005377cd7f5a8a8b77 (diff) | |
download | tanzanite-a61f54e0d1fbf49c71250413f455de9632c29a03.tar.gz tanzanite-a61f54e0d1fbf49c71250413f455de9632c29a03.tar.bz2 tanzanite-a61f54e0d1fbf49c71250413f455de9632c29a03.zip |
some auto publishing changes
-rw-r--r-- | src/listeners/message/autoPublisher.ts | 35 |
1 files changed, 18 insertions, 17 deletions
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}>.`); + }); } } |