debug control added

This commit is contained in:
Ladislav Hano 2023-07-08 10:40:41 +02:00
parent bb574a1fc4
commit 2d9c5188c2
2 changed files with 27 additions and 23 deletions

View file

@ -1,11 +1,27 @@
const moove = require('./moove'); const moove = require('./moove');
const help = require('./helpFunctions'); const help = require('./helpFunctions');
var ignore_messages = false;
function gotMessage(message) { function gotMessage(message) {
if (message.author.bot) { if (message.author.bot) {
return; 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 * reference can't be null => must be a reply to message
* must contain only one argument * must contain only one argument

View file

@ -20,10 +20,11 @@ function moove(message) {
message.react('🐮'); message.react('🐮');
originalChannel.messages.fetch(msgToMooveId).then(msg => { originalChannel.messages.fetch(msgToMooveId).then(msg => {
const sentBy = `Sent by ${msg.author}\nmooved ${message.author}\n`; 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 }); mentionedChannel.send({ embeds: msg.embeds });
} }
else if (msg.attachments.size > 0) {
if (msg.attachments.size > 0) {
const originalMsgAttachments = msg.attachments.values(); const originalMsgAttachments = msg.attachments.values();
@ -38,28 +39,15 @@ function moove(message) {
} }
mentionedChannel.send({ content: sentBy + messStr, files: attachmentsArr }); mentionedChannel.send({ content: sentBy + messStr, files: attachmentsArr });
if (msg.embeds.length > 0) {
mentionedChannel.send({ embeds: msg.embeds });
}
} }
else { if (msg.content != '') {
if (msg.content == '') { const embed = new EmbedBuilder()
// ? Empty, Has embeds .setColor(help.randomColor())
mentionedChannel.send({ .addFields(
content: sentBy + `Message:\n${msg.content}`, { name: 'MOO', value: sentBy },
}); { name: 'Message', value: msg.content },
} );
else { mentionedChannel.send({ embeds: [embed] });
// ? 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] });
}
} }
setTimeout(() => msg.delete(), 3000); setTimeout(() => msg.delete(), 3000);