🚑 top command was sorting "top 10 documents"
This commit is contained in:
parent
9910b2577a
commit
0fb3aa168a
1 changed files with 4 additions and 4 deletions
|
@ -1,13 +1,13 @@
|
|||
const credits = require('../../../helpers/database/models/creditSchema');
|
||||
const debug = require('../../../handlers/debug');
|
||||
module.exports = async (interaction) => {
|
||||
credits.find().then(async (data) => {
|
||||
const topTen = data.slice(0, 10);
|
||||
const sorted = topTen.sort((a, b) => (a.balance > b.balance ? -1 : 1));
|
||||
await credits.find().then(async (data) => {
|
||||
const sorted = data.sort((a, b) => (a.balance > b.balance ? -1 : 1));
|
||||
const topTen = sorted.slice(0, 10);
|
||||
|
||||
const embed = {
|
||||
title: 'Balance Top',
|
||||
description: `Below are the top ten.\n${sorted
|
||||
description: `Below are the top ten.\n${topTen
|
||||
.map(
|
||||
(x, index) =>
|
||||
`**Top ${index + 1}** - <@${x.userId}> ${
|
||||
|
|
Loading…
Add table
Reference in a new issue