aboutsummaryrefslogtreecommitdiff
path: root/deprecated/buy.js
diff options
context:
space:
mode:
Diffstat (limited to 'deprecated/buy.js')
-rw-r--r--deprecated/buy.js49
1 files changed, 24 insertions, 25 deletions
diff --git a/deprecated/buy.js b/deprecated/buy.js
index e5b8fee..8e52f08 100644
--- a/deprecated/buy.js
+++ b/deprecated/buy.js
@@ -1,5 +1,5 @@
-/****************************************
- *
+/** **************************************
+ *
* Buy: Command for AleeBot
* Copyright (C) 2018 AleeCorp
*
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
* *************************************/
module.exports.run = async (client, message, args) => {
/*
@@ -23,27 +23,27 @@ const Discord = require('discord.js');
const fs = require('fs')
const db = require('quick.db');
const items = JSON.parse(fs.readFileSync('./storage/items.json', 'utf8'));
-
- let categories = [];
- if (!args.join(" ")) {
+ let categories = [];
+
+ if (!args.join(" ")) {
+
+
+ for (var i in items) {
-
- for (var i in items) {
-
if (!categories.includes(items[i].type)) {
categories.push(items[i].type)
}
}
-
+
const embed = new Discord.RichEmbed()
.setDescription(`Available Items`)
.setColor('#1fd619')
- for (var i = 0; i < categories.length; i++) {
+ for (var i = 0; i < categories.length; i++) {
var tempDesc = '';
@@ -60,7 +60,7 @@ const items = JSON.parse(fs.readFileSync('./storage/items.json', 'utf8'));
}
-
+
return message.channel.send({
embed
});
@@ -72,15 +72,15 @@ const items = JSON.parse(fs.readFileSync('./storage/items.json', 'utf8'));
let itemPrice = 0;
let itemDesc = '';
- for (var i in items) {
- if (args.join(" ").trim().toUpperCase() === items[i].name.toUpperCase()) {
+ for (var i in items) {
+ if (args.join(" ").trim().toUpperCase() === items[i].name.toUpperCase()) {
itemName = items[i].name;
itemPrice = items[i].price;
itemDesc = items[i].desc;
}
}
-
+
if (itemName === '') {
return message.channel.send(`Item ${args.join(" ").trim()} not found.`)
}
@@ -90,10 +90,10 @@ const items = JSON.parse(fs.readFileSync('./storage/items.json', 'utf8'));
if (selfBalance === null) {
db.set(`userBalance_${message.author.id}`, 0);
selfBalance = 0
- }
+ }
if (itemPrice > selfBalance) return message.reply('You don\'t have enough money for this item.')
-
+
db.subtract(`userBalance_${message.author.id}`, itemPrice);
if (itemName === 'Programmer Role') {
@@ -102,17 +102,16 @@ const items = JSON.parse(fs.readFileSync('./storage/items.json', 'utf8'));
message.channel.send('You bought ' + itemName + '!');
*/
- message.reply('Command is broken for now');
+ message.reply('Command is broken for now');
};
exports.conf = {
- aliases: [],
- guildOnly: false,
+ aliases: [],
+ guildOnly: false,
};
exports.help = {
- name: 'buy',
- description: 'Buy things.',
- usage: 'buy [item]',
- category: '- Economy Commands',
+ name: 'buy',
+ description: 'Buy things.',
+ usage: 'buy [item]',
+ category: '- Economy Commands',
};
- \ No newline at end of file