From b6d9e3305107c221741108a8de7559c9d7f59f14 Mon Sep 17 00:00:00 2001 From: Alee Date: Mon, 21 Oct 2019 04:53:18 +0000 Subject: Got economy back + removed outdated help --- bot.js | 2 +- commands/Getting Started/help.js | 2 +- package.json | 2 +- plugins/economy.js | 40 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 plugins/economy.js diff --git a/bot.js b/bot.js index d337a50..4c87850 100644 --- a/bot.js +++ b/bot.js @@ -17,7 +17,7 @@ bot.aliases = new Discord.Collection(); bot.categories = new Discord.Collection(); bot.queue = new Discord.Collection(); bot.plugins = { - //economy : require('./plugins/economy.js'), + economy : require('./plugins/economy.js'), settings : require('./plugins/settings.js'), whitelist: require('./plugins/whitelist.js'), gyms : require('./plugins/gyms.js')}; diff --git a/commands/Getting Started/help.js b/commands/Getting Started/help.js index 1e5ebdb..8c05e40 100644 --- a/commands/Getting Started/help.js +++ b/commands/Getting Started/help.js @@ -14,7 +14,7 @@ exports.run = (bot, msg, args) => { embed .setColor (0x36393e) .setTitle('PokeBot Command List') - .setDescription('Our main VPS just died, so now we host PokeBot on a RPI with pings of over 2000 MS. Therefore, we need to rely on you for our funding. Please support us using the below links to keep this project alive!\nhttps://patreon.com/pallet\nhttps://fiverr.com/universedg') + .setDescription('PokeBot is back :D') .setFooter('PokeBot v1.0'); const categories = Array.from(bot.categories.keys()); diff --git a/package.json b/package.json index 1851abe..139a221 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "", "main": "bot.js", "scripts": { - "test": "node test.js" + "start": "node bot.js" }, "author": "Alee, Justin, and Trey", "license": "GPL-3.0", diff --git a/plugins/economy.js b/plugins/economy.js new file mode 100644 index 0000000..3658ce8 --- /dev/null +++ b/plugins/economy.js @@ -0,0 +1,40 @@ +/** ************************************** + * + * Economy: Plugin for PokeBot that enables economy features. + * Copyright (C) 2018 TheEdge, jtsshieh, Alee + * + * Licensed under the Open Software License version 3.0 + * + * *************************************/ + +const db = require('quick.db'); +exports.get = async (userid) => { + const amount = await db.fetch(`money_${userid}`); + if (amount) { + return amount; + } + else { + await db.set(`money_${userid}`, 0); + return await db.fetch(`money_${userid}`); + } +}; + +exports.add = async (userid, money) => { + const amount = await db.fetch(`money_${userid}`); + if (amount) { + await db.set(`money_${userid}`, amount + money); + } + else { + await db.set(`money_${userid}`, money); + } +}; + +exports.subtract = async (userid, money) => { + const amount = await db.fetch(`money_${userid}`); + if (amount) { + await db.set(`money_${userid}`, amount - money); + } + else { + await db.set(`money_${userid}`, 0 - money); + } +}; -- cgit v1.2.3