From 84b31dae4b54302a6f1768b9c218e972681e9d5f Mon Sep 17 00:00:00 2001 From: loicbersier Date: Tue, 19 Nov 2019 17:27:46 +0100 Subject: [PATCH] Add messages when there is no tag --- commands/utility/seetag.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/commands/utility/seetag.js b/commands/utility/seetag.js index dd63ebd5..94359430 100644 --- a/commands/utility/seetag.js +++ b/commands/utility/seetag.js @@ -35,6 +35,7 @@ class seetagCommand extends Command { async exec(message, args) { if (args.raw) { let tagList = await Tag.findOne({attributes: ['trigger','response','ownerID'], where: {trigger: args.raw, serverID: message.guild.id}}); + if (!tagList) return message.channel.send('Tag not found.'); this.client.users.fetch(tagList.dataValues.ownerID) .then(user => { const TagEmbed = new MessageEmbed() @@ -58,6 +59,7 @@ class seetagCommand extends Command { }); } else if (args.all) { let tagList = await Tag.findAll({attributes: ['trigger','response','ownerID'], where: {serverID: message.guild.id}}); + if (!tagList[0]) return message.channel.send('This guild do not have any tag.'); var tagArray = []; tagList.forEach(tag => { tagArray.push(tag.dataValues);