feat(*): Add config option to toggle auto deleting commands

This commit is contained in:
2020-10-26 16:41:49 +00:00
parent 35e751b43f
commit 065f808689
2 changed files with 22 additions and 7 deletions
+1
View File
@@ -1,6 +1,7 @@
{ {
"maxqueuesize": 4, "maxqueuesize": 4,
"channeldeletetimeinminutes": 20, "channeldeletetimeinminutes": 20,
"deletecommandstoggle": false,
"prefix": "!", "prefix": "!",
"token": "NzcwMDQyMDEzMjY5NDkxNzUy.X5Xzgg.kcr_51g95iUvEcYCfbQvG1Sx8ao" "token": "NzcwMDQyMDEzMjY5NDkxNzUy.X5Xzgg.kcr_51g95iUvEcYCfbQvG1Sx8ao"
} }
+21 -7
View File
@@ -167,7 +167,9 @@ client.on('message', function (message) {
// Join the queue // Join the queue
if (command === 'q' && !(playerQueue.includes(message.author))) { if (command === 'q' && !(playerQueue.includes(message.author))) {
// Delete the message with the bot command // Delete the message with the bot command
message.delete(); if (config.deletecommandstoggle) {
message.delete();
}
logger.log('info', `${message.author.username} joined the queue.`); logger.log('info', `${message.author.username} joined the queue.`);
message.channel.send(`=====\n${message.author.username} joined the queue.`); message.channel.send(`=====\n${message.author.username} joined the queue.`);
@@ -184,14 +186,18 @@ client.on('message', function (message) {
} }
else if (command === 'q' && (playerQueue.includes(message.author))) { else if (command === 'q' && (playerQueue.includes(message.author))) {
// Delete the message with the bot command // Delete the message with the bot command
message.delete(); if (config.deletecommandstoggle) {
message.delete();
}
message.channel.send(`${message.author.username} is too keen, you're already in the queue mate!`); message.channel.send(`${message.author.username} is too keen, you're already in the queue mate!`);
} }
// Leave the queue // Leave the queue
if(command === 'lq' && (playerQueue.includes(message.author))){ if(command === 'lq' && (playerQueue.includes(message.author))){
// Delete the message with the bot command // Delete the message with the bot command
message.delete(); if (config.deletecommandstoggle) {
message.delete();
}
logger.log('info', `${message.author.username} left the queue.`); logger.log('info', `${message.author.username} left the queue.`);
message.channel.send(`${message.author.username} left the queue.`); message.channel.send(`${message.author.username} left the queue.`);
@@ -207,21 +213,27 @@ client.on('message', function (message) {
} }
else if (command === 'lq' && !(playerQueue.includes(message.author))) { else if (command === 'lq' && !(playerQueue.includes(message.author))) {
// Delete the message with the bot command // Delete the message with the bot command
message.delete(); if (config.deletecommandstoggle) {
message.delete();
}
message.channel.send(`${message.author.username} you can't leave the queue before you've joined it!`); message.channel.send(`${message.author.username} you can't leave the queue before you've joined it!`);
} }
// Show the queue // Show the queue
if(command === 'sq') { if(command === 'sq') {
// Delete the message with the bot command // Delete the message with the bot command
message.delete(); if (config.deletecommandstoggle) {
message.delete();
}
checkQueue(message); checkQueue(message);
} }
// Clear the queue // Clear the queue
if(command === 'cq') { if(command === 'cq') {
// Delete the message with the bot command // Delete the message with the bot command
message.delete(); if (config.deletecommandstoggle) {
message.delete();
}
if (playerQueue.length === 0) { if (playerQueue.length === 0) {
message.channel.send(`The queue is already empty...`); message.channel.send(`The queue is already empty...`);
@@ -239,7 +251,9 @@ client.on('message', function (message) {
const user = getUserFromMention(args[0]); const user = getUserFromMention(args[0]);
// Delete the message with the bot command // Delete the message with the bot command
message.delete(); if (config.deletecommandstoggle) {
message.delete();
}
if ((playerQueue.includes(user))) { if ((playerQueue.includes(user))) {