add points tally to history command

This commit is contained in:
Erik 2022-07-13 00:50:22 +03:00
parent 606423d74e
commit d1da5b1629
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -107,6 +107,25 @@ class HistoryCommand extends SlashCommand {
color: invoker.guild.me.roles.highest.color 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; let long = false;
const handleReason = (text) => { const handleReason = (text) => {
const MaxCharacters = Constants[verbose?.value ? 'MaxCharactersVerbose' : 'MaxCharacters']; const MaxCharacters = Constants[verbose?.value ? 'MaxCharactersVerbose' : 'MaxCharacters'];