├── .gitattributes ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── CNAME ├── Commands ├── Economy │ ├── balance.js │ ├── beg.js │ ├── buy.js │ ├── crime.js │ ├── daily.js │ ├── deposit.js │ ├── fish.js │ ├── pay.js │ ├── profile.js │ ├── rob.js │ ├── roulette.js │ ├── sell.js │ ├── slots.js │ ├── store.js │ ├── weekly.js │ ├── withdraw.js │ └── work.js ├── Owner │ ├── botavatar.js │ ├── botnick.js │ ├── eval.js │ ├── exec.js │ └── reload.js └── Utility │ ├── help.js │ └── leaderboard.js ├── Configuration └── config.json ├── LICENSE ├── README.md ├── _config.yml ├── events └── client │ ├── disconnect.js │ ├── error.js │ ├── message.js │ ├── ready.js │ ├── reconnecting.js │ └── warn.js ├── functions.js ├── handlers ├── commandHandler.js ├── economybot.js └── eventHandler.js ├── index.js ├── package.json └── shrinkwrap.yaml /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: TheGamer456YT 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Report incorrect or unexpected behavior of the bot. 4 | title: "[BUG] - " 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Please describe the problem you are having in as much detail as possible:** 11 | 12 | **To Reproduce** 13 | Steps to reproduce the behavior: 14 | 15 | **Expected behavior** 16 | A clear and concise description of what you expected to happen: 17 | 18 | **Screenshots** 19 | If applicable, add screenshots to help explain your problem: 20 | 21 | **Further details:** 22 | - bot version: 23 | - discord.js version: 24 | - Node.js version: 25 | - Operating system: 26 | 27 | **Additional context** 28 | Add any other context about the problem here: 29 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **Please describe the changes this pull request makes and why it should be merged:** 2 | 3 | 4 | **Status:** 5 | 6 | - [ ] Code changes have been tested 7 | - [ ] Code changes work without errors 8 | 9 | **Content of the pull request:** 10 | 11 | - [ ] This pull request changes the bot 12 | - [ ] This pull request includes breaking changes for the bot 13 | - [ ] This pull request includes new command(s) for the bot 14 | 15 | - [ ] This pull request changes the dashboard 16 | 17 | - [ ] This pull request **only** includes non-code changes, like changes to templates, README.md, languages, etc. 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | economybot.com -------------------------------------------------------------------------------- /Commands/Economy/balance.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const { match } = require("../../functions.js") 3 | 4 | module.exports = { 5 | help: { 6 | name: "balance", 7 | description: "Check's your balance!", 8 | aliases: ["bal"], 9 | category: "Economy" 10 | }, 11 | 12 | run: async(client, message, args) => { 13 | 14 | let user = message.mentions.users.first() || 15 | client.users.cache.get(args[0]) || 16 | match(args.join(" ").toLowerCase(), message.guild) || 17 | message.author; 18 | 19 | let bal = await client.db.fetch(`money_${message.guild.id}_${user.id}.pocket`); 20 | if (bal === null) bal = 0; 21 | 22 | let bank = await client.db.fetch(`money_${message.guild.id}_${user.id}.bank`); 23 | if (bank === null) bank = 0; 24 | 25 | let TotalMoney = bank + bal; 26 | 27 | let moneyEmbed = new Discord.MessageEmbed() 28 | .setColor("#FFFFFF") 29 | .setDescription(`**${user}'s Balance**\n 30 | **Pocket:** ${bal} 31 | **Bank:** ${bank} 32 | **Total:** ${TotalMoney}`); 33 | message.channel.send(moneyEmbed) 34 | } 35 | } -------------------------------------------------------------------------------- /Commands/Economy/beg.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const ms = require("parse-ms"); 3 | 4 | module.exports = { 5 | help: { 6 | name: "beg", 7 | description: "Beg on the streets for some money!", 8 | category: "Economy" 9 | }, 10 | 11 | 12 | run: async(client, message, args) => { 13 | 14 | let user = message.author; 15 | let timeout = 60000; 16 | 17 | let multiplier = await client.db.fetch(`multiplier_${message.guild.id}`); 18 | if(!multiplier) multiplier = 1; 19 | let amounta = Math.floor(Math.random() * 30) + 1; 20 | 21 | let amounts = amounta * multiplier; 22 | 23 | let beg = await client.db.fetch(`beg_${message.guild.id}_${user.id}`); 24 | 25 | if (beg !== null && timeout - (Date.now() - beg) > 0) { 26 | let time = ms(timeout - (Date.now() - beg)); 27 | 28 | let timeEmbed = new Discord.MessageEmbed() 29 | .setColor("#FFFFFF") 30 | .setDescription(` You've already begged recently\n\nBeg again in ${time.minutes}m ${time.seconds}s `); 31 | message.channel.send(timeEmbed) 32 | } else { 33 | 34 | await client.db.add(`money_${message.guild.id}_${user.id}.pocket`, amounts); 35 | await client.db.set(`beg_${message.guild.id}_${user.id}`, Date.now()); 36 | 37 | message.channel.send(` You've begged on the streets and received ${amounts} coins`) 38 | 39 | 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Commands/Economy/buy.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | 3 | module.exports = { 4 | help: { 5 | name: "buy", 6 | description: "Buy something from the store!", 7 | category: "Economy" 8 | }, 9 | 10 | 11 | run: async(client, message, args) => { 12 | 13 | let user = message.author; 14 | 15 | let author = await client.db.fetch(`money_${message.guild.id}_${user.id}.pocket`) 16 | 17 | let Embed = new Discord.MessageEmbed() 18 | .setColor("#FFFFFF") 19 | .setDescription(` You need 2000 coins to purchase Bronze VIP`); 20 | 21 | switch(args[0]) { 22 | case 'bronze': 23 | if (author < 3500) return message.channel.send(Embed) 24 | 25 | await client.db.fetch(`bronze_${message.guild.id}_${user.id}`); 26 | await client.db.set(`bronze_${message.guild.id}_${user.id}`, true) 27 | 28 | let Embed2 = new Discord.MessageEmbed() 29 | .setColor("#FFFFFF") 30 | .setDescription(` Purchased Bronze VIP For 3500 Coins`); 31 | 32 | await client.db.subtract(`money_${message.guild.id}_${user.id}.pocket`, 3500) 33 | message.channel.send(Embed2) 34 | break; 35 | 36 | case 'nikes': 37 | let Embedn = new Discord.MessageEmbed() 38 | .setColor("#FFFFFF") 39 | .setDescription(` You need 600 coins to purchase some Nikes`); 40 | 41 | if (author < 600) return message.channel.send(Embedn) 42 | 43 | await client.db.fetch(`nikes_${message.guild.id}_${user.id}`) 44 | await client.db.add(`nikes_${message.guild.id}_${user.id}`, 1) 45 | 46 | let Embed3 = new Discord.MessageEmbed() 47 | .setColor("#FFFFFF") 48 | .setDescription(` Purchased Fresh Nikes For 600 Coins`); 49 | 50 | await client.db.subtract(`money_${message.guild.id}_${user.id}.pocket`, 600) 51 | message.channel.send(Embed3) 52 | break; 53 | 54 | case 'car': 55 | let Embed4 = new Discord.MessageEmbed() 56 | .setColor("#FFFFFF") 57 | .setDescription(` You need 800 coins to purchase a new car`); 58 | 59 | if (author < 800) return message.channel.send(Embed4) 60 | 61 | await client.db.fetch(`car_${message.guild.id}_${user.id}`) 62 | await client.db.add(`car_${message.guild.id}_${user.id}`, 1) 63 | 64 | let Embed5 = new Discord.MessageEmbed() 65 | .setColor("#FFFFFF") 66 | .setDescription(` Purchased a New Car For 800 Coins`); 67 | 68 | await client.db.subtract(`money_${message.guild.id}_${user.id}.pocket`, 800) 69 | message.channel.send(Embed5) 70 | break; 71 | 72 | case "fish": 73 | case "fishing": 74 | let Embed6 = new Discord.MessageEmbed() 75 | .setColor("#FFFFFF") 76 | .setDescription(` You need 50 coins to purchase a fishing rod`); 77 | 78 | if (author < 50) return message.channel.send(Embed6); 79 | let iffish = await client.db.get(`fish_${message.guild.id}_${user.id}`); 80 | if(iffish !== null) { 81 | if(iffish.rod === 1) return message.channel.send("You already have a fishing rod!"); 82 | } 83 | //await client.db.fetch(`fish_${message.guild.id}_${user.id}`) 84 | await client.db.add(`fish_${message.guild.id}_${user.id}.rod`, 1); 85 | await client.db.set(`fish_${message.guild.id}_${user.id}.fish`, []) 86 | 87 | let Embed7 = new Discord.MessageEmbed() 88 | .setColor("#FFFFFF") 89 | .setDescription(` Purchased a Fishing rod For 50 Coins`); 90 | 91 | await client.db.subtract(`money_${message.guild.id}_${user.id}.pocket`, 50) 92 | message.channel.send(Embed7) 93 | break; 94 | 95 | case 'mansion': 96 | let Embed8 = new Discord.MessageEmbed() 97 | .setColor("#FFFFFF") 98 | .setDescription(` You need 1200 coins to purchase a Mansion`); 99 | 100 | if (author < 1200) return message.channel.send(Embed8) 101 | 102 | await client.db.fetch(`house_${message.guild.id}_${user.id}`) 103 | await client.db.add(`house_${message.guild.id}_${user.id}`, 1) 104 | 105 | let Embed9 = new Discord.MessageEmbed() 106 | .setColor("#FFFFFF") 107 | .setDescription(` Purchased a Mansion For 1200 Coins`); 108 | 109 | await client.db.subtract(`money_${message.guild.id}_${user.id}.pocket`, 1200) 110 | message.channel.send(Embed9) 111 | break; 112 | 113 | default: 114 | let embed3 = new Discord.MessageEmbed() 115 | .setColor("#FFFFFF") 116 | .setDescription(' Enter an item to buy') 117 | message.channel.send(embed3) 118 | break; 119 | 120 | } 121 | } 122 | } -------------------------------------------------------------------------------- /Commands/Economy/crime.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"), 2 | ms_2 = require('parse-ms'); 3 | 4 | module.exports = { 5 | help: { 6 | name: "crime", 7 | description: "Commit a crime, but is it worth it?", 8 | category: "Economy" 9 | }, 10 | 11 | run: async(client, message, args) => { 12 | 13 | let user = message.author; 14 | 15 | let timeout = 60000; 16 | 17 | let author = await client.db.fetch(`money_${message.guild.id}_${user.id}.pocket`); 18 | let multiplier = await client.db.fetch(`multiplier_${message.guild.id}`); 19 | if(!multiplier) multiplier = 1; 20 | let randoma = Math.floor(Math.random() * 200) + 1; 21 | let random = randoma * multiplier; 22 | 23 | if (author < 250) { 24 | return message.channel.send(' You need at least 250$ to commit a crime') 25 | } 26 | 27 | let crime = await client.db.fetch(`crime_${message.author.id}`) 28 | 29 | if (crime !== null && timeout - (Date.now() - crime) > 0) { 30 | 31 | let time = ms_2(timeout - (Date.now() - crime)); 32 | 33 | message.channel.send(`You already commited a crime! Try again in ${time.seconds} seconds!`) 34 | 35 | } else { 36 | 37 | const result = [ 38 | "WINWIN", 39 | "LOOSELOOSE" 40 | ] 41 | 42 | let awnser = result[Math.floor(Math.random() * result.length)]; 43 | 44 | if (awnser === "LOOSELOOSE") { 45 | 46 | message.channel.send("You were caught and had to pay `$250` to stay out of jail"); 47 | 48 | await client.db.subtract(`money_${message.guild.id}_${user.id}.pocket`, 250); 49 | 50 | await client.db.set(`crime_${message.author.id}`, Date.now()); 51 | } else { 52 | 53 | let embed = new Discord.MessageEmbed() 54 | .setAuthor(message.author.tag, message.author.avatarURL()) 55 | .setTitle("You Have Just Commited A Crime!") 56 | .addField("Amount Robbed:", random) 57 | .setColor("RANDOM") 58 | .setTimestamp(); 59 | message.channel.send(embed) 60 | await client.db.add(`crimecommited_${user.id}`, 1); 61 | await client.db.add(`money_${message.guild.id}_${user.id}.pocket`, random); 62 | await client.db.set(`crime_${message.author.id}`, Date.now()); 63 | 64 | } 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /Commands/Economy/daily.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const ms = require("parse-ms"); 3 | 4 | module.exports = { 5 | help: { 6 | name: "daily", 7 | description: "Get your daily money!", 8 | category: "Economy" 9 | }, 10 | 11 | run: async(client, message, args) => { 12 | 13 | let user = message.author; 14 | 15 | let timeout = 86400000; 16 | 17 | let daili = Math.floor(Math.random() * 200) + 1; 18 | let multiplier = await client.db.fetch(`multiplier_${message.guild.id}`); 19 | if(!multiplier) multiplier = 1; 20 | let dailies = daili * multiplier; 21 | 22 | let daily = await client.db.fetch(`daily_${message.guild.id}_${user.id}`); 23 | 24 | if (daily !== null && timeout - (Date.now() - daily) > 0) { 25 | let time = ms(timeout - (Date.now() - daily)); 26 | 27 | let timeEmbed = new Discord.MessageEmbed() 28 | .setColor("#FFFFFF") 29 | .setDescription(`You've already collected your daily reward\n\nCollect it again in ${time.hours}h ${time.minutes}m ${time.seconds}s `); 30 | message.channel.send(timeEmbed) 31 | } else { 32 | 33 | let moneyEmbed = new Discord.MessageEmbed() 34 | .setColor("#FFFFFF") 35 | .setDescription(`You've collected your daily reward of ${dailies} coins`); 36 | 37 | await client.db.add(`money_${message.guild.id}_${user.id}.pocket`, dailies); 38 | await client.db.set(`daily_${message.guild.id}_${user.id}`, Date.now()); 39 | 40 | message.channel.send(moneyEmbed) 41 | 42 | 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Commands/Economy/deposit.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const ms = require("parse-ms"); 3 | 4 | module.exports = { 5 | help: { 6 | name: "deposit", 7 | description: "Deposit some money to your local bank!", 8 | aliases: ["dep"], 9 | category: "Economy" 10 | }, 11 | 12 | run: async(client, message, args) => { 13 | 14 | let user = message.author; 15 | 16 | let member = await client.db.fetch(`money_${message.guild.id}_${user.id}.pocket`) 17 | 18 | if (args[0] == 'all') { 19 | let money = await client.db.fetch(`money_${message.guild.id}_${user.id}.pocket`) 20 | 21 | let embedbank = new Discord.MessageEmbed() 22 | .setColor('#FFFFFF') 23 | .setDescription(" You don't have any money to deposit") 24 | 25 | if(money === 0 || money === null) return message.channel.send(embedbank) 26 | 27 | await client.db.add(`money_${message.guild.id}_${user.id}.bank`, money) 28 | await client.db.subtract(`money_${message.guild.id}_${user.id}.pocket`, money) 29 | let embed5 = new Discord.MessageEmbed() 30 | .setColor("#FFFFFF") 31 | .setDescription(` You have deposited ${args[0]} coins into your bank`); 32 | message.channel.send(embed5) 33 | 34 | } else { 35 | 36 | let embed2 = new Discord.MessageEmbed() 37 | .setColor("#FFFFFF") 38 | .setDescription(` Specify an amount to deposit`); 39 | 40 | if (!args[0]) { 41 | return message.channel.send(embed2) 42 | .catch(err => console.log(err)) 43 | } 44 | let embed3 = new Discord.MessageEmbed() 45 | .setColor("#FFFFFF") 46 | .setDescription(` You can't deposit negative money`); 47 | 48 | if (message.content.includes('-')) { 49 | return message.channel.send(embed3) 50 | } 51 | let embed4 = new Discord.MessageEmbed() 52 | .setColor("#FFFFFF") 53 | .setDescription(` You don't have that much money`); 54 | 55 | if (member < args[0]) { 56 | return message.channel.send(embed4) 57 | } 58 | 59 | let embed5 = new Discord.MessageEmbed() 60 | .setColor("#FFFFFF") 61 | .setDescription(` You have deposited ${parseInt(args[0])} coins into your bank`); 62 | 63 | await client.db.subtract(`money_${message.guild.id}_${user.id}.pocket`, parseInt(args[0])); 64 | await client.db.add(`money_${message.guild.id}_${user.id}.bank`, parseInt(args[0])); 65 | 66 | 67 | message.channel.send(embed5); 68 | 69 | 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /Commands/Economy/fish.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const ms = require("parse-ms"); 3 | 4 | module.exports = { 5 | help: { 6 | name: "fish", 7 | description: "Fish some fish.", 8 | category: "Economy" 9 | }, 10 | 11 | run: async(client, message, args) => { 12 | 13 | const rand = (min, max) => { 14 | return Math.floor(Math.random() * (max - min) ) + min; 15 | }; 16 | 17 | let user = message.author; 18 | let timeout = 60000; 19 | let fish = 20 | ["Yellow Fish :tropical_fish:", 21 | "Fat Fish :blowfish:", 22 | "Blue Fish :fish:", 23 | "Coconut :coconut:", 24 | "Dolphin :dolphin:", 25 | "Lobster :lobster:", 26 | "Shark :shark:", 27 | "Crab :crab:", 28 | "Squid :squid:", 29 | "Whale :whale2:", 30 | "Shrimp :shrimp:", 31 | "Octopus :octopus:", 32 | //"Duck :duck:", 33 | "Diamond :gem:"]; 34 | 35 | let randn = rand(0, parseInt(fish.length)); 36 | let randrod = rand(15, 30); 37 | 38 | let fishToWin = fish[randn]; 39 | 40 | 41 | let fishdb = await client.db.fetch(`fish_${message.guild.id}_${user.id}`); 42 | let rod = await client.db.get(`fish_${message.guild.id}_${user.id}.rod`); 43 | let rodusage = await client.db.get(`fish_${message.guild.id}_${user.id}.rodusage`); 44 | let wait = await client.db.fetch(`fish_${message.guild.id}_${user.id}.wait`); 45 | 46 | 47 | if(!rod) return message.channel.send(`You have to buy a fishing rod!`); 48 | 49 | if(rodusage) { 50 | if(fishdb.rodusage >= randrod) { 51 | await client.db.delete(`fish_${message.guild.id}_${user.id}.rod`); 52 | return message.reply("Your fishing rod has broken! Go buy a new one!") 53 | } 54 | } 55 | 56 | 57 | 58 | if (wait !== null && timeout - (Date.now() - wait) > 0) { 59 | let time = ms(timeout - (Date.now() - wait)); 60 | 61 | message.channel.send(` You have already fished!\nFish it again in ${time.seconds}s`); 62 | 63 | } else { 64 | 65 | message.channel.send(` You've fished and gotten a ${fishToWin}`); 66 | 67 | await client.db.push(`fish_${message.guild.id}_${user.id}.fish`, fishToWin); 68 | await client.db.set(`fish_${message.guild.id}_${user.id}.wait`, Date.now()); 69 | await client.db.add(`fish_${message.guild.id}_${user.id}.rodusage`, 1); 70 | 71 | } 72 | } 73 | }; 74 | 75 | 76 | -------------------------------------------------------------------------------- /Commands/Economy/pay.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const ms = require("parse-ms"); 3 | const { match } = require("../../functions.js") 4 | 5 | module.exports = { 6 | help: { 7 | name: "pay", 8 | description: "Pay someone!", 9 | category: "Economy" 10 | }, 11 | 12 | run: async(client, message, args) => { 13 | 14 | let user = message.mentions.members.first() || 15 | client.users.cache.get(args[0]) || 16 | match(args.join(" ").toLowerCase(), message.guild) || 17 | message.author; 18 | 19 | 20 | let member = await client.db.fetch(`money_${message.guild.id}_${message.author.id}.pocket`); 21 | 22 | let embed1 = new Discord.MessageEmbed() 23 | .setColor("#FFFFFF") 24 | .setDescription(` Mention someone to pay`); 25 | 26 | if (!user) { 27 | return message.channel.send(embed1) 28 | } 29 | let embed2 = new Discord.MessageEmbed() 30 | .setColor("#FFFFFF") 31 | .setDescription(`<:Cross:618736602901905418> Specify an amount to pay`); 32 | 33 | if (!parseInt(args[1])) { 34 | return message.channel.send(embed2) 35 | } 36 | let embed3 = new Discord.MessageEmbed() 37 | .setColor("#FFFFFF") 38 | .setDescription(`<:Cross:618736602901905418> You can't pay someone negative money`); 39 | 40 | if (message.content.includes('-')) { 41 | return message.channel.send(embed3) 42 | } 43 | let embed4 = new Discord.MessageEmbed() 44 | .setColor("#FFFFFF") 45 | .setDescription(`<:Cross:618736602901905418> You don't have that much money`); 46 | 47 | if (member < parseInt(args[1])) { 48 | return message.channel.send(embed4) 49 | } 50 | 51 | let embed5 = new Discord.MessageEmbed() 52 | .setColor("#FFFFFF") 53 | .setDescription(`<:Check:618736570337591296> You have payed ${user.user.username} ${parseInt(args[1])} coins`); 54 | 55 | await client.db.add(`money_${message.guild.id}_${user.id}.pocket`, parseInt(args[1])); 56 | await client.db.subtract(`money_${message.guild.id}_${message.author.id}.pocket`, parseInt(args[1])); 57 | 58 | message.channel.send(embed5); 59 | 60 | 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /Commands/Economy/profile.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const { match } = require("../../functions.js") 3 | 4 | module.exports = { 5 | help: { 6 | name: "profile", 7 | description: "Get the profile/Inventory of someone!", 8 | aliases: ["inventory", "inv"], 9 | category: "Economy" 10 | }, 11 | 12 | run: async (client, message, args) => { 13 | 14 | let user = message.mentions.users.first() || 15 | client.users.cache.get(args[0]) || 16 | match(args.join(" ").toLowerCase(), message.guild) || 17 | message.author; 18 | 19 | let bal = await client.db.fetch(`money_${message.guild.id}_${user.id}.pocket`); 20 | if (bal === null) bal = 0; 21 | 22 | let bank = await client.db.fetch(`money_${message.guild.id}_${user.id}.bank`); 23 | if (bank === null) bank = 0; 24 | 25 | let vip = await client.db.fetch(`bronze_${message.guild.id}_${user.id}`); 26 | if(vip === null) vip = 'None' 27 | if(vip === true) vip = 'Bronze' 28 | 29 | let shoes = await client.db.fetch(`nikes_${message.guild.id}_${user.id}`); 30 | if(shoes === null) shoes = 0; 31 | 32 | let newcar = await client.db.fetch(`car_${message.guild.id}_${user.id}`); 33 | if(newcar === null) newcar = 0; 34 | 35 | let newhouse = await client.db.fetch(`house_${message.guild.id}_${user.id}`); 36 | if(newhouse === null) newhouse = 0; 37 | 38 | let fish = await client.db.fetch(`fish_${message.guild.id}_${user.id}.fish`); 39 | 40 | let moneyEmbed = new Discord.MessageEmbed() 41 | .setColor("RANDOM") 42 | .setDescription(`**${user}'s Profile:**\n 43 | **Net Worth:** ${+bank + +bal} 44 | **VIP Rank:** ${vip} 45 | \n**Inventory** 46 | \n**Nikes:** ${shoes} 47 | **Cars:** ${newcar} 48 | **Mansions:** ${newhouse} 49 | **Fish & Stuff:** ${(fish === null) ? "No Fish." : (fish.join(" ").toString().length > 2000) 50 | ? "You have too many fish! Please run the fishes command!" 51 | : fish.join(", ")}`); 52 | 53 | message.channel.send(moneyEmbed); 54 | } 55 | }; 56 | -------------------------------------------------------------------------------- /Commands/Economy/rob.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const ms = require("parse-ms"); 3 | const { match } = require("../../functions.js") 4 | 5 | module.exports = { 6 | help: { 7 | name: "rob", 8 | description: "Rob someone!", 9 | category: "Economy" 10 | }, 11 | 12 | run: async (client, message, args) => { 13 | 14 | let user = 15 | message.mentions.users.first() || 16 | client.users.cache.get(args[0]) || 17 | match(args.join(" ").toLowerCase(), message.guild); 18 | 19 | let targetuser = await client.db.fetch(`money_${message.guild.id}_${user.id}.pocket`); 20 | let author = await client.db.fetch(`rob_${message.guild.id}_${message.author.id}`); 21 | let author2 = await client.db.fetch(`money_${message.guild.id}_${message.author.id}.pocket`); 22 | 23 | let timeout = 6000000; 24 | 25 | if (author !== null && timeout - (Date.now() - author) > 0) { 26 | 27 | let time = ms(timeout - (Date.now() - author)); 28 | 29 | let timeEmbed = new Discord.MessageEmbed() 30 | .setColor("#FFFFFF") 31 | .setDescription(` You have already robbed someone\n\nTry again in ${time.minutes}m ${time.seconds}s `); 32 | message.channel.send(timeEmbed) 33 | 34 | } else { 35 | 36 | let moneyEmbed = new Discord.MessageEmbed() 37 | .setColor("#FFFFFF") 38 | .setDescription(` You need at least 200 coins in your wallet to rob someone`); 39 | 40 | 41 | if (author2 < 200) { 42 | return message.channel.send(moneyEmbed) 43 | } 44 | 45 | let moneyEmbed2 = new Discord.MessageEmbed() 46 | .setColor("#FFFFFF") 47 | .setDescription(` ${user.username} does not have anything you can rob`); 48 | 49 | if (targetuser <= 0 || targetuser === null) { 50 | return message.channel.send(moneyEmbed2) 51 | } 52 | 53 | let authorembed = new Discord.MessageEmbed() 54 | .setColor("#FFFFFF") 55 | .setDescription(` You cannot rob yourself!`); 56 | 57 | if(user.id === message.author.id) { 58 | return message.channel.send(authorembed) 59 | } 60 | 61 | let vip = await client.db.fetch(`bronze_${user.id}`) 62 | 63 | if(vip === true) random = Math.floor(Math.random() * parseInt(targetuser)) + 1; 64 | if(vip === null) random = Math.floor(Math.random() * 100) + 1; 65 | 66 | 67 | let embed = new Discord.MessageEmbed() 68 | .setDescription(` You robbed ${user} and got away with ${random} coins`) 69 | .setColor("#FFFFFF") 70 | 71 | message.channel.send(embed) 72 | 73 | await client.db.subtract(`money_${message.guild.id}_${user.id}.pocket`, random); 74 | await client.db.add(`money_${message.guild.id}_${message.author.id}.pocket`, random); 75 | await client.db.set(`rob_${message.guild.id}_${message.author.id}`, Date.now()); 76 | 77 | } 78 | } 79 | }; -------------------------------------------------------------------------------- /Commands/Economy/roulette.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const ms = require("parse-ms"); 3 | 4 | module.exports = { 5 | help: { 6 | name: "roulette", 7 | description: "Play roulette!", 8 | aliases: ["roul"], 9 | category: "Economy" 10 | }, 11 | 12 | run: async (client, message, args) => { 13 | 14 | let user = message.author; 15 | 16 | function isOdd(num) { 17 | if ((num % 2) == 0) return false; 18 | else if ((num % 2) == 1) return true; 19 | } 20 | 21 | let colour = args[0]; 22 | 23 | let money = parseInt(args[1]); 24 | 25 | let moneydb = await client.db.fetch(`money_${message.guild.id}_${user.id}.pocket`) 26 | 27 | 28 | let random = Math.floor(Math.random() * 37); 29 | 30 | 31 | let moneyhelp = new Discord.MessageEmbed() 32 | .setColor("#FFFFFF") 33 | .setDescription(` Specify an amount to gamble | ,roulette `); 34 | 35 | 36 | let moneymore = new Discord.MessageEmbed() 37 | .setColor("#FFFFFF") 38 | .setDescription(` You are betting more than you have`); 39 | 40 | 41 | let colorbad = new Discord.MessageEmbed() 42 | .setColor("#FFFFFF") 43 | .setDescription(` Specify a color | Red [1.5x] Black [2x] Green [15x]`); 44 | 45 | 46 | if (!colour) return message.channel.send(colorbad); 47 | colour = colour.toLowerCase() 48 | if (!money) return message.channel.send(moneyhelp); 49 | if (money > moneydb) return message.channel.send(moneymore); 50 | 51 | if (colour == "b" || colour.includes("black")) colour = 0; 52 | else if (colour == "r" || colour.includes("red")) colour = 1; 53 | else if (colour == "g" || colour.includes("green")) colour = 2; 54 | else return message.channel.send(colorbad); 55 | 56 | 57 | 58 | if (random == 0 && colour == 2) { // Green 59 | money *= 15 60 | await client.db.add(`money_${message.guild.id}_${user.id}.pocket`, money) 61 | let moneyEmbed1 = new Discord.MessageEmbed() 62 | .setColor("#FFFFFF") 63 | .setDescription(`:red_square: You won ${money} coins\n\nMultiplier: 15x`); 64 | message.channel.send(moneyEmbed1) 65 | } else if (isOdd(random) && colour == 1) { // Red 66 | money = parseInt(money * 1.5) 67 | await client.db.add(`money_${message.guild.id}_${user.id}.pocket`, money) 68 | let moneyEmbed2 = new Discord.MessageEmbed() 69 | .setColor("#FFFFFF") 70 | .setDescription(`:red_square: You won ${money} coins\n\nMultiplier: 1.5x`); 71 | message.channel.send(moneyEmbed2) 72 | } else if (!isOdd(random) && colour == 0) { // Black 73 | money = parseInt(money * 2) 74 | await client.db.add(`money_${message.guild.id}_${user.id}.pocket`, money) 75 | let moneyEmbed3 = new Discord.MessageEmbed() 76 | .setColor("#FFFFFF") 77 | .setDescription(`:black_large_square: You won ${money} coins\n\nMultiplier: 2x`); 78 | message.channel.send(moneyEmbed3) 79 | } else { // Wrong 80 | await client.db.subtract(`money_${message.guild.id}_${user.id}.pocket`, money) 81 | let moneyEmbed4 = new Discord.MessageEmbed() 82 | .setColor("#FFFFFF") 83 | .setDescription(` You lost ${money} coins\n\nMultiplier: 0x`); 84 | message.channel.send(moneyEmbed4) 85 | } 86 | } 87 | } -------------------------------------------------------------------------------- /Commands/Economy/sell.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | 3 | module.exports = { 4 | help: { 5 | name: "sell", 6 | description: "Sell something you dont use/want!", 7 | category: "Economy" 8 | }, 9 | 10 | run: async (client, message, args) => { 11 | 12 | let user = message.author; 13 | 14 | if(args[0].toLowerCase() == 'nikes') { 15 | let Embed2 = new Discord.MessageEmbed() 16 | .setColor("#FFFFFF") 17 | .setDescription(` You don't have Nikes to sell`); 18 | 19 | let nikeses = await client.db.fetch(`nikes_${message.guild.id}_${user.id}`) 20 | 21 | if (nikeses < 1) return message.channel.send(Embed2) 22 | 23 | await client.db.fetch(`nikes_${message.guild.id}_${user.id}`) 24 | await client.db.subtract(`nikes_${message.guild.id}_${user.id}`, 1) 25 | 26 | let Embed3 = new Discord.MessageEmbed() 27 | .setColor("#FFFFFF") 28 | .setDescription(` Sold Fresh Nikes For 600 Coins`); 29 | 30 | await client.db.add(`money_${message.guild.id}_${user.id}.pocket`, 600) 31 | message.channel.send(Embed3) 32 | } else if(args[0].toLowerCase() == 'car') { 33 | let Embed2 = new Discord.MessageEmbed() 34 | .setColor("#FFFFFF") 35 | .setDescription(` You don't have a Car to sell`); 36 | 37 | let cars = await db.fetch(`car_${message.guild.id}_${user.id}`) 38 | 39 | if (cars < 1) return message.channel.send(Embed2) 40 | 41 | await client.db.fetch(`car_${message.guild.id}_${user.id}`) 42 | await client.db.subtract(`car_${message.guild.id}_${user.id}`, 1) 43 | 44 | let Embed3 = new Discord.MessageEmbed() 45 | .setColor("#FFFFFF") 46 | .setDescription(` Sold a Car For 800 Coins`); 47 | 48 | await client.db.add(`money_${message.guild.id}_${user.id}.pocket`, 800) 49 | message.channel.send(Embed3) 50 | } else if(args[0].toLowerCase() == 'mansion') { 51 | let Embed2 = new Discord.MessageEmbed() 52 | .setColor("#FFFFFF") 53 | .setDescription(` You don't have a Mansion to sell`); 54 | 55 | let houses = await db.fetch(`house_${message.guild.id}_${user.id}`) 56 | 57 | if (houses < 1) return message.channel.send(Embed2) 58 | 59 | await client.db.fetch(`house_${message.guild.id}_${user.id}`) 60 | await client.db.subtract(`house_${message.guild.id}_${user.id}`, 1) 61 | 62 | let Embed3 = new Discord.MessageEmbed() 63 | .setColor("#FFFFFF") 64 | .setDescription(` Sold a Mansion For 1200 Coins`); 65 | 66 | await client.db.add(`money_${message.guild.id}_${user.id}.pocket`, 1200) 67 | message.channel.send(Embed3) 68 | }; 69 | 70 | } 71 | } -------------------------------------------------------------------------------- /Commands/Economy/slots.js: -------------------------------------------------------------------------------- 1 | const slotItems = [":Grape:", ":Watermelon:", "🍊", ":Apple:", ":slot_machine:", ":Strawberry:", ":cherries:"]; 2 | const Discord = require('discord.js'); 3 | 4 | module.exports = { 5 | help: { 6 | name: "slots", 7 | description: "Play slots!", 8 | aliases: ["sl"], 9 | category: "Economy" 10 | }, 11 | 12 | run: async (client, message, args) => { 13 | 14 | let user = message.author; 15 | 16 | let moneydb = await client.db.fetch(`money_${message.guild.id}_${user.id}.pocket`) 17 | 18 | let money = parseInt(args[0]); 19 | 20 | let win = false; 21 | 22 | let moneymore = new Discord.MessageEmbed() 23 | .setColor("#FFFFFF") 24 | .setDescription(` You are betting more than you have`); 25 | 26 | let moneyhelp = new Discord.MessageEmbed() 27 | .setColor("#FFFFFF") 28 | .setDescription(` Specify an amount`); 29 | 30 | if (!money) return message.channel.send(moneyhelp); 31 | if (money > moneydb) return message.channel.send(moneymore); 32 | 33 | let number = [] 34 | for (i = 0; i < 3; i++) { number[i] = Math.floor(Math.random() * slotItems.length); } 35 | 36 | if (number[0] == number[1] && number[1] == number[2]) { 37 | money *= 9 38 | win = true; 39 | } else if (number[0] == number[1] || number[0] == number[2] || number[1] == number[2]) { 40 | money *= 2 41 | win = true; 42 | } 43 | if (win) { 44 | let slotsEmbed1 = new Discord.MessageEmbed() 45 | .setDescription(`${slotItems[number[0]]} | ${slotItems[number[1]]} | ${slotItems[number[2]]}\n\nYou won ${money} coins`) 46 | .setColor("#FFFFFF") 47 | message.channel.send(slotsEmbed1) 48 | await client.db.add(`money_${message.guild.id}_${user.id}.pocket`, money) 49 | } else { 50 | let slotsEmbed = new Discord.MessageEmbed() 51 | .setDescription(`${slotItems[number[0]]} | ${slotItems[number[1]]} | ${slotItems[number[2]]}\n\nYou lost ${money} coins`) 52 | .setColor("#FFFFFF") 53 | message.channel.send(slotsEmbed) 54 | await client.db.subtract(`money_${message.guild.id}_${user.id}.pocket`, money) 55 | } 56 | 57 | } 58 | } -------------------------------------------------------------------------------- /Commands/Economy/store.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js') 2 | 3 | module.exports = { 4 | help: { 5 | name: "store", 6 | description: "Check the store!", 7 | category: "Economy" 8 | }, 9 | 10 | run: async (client, message, args) => { 11 | 12 | let embed = new Discord.MessageEmbed() 13 | .setDescription( 14 | "**VIP Ranks**\n\n\ 15 | Bronze: 3500 Coins [,buy bronze]\n\n\ 16 | **Lifestyle Items**\n\n\ 17 | Fresh Nikes: 600 [,buy nikes]\n\ 18 | Car: 800 [,buy car]\n\ 19 | Mansion: 1200 [,buy mansion]\n\n\ 20 | **Useful items**\n\ 21 | Fishing Rod: 50 [,buy fishing]") 22 | .setColor("#FFFFFF") 23 | message.channel.send(embed) 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /Commands/Economy/weekly.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const ms = require("parse-ms"); 3 | 4 | module.exports = { 5 | help: { 6 | name: "weekly", 7 | description: "Get your weekly money!", 8 | category: "Economy" 9 | }, 10 | 11 | run: async (client, message, args) => { 12 | 13 | let user = message.author; 14 | let timeout = 604800000; 15 | let am = 500; 16 | let multiplier = await client.db.fetch(`multiplier_${message.guild.id}`); 17 | if(!multiplier) multiplier = 1; 18 | let amount = 500 * multiplier; 19 | 20 | let weekly = await client.db.fetch(`weekly_${message.guild.id}_${user.id}`); 21 | 22 | if (weekly !== null && timeout - (Date.now() - weekly) > 0) { 23 | let time = ms(timeout - (Date.now() - weekly)); 24 | 25 | let timeEmbed = new Discord.MessageEmbed() 26 | .setColor("#FFFFFF") 27 | .setDescription(` You have already collected your weekly reward\n\nCollect it again in ${time.days}d ${time.hours}h ${time.minutes}m ${time.seconds}s `); 28 | message.channel.send(timeEmbed) 29 | } else { 30 | let moneyEmbed = new Discord.MessageEmbed() 31 | .setColor("#FFFFFF") 32 | .setDescription(` You've collected your weekly reward of ${amount} coins`); 33 | message.channel.send(moneyEmbed); 34 | 35 | await client.db.add(`money_${message.guild.id}_${user.id}.pocket`, amount); 36 | await client.db.set(`weekly_${message.guild.id}_${user.id}`, Date.now()); 37 | 38 | 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Commands/Economy/withdraw.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const ms = require("parse-ms"); 3 | 4 | module.exports = { 5 | help: { 6 | name: "withdraw", 7 | description: "Withdraw your money from the bank!", 8 | category: "Economy", 9 | aliases: ["with"] 10 | }, 11 | 12 | run: async (client, message, args) => { 13 | 14 | let user = message.author; 15 | 16 | let member = await client.db.fetch(`money_${message.guild.id}_${user.id}.pocket`) 17 | 18 | let member2 = await client.db.fetch(`money_${message.guild.id}_${user.id}.bank`) 19 | 20 | if (args[0] == 'all') { 21 | let money = await client.db.fetch(`money_${message.guild.id}_${user.id}.bank`) 22 | 23 | await client.db.subtract(`money_${message.guild.id}_${user.id}.bank`, money) 24 | await client.db.add(`money_${message.guild.id}_${user.id}.pocket`, money) 25 | 26 | let embed5 = new Discord.MessageEmbed() 27 | .setColor("#FFFFFF") 28 | .setDescription(` You have withdrawn ${args[0]} your coins from your bank`); 29 | message.channel.send(embed5) 30 | 31 | } else { 32 | 33 | let embed2 = new Discord.MessageEmbed() 34 | .setColor("#FFFFFF") 35 | .setDescription(` Specify an amount to withdraw`); 36 | 37 | if (!args[0]) { 38 | return message.channel.send(embed2) 39 | } 40 | let embed3 = new Discord.MessageEmbed() 41 | .setColor("#FFFFFF") 42 | .setDescription(` You can't withdraw negative money`); 43 | 44 | if (message.content.includes('-')) { 45 | return message.channel.send(embed3) 46 | } 47 | let embed4 = new Discord.MessageEmbed() 48 | .setColor("#FFFFFF") 49 | .setDescription(` You don't have that much money in the bank`); 50 | 51 | if (member2 < args[0]) { 52 | return message.channel.send(embed4) 53 | } 54 | 55 | let embed5 = new Discord.MessageEmbed() 56 | .setColor("#FFFFFF") 57 | .setDescription(` You have withdrawn ${args[0]} coins from your bank`); 58 | 59 | message.channel.send(embed5) 60 | await client.db.subtract(`money_${message.guild.id}_${user.id}.bank`, parseInt(args[0])) 61 | await client.db.add(`money_${message.guild.id}_${user.id}.pocket`, parseInt(args[0])) 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Commands/Economy/work.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | const ms = require("parse-ms"); 3 | 4 | module.exports = { 5 | help: { 6 | name: "work", 7 | description: "Work to get some money!", 8 | category: "Economy" 9 | }, 10 | 11 | run: async (client, message, args) => { 12 | 13 | let user = message.author; 14 | 15 | let author = await client.db.fetch(`work_${message.guild.id}_${user.id}`) 16 | 17 | let timeout = 300000; 18 | 19 | if (author !== null && timeout - (Date.now() - author) > 0) { 20 | let time = ms(timeout - (Date.now() - author)); 21 | 22 | let timeEmbed = new Discord.MessageEmbed() 23 | .setColor("#FFFFFF") 24 | .setDescription(` You have already worked recently\n\nTry again in ${time.minutes}m ${time.seconds}s `); 25 | message.channel.send(timeEmbed) 26 | } else { 27 | 28 | let replies = ['Programmer','Builder','Waiter','Busboy','Chief','Mechanic'] 29 | 30 | let result = Math.floor((Math.random() * replies.length)); 31 | let amounta = Math.floor(Math.random() * 80) + 1; 32 | let multiplier = await client.db.fetch(`multiplier_${message.guild.id}`); 33 | if(!multiplier) multiplier = 1; 34 | let amount = amounta * multiplier; 35 | 36 | let embed1 = new Discord.MessageEmbed() 37 | .setColor("#FFFFFF") 38 | .setDescription(` You worked as a ${replies[result]} and earned ${amount} coins`); 39 | message.channel.send(embed1) 40 | 41 | await client.db.add(`money_${message.guild.id}_${user.id}.pocket`, amount) 42 | await client.db.set(`work_${message.guild.id}_${user.id}`, Date.now()) 43 | }; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Commands/Owner/botavatar.js: -------------------------------------------------------------------------------- 1 | const discord = require("discord.js"); 2 | const config = require("../../Configuration/config.json"); 3 | 4 | module.exports = { 5 | help: { 6 | name:"botavatar", 7 | description: "Set's the client's avatar", 8 | aliases: ["ba", "clientavatar", "ca"], 9 | ownerOnly: true, 10 | category: "Owner" 11 | }, 12 | 13 | run: async(client, message, args) => { 14 | 15 | const clientavatar = args[0]; 16 | 17 | var request = require("request").defaults({ "encoding" : null }); 18 | 19 | request(clientavatar, function (err, res, body) { 20 | 21 | if (!err && res.statusCode === 200) { 22 | 23 | var data = "data:" + res.headers["content-type"] + ";base64," + new Buffer(body).toString("base64"); 24 | 25 | client.user.setAvatar(clientavatar) 26 | 27 | .catch((error) => { 28 | 29 | message.channel.send('BSomething went wrong. Check the console to see the error.'); 30 | 31 | console.log('Error on botavatar command:', error); }); 32 | 33 | message.channel.send('Done.'); 34 | }}) 35 | } 36 | } -------------------------------------------------------------------------------- /Commands/Owner/botnick.js: -------------------------------------------------------------------------------- 1 | const discord = require("discord.js"); 2 | const config = require("../../Configuration/config.json"); 3 | 4 | module.exports = { 5 | help: { 6 | name:"botnick", 7 | description: "Set's the client's nickname", 8 | aliases: ["bn", "clientnick", "cn"], 9 | ownerOnly: true, 10 | category: "Owner" 11 | }, 12 | 13 | run: async(client, message, args) => { 14 | 15 | const clientnickname = args.join(" "); 16 | 17 | message.guild.members.cache.get(client.user.id) 18 | .setNickname(clientnickname); 19 | 20 | message.channel.send('Done.'); 21 | 22 | } 23 | } -------------------------------------------------------------------------------- /Commands/Owner/eval.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | 3 | module.exports = { 4 | help: { 5 | name:"eval", 6 | description: "Evaluate some code", 7 | aliases: ["ev"], 8 | ownerOnly: true, 9 | category: "Owner" 10 | }, 11 | 12 | run: async(client, message, args) => { 13 | 14 | const code = args.join(" "); 15 | 16 | 17 | const no = new Discord.MessageEmbed() 18 | .setImage(`https://media.giphy.com/media/nR4L10XlJcSeQ/giphy.gif`) 19 | .setColor(0xffa500); 20 | 21 | 22 | if(message.content.includes(client.token || config.token || child.process || config)) { 23 | message.channel.send(no); 24 | } 25 | 26 | if(code.length === 0) { 27 | return message.channel.send("**Gimme something to work with!**"); 28 | } 29 | try { 30 | 31 | let evaled = eval(code); 32 | if (typeof evaled !== "string") 33 | evaled = require("util").inspect(evaled); 34 | message.channel.send(evaled, { split: true, code: true }); 35 | 36 | } catch (err) { 37 | message.channel.send(err, { split: true, code: true }); 38 | 39 | } 40 | }}; -------------------------------------------------------------------------------- /Commands/Owner/exec.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const config = require("../../Configuration/config.json"); 3 | 4 | module.exports = { 5 | help: { 6 | name:"exec", 7 | description: "Eexecute something in the powershell window", 8 | aliases: ["execute"], 9 | ownerOnly: true, 10 | category: "Owner" 11 | }, 12 | 13 | run: async(client, message, args) => { 14 | 15 | var exec = require("child_process").exec; 16 | 17 | (function () { 18 | var code = args.join(" "); 19 | var t0 = Date.now(); 20 | exec(code, (error, stdout, stderr) => { 21 | var t1 = Date.now(); 22 | if (!error) { 23 | if (stdout) { 24 | if (stdout.length > 1300) { 25 | stdout = stdout.substr(stdout.length - 1299, stdout.length) 26 | } 27 | } 28 | 29 | var cleanedContent = clean(stdout); 30 | var timeExec = (t1 - t0); 31 | 32 | const embed1 = new Discord.MessageEmbed() 33 | .setColor(0x00FF00) 34 | .setAuthor(message.author.username, message.author.avatarURL()) 35 | .addField(" :inbox_tray: Input: ", "```js\n" + code + "```", false) 36 | .addField(" :outbox_tray: Output: ", "```xl\n" + cleanedContent + "```", false) 37 | .setFooter(`Success | In ${timeExec} Miliseconds.`, client.user.avatarURL()); 38 | 39 | message.channel.send(embed1); 40 | 41 | } else { 42 | 43 | var cleanedContent = clean(error); 44 | let timeExec = (t1 - t0); 45 | 46 | const embed2 = new Discord.MessageEmbed() 47 | .setColor(0xff0000) 48 | .setAuthor(message.author.username, message.author.avatarURL()) 49 | .addField(" :inbox_tray: Input: ", "```js\n" + code + "```", false) 50 | .addField(" :outbox_tray: Output: ", "```xl\n" + cleanedContent + "```", false) 51 | .setFooter(`Error | In ${timeExec} Miliseconds.`, client.user.avatarURL()); 52 | 53 | message.channel.send(embed2); 54 | console.error(stderr); 55 | } 56 | }); 57 | })(); 58 | return; 59 | } 60 | }; 61 | 62 | 63 | function clean(text) { 64 | if (typeof(text) === "string") { 65 | return text.replace(/``/g, "`" + String.fromCharCode(8203) + "`").replace(/@/g, "@" + String.fromCharCode(8203)); 66 | } else if (text !== null && text !== undefined) { 67 | return text.toString().replace(/``/g, "`" + String.fromCharCode(8203) + "`").replace(/@/g, "@" + String.fromCharCode(8203)) 68 | } else { 69 | return text; 70 | } 71 | } -------------------------------------------------------------------------------- /Commands/Owner/reload.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"), 2 | { readdirSync } = require("fs"), 3 | { join } = require("path"), 4 | { creatorID } = require("../../Configuration/config.json"); 5 | 6 | module.exports = { 7 | help: { 8 | name: "reload", 9 | description: "Reload's a command", 10 | aliases: ["r"], 11 | ownerOnly: true, 12 | category: "Owner" 13 | }, 14 | 15 | run: async (client, message, args) => { 16 | 17 | if (!args[0]) return message.channel.send("Please provide a command to reload!"); 18 | 19 | const commandName = args[0].toLowerCase(); 20 | 21 | const command = client.commands.get(commandName) 22 | || client.commands.find(cmd => cmd.help.aliases && cmd.help.aliases.includes(commandName)); 23 | 24 | if (!command) return message.channel.send("That command doesn't exist. Try again."); 25 | 26 | readdirSync(join(__dirname, "..")).forEach(f => { 27 | const files = readdirSync(join(__dirname, "..", f)); 28 | if (files.includes(`${commandName}.js`)) { 29 | const file = `../${f}/${commandName}.js`; 30 | try { 31 | delete require.cache[require.resolve(file)]; 32 | client.commands.delete(commandName); 33 | const pull = require(file); 34 | client.commands.set(commandName, pull); 35 | return message.channel.send(`Successfully reloaded \`${commandName}.js\` !`); 36 | } 37 | catch (err) { 38 | message.channel.send(`Could not reload: \`${args[0].toUpperCase()}\` `); 39 | return console.log(err.stack || err); 40 | } 41 | } 42 | }); 43 | }}; -------------------------------------------------------------------------------- /Commands/Utility/help.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | const config = require("../../Configuration/config.json"); 3 | 4 | module.exports = { 5 | help: { 6 | name: "help", 7 | description: "The basic Help command", 8 | aliases: ["commands", "halp"], 9 | usage: "(command)", 10 | category: "Utility" 11 | }, 12 | 13 | /** 14 | * Big thanks to Androz2091 for his beutiful help command, i couldn't get it to work... 15 | * but Androz's help command is just, perfect, be sure to check him out at 16 | * @link https://github.com/Androz2091 17 | */ 18 | 19 | run: async(client, message, args) => { 20 | 21 | const data = []; 22 | const commands = client.commands; 23 | 24 | const categories = []; 25 | 26 | if(!args[0]) { 27 | 28 | commands.forEach((command) => { 29 | if(!categories.includes(command.help.category)){ 30 | 31 | if(command.help.category === "Owner" && message.author.id !== config.creatorID) { 32 | return; 33 | } 34 | categories.push(command.help.category); 35 | } 36 | }); 37 | 38 | const embed = new Discord.MessageEmbed() 39 | .setColor("RANDOM") 40 | .setFooter(`To get help on a specific command type "!help " !`, client.user.avatarURL()); 41 | 42 | categories.sort().forEach((cat) => { 43 | 44 | const tCommands = commands.filter((cmd) => cmd.help.category === cat); 45 | 46 | embed.addField(`${cat} - (${tCommands.size})`, tCommands.map((cmd) => ` \`${cmd.help.name}\` `).join(" | ")); 47 | 48 | }); 49 | 50 | embed.setAuthor(message.author.username, message.author.displayAvatarURL()); 51 | 52 | message.channel.send(embed); 53 | 54 | } else { 55 | 56 | const name = args[0].toLowerCase(); 57 | 58 | const command = client.commands.get(name) || client.commands.find(c => c.aliases && c.aliases.includes(name)); 59 | 60 | if (!command) { 61 | return message.reply("that's not a valid command!"); 62 | } 63 | 64 | const embedcommandinfo = new Discord.MessageEmbed(); 65 | 66 | embedcommandinfo.setTitle(`**Name:** ${command.help.name}`) 67 | .setColor("BLUE") 68 | .setDescription(`**Description:**\n${command.help.description}`) 69 | .addField(`**Category:**`, `${command.help.category}`, true); 70 | 71 | if (command.help.aliases) embedcommandinfo.addField(`**Aliases:**`, ` \`${command.help.aliases.join(', ') || "None"}\` `, true); 72 | if (command.help.usage) embedcommandinfo.addField(`**Usage:**`, `!${command.help.name} ${command.help.usage}`).setFooter(`"<>" is required, while "()" is optional`); 73 | 74 | message.channel.send(embedcommandinfo); 75 | } 76 | } 77 | }; -------------------------------------------------------------------------------- /Commands/Utility/leaderboard.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | const { ReactionCollector } = require('discord.js-collector'); 3 | 4 | module.exports = { 5 | help: { 6 | name:"leaderboard", 7 | description: "Get the leaderboard!", 8 | aliases: ["lb"], 9 | category: "Utility" 10 | }, 11 | 12 | run: async (client, message, args) => { 13 | 14 | 15 | let money = await client.db.startsWith(`money_${message.guild.id}`, { sort: '.data'}); 16 | let contentm = ""; 17 | 18 | for (let i = 0; i < money.length; i++) { 19 | let user = client.users.cache.get(money[i].ID.split('_')[2]) || "Unregistered user"; 20 | contentm += `${i+1}. ${user} ~ ${money[i].data.pocket}\n` 21 | } 22 | 23 | let bank = await client.db.startsWith(`money_${message.guild.id}`, { sort: '.data'}); 24 | let contentb = ""; 25 | 26 | for (let i = 0; i < bank.length; i++) { 27 | let user = client.users.cache.get(bank[i].ID.split('_')[2]) || "Unregistered user"; 28 | contentb += `${i+1}. ${user} ~ ${money[i].data.bank}\n` 29 | } 30 | 31 | let nike = await client.db.startsWith(`nikes_${message.guild.id}`, { sort: '.data'}); 32 | let contentn = ""; 33 | 34 | for (let i = 0; i < nike.length; i++) { 35 | let user = client.users.cache.get(nike[i].ID.split('_')[2]) || "Unregistered user"; 36 | contentn += `${i+1}. ${user} ~ ${nike[i].data}\n` 37 | } 38 | 39 | let car = await client.db.startsWith(`car_${message.guild.id}`, { sort: '.data'}); 40 | let contentc = ""; 41 | 42 | for (let i = 0; i < car.length; i++) { 43 | let user = client.users.cache.get(car[i].ID.split('_')[2]) || "Unregistered user"; 44 | contentm += `${i+1}. ${user} ~ ${car[i].data}\n` 45 | } 46 | 47 | let house = await client.db.startsWith(`house_${message.guild.id}`, { sort: '.data'}); 48 | let contentma = ""; 49 | 50 | for (let i = 0; i < house.length; i++) { 51 | let user = client.users.cache.get(house[i].ID.split('_')[2]) || "Unregistered user"; 52 | contentma += `${i+1}. ${user} ~ ${house[i].data}\n` 53 | } 54 | 55 | 56 | const pages = { 57 | "741742588998058074": { 58 | id: 'money', 59 | clearReactions: true, 60 | content: '', 61 | embed: { 62 | description: `**${message.guild.name}'s Coin Leaderboard**\n\n${contentm}` 63 | }, 64 | onMessage: (controller, message) => { 65 | controller.stop(); 66 | } 67 | }, 68 | 69 | '🏧': { 70 | id: 'bank', 71 | clearReactions: true, 72 | content: '', 73 | embed: { 74 | description: `**${message.guild.name}'s Bank Leaderboard**\n\n${contentb}` 75 | }, 76 | onMessage: (controller, message) => { 77 | controller.stop(); 78 | } 79 | }, 80 | 81 | '👟': { 82 | id: 'nike', 83 | clearReactions: true, 84 | content: '', 85 | embed: { 86 | description: `**${message.guild.name}'s Nike Leaderboard**\n\n${contentn}` 87 | }, 88 | onMessage: (controller, message) => { 89 | controller.stop(); 90 | } 91 | }, 92 | 93 | '🚙': { 94 | id: 'car', 95 | clearReactions: true, 96 | content: '', 97 | embed: { 98 | description: `**${message.guild.name}'s Car Leaderboard**\n\n${contentc}` 99 | }, 100 | onMessage: (controller, message) => { 101 | controller.stop(); 102 | } 103 | }, 104 | 105 | '🏠': { 106 | id: 'mansion', 107 | clearReactions: true, 108 | content: '', 109 | embed: { 110 | description: `**${message.guild.name}'s Mansion Leaderboard**\n\n${contentma}` 111 | }, 112 | onMessage: (controller, message) => { 113 | controller.stop(); 114 | } 115 | } 116 | 117 | }; 118 | 119 | const botMessage = await message.reply( 120 | `React with ${client.emojis.money} to see the coins leaderboard. 121 | React with 👟 to see nikes leaderboard. 122 | React with 🚙 to see car leaderboard. 123 | React with 🏠 mansion to see mansion leaderboard` 124 | ); 125 | 126 | ReactionCollector.menu({ botMessage, user: message.author, pages }); 127 | 128 | // const embed = new Discord.MessageEmbed() 129 | // .setDescription(`**Input a Leaderboard Option**\n\n 130 | // Coin Leaderboard: ,leaderboard coins\n 131 | // Bank Leaderboard: 132 | // Fresh Nikes Leaderboard: ,leaderboard nikes\n 133 | // Car Leaderboard: ,leaderboard car\n 134 | // Mansion Leaderboard: ,leaderboard mansion 135 | // `) 136 | // .setColor("#FFFFFF") 137 | 138 | // if(!args[0]) return message.channel.send(embed); 139 | 140 | // switch(args[0]) { 141 | 142 | // case "coins": 143 | // case "money": 144 | // let money = await client.db.startsWith(`money_${message.guild.id}`, { sort: '.data'}); 145 | // let content = ""; 146 | 147 | // for (let i = 0; i < money.length; i++) { 148 | // let user = client.users.cache.get(money[i].ID.split('_')[2]) || "Unregistered user"; 149 | 150 | // content += `${i+1}. ${user} ~ ${money[i].data}\n` 151 | 152 | // } 153 | 154 | // const embed = new Discord.MessageEmbed() 155 | // .setDescription(`**${message.guild.name}'s Coin Leaderboard**\n\n${content}`) 156 | // .setColor("#FFFFFF") 157 | 158 | // message.channel.send(embed); 159 | 160 | // case "bank": 161 | // let bank = await client.db.startsWith(`bank_${message.guild.id}`, { sort: '.data'}); 162 | // let content = ""; 163 | 164 | // for (let i = 0; i < bank.length; i++) { 165 | // let user = client.users.cache.get(bank[i].ID.split('_')[2]) || "Unregistered user"; 166 | 167 | // content += `${i+1}. ${user} ~ ${bank[i].data}\n` 168 | 169 | // } 170 | 171 | // const embed = new Discord.MessageEmbed() 172 | // .setDescription(`**${message.guild.name}'s Coin Leaderboard**\n\n${content}`) 173 | // .setColor("#FFFFFF"); 174 | 175 | // message.channel.send(embed); 176 | 177 | // case "nikes": 178 | // let nike = await client.db.startsWith(`nikes_${message.guild.id}`, { sort: '.data'}) 179 | // let content = ""; 180 | 181 | // for (let i = 0; i < nike.length; i++) { 182 | // let user = client.users.cache.get(nike[i].ID.split('_')[2]) || "Unregistered user"; 183 | 184 | // content += `${i+1}. ${user} ~ ${nike[i].data}\n` 185 | // } 186 | 187 | // const embed = new Discord.MessageEmbed() 188 | // .setDescription(`**${message.guild.name}'s Fresh Nikes Leaderboard**\n\n${content}`) 189 | // .setColor("#FFFFFF") 190 | 191 | // message.channel.send(embed); 192 | 193 | // case "car": 194 | // let cars = await client.db.startsWith(`car_${message.guild.id}`, { sort: '.data'}) 195 | // let content = ""; 196 | 197 | // for (let i = 0; i < cars.length; i++) { 198 | // let user = client.users.cache.get(cars[i].ID.split('_')[2]) || "Unregistered user"; 199 | 200 | // content += `${i+1}. ${user} ~ ${cars[i].data}\n` 201 | // } 202 | 203 | // const embed = new Discord.MessageEmbed() 204 | // .setDescription(`**${message.guild.name}'s Car Leaderboard**\n\n${content}`) 205 | // .setColor("#FFFFFF") 206 | 207 | // message.channel.send(embed); 208 | 209 | // case "mansion": 210 | // let mansions = await client.db.startsWith(`house_${message.guild.id}`, { sort: '.data'}) 211 | // let content = ""; 212 | 213 | // for (let i = 0; i < mansions.length; i++) { 214 | // let user = client.users.cache.get(mansions[i].ID.split('_')[2]) || "Unregistered user"; 215 | 216 | // content += `${i+1}. ${user} ~ ${mansions[i].data}\n` 217 | // } 218 | 219 | // const embed = new Discord.MessageEmbed() 220 | // .setDescription(`**${message.guild.name}'s Mansion Leaderboard**\n\n${content}`) 221 | // .setColor("#FFFFFF") 222 | 223 | // message.channel.send(embed); 224 | 225 | // } 226 | } 227 | } -------------------------------------------------------------------------------- /Configuration/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "Alpha 1.7", 3 | "branch": "master", 4 | "prefix": "!", 5 | "creatorID": "" 6 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 SpaghettDee 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Economy Bot 2 | 3 | [![GitHub contributors](https://img.shields.io/github/contributors/TheGamer456YT/Economy-Bot.svg?style=flat-square)](https://github.com/TheGamer456YT/Economy-Bot/graphs/contributors) 4 | [![GitHub license](https://img.shields.io/github/license/TheGamer456YT/Economy-Bot.svg?style=flat-square)](https://github.com/TheGamer456YT/Economy-Bot/blob/master/LICENSE) 5 | 6 | 7 | 8 | 9 | 10 | ## Getting Started 11 | 12 | These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system. 13 | 14 | ## Installation 15 | 16 | You can install this project by clicking [here](https://github.com/TheGamer456YT/Economy-Bot/archive/main.zip), or by installing the [release](https://github.com/TheGamer456YT/Economy-Bot/releases/tag/0.0.1), or by running this git command in your command prompt: 17 | ```shell 18 | git clone https://github.com/TheGamer456YT/Economy-Bot 19 | ``` 20 | 21 | ### Prerequisites 22 | 23 | What things you need to install the software and how to install them: 24 | 25 | Firstly, install all the needed modules, for that, you will need to install [node.js](https://nodejs.org/en/download/) and to do that fllow [this tutorial](https://treehouse.github.io/installation-guides/windows/node-windows.html) 26 | 27 | ``` 28 | npm install 29 | ``` 30 | 31 | ### Installing 32 | 33 | 1. Firstly, You will have to edit the [config.json](https://github.com/TheGamer456YT/Economy-Bot/blob/main/Configuration/config.json); After that, you will have to create/edit the .env file by adding your token, here's a example of what it will be: 34 | ```env 35 | TOKEN=your token 36 | ``` 37 | 38 | 2. If you want a tutorial on how to make a bot account and the basic's of how to make a discord bot, I recommend following [this tutorial](https://github.com/dylanwe/How-to-make-a-discord-bot) 39 | 40 | ## Usage 41 | 42 | If you would like to use this bot, personally or commercially, please give me ([SpaghettDev](https://github.com/TheGamer456YT)) credit. 43 | 44 | ## Built With 45 | 46 | * [Discord.js](https://discord.js.org/#/docs/main/12.2.0/general/welcome) - The library used 47 | * [Node.js](https://www.nodejs.org) - The Runtime 48 | 49 | ## Contributing 50 | 51 | Any pull request's are welcome! 52 | 53 | ## Issues 54 | 55 | If you have any issue, please don't hesitate to make a [issue](https://github.com/TheGamer456YT/Economy-Bot/issues/new), I will gladly take a look at it and try to fix it! 56 | 57 | ## Authors 58 | 59 | * **TheGamerYT** - *Initial work & all the project* - [SpaghettDev](https://github.com/TheGamer456YT) 60 | 61 | ## License 62 | 63 | This project is licensed under the MIT License - see the [LICENSE](https://github.com/TheGamer456YT/Economy-Bot/blob/main/LICENSE) file for details 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /events/client/disconnect.js: -------------------------------------------------------------------------------- 1 | module.exports = async(client) => console.log("Bot is disconnecting..."); -------------------------------------------------------------------------------- /events/client/error.js: -------------------------------------------------------------------------------- 1 | module.exports = async(client, error) => console.log(error); -------------------------------------------------------------------------------- /events/client/message.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"), 2 | db = require("discord.js"), 3 | chalk = require("chalk"), 4 | config = require(`${process.cwd()}/Configuration/config.json`); 5 | 6 | module.exports = async(client, message) => { 7 | 8 | 9 | //---------------------------------------------------------------------------------- 10 | //| Start of XP area | 11 | //---------------------------------------------------------------------------------- 12 | /* 13 | 14 | xp(message); 15 | 16 | function xp(message) { 17 | if (!message.guild || message.author.bot) return; 18 | 19 | if (!client.cooldown.has(`${message.author.id}`) || !(Date.now() - client.cooldown.get(`${message.author.id}`) > client.config.cooldown)) { 20 | let xp = db.add(`xp_${message.author.id}`, 1); 21 | 22 | let level = Math.floor(0.3 * Math.sqrt(xp)); 23 | 24 | let lvl = db.get(`level_${message.author.id}`) || db.set(`level_${message.author.id}`, 1); 25 | 26 | if (level > lvl) { 27 | let newLevel = db.set(`level_${message.author.id}`, level); 28 | 29 | message.channel.send(`:tada: ${message.author.toString()}, You just advanced to level ${newLevel}!`) 30 | .then(m => m.delete({ timeout: 5000 })); 31 | } 32 | 33 | client.cooldown.set(`${message.author.id}`, Date.now()); 34 | 35 | } 36 | } 37 | */ 38 | //---------------------------------------------------------------------------------- 39 | //| Player Events | 40 | //---------------------------------------------------------------------------------- 41 | const escapeRegex = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); 42 | 43 | const prefixRegex = new RegExp(`^(<@!?${client.user.id}>|${escapeRegex(",")})\\s*`); 44 | if (!prefixRegex.test(message.content)) return; 45 | if (!message.guild || message.author.bot) return; 46 | 47 | const [, matchedPrefix] = message.content.match(prefixRegex); 48 | 49 | const args = message.content.slice(matchedPrefix.length).trim().split(/ +/); 50 | 51 | const commandName = args.shift().toLowerCase(); 52 | 53 | const command = client.commands.get(commandName) 54 | || client.commands.find(cmd => cmd.help.aliases && cmd.help.aliases.includes(commandName)); 55 | 56 | if(!command) return; 57 | 58 | 59 | if(command) { 60 | 61 | try { 62 | 63 | if(command.help.ownerOnly && message.author.id !== config.creatorID) { 64 | 65 | const noPerms = new Discord.MessageEmbed() 66 | .setAuthor(client.user.username, client.user.avatarURL()) 67 | .setDescription(`:no_entry_sign: ${message.author.username}, you don't have the permission to run this command`) 68 | .setColor(0xff0000) 69 | .setFooter(`Contact a developer if you believe this isn't right`); 70 | 71 | message.reply(noPerms); 72 | return console.log(chalk.greenBright(command.help.name+".js")+chalk.reset(" : ")+chalk.yellowBright(message.author.tag)+chalk.reset(` has tried to execute the command ${chalk.cyanBright(command.help.name)} on the guild ${chalk.magenta(message.guild.name)}.`)); 73 | } 74 | 75 | command.run(client, message, args); 76 | 77 | } catch (err) { 78 | 79 | console.error(err); 80 | message.reply("Error Code 500, Status Code 021. Please Contact A Developer For Help!"); 81 | 82 | } finally { 83 | 84 | console.log(chalk.white(`[command-execute] The command: `)+chalk.red(`${commandName}`)+chalk.white(` has been executed by: `)+chalk.blue(`${message.author.tag} (${message.author.id})`)+chalk.white(` in `)+chalk.green(`${message.guild.name}.`)); 85 | 86 | } 87 | }; 88 | 89 | 90 | 91 | } -------------------------------------------------------------------------------- /events/client/ready.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"), 2 | config = require(`${process.cwd()}/Configuration/config.json`); 3 | 4 | module.exports = async(client, args) => { 5 | 6 | console.log(`[INFO] Started the best Discord bot! Running...`); 7 | console.log( 8 | `[INFO] Connected to Discord as: ${client.user.tag} with the id: ${client.user.id}! 9 | Prefix: ${config.prefix}, 10 | branch: ${config.branch}, 11 | version: ${config.version} 12 | `); 13 | 14 | const mabe = [ 15 | `${config.prefix}help | ${client.user.username} Version: ${config.version}`, 16 | `your commands! | ${client.user.username} Version: ${config.version}` 17 | ]; 18 | 19 | setInterval(function() { 20 | let awnser = mabe[Math.floor(Math.random() * mabe.length)]; 21 | 22 | client.user.setActivity(awnser, { type: "LISTENING" }); 23 | 24 | }, 8000); 25 | 26 | } //jeff was here -------------------------------------------------------------------------------- /events/client/reconnecting.js: -------------------------------------------------------------------------------- 1 | module.exports = async(client) => console.log("Bot reconnecting..."); -------------------------------------------------------------------------------- /events/client/warn.js: -------------------------------------------------------------------------------- 1 | module.exports = async(client, info) => console.log(info); -------------------------------------------------------------------------------- /functions.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | match: function(msg, i) { 3 | if (!msg) return undefined; 4 | if (!i) return undefined; 5 | let user = i.members.cache.find( 6 | m => 7 | m.user.username.toLowerCase().startsWith(msg) || 8 | m.user.username.toLowerCase() === msg || 9 | m.user.username.toLowerCase().includes(msg) || 10 | m.displayName.toLowerCase().startsWith(msg) || 11 | m.displayName.toLowerCase() === msg || 12 | m.displayName.toLowerCase().includes(msg) 13 | ); 14 | if (!user) return undefined; 15 | return user.user; 16 | } 17 | }; -------------------------------------------------------------------------------- /handlers/commandHandler.js: -------------------------------------------------------------------------------- 1 | const chalk = require("chalk"), 2 | fs = require("fs"); 3 | 4 | module.exports = async(client) => { 5 | 6 | 7 | fs.readdirSync(`${process.cwd()}/Commands/`).forEach(dir => { 8 | 9 | fs.readdir(`${process.cwd()}/Commands/${dir}/`, (err, files) => { 10 | 11 | if (err) throw new Error(err); 12 | 13 | console.log(chalk.green(`\n\n[Directory-loading-logs] Loading ${files.length} commands of module ${dir} :\n\n`)); 14 | 15 | files.forEach(file => { 16 | 17 | const props = require(`${process.cwd()}/Commands/${dir}/${file}`); 18 | 19 | client.commands.set(props.help.name, props); 20 | 21 | console.log(chalk.white('[Command-loading-logs] Loaded command : ')+chalk.red(`${file}`)); 22 | 23 | }); 24 | }); 25 | }); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /handlers/economybot.js: -------------------------------------------------------------------------------- 1 | require("moment-duration-format"); 2 | 3 | const { Client } = require("discord.js"); 4 | 5 | class economybot extends Client { 6 | /** 7 | * @constructor 8 | * @param {options} options options 9 | */ 10 | constructor (options) { 11 | super(options); 12 | this.commands = new Discord.Collection(); 13 | this.aliases = new Discord.Collection(); 14 | this.cooldown = new Discord.Collection(); 15 | this.events = new Discord.Collection(); 16 | } 17 | 18 | 19 | /** 20 | *diagramMaker 21 | *@param {Number} number number 22 | */ 23 | bar(used, free) { 24 | const full = '▰'; 25 | const empty = '▱'; 26 | const total = used + free; 27 | used = Math.round((used / total) * 10); 28 | free = Math.round((free / total) * 10); 29 | return full.repeat(used) + empty.repeat(free); 30 | }; 31 | 32 | } 33 | 34 | module.exports = economybot; -------------------------------------------------------------------------------- /handlers/eventHandler.js: -------------------------------------------------------------------------------- 1 | const { readdirSync } = require("fs"), 2 | chalk = require("chalk"); 3 | 4 | module.exports = async(client) => { 5 | 6 | const events = readdirSync(`${process.cwd()}/events/client`); 7 | console.log(chalk.green(`\n[Event-loading-logs] Loading ${events.length} Client Events!`)); 8 | 9 | for (let event of events) { 10 | let file = require(`${process.cwd()}/events/client/${event}`); 11 | 12 | console.log(chalk.white('[Event-loading-logs] Successfully Loaded Client Event : ')+chalk.red(`${event}`)); 13 | 14 | client.on(event.split(".")[0], (...args) => file(client, ...args)); 15 | }; 16 | 17 | }; -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config(); 2 | require("moment-duration-format"); 3 | 4 | const economybot = require(`${process.cwd()}/handlers/economybot.js`); 5 | 6 | const db = require("enhanced.db"), 7 | TOKEN = process.env.TOKEN, 8 | client = new economybot(); 9 | 10 | db.options({ 11 | clearOnStart: false, 12 | filename: 'ec.sqlite' 13 | }) 14 | 15 | client.login(TOKEN).catch(console.error); 16 | 17 | 18 | require(`${process.cwd()}/handlers/eventHandler.js`)(client); 19 | require(`${process.cwd()}/handlers/commandHandler.js`)(client); 20 | 21 | client.config = require(`${process.cwd()}/Configuration/config.json`); 22 | client.env = process.env; 23 | client.db = db; 24 | 25 | //process.on("unhandledRejection", (err) => { 26 | // console.error(err); 27 | //}); 28 | 29 | 30 | //-----------------------------------------------------The End----------------------------------------------------- -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Discord.js-Economy-Bot", 3 | "version": "1.7.1", 4 | "description": "A basic discord.js economy bot!", 5 | "main": "index.js", 6 | "dependencies": { 7 | "@discordjs/opus": "^0.3.2", 8 | "canvacord": "^4.0.1", 9 | "canvas": "^2.6.1", 10 | "canvas-constructor": "^3.2.0", 11 | "chalk": "^4.1.0", 12 | "child_process": "^1.0.2", 13 | "common-tags": "^1.8.0", 14 | "discord.js": "^12.3.1", 15 | "discord.js-collector": "^1.4.41", 16 | "discord.js-commando": "^0.10.0", 17 | "dotenv": "^8.2.0", 18 | "enhanced.db": "^0.3.4" 19 | }, 20 | "devDependencies": { 21 | "enhanced.db": "^0.3.4" 22 | }, 23 | "scripts": { 24 | "test": "echo \"Error: no test specified\" && exit 1", 25 | "start": "node index.js" 26 | }, 27 | "author": "SpaghettDev", 28 | "license": "None" 29 | } 30 | --------------------------------------------------------------------------------