mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 14:38:49 +00:00
Update permissionValidator.js
This commit is contained in:
1 parent
d0254abc31
commit
006bcce545
1 file changed
+12
-5
@@ -36,7 +36,9 @@ exports.cannotSendMessageInChannel = async (interaction) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// we can still send ephemeral replies in channels we can't view, so sending message to user instead
|
// we can still send ephemeral replies in channels we can't view, so sending message to user instead
|
||||||
await interaction.deferReply({ ephemeral: true });
|
if (!interaction.deferred && !interaction.replied) {
|
||||||
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
}
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
@@ -48,10 +50,15 @@ exports.cannotSendMessageInChannel = async (interaction) => {
|
|||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(
|
if(error.message == "The reply to this interaction has already been sent or deferred.") {
|
||||||
error,
|
logger.warn('Error while sending ephemereal message about insufficient permissions to send message in channel.');
|
||||||
'Failed to send ephemeral reply to user in channel that bot cannot view/send message in.'
|
logger.debug(error);
|
||||||
);
|
} else {
|
||||||
|
logger.error(
|
||||||
|
error,
|
||||||
|
'Failed to send ephemeral reply to user in channel that bot cannot view/send message in.'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in new issue
Block a user