Added command counts to Prometheus metrics
This commit is contained in:
parent
d0a4addcb5
commit
e5d9388952
4 changed files with 21 additions and 11 deletions
|
@ -8,15 +8,19 @@ class CountCommand extends Command {
|
|||
if (this.message.channel.guild && !this.message.channel.permissionsOf(this.client.user.id).has("embedLinks")) return `${this.message.author.mention}, I don't have the \`Embed Links\` permission!`;
|
||||
const counts = await database.getCounts();
|
||||
const countArray = [];
|
||||
const sortedValues = counts.sort((a, b) => {
|
||||
for (const entry of Object.entries(counts)) {
|
||||
countArray.push(entry);
|
||||
}
|
||||
const sortedValues = countArray.sort((a, b) => {
|
||||
return b[1] - a[1];
|
||||
});
|
||||
const countArray2 = [];
|
||||
for (const [key, value] of sortedValues) {
|
||||
countArray.push(`**${key}**: ${value}`);
|
||||
countArray2.push(`**${key}**: ${value}`);
|
||||
}
|
||||
const embeds = [];
|
||||
const groups = countArray.map((item, index) => {
|
||||
return index % 15 === 0 ? countArray.slice(index, index + 15) : null;
|
||||
const groups = countArray2.map((item, index) => {
|
||||
return index % 15 === 0 ? countArray2.slice(index, index + 15) : null;
|
||||
}).filter((item) => {
|
||||
return item;
|
||||
});
|
||||
|
|
|
@ -14,12 +14,12 @@ class HelpCommand extends Command {
|
|||
if (this.args.length !== 0 && (commands.has(this.args[0].toLowerCase()) || aliases.has(this.args[0].toLowerCase()))) {
|
||||
const command = aliases.has(this.args[0].toLowerCase()) ? collections.aliases.get(this.args[0].toLowerCase()) : this.args[0].toLowerCase();
|
||||
const info = collections.info.get(command);
|
||||
const countDB = await database.getCounts();
|
||||
const counts = countDB.reduce((acc, val) => {
|
||||
const counts = await database.getCounts();
|
||||
/*const counts = countDB.reduce((acc, val) => {
|
||||
const [key, value] = val;
|
||||
acc[key] = value;
|
||||
return acc;
|
||||
}, {});
|
||||
}, {});*/
|
||||
const embed = {
|
||||
"embed": {
|
||||
"author": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue