Added ability to display or not the project link the status embed

main
Killian 4 years ago
parent 4cf94b2e73
commit 139186a372

@ -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 (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 purgeOnRestart is set to true in the config bulkDelete the channel
if (bot.config.purgeOnRestart) channel.bulkDelete(amountToPurge); 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 // Creates a discord MessageEmbed
let embed = new Discord.MessageEmbed() let embed = new Discord.MessageEmbed()
.setDescription(`**Status of the languages**`) .setDescription(`**Status of the languages**${link}`)
.setFooter(`Last edit ${new Date()}`); .setFooter(`Last edit ${new Date()}`);
// Get the data with the getData() function // Get the data with the getData() function
let data = await getData(); 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)`); if (isNaN(bot.config.editTime)) return console.log(`You need to set a valid edit time in the configuration file (config.json)`);
setInterval(async () => { setInterval(async () => {
let embedEdit = new Discord.MessageEmbed(); let embedEdit = new Discord.MessageEmbed();
embedEdit.setDescription(`**Status of the languages**`) embedEdit.setDescription(`**Status of the languages**${link}`)
.setFooter(`Last edit ${new Date()}`); .setFooter(`Last edit ${new Date()}`);
let newData = await getData(); let newData = await getData();
for (let languages of newData) { for (let languages of newData) {

@ -49,12 +49,20 @@ Put the time you want the bot to check and update with new data. (In millisecond
### Purge On Restart ### 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 ### Purge Amount
Put the amount of messages you want the bot to purge on restart in the ``purgeAmount`` key in the config.json file. 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 # TO DO
- Ability to see specific language status using a command - Ability to see specific language status using a command

@ -2,5 +2,7 @@
"channel": "XXXXXXXXXXXX", // the channel id where you want the status message to be" "channel": "XXXXXXXXXXXX", // the channel id where you want the status message to be"
"editTime": 10000, // the time beetween two message edit (in ms) "editTime": 10000, // the time beetween two message edit (in ms)
"purgeOnRestart": true, // wether to purge or not the status channel on restart "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
} }
Loading…
Cancel
Save