This commit is contained in:
Erik 2022-08-03 11:23:43 +03:00
parent 74a4c1763f
commit 65a9549b9c
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
3 changed files with 8 additions and 7 deletions

View File

@ -171,11 +171,12 @@ class CommandHandler extends Observer {
});
const now = Date.now();
let debugstr = invoker.command.name;
if (invoker.subcommandGroup) debugstr += ` ${invoker.subcommandGroup.name}`;
if (invoker.subcommand) debugstr += ` ${invoker.subcommand.name}`;
this.logger.info(`[${invoker.type.toUpperCase()}] ${invoker.user.tag} (${invoker.user.id}) is executing ${debugstr} in ${invoker.guild?.name || 'dms'}`);
try {
let debugstr = invoker.command.name;
if (invoker.subcommandGroup) debugstr += ` ${invoker.subcommandGroup.name}`;
if(invoker.subcommand) debugstr += ` ${invoker.subcommand.name}`;
this.logger.info(`[${invoker.type.toUpperCase()}] ${invoker.user.tag} (${invoker.user.id}) is executing ${debugstr} in ${invoker.guild?.name || 'dms'}`);
response = await invoker.command.execute(invoker, options);
// Settings have a lot of prompts that will skew the resultts
if(!(invoker.command instanceof SettingsCommand)) invoker.command.success(now);
@ -184,7 +185,7 @@ class CommandHandler extends Observer {
this._generateError(invoker, { error, type: 'command' });
} else {
if (!(invoker.command instanceof SettingsCommand)) invoker.command.error(now);
this.logger.error(`Command ${invoker.command.name} errored:\nOptions:\n${Object.keys(options).map((key) => `[${key}: ${options[key]._rawValue}]`).join('\n')}\n${error.stack || error}`);
this.logger.error(`Command ${debugstr} errored:\nOptions:\n${Object.keys(options).map((key) => `[${key}: ${options[key]._rawValue}]`).join('\n')}\n${error.stack || error}`);
this._generateError(invoker, { type: 'commandHandler' });
}
return;

View File

@ -45,7 +45,7 @@ class BanInfraction extends Infraction {
try {
await this.guild.members.ban(this.target.id, {
reason: this._reason,
days
deleteMessageDays: days
});
} catch (error) {
return this._fail('INFRACTION_ERROR');

View File

@ -189,7 +189,7 @@ class Setting extends Component {
{ time, editReply: invoker.replied, embed }
);
if (!response) return { error: true, message: invoker.format('ERR_TIMEOUT') };
if (!response) return { error: true, content: invoker.format('ERR_TIMEOUT') };
const content = response.content.toLowerCase();
if (invoker.channel.permissionsFor(this.client.user).has('ManageMessages'))
await response.delete().catch(() => null);