Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { config } from '../config/cfg';
- discord.on('MESSAGE_CREATE', async (message) => {
- const errorChannel = await discord.getTextChannel(
- config.modules.errors.channel
- );
- if (!errorChannel) throw new Error('Invalid Channel');
- if (
- !config.modules.automated.autopublisher.enabled &&
- !config.modules.automated.autopublisher.blacklist &&
- !config.modules.automated.autopublisher.announcements
- )
- return;
- try {
- for (
- let i = 0;
- i < config.modules.automated.autopublisher.channels.length;
- i++
- ) {
- let id = config.modules.automated.autopublisher.channels[i];
- let channel = await discord.getGuildNewsChannel(id);
- if (message.channelId !== id || !channel) return;
- await channel!.publishMessage(message.id);
- }
- } catch (err) {
- console.error(err);
- errorChannel.sendMessage(
- '```css\n' +
- config.msg.DISCORD_API_ERROR +
- ':' +
- err.code +
- '[' +
- err.message +
- ']\n```'
- );
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement