tweak to history, bugfix to sending reply to dms

This commit is contained in:
Erik 2023-12-13 22:50:55 +02:00
parent 18fb92c3a0
commit f08879a19d
4 changed files with 26 additions and 13 deletions

View File

@ -96,9 +96,13 @@
"id-blacklist": "warn", "id-blacklist": "warn",
"id-match": "warn", "id-match": "warn",
"implicit-arrow-linebreak": "warn", "implicit-arrow-linebreak": "warn",
"indent": ["warn", 4, { "indent": [
"SwitchCase": 1 "warn",
}], 4,
{
"SwitchCase": 1
}
],
"init-declarations": "warn", "init-declarations": "warn",
"quotes": [ "quotes": [
"error", "error",
@ -200,7 +204,10 @@
"no-restricted-modules": "warn", "no-restricted-modules": "warn",
"no-restricted-properties": "warn", "no-restricted-properties": "warn",
"no-restricted-syntax": "warn", "no-restricted-syntax": "warn",
"no-return-assign": ["warn", "except-parens"], "no-return-assign": [
"warn",
"except-parens"
],
"no-return-await": "warn", "no-return-await": "warn",
"no-script-url": "warn", "no-script-url": "warn",
"no-self-compare": "warn", "no-self-compare": "warn",

View File

@ -10,7 +10,7 @@ import { APIEmbed, AttachmentBuilder, GuildChannel, User } from 'discord.js';
import { Filter } from 'mongodb'; import { Filter } from 'mongodb';
const Constants = { const Constants = {
PageSize: 5, PageSize: 10,
MaxCharacters: 256, MaxCharacters: 256,
MaxCharactersVerbose: 128 // Displays more information in the field, decreases characters. MaxCharactersVerbose: 128 // Displays more information in the field, decreases characters.
}; };
@ -56,8 +56,9 @@ class HistoryCommand extends SlashCommand
description: 'Amount of infractions to list per page', description: 'Amount of infractions to list per page',
type: CommandOptionType.INTEGER, type: CommandOptionType.INTEGER,
flag: true, flag: true,
maximum: 10, maximum: 25,
minimum: 1 minimum: 1,
defaultValue: 10
}, { }, {
name: 'page', name: 'page',
description: 'Page to select', description: 'Page to select',
@ -221,8 +222,13 @@ class HistoryCommand extends SlashCommand
embed.fields!.push({ embed.fields!.push({
name: `__**${infraction.type} \`[case-${infraction.case}]\`** *(${moment(infraction.timestamp).fromNow()})*__`, name: `__**${infraction.type} \`[case-${infraction.case}]\`** *(${moment(infraction.timestamp).fromNow()})*__`,
value: string value: string,
inline: true
}); });
if (results.length <= 16 && i > 0 && i % 2 === 1)
embed.fields!.push({
name: ZeroWidthChar, value: ZeroWidthChar, inline: true
});
} }
if (long) if (long)

View File

@ -259,10 +259,10 @@ class InvokerWrapper<InGuild extends boolean = boolean, HasCommand extends boole
if (options.dm) if (options.dm)
{ {
this.#pending = await this.author.send(options); this.#pending = await this.author.send(options);
await this.#target.reply({ if (this.deferred && !this.replied)
content: ':thumbsup:', await this.#target.editReply({ content: ':thumbsup:' });
ephemeral: true else
}); await this.#target.reply({ content: ':thumbsup:' });
return this.#pending; return this.#pending;
} }

View File

@ -339,7 +339,7 @@ switch({old}) {
} }
[COMMAND_HISTORY_SUCCESS] [COMMAND_HISTORY_SUCCESS]
Fetched the {type} moderation cases {targets}. Fetched the {type} moderation cases {targets}
[COMMAND_HISTORY_FAILTOOLONG] [COMMAND_HISTORY_FAILTOOLONG]
Failed to display cases in one embed, try a smaller page size. Failed to display cases in one embed, try a smaller page size.