diff --git a/messageHandler.js b/messageHandler.js index bdffa6c..0ac5251 100644 --- a/messageHandler.js +++ b/messageHandler.js @@ -1,11 +1,27 @@ const moove = require('./moove'); const help = require('./helpFunctions'); +var ignore_messages = false; + function gotMessage(message) { if (message.author.bot) { return; } + if (message.content == "!vypnisa") { + ignore_messages = true; + message.react('🐮'); + } + + if (message.content == "!zapnisa") { + ignore_messages = false; + message.react('🐮'); + } + + if (ignore_messages) { + return; + } + /** * reference can't be null => must be a reply to message * must contain only one argument diff --git a/moove.js b/moove.js index 5df500c..b112c4f 100644 --- a/moove.js +++ b/moove.js @@ -20,10 +20,11 @@ function moove(message) { message.react('🐮'); originalChannel.messages.fetch(msgToMooveId).then(msg => { const sentBy = `Sent by ${msg.author}\nmooved ${message.author}\n`; - if (msg.embeds.length > 0 && msg.content == '' && msg.attachments.size == 0) { + if (msg.embeds.length > 0) { mentionedChannel.send({ embeds: msg.embeds }); } - else if (msg.attachments.size > 0) { + + if (msg.attachments.size > 0) { const originalMsgAttachments = msg.attachments.values(); @@ -38,28 +39,15 @@ function moove(message) { } mentionedChannel.send({ content: sentBy + messStr, files: attachmentsArr }); - - if (msg.embeds.length > 0) { - mentionedChannel.send({ embeds: msg.embeds }); - } } - else { - if (msg.content == '') { - // ? Empty, Has embeds - mentionedChannel.send({ - content: sentBy + `Message:\n${msg.content}`, - }); - } - else { - // ? Has content, No embeds - const embed = new EmbedBuilder() - .setColor(help.randomColor()) - .addFields( - { name: 'MOO', value: sentBy }, - { name: 'Message', value: msg.content }, - ); - mentionedChannel.send({ embeds: [embed] }); - } + if (msg.content != '') { + const embed = new EmbedBuilder() + .setColor(help.randomColor()) + .addFields( + { name: 'MOO', value: sentBy }, + { name: 'Message', value: msg.content }, + ); + mentionedChannel.send({ embeds: [embed] }); } setTimeout(() => msg.delete(), 3000);