added .toggleimages

This commit is contained in:
Wizzard 2024-02-06 15:56:37 -05:00
parent 6a56a38f51
commit 1bc6f76395
2 changed files with 9 additions and 1 deletions

View File

@ -2,3 +2,4 @@ SOURCE_CHANNEL_ID_1=111111111111111111
TARGET_CHANNEL_ID_1=111111111111111111
DISCORD_TOKEN=mASJIUFHKWHG.18295790udqawihKS
IMAGES=0
COMMAND_CHANNEL_ID=28191298283975

View File

@ -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;