From d3af68bc688b4efbaa447d898b868fb4484bddfb Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Fri, 12 Feb 2021 15:14:27 -0700 Subject: [PATCH] ar adding --- commands/ar.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/commands/ar.js b/commands/ar.js index f324b05..8ea8a5b 100644 --- a/commands/ar.js +++ b/commands/ar.js @@ -9,15 +9,11 @@ module.exports = { name: "ar", aliases: ['autoresponse', 'autoresponses'], meta: { - category: "", - perms: "", - staff: false, - vip: "", - serverPerms: [], - writtenBy: "", - serverOnly: true + category: 'Misc', + description: "Create and edit automatic responses, which lets the bot say stuff when you say something in your server!", + syntax: '`ar `', + extra: null }, - tags: [], help: new Discord.MessageEmbed() .setTitle("Help -> Auto Responses") .setDescription("Create and edit automatic responses, which lets the bot say stuff when you say something in your server!") @@ -27,7 +23,7 @@ module.exports = { if (!message.guild) {return message.channel.send("You must be in a server in order to use this command.");} if (!args.length) {return message.channel.send(`Syntax: \`${prefix}\``);} const tg = await GuildData.findOne({gid: message.guild.id}); - if (['a', 'add', 'e', 'edit', 'delete', 'd'].includes(args[0].toLowerCase()) && (!tg || !tg.staffrole || !tg.staffrole.length || (message.member.roles.cache.has(tg.staffrole) && message.member.permissions.has("ADMINISTRATOR")))) {return message.channel.send("You must have the staff role or be an administrator in this server in order to edit AR settings.");} + if (['a', 'add', 'e', 'edit', 'delete', 'd'].includes(args[0].toLowerCase()) && ((!tg || !tg.staffrole || !tg.staffrole.length || !message.member.roles.cache.has(tg.staffrole)) && !message.member.permissions.has("ADMINISTRATOR"))) {return message.channel.send("You must have the staff role or be an administrator in this server in order to edit AR settings.");} if (['a', 'add'].includes(args[0].toLowerCase())) { let trigger = await ask(message, "What would you like the trigger to be? This is the message that will make your AR work.", 120000); if (!trigger) {return null;} @@ -38,6 +34,10 @@ module.exports = { let tar = await AR.findOne({gid: message.guild.id}) || new AR({gid: message.guild.id}); let h = false; let ar; for (ar of tar.triggers) {if (ar.toLowerCase() === `${trigger}`.toLowerCase()) {h = true;}} if (!h) {tar.triggers.push(trigger);} + tar.ars[`${trigger}`.trim().toLowerCase()] = `${response}`.trim(); + tar.markModified('tar.ars'); + tar.save(); + return message.channel.send("AR added!"); } } }; \ No newline at end of file