forked from Galactic/galactic-bot
fixes
This commit is contained in:
parent
74a4c1763f
commit
65a9549b9c
@ -171,11 +171,12 @@ class CommandHandler extends Observer {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
try {
|
|
||||||
let debugstr = invoker.command.name;
|
let debugstr = invoker.command.name;
|
||||||
if (invoker.subcommandGroup) debugstr += ` ${invoker.subcommandGroup.name}`;
|
if (invoker.subcommandGroup) debugstr += ` ${invoker.subcommandGroup.name}`;
|
||||||
if (invoker.subcommand) debugstr += ` ${invoker.subcommand.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'}`);
|
this.logger.info(`[${invoker.type.toUpperCase()}] ${invoker.user.tag} (${invoker.user.id}) is executing ${debugstr} in ${invoker.guild?.name || 'dms'}`);
|
||||||
|
|
||||||
|
try {
|
||||||
response = await invoker.command.execute(invoker, options);
|
response = await invoker.command.execute(invoker, options);
|
||||||
// Settings have a lot of prompts that will skew the resultts
|
// Settings have a lot of prompts that will skew the resultts
|
||||||
if(!(invoker.command instanceof SettingsCommand)) invoker.command.success(now);
|
if(!(invoker.command instanceof SettingsCommand)) invoker.command.success(now);
|
||||||
@ -184,7 +185,7 @@ class CommandHandler extends Observer {
|
|||||||
this._generateError(invoker, { error, type: 'command' });
|
this._generateError(invoker, { error, type: 'command' });
|
||||||
} else {
|
} else {
|
||||||
if (!(invoker.command instanceof SettingsCommand)) invoker.command.error(now);
|
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' });
|
this._generateError(invoker, { type: 'commandHandler' });
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -45,7 +45,7 @@ class BanInfraction extends Infraction {
|
|||||||
try {
|
try {
|
||||||
await this.guild.members.ban(this.target.id, {
|
await this.guild.members.ban(this.target.id, {
|
||||||
reason: this._reason,
|
reason: this._reason,
|
||||||
days
|
deleteMessageDays: days
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return this._fail('INFRACTION_ERROR');
|
return this._fail('INFRACTION_ERROR');
|
||||||
|
@ -189,7 +189,7 @@ class Setting extends Component {
|
|||||||
{ time, editReply: invoker.replied, embed }
|
{ 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();
|
const content = response.content.toLowerCase();
|
||||||
if (invoker.channel.permissionsFor(this.client.user).has('ManageMessages'))
|
if (invoker.channel.permissionsFor(this.client.user).has('ManageMessages'))
|
||||||
await response.delete().catch(() => null);
|
await response.delete().catch(() => null);
|
||||||
|
Loading…
Reference in New Issue
Block a user