Convert unnecessary async functions

This commit is contained in:
Essem 2022-09-10 23:18:44 -05:00
parent 239d69d6d3
commit 20f4849fee
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
8 changed files with 19 additions and 14 deletions

View file

@ -61,8 +61,10 @@ export default async (client, cluster, worker, ipc, interaction) => {
} else {
logger.error(`Error occurred with application command ${command} with arguments ${JSON.stringify(interaction.data.options)}: ${error.stack || error}`);
try {
let err = error;
if (error?.constructor?.name == "Promise") err = await error;
await interaction[replyMethod]("Uh oh! I ran into an error while running this command. Please report the content of the attached file at the following link or on the esmBot Support server: <https://github.com/esmBot/esmBot/issues>", {
file: `Message: ${await clean(error)}\n\nStack Trace: ${await clean(error.stack)}`,
file: `Message: ${clean(err)}\n\nStack Trace: ${clean(err.stack)}`,
name: "error.txt"
});
} catch { /* silently ignore */ }

View file

@ -155,10 +155,12 @@ export default async (client, cluster, worker, ipc, message) => {
} else {
_error(`Error occurred with command message ${message.cleanContent}: ${error.stack || error}`);
try {
let err = error;
if (error?.constructor?.name == "Promise") err = await error;
await client.createMessage(message.channel.id, Object.assign({
content: "Uh oh! I ran into an error while running this command. Please report the content of the attached file at the following link or on the esmBot Support server: <https://github.com/esmBot/esmBot/issues>"
}, reference), [{
file: `Message: ${await clean(error)}\n\nStack Trace: ${await clean(error.stack)}`,
file: `Message: ${clean(err)}\n\nStack Trace: ${clean(err.stack)}`,
name: "error.txt"
}]);
} catch { /* silently ignore */ }