-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
74 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* Allows an admin to check the server list | ||
* @param {("fr"|"en")} language - Language to use in the response | ||
* @param {module:"discord.js".Message} message - Message from the discord server | ||
* @param {String[]} args=[] - Additional arguments sent with the command | ||
*/ | ||
const ServersCommand = async (language, message, args) => { | ||
if ((await canPerformCommand(message, language, | ||
PERMISSION.ROLE.BOTOWNER)) !== true) { | ||
return; | ||
} | ||
|
||
let count = 0; | ||
let total = 0; | ||
let result = ""; | ||
|
||
function logMapElements(guild) { | ||
count++; | ||
let { validation, humans, bots, ratio } = getValidationInfos(guild); | ||
total += humans; | ||
result += format(JsonReader.bot.getTranslation(language).serverList, { | ||
count: count, | ||
guild: guild, | ||
humans: humans, | ||
robots: bots, | ||
ratio: ratio, | ||
validation: validation | ||
}) + "\n"; | ||
if (result.length > 1800) { | ||
message.channel.send(result); | ||
result = ""; | ||
} | ||
} | ||
|
||
client.guilds.cache.forEach(logMapElements); | ||
result += '\n' + format(JsonReader.bot.getTranslation(language).totalUsersCount, { count: total }); | ||
message.channel.send(result); | ||
}; | ||
|
||
module.exports = { | ||
commands: [ | ||
{ | ||
name: 'servs', | ||
func: ServersCommand | ||
} | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters