forked from Galactic/galactic-bot
defer replies to all commands to avoid timeouts
This commit is contained in:
parent
7643256df7
commit
7f575ce617
@ -53,7 +53,7 @@ class PollCommand extends SlashCommand {
|
||||
|
||||
if (subcommand.name === 'create') {
|
||||
|
||||
await invoker.deferReply();
|
||||
// await invoker.deferReply();
|
||||
const questions = [];
|
||||
|
||||
const _channel = channel?.value || invoker.channel;
|
||||
|
@ -76,13 +76,14 @@ class CommandHandler extends Observer {
|
||||
emoji: 'failure', ephemeral: true
|
||||
});
|
||||
|
||||
await invoker.deferReply();
|
||||
const inhibitors = await this._handleInhibitors(invoker);
|
||||
if(inhibitors.length) return this._generateError(invoker, { type: 'inhibitor', ...inhibitors[0] });
|
||||
|
||||
const response = await this._parseInteraction(interaction, command);
|
||||
if (await this._parseResponse(invoker, response)) return;
|
||||
|
||||
try {
|
||||
try { // Temp logging
|
||||
await this._executeCommand(invoker, response.options);
|
||||
} catch (err) {
|
||||
this.logger.error(`_executeCommand errored:\nCommand: ${invoker.command.name}\nOptions:\n${Object.keys(response.options).map((key) => `[${key}: ${response.options[key]._rawValue}]`).join('\n')}\n${err.stack}`);
|
||||
@ -130,6 +131,8 @@ class CommandHandler extends Observer {
|
||||
}
|
||||
|
||||
async _executeCommand(invoker, options) {
|
||||
// TODO defer all replies -- need to go through all commands to ensure they're not deferrign them to avoid errors
|
||||
// Why? Occasionally some interacitons don't complete in time due to taking longer than normal to reach the bot -- unsure if deferring all replies will fix it
|
||||
|
||||
let response = null;
|
||||
const now = Date.now();
|
||||
|
@ -97,7 +97,7 @@ class SettingsCommand extends SlashCommand {
|
||||
});
|
||||
}
|
||||
|
||||
await invoker.deferReply();
|
||||
// await invoker.deferReply();
|
||||
const settings = await guild.settings();
|
||||
if (!Object.keys(opts).length && this.subcommand(subcommand.name).options.length) return this._showSetting(invoker, setting);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user