From d1da5b162915463df13a817228785e9d46d36758 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Wed, 13 Jul 2022 00:50:22 +0300 Subject: [PATCH] add points tally to history command --- .../components/commands/moderation/History.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/structure/components/commands/moderation/History.js b/src/structure/components/commands/moderation/History.js index 3995e7a..f1eef3e 100644 --- a/src/structure/components/commands/moderation/History.js +++ b/src/structure/components/commands/moderation/History.js @@ -107,6 +107,25 @@ class HistoryCommand extends SlashCommand { color: invoker.guild.me.roles.highest.color }; + if (invoker.guild._settings.modpoints.enabled) { + const [result] = await infractions.aggregate([{ + $match: { + ...query, + $or: [{ expiration: { $gt: Date.now() } }, { expiration: null }], + resolved: false + } + }, { + $group: { + _id: null, + points: { + $sum: '$points' + } + } + }]); + const { points } = result; + embed.footer.text += ` | ${points} Points`; + } + let long = false; const handleReason = (text) => { const MaxCharacters = Constants[verbose?.value ? 'MaxCharactersVerbose' : 'MaxCharacters'];