better error handling
This commit is contained in:
4 files changed
+21
-5
No files matched your search
+6
-2
@@ -146,7 +146,7 @@ module.exports = {
|
||||
.setStyle("DANGER"),
|
||||
)
|
||||
|
||||
return ButtonInteraction.update({ embeds: [embed911], components: [opt] });
|
||||
return ButtonInteraction.update({ embeds: [embed311], components: [opt] });
|
||||
})
|
||||
|
||||
const channel = interaction.guild.channels.cache.find(channel => channel.id === GuildDB.dispatchChannel);
|
||||
@@ -157,7 +157,11 @@ module.exports = {
|
||||
|
||||
return interaction.send({ embeds: [embed] });
|
||||
}
|
||||
channel.send({ content: `<@&${GuildDB.dispatcherRole}> New 311 report`, embeds: [embed911], components: [opt] });
|
||||
try {
|
||||
channel.send({ content: `<@&${GuildDB.dispatcherRole}> New 311 report`, embeds: [embed311], components: [opt] });
|
||||
} catch (err) {
|
||||
return interaction.send(`<@${client.user.id}> Does not have permissions to send to the channel.\nMake sure your admins give <@${client.user.id}> access to all channels required. `)
|
||||
}
|
||||
return interaction.send('A report has been sent via 311.');
|
||||
},
|
||||
},
|
||||
|
||||
+5
-1
@@ -157,7 +157,11 @@ module.exports = {
|
||||
|
||||
return interaction.send({ embeds: [embed] });
|
||||
}
|
||||
channel.send({ content: `<@&${GuildDB.dispatcherRole}> New 911 call!`, embeds: [embed911], components: [opt] });
|
||||
try {
|
||||
channel.send({ content: `<@&${GuildDB.dispatcherRole}> New 911 call!`, embeds: [embed911], components: [opt] });
|
||||
} catch (err) {
|
||||
return interaction.send(`<@${client.user.id}> Does not have permissions to send to the channel.\nMake sure your admins give <@${client.user.id}> access to all channels required. `)
|
||||
}
|
||||
return interaction.send('911 Alerted!');
|
||||
},
|
||||
},
|
||||
|
||||
+5
-1
@@ -46,7 +46,11 @@ module.exports = {
|
||||
|
||||
return interaction.send({ embeds: [embed] });
|
||||
}
|
||||
channel.send({ embeds: [actionEmbed] });
|
||||
try {
|
||||
channel.send({ embeds: [actionEmbed] });
|
||||
} catch (err) {
|
||||
return interaction.send(`<@${client.user.id}> Does not have permissions to send to the channel.\nMake sure your admins give <@${client.user.id}> access to all channels required. `)
|
||||
}
|
||||
return interaction.send('Action performed');
|
||||
} else {
|
||||
return interaction.send({ content: 'Action performed', embeds: [actionEmbed] });
|
||||
|
||||
+5
-1
@@ -51,7 +51,11 @@ module.exports = {
|
||||
|
||||
return interaction.send({ embeds: [embed] });
|
||||
}
|
||||
channel.send({ embeds: [tweetEmbed] });
|
||||
try {
|
||||
channel.send({ embeds: [tweetEmbed] });
|
||||
} catch (err) {
|
||||
return interaction.send(`<@${client.user.id}> Does not have permissions to send to the channel.\nMake sure your admins give <@${client.user.id}> access to all channels required. `)
|
||||
}
|
||||
return interaction.send('Tweeted!');
|
||||
} else {
|
||||
return interaction.send({ content: 'Tweeted!', embeds: [tweetEmbed] });
|
||||
|
||||
Reference in new issue
Block a user