diff --git a/src/commands/credits/addons/top.js b/src/commands/credits/addons/top.js index a41eb0c..cf196dd 100644 --- a/src/commands/credits/addons/top.js +++ b/src/commands/credits/addons/top.js @@ -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}> ${