diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..b10b294 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +guild.js \ No newline at end of file diff --git a/.idea/discord.xml b/.idea/discord.xml new file mode 100644 index 0000000..cd711a0 --- /dev/null +++ b/.idea/discord.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/commands/ar.js b/commands/ar.js index 8ea8a5b..4127619 100644 --- a/commands/ar.js +++ b/commands/ar.js @@ -25,6 +25,14 @@ module.exports = { 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.");} + function viewARs(tar) { + let t = tar.triggers; + let ar = tar.ars; + let s = ''; + + for (let i=0;i 150) {return message.channel.send("Your trigger needs to be less than 150 characters, please!");} @@ -32,6 +40,7 @@ module.exports = { if (`${response}`.length > 300) {return message.channel.send("Your response needs to be less than 300 characters, please!");} let tar = await AR.findOne({gid: message.guild.id}) || new AR({gid: message.guild.id}); + if (tar.triggers.length === 20) {return message.channel.send("Because of data storage concerns, your ARs are capped at 20 per server. You can join the official support server and talk to the devs if you have a legitimate reason for raising this limit and they can see about raising it for you!");} 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(); @@ -39,5 +48,18 @@ module.exports = { tar.save(); return message.channel.send("AR added!"); } + + if (['e', 'edit'].includes(args[0].toLowerCase())) { + + } + + if (['d', 'delete'].includes(args[0].toLowerCase())) { + let tar = await AR.findOne({gid: message.guild.id}); + if (!tar || !tar.triggers.length) {return message.channel.send("It's not like this server has any ARs for me to delete in the first place!");} + + + } + + return message.channel.send(`That's not a valid argument! Try \`${prefix}help ar\``); } }; \ No newline at end of file