From 8b47fba0ba7d19ad740b2cdf072d4c40bb82b5e8 Mon Sep 17 00:00:00 2001 From: Bsian Date: Sat, 2 Nov 2019 16:17:55 +0000 Subject: [PATCH] Sort by date --- src/commands/modlogs.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/modlogs.ts b/src/commands/modlogs.ts index ee5ea30..aeb2e21 100644 --- a/src/commands/modlogs.ts +++ b/src/commands/modlogs.ts @@ -21,7 +21,8 @@ export default class Modlogs extends Command { const query = await this.client.db.Moderation.find({ $or: [{ username: args.join(' ') }, { userID: args.filter((a) => a)[0].replace(/[<@!>]/g, '') }] }); if (!query.length) return msg.edit(`***${this.client.stores.emojis.error} Cannot locate modlogs for ${args.join(' ')}***`); - const formatted = query.map((log) => { + // @ts-ignore + const formatted = query.sort((a, b) => a.date - b.date).map((log) => { const { username, moderatorID, reason, type, date } = log; let name: string; switch (type) {