From 139186a372003b44cd3b56fcca48bf9823e515c0 Mon Sep 17 00:00:00 2001 From: Killian Date: Wed, 9 Dec 2020 11:54:30 +0100 Subject: [PATCH] :zap: Added ability to display or not the project link the status embed --- Events/ready.js | 6 ++++-- README.md | 10 +++++++++- config.json.example | 4 +++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Events/ready.js b/Events/ready.js index 7ccd186..1f2fc44 100644 --- a/Events/ready.js +++ b/Events/ready.js @@ -24,9 +24,11 @@ module.exports = async (bot) => { if (isNaN(amountToPurge) || parseInt(amountToPurge) < 1 || parseInt(amountToPurge) > 100) return console.log(`You need to set a valid amount of messages to purge (beetween 1 and 100) in the configuration file (config.json)`); // If purgeOnRestart is set to true in the config bulkDelete the channel if (bot.config.purgeOnRestart) channel.bulkDelete(amountToPurge); + // Display or not the project link + let link = bot.config.displayLink ? `\nYou can help translating by following [this](${bot.config.projectLink}) link.` : ``; // Creates a discord MessageEmbed let embed = new Discord.MessageEmbed() - .setDescription(`**Status of the languages**`) + .setDescription(`**Status of the languages**${link}`) .setFooter(`Last edit ${new Date()}`); // Get the data with the getData() function let data = await getData(); @@ -42,7 +44,7 @@ module.exports = async (bot) => { if (isNaN(bot.config.editTime)) return console.log(`You need to set a valid edit time in the configuration file (config.json)`); setInterval(async () => { let embedEdit = new Discord.MessageEmbed(); - embedEdit.setDescription(`**Status of the languages**`) + embedEdit.setDescription(`**Status of the languages**${link}`) .setFooter(`Last edit ${new Date()}`); let newData = await getData(); for (let languages of newData) { diff --git a/README.md b/README.md index d2c1aee..4f3f64a 100644 --- a/README.md +++ b/README.md @@ -49,12 +49,20 @@ Put the time you want the bot to check and update with new data. (In millisecond ### Purge On Restart -Wether you want the bot to purge the status channel on start or not. Put true or false in the ``purgeOnRestart`` key in config.json file. +Wether you want the bot to purge the status channel on start or not. Put ``true`` or ``false`` in the ``purgeOnRestart`` key in config.json file. ### Purge Amount Put the amount of messages you want the bot to purge on restart in the ``purgeAmount`` key in the config.json file. +### Display Link + +Wether you want to display the crowdin project link or not. Put ``true`` or ``false`` in the ``displayLink`` key in the config.json file. + +### Project Link + +Put the link of your crowdin project (if public) in the ``projectLink`` key in the config.json file. + # TO DO - Ability to see specific language status using a command diff --git a/config.json.example b/config.json.example index d550c12..198a1fb 100644 --- a/config.json.example +++ b/config.json.example @@ -2,5 +2,7 @@ "channel": "XXXXXXXXXXXX", // the channel id where you want the status message to be" "editTime": 10000, // the time beetween two message edit (in ms) "purgeOnRestart": true, // wether to purge or not the status channel on restart - "purgeAmount": 100 // the amount of messages to purge on start + "purgeAmount": 100, // the amount of messages to purge on start + "displayLink": true, // wether to display or not the project link + "projectLink": "http link" // the link of your crowdin project if public } \ No newline at end of file