aboutsummaryrefslogtreecommitdiff
path: root/deprecated
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2020-05-22 20:36:26 -0400
committerAndrew Lee <alee14498@protonmail.com>2020-05-22 20:36:26 -0400
commitfc76d7c73ae9ffec6be86fc7d9d9e8c9a14605ab (patch)
tree0f4930fd8655e550c974bc404b93149cf7eab4ac /deprecated
parentbbb982243b6564e526fb581f55946704cdf256a3 (diff)
downloadAleeBot-fc76d7c73ae9ffec6be86fc7d9d9e8c9a14605ab.tar.gz
AleeBot-fc76d7c73ae9ffec6be86fc7d9d9e8c9a14605ab.tar.bz2
AleeBot-fc76d7c73ae9ffec6be86fc7d9d9e8c9a14605ab.zip
Added more ALP exclusive logs & cleaning up code
Diffstat (limited to 'deprecated')
-rw-r--r--deprecated/buy.js49
-rw-r--r--deprecated/daily.js63
2 files changed, 54 insertions, 58 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
diff --git a/deprecated/daily.js b/deprecated/daily.js
index 0d844a2..efb6c2e 100644
--- a/deprecated/daily.js
+++ b/deprecated/daily.js
@@ -1,5 +1,5 @@
-/****************************************
- *
+/** **************************************
+ *
* Daily: Command for AleeBot
* Copyright (C) 2018 AleeCorp
*
@@ -15,45 +15,42 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
* *************************************/
const db = require('quick.db');
- ms = require('parse-ms');
+ms = require('parse-ms');
module.exports.run = async (client, message) => {
+ const cooldown = 8.64e+7;
+ const amount = 100;
- let cooldown = 8.64e+7,
- amount = 100;
-
- let lastDaily = await db.fetch(`lastDaily_${message.author.id}`);
-
- if (lastDaily !== null && cooldown - (Date.now() - lastDaily) > 0) {
- let timeObj = ms(cooldown - (Date.now() - lastDaily));
+ const lastDaily = await db.fetch(`lastDaily_${message.author.id}`);
- message.reply(`You already collected your money, please wait **${timeObj.hours}h ${timeObj.minutes}m**!`)
- } else {
- message.channel.send(`You have successfully collected $${amount} dollars!`);
+ if (lastDaily !== null && cooldown - (Date.now() - lastDaily) > 0) {
+ const timeObj = ms(cooldown - (Date.now() - lastDaily));
- let balance = await db.fetch(`userBalance_${message.author.id}`);
+ message.reply(`You already collected your money, please wait **${timeObj.hours}h ${timeObj.minutes}m**!`);
+ } else {
+ message.channel.send(`You have successfully collected $${amount} dollars!`);
- if (balance == null) {
- db.set(`userBalance_${message.author.id}`, 0);
- }
+ const balance = await db.fetch(`userBalance_${message.author.id}`);
- db.set(`lastDaily_${message.author.id}`, Date.now());
- db.add(`userBalance_${message.author.id}`, 100);
+ if (balance == null) {
+ db.set(`userBalance_${message.author.id}`, 0);
}
- };
-
- exports.conf = {
- aliases: [],
- guildOnly: false,
- };
- exports.help = {
- name: 'daily',
- description: 'This gives you money everyday.',
- usage: 'daily',
- category: '- Economy Commands',
- };
- \ No newline at end of file
+ db.set(`lastDaily_${message.author.id}`, Date.now());
+ db.add(`userBalance_${message.author.id}`, 100);
+ }
+};
+
+exports.conf = {
+ aliases: [],
+ guildOnly: false,
+};
+exports.help = {
+ name: 'daily',
+ description: 'This gives you money everyday.',
+ usage: 'daily',
+ category: '- Economy Commands',
+};