From 0913f19fede8e4e22682a744f8b72d5c6a666d1d Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 12 Mar 2018 21:57:11 -0400 Subject: hopefully not breaking anything :pray: --- commands/Moderation/lswarns.js | 7 ++--- commands/Moderation/warn.js | 8 ++---- commands/Owners Only/modifycredits.js | 51 +++++++++++++++++----------------- commands/Owners Only/testingcredits.js | 47 +++++++++++++++---------------- 4 files changed, 54 insertions(+), 59 deletions(-) (limited to 'commands') diff --git a/commands/Moderation/lswarns.js b/commands/Moderation/lswarns.js index dea3569..a9bf5d9 100644 --- a/commands/Moderation/lswarns.js +++ b/commands/Moderation/lswarns.js @@ -22,13 +22,12 @@ exports.run = async (bot, msg) => { const db = require('quick.db'); const { RichEmbed } = require('discord.js'); - const warns = await db.fetch(`warns_${msg.author.id}_count`); + const warns = await db.fetch(`warns_${msg.guild.id}_${msg.author.id}`); if (!warns) return await msg.reply('Yay! You have no warns.'); const embed = new RichEmbed() .setTitle('Warns'); - for (let i = 1; i <= warns; i++) { - const warning = await db.fetch(`warns_${msg.author.id}_warn_${i}`); - embed.addField('Warning #' + i, warning); + for (let i = 0; i < warns.count; i++) { + embed.addField('Warning #' + i, warns.reasons[i]); } msg.channel.send({ embed }); }; diff --git a/commands/Moderation/warn.js b/commands/Moderation/warn.js index 816367d..c59023c 100644 --- a/commands/Moderation/warn.js +++ b/commands/Moderation/warn.js @@ -29,14 +29,12 @@ exports.run = async (bot, msg, args) => { } msg.channel.send(`Successfully logged ${victim.user.tag}'s warning.`); const db = require('quick.db'); - const warns = await db.fetch(`warns_${victim.user.id}_count`); + const warns = await db.fetch(`warns_${msg.guild.id}_${victim.user.id}`); if (warns) { - await db.set(`warns_${victim.user.id}_count`, warns + 1); - await db.set(`warns_${victim.user.id}_warn_${warns + 1}`, warnReason); + await db.set(`warns_${msg.guild.id}_${victim.user.id}`, { count : warns.count + 1, reasons : warns.reasons.push(warnReason)}); } else { - await db.set(`warns_${victim.user.id}_count`, 1); - await db.set(`warns_${victim.user.id}_warn_1`, warnReason); + await db.set(`warns_${msg.guild.id}_${victim.user.id}`, { count : 1, reasons : [warnReason]}); } const { RichEmbed } = require('discord.js'); diff --git a/commands/Owners Only/modifycredits.js b/commands/Owners Only/modifycredits.js index eb56478..a714ea8 100644 --- a/commands/Owners Only/modifycredits.js +++ b/commands/Owners Only/modifycredits.js @@ -18,31 +18,30 @@ * * *************************************/ -exports.run = async (bot, msg, args) => { - if (!['242775871059001344', '247221105515823104', '236279900728721409'].includes(msg.author.id)) return msg.reply('Nope! You need the person who created this bot to use this command.'); - - let user; - if (!msg.mentions.members.first()) { - user = msg.author; - } else { - user = msg.mentions.members.first(); - }; - - var oldbal = bot.plugins.economy.get(user.id) +exports.run = async (bot, msg) => { + if (!['242775871059001344', '247221105515823104', '236279900728721409'].includes(msg.author.id)) return msg.reply('Nope! You need the person who created this bot to use this command.'); - bot.plugins.economy.subtract(user.id, oldbal); + let user; + if (!msg.mentions.members.first()) { + user = msg.author; + } else { + user = msg.mentions.members.first(); + } - msg.channel.send(`Reset ${user.tag}'s credits.`); - }; - - exports.conf = { - aliases: [], - guildOnly: true, - }; - - exports.help = { - name: 'modifycredits', - description: 'Modifies the credits of a user', - usage: '@user ', - }; - \ No newline at end of file + var oldbal = bot.plugins.economy.get(user.id); + + bot.plugins.economy.subtract(user.id, oldbal); + + msg.channel.send(`Reset ${user.tag}'s credits.`); +}; + +exports.conf = { + aliases: [], + guildOnly: true, +}; + +exports.help = { + name: 'modifycredits', + description: 'Modifies the credits of a user', + usage: '@user ', +}; diff --git a/commands/Owners Only/testingcredits.js b/commands/Owners Only/testingcredits.js index 76a6451..e902df8 100644 --- a/commands/Owners Only/testingcredits.js +++ b/commands/Owners Only/testingcredits.js @@ -18,29 +18,28 @@ * * *************************************/ -exports.run = async (bot, msg, args) => { - if (!['242775871059001344', '247221105515823104', '236279900728721409'].includes(msg.author.id)) return msg.reply('Nope! You need the person who created this bot to use this command.'); - - let user; - if (!msg.mentions.members.first()) { - user = msg.author; - } else { - user = msg.mentions.members.first(); - }; +exports.run = async (bot, msg) => { + if (!['242775871059001344', '247221105515823104', '236279900728721409'].includes(msg.author.id)) return msg.reply('Nope! You need the person who created this bot to use this command.'); - bot.plugins.economy.add(user.id, 50); + let user; + if (!msg.mentions.members.first()) { + user = msg.author; + } else { + user = msg.mentions.members.first(); + } - msg.channel.send('Added 50 credits'); - }; - - exports.conf = { - aliases: [], - guildOnly: true, - }; - - exports.help = { - name: 'testingcredits', - description: 'Modifies the credits of a user', - usage: '@user ', - }; - \ No newline at end of file + bot.plugins.economy.add(user.id, 50); + + msg.channel.send('Added 50 credits'); +}; + +exports.conf = { + aliases: [], + guildOnly: true, +}; + +exports.help = { + name: 'testingcredits', + description: 'Modifies the credits of a user', + usage: '@user ', +}; -- cgit v1.2.3