master
Kit Kasune 4 years ago
parent 3ab7728ae6
commit 36ede9d7de
  1. 1
      .idea/.name
  2. 6
      .idea/discord.xml
  3. 22
      commands/ar.js

@ -0,0 +1 @@
guild.js

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" />
</component>
</project>

@ -25,6 +25,14 @@ module.exports = {
const tg = await GuildData.findOne({gid: message.guild.id}); 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.");}
function viewARs(tar) {
let t = tar.triggers;
let ar = tar.ars;
let s = '';
for (let i=0;i<t.length;i++) {s+=``;}
}
if (['a', 'add'].includes(args[0].toLowerCase())) { 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;} 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;}
if (`${trigger}`.length > 150) {return message.channel.send("Your trigger needs to be less than 150 characters, please!");} if (`${trigger}`.length > 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!");} 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}); 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;}} let h = false; let ar; for (ar of tar.triggers) {if (ar.toLowerCase() === `${trigger}`.toLowerCase()) {h = true;}}
if (!h) {tar.triggers.push(trigger);} if (!h) {tar.triggers.push(trigger);}
tar.ars[`${trigger}`.trim().toLowerCase()] = `${response}`.trim(); tar.ars[`${trigger}`.trim().toLowerCase()] = `${response}`.trim();
@ -39,5 +48,18 @@ module.exports = {
tar.save(); tar.save();
return message.channel.send("AR added!"); 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\``);
} }
}; };
Loading…
Cancel
Save