catch potential crash issue

This commit is contained in:
bignutty 2025-02-09 20:31:47 +01:00
parent e23053650e
commit bbf34590c6

View file

@ -48,6 +48,8 @@ module.exports.editOrReply = function(context, message, disableReference = false
}
return context.editOrRespond(message).catch(async (e)=>{
try{
const errorData = await e.response.json();
if(MESSAGE_BLOCK_REASONS[errorData.code]){
// Delete the public response
@ -74,7 +76,9 @@ module.exports.editOrReply = function(context, message, disableReference = false
context._meta.replacementMessageId = replacementMessage.id;
return replacementMessage;
}
}catch(e){
console.log(e)
}
basecamp(formatErrorMessage(3, "SHARD_MESSAGE_ERROR", `\`[Shard ${context.client.shardId}]\` Command \`${context.command.name}\` failed to respond: @ \`${Date.now()}\`\nGuild: \`${context.guild?.id}\`\nChannel: \`${context.channel?.id}\`\nUser: \`${context.user?.id}\`\`\`\`js\n${e}\`\`\``), message);
})