ninja-gen

Bank

Nov 3rd, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require("discord.js");
  2. const client = new Discord.Client({
  3.   disableEveryone : true,
  4.   fetchAllMembers : true
  5. });
  6.  
  7. const config = require("../../commanddata/config.json");
  8. const fs = require("fs");
  9. const snekfetch = require('snekfetch');
  10. const embedColor = require('../../commanddata/config.json');
  11. const db = require('quick.db');
  12.  
  13. exports.run = async (client, message, args) => {
  14.  
  15.       db.set('inHand', 'bankAcct')
  16.  
  17.       const inHand = db.fetch(`money_${message.author.id}`)
  18.       const bankAcct = db.fetch(`money_${message.guild.id}`)
  19.  
  20. let help = new Discord.RichEmbed()
  21.      .setTitle("Bank Commands")
  22.      .setDescription("Here is a list of Banking commands")
  23.      .setColor(client.config.embedcolor)
  24.      .addField("Deposit", "``nb/bank deposit {amount}``\nDeposits the amount specified into your bank")
  25.      .addField("Withdrawl", "``nb/bank withdrawl {amount}``\nWithdrawls the amount specified from your bank")
  26.  
  27.    if(!args[0] || args[0] == "help") return message.channel.send(help);
  28.  
  29.    if (args[0] == 'deposit') {
  30.    
  31.     if (!args[1]){
  32.         return message.channel.send('Please specify an amount.')
  33.     }
  34.  
  35.     if (message.content.includes('-')) { // if the message includes "-" do this.
  36.         return message.channel.send('Negative money can not be deposited.')
  37.     }
  38.  
  39.     if (inHand < args[1]) {
  40.         return message.channel.send(`That's more money than you've got in your balance. try again.`)
  41.     }
  42.  
  43.        message.channel.send(`<@${message.author.id}>, You successfully deposited $` + `${args[1]}`)
  44.        db.subtract(`money_${message.author.id}`, args[1])
  45.        db.add(`money_{message.guild.id}`, args[1])
  46.     } else if(args[0] == 'withdrawl') {
  47.  
  48.     if (!args[1]){
  49.         return message.channel.send('Please specify an amount.')
  50.     }
  51.  
  52.     if (message.content.includes('-')) { // if the message includes "-" do this.
  53.         return message.channel.send('Negative money can not be withdrawn.')
  54.     }
  55.  
  56.     if (bankAcct < args[1]) {
  57.         return message.channel.send(`That's more money than you've got in your bank. try again.`)
  58.     }
  59.  
  60.        message.channel.send(`<@${message.author.id}>, You successfully deposited $` + `${args[1]}`)
  61.        db.subtract(`money_{message.guild.id}`, args[1])
  62.        db.add(`money_${message.author.id}`, args[1])
  63.    }
  64.  
  65. }
  66.  
  67. exports.conf = {
  68.   enabled: true,
  69.   guildOnly: false,
  70.   aliases: [],
  71.   permLevel: 0
  72. };
  73.  
  74. exports.help = {
  75.   name: 'bank',
  76.   description: 'WORK IN PROGRESS!!!',
  77.   usage: 'nb/bank',
  78.   permsissions: 'Everyone!',
  79.   group: 'Economy Module'
  80. };
Add Comment
Please, Sign In to add comment