diff --git a/EXAMPLE.env b/EXAMPLE.env index 030344b..92567e6 100644 --- a/EXAMPLE.env +++ b/EXAMPLE.env @@ -2,3 +2,4 @@ SOURCE_CHANNEL_ID_1=111111111111111111 TARGET_CHANNEL_ID_1=111111111111111111 DISCORD_TOKEN=mASJIUFHKWHG.18295790udqawihKS IMAGES=0 +COMMAND_CHANNEL_ID=28191298283975 diff --git a/main.js b/main.js index 9a71952..b5e71bf 100644 --- a/main.js +++ b/main.js @@ -10,7 +10,8 @@ const channelMappings = { [process.env.SOURCE_CHANNEL_ID_2]: process.env.TARGET_CHANNEL_ID_2, }; -const includeImages = process.env.IMAGES === '1'; +let includeImages = process.env.IMAGES === '1'; +const COMMAND_CHANNEL_ID = process.env.COMMAND_CHANNEL_ID; client.on('ready', () => { console.log(`${client.user.tag} is ready!`); @@ -18,6 +19,12 @@ client.on('ready', () => { }); client.on('messageCreate', async message => { + if (message.channel.id === COMMAND_CHANNEL_ID && message.content === '.toggleimages') { + includeImages = !includeImages; + return message.channel.send(`Image and link forwarding is now ${includeImages ? "enabled" : "disabled"}.`) + .then(msg => setTimeout(() => msg.delete(), 5000)); + } + if (channelMappings[message.channel.id]) { if (message.author.id === client.user.id) return;