aboutsummaryrefslogtreecommitdiff
path: root/deprecated/buy.js
diff options
context:
space:
mode:
authorAndrew Lee <andrew@alee14.me>2025-01-11 11:55:18 -0500
committerAndrew Lee <andrew@alee14.me>2025-01-11 11:55:18 -0500
commitf5de90ba89146008af78c16e798e216efccf0c50 (patch)
tree75f2bb7cee8bacce3f92c2b1bc468c7831b3429e /deprecated/buy.js
parent83dcca0a0279ce6415a3e9d153c13d91284369b0 (diff)
downloadAleeBot-f5de90ba89146008af78c16e798e216efccf0c50.tar.gz
AleeBot-f5de90ba89146008af78c16e798e216efccf0c50.tar.bz2
AleeBot-f5de90ba89146008af78c16e798e216efccf0c50.zip
Ability to add quotes, web interface, pending quotes
Diffstat (limited to 'deprecated/buy.js')
-rw-r--r--deprecated/buy.js114
1 files changed, 0 insertions, 114 deletions
diff --git a/deprecated/buy.js b/deprecated/buy.js
deleted file mode 100644
index 98d4fcf..0000000
--- a/deprecated/buy.js
+++ /dev/null
@@ -1,114 +0,0 @@
-/** **************************************
- *
- * Buy: Command for AleeBot
- * Copyright (C) 2017-2021 Alee Productions
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * 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) => {
-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(" ")) {
-
-
- for (var i in items) {
-
-
- if (!categories.includes(items[i].type)) {
- categories.push(items[i].type)
- }
-
- }
-
-
- const embed = new Discord.MessageEmbed()
- .setDescription(`Available Items`)
- .setColor('#1fd619')
-
- for (var i = 0; i < categories.length; i++) {
-
- var tempDesc = '';
-
- for (var c in items) {
- if (categories[i] === items[c].type) {
-
- tempDesc += `${items[c].name} - ${items[c].price}$ - ${items[c].desc}\n`;
-
- }
-
- }
-
- embed.addField(categories[i], tempDesc);
-
- }
-
-
- return message.channel.send({
- embed
- });
-
-
- }
-
- let itemName = '';
- let itemPrice = 0;
- let itemDesc = '';
-
- 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.`)
- }
-
- let selfBalance = await db.fetch(`userBalance_${message.author.id}`);
-
- 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') {
- message.guild.members.get(message.author.id).addRole(message.guild.roles.find("name", "Programmers"));
- }
-
- message.channel.send('You bought ' + itemName + '!');
-};
-
-exports.conf = {
- aliases: [],
- guildOnly: false,
-};
-exports.help = {
- name: 'buy',
- description: 'Buy things.',
- usage: 'buy [item]',
- category: '- Economy Commands',
-};