generated from Baipyrus/DiscordJS-Template
bugfix: abort if not found
This commit is contained in:
parent
765e80071a
commit
904c33c2f8
@ -146,7 +146,7 @@ async function removeResponse(interaction) {
|
|||||||
const name = options.getString('name');
|
const name = options.getString('name');
|
||||||
|
|
||||||
// Find keyword in database
|
// Find keyword in database
|
||||||
/** @type {import('../../models/keywords.js').Keyword} */
|
/** @type {import('../../models/keywords.js').Keyword|null} */
|
||||||
const found = await Keywords.findOne({
|
const found = await Keywords.findOne({
|
||||||
where: {
|
where: {
|
||||||
guild: interaction.guildId,
|
guild: interaction.guildId,
|
||||||
@ -154,6 +154,15 @@ async function removeResponse(interaction) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Abort if keyword not found
|
||||||
|
if (found === null) {
|
||||||
|
await interaction.reply({
|
||||||
|
content: 'Unknown keyword was specified!',
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Try deleting response from database
|
// Try deleting response from database
|
||||||
await Responses.destroy({
|
await Responses.destroy({
|
||||||
where: {
|
where: {
|
||||||
|
Loading…
Reference in New Issue
Block a user