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

View file

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