├── src ├── assets │ ├── json │ │ ├── looting.json │ │ ├── fishy.json │ │ ├── status.json │ │ ├── nsfwAns.json │ │ ├── cookies.json │ │ └── nobully.json │ └── font │ │ ├── emoji.ttf │ │ ├── Captcha.ttf │ │ ├── Japanese.ttf │ │ ├── Minecraftia.ttf │ │ ├── Noto-Regular.ttf │ │ ├── Roboto-Regular.ttf │ │ ├── NotoEmoji-Regular.ttf │ │ └── Burbank Big Regular Black.ttf ├── database │ ├── afk.json │ ├── rep.json │ ├── xp.json │ ├── badge.json │ ├── balance.json │ ├── fish.json │ ├── logging.json │ ├── logonoff.json │ ├── note.json │ ├── works.json │ ├── background.json │ ├── blacklist.json │ ├── cookieIn.json │ └── cookieOut.json ├── events │ ├── error.js │ ├── warn.js │ ├── disconnect.js │ ├── reconnecting.js │ ├── guildMemberAdd.js │ ├── guildMemberRemove.js │ ├── messageDelete.js │ ├── messageUpdate.js │ ├── ready.js │ ├── channelUpdate.js │ ├── message.js │ └── guildMemberUpdate.js ├── commands │ ├── fun │ │ ├── module.json │ │ ├── roast.js │ │ ├── rem.js │ │ ├── owo.js │ │ ├── meme.js │ │ ├── kemonomimi.js │ │ ├── belikebill.js │ │ ├── neko.js │ │ ├── nekoholo.js │ │ ├── nobully.js │ │ ├── hug.js │ │ ├── 8ball.js │ │ ├── ship.js │ │ └── hangman.js │ ├── nsfw │ │ ├── module.json │ │ ├── gonewild.js │ │ ├── hentai.js │ │ ├── lewdneko.js │ │ ├── hentaianal.js │ │ └── lewdkitsune.js │ ├── admin │ │ ├── module.json │ │ ├── kick.js │ │ ├── unmute.js │ │ ├── purge.js │ │ ├── mute.js │ │ └── logging.js │ ├── economy │ │ ├── module.json │ │ ├── balance.js │ │ ├── setinfo.js │ │ ├── work.js │ │ ├── dailies.js │ │ ├── background.js │ │ ├── transfer.js │ │ ├── rep.js │ │ ├── level.js │ │ ├── fish.js │ │ ├── slots.js │ │ ├── roulette.js │ │ ├── leaderboard.js │ │ ├── gamble.js │ │ ├── profile.js │ │ └── blackjack.js │ ├── process │ │ ├── module.json │ │ ├── reboot.js │ │ ├── blacklist.js │ │ ├── whitelist.js │ │ ├── exec.js │ │ ├── reload.js │ │ ├── debug.js │ │ ├── snekfetch.js │ │ ├── eco.js │ │ ├── hypesquad.js │ │ └── eval.js │ └── utility │ │ ├── module.json │ │ ├── invite.js │ │ ├── afk.js │ │ ├── ping.js │ │ ├── help.js │ │ └── stats.js ├── config.json ├── handle │ ├── events.js │ ├── cooldownAns.json │ ├── AkariClient.js │ ├── module.js │ ├── command.js │ └── util.js ├── app.js └── work.json ├── procfile ├── .replit ├── index.js ├── .gitignore ├── README.md ├── shard.js ├── LICENSE └── package.json /src/assets/json/looting.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /src/database/afk.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } -------------------------------------------------------------------------------- /src/database/rep.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } -------------------------------------------------------------------------------- /src/database/xp.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } -------------------------------------------------------------------------------- /procfile: -------------------------------------------------------------------------------- 1 | worker : node index.js 2 | -------------------------------------------------------------------------------- /src/database/badge.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } -------------------------------------------------------------------------------- /src/database/balance.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } -------------------------------------------------------------------------------- /src/database/fish.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } -------------------------------------------------------------------------------- /src/database/logging.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } -------------------------------------------------------------------------------- /src/database/logonoff.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } -------------------------------------------------------------------------------- /src/database/note.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } -------------------------------------------------------------------------------- /src/database/works.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } -------------------------------------------------------------------------------- /src/database/background.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } -------------------------------------------------------------------------------- /src/database/blacklist.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } -------------------------------------------------------------------------------- /src/database/cookieIn.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } -------------------------------------------------------------------------------- /src/database/cookieOut.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } -------------------------------------------------------------------------------- /.replit: -------------------------------------------------------------------------------- 1 | language = "nodejs" 2 | run = "npm start" -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./src/app'); -------------------------------------------------------------------------------- /src/events/error.js: -------------------------------------------------------------------------------- 1 | module.exports = async (client) => { console.error } -------------------------------------------------------------------------------- /src/events/warn.js: -------------------------------------------------------------------------------- 1 | module.exports = async (client) => { console.warn } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SharifPoetra/tokisaki/HEAD/.gitignore -------------------------------------------------------------------------------- /src/commands/fun/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "🎭 | Fun", 3 | "hide": false 4 | } 5 | -------------------------------------------------------------------------------- /src/commands/nsfw/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "🔞 | Nsfw", 3 | "hide": false 4 | } 5 | -------------------------------------------------------------------------------- /src/commands/admin/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "🔨 | Admin", 3 | "hide": false 4 | } 5 | -------------------------------------------------------------------------------- /src/commands/economy/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "💳 | Economy", 3 | "hide": false 4 | } 5 | -------------------------------------------------------------------------------- /src/commands/process/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "🔐 | Owner Tools", 3 | "hide": true 4 | } 5 | -------------------------------------------------------------------------------- /src/commands/utility/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "⚙️ | Utility", 3 | "hide": false 4 | } 5 | -------------------------------------------------------------------------------- /src/assets/font/emoji.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SharifPoetra/tokisaki/HEAD/src/assets/font/emoji.ttf -------------------------------------------------------------------------------- /src/assets/font/Captcha.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SharifPoetra/tokisaki/HEAD/src/assets/font/Captcha.ttf -------------------------------------------------------------------------------- /src/assets/font/Japanese.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SharifPoetra/tokisaki/HEAD/src/assets/font/Japanese.ttf -------------------------------------------------------------------------------- /src/assets/font/Minecraftia.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SharifPoetra/tokisaki/HEAD/src/assets/font/Minecraftia.ttf -------------------------------------------------------------------------------- /src/assets/font/Noto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SharifPoetra/tokisaki/HEAD/src/assets/font/Noto-Regular.ttf -------------------------------------------------------------------------------- /src/assets/font/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SharifPoetra/tokisaki/HEAD/src/assets/font/Roboto-Regular.ttf -------------------------------------------------------------------------------- /src/assets/font/NotoEmoji-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SharifPoetra/tokisaki/HEAD/src/assets/font/NotoEmoji-Regular.ttf -------------------------------------------------------------------------------- /src/assets/font/Burbank Big Regular Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SharifPoetra/tokisaki/HEAD/src/assets/font/Burbank Big Regular Black.ttf -------------------------------------------------------------------------------- /src/events/disconnect.js: -------------------------------------------------------------------------------- 1 | module.exports = async (client) => { 2 | console.log('I\'m just disconnect making sure you know i\'ll reconnecting now'); 3 | } -------------------------------------------------------------------------------- /src/events/reconnecting.js: -------------------------------------------------------------------------------- 1 | module.exports = async (client) => { 2 | console.log('==========\nSucces Reconnecting And Ready To Goo\n=========='); 3 | } -------------------------------------------------------------------------------- /src/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "bot_prefix": "t.", 3 | "embed_color": "RANDOM", 4 | "owners_id": ["444454206800396309", "337028800929857536", "316063819824627712", "475230849239875584"], 5 | "env": { 6 | "TOKEN": "" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/events/guildMemberAdd.js: -------------------------------------------------------------------------------- 1 | module.exports = async(client, member) => { 2 | const guild = client.guilds.get('492345609928572948'); 3 | guild.channels.get('498353708971720714').setName(`Total Member : ${guild.memberCount}`) 4 | 5 | } -------------------------------------------------------------------------------- /src/events/guildMemberRemove.js: -------------------------------------------------------------------------------- 1 | module.exports = (client, member) => { 2 | 3 | const guild = client.guilds.get('492345609928572948'); 4 | guild.channels.get('498353708971720714').setName(`Total Member : ${guild.memberCount}`) 5 | 6 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tokisaki 2 | 3 | A Discord economy bot using JSON for database so.. its so easy to corrupt because of that i archive this bot and officially open source under MIT LICENSE 4 | [![Run on Repl.it](https://repl.it/badge/github/SharifPoetra/tokisaki)](https://repl.it/github/SharifPoetra/tokisaki) -------------------------------------------------------------------------------- /src/handle/events.js: -------------------------------------------------------------------------------- 1 | const { readdirSync } = require('fs'); 2 | 3 | module.exports = client => { 4 | const events = readdirSync('./src/events/'); 5 | for (let event of events) { 6 | let file = require(`../events/${event}`); 7 | client.on(event.split('.')[0], (...args) => file(client, ...args)); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/app.js: -------------------------------------------------------------------------------- 1 | const AkariClient = require('./handle/AkariClient'); 2 | const client = new AkariClient({ 3 | fetchAllMembers: true, 4 | disabledEvents: ["TYPING_START", "USER_NOTE_UPDATE"], 5 | disableEveryone: true 6 | }); 7 | 8 | require('./handle/events')(client); 9 | require('./handle/module')(client); 10 | 11 | client.login(client.config.env.TOKEN); 12 | -------------------------------------------------------------------------------- /src/assets/json/fishy.json: -------------------------------------------------------------------------------- 1 | { 2 | "junk": { 3 | "symbol": "🔧", 4 | "max": 5, 5 | "min": 1 6 | }, 7 | "common": { 8 | "symbol": "🐟", 9 | "max": 25, 10 | "min": 10 11 | }, 12 | "uncommon": { 13 | "symbol": "🐠", 14 | "max": 50, 15 | "min": 18 16 | }, 17 | "rare": { 18 | "symbol": "🦑", 19 | "max": 75, 20 | "min": 30 21 | }, 22 | "legendary": { 23 | "symbol": "🐋", 24 | "max": 100, 25 | "min": 50 26 | } 27 | } -------------------------------------------------------------------------------- /src/handle/cooldownAns.json: -------------------------------------------------------------------------------- 1 | [ 2 | "Wait just a tiiiiny bit more uwu", 3 | "Y-You're calling me so fast that i'm getting dizzy...", 4 | "Seems like we're gonna get a speed ticket if we continue going this fast!", 5 | "Hey, wait up, I'm not done with my break yet!", "Don't be greedy!", 6 | "Woah... you're calling me a bit too fast... I might get dizzy!", 7 | "I wanna do this... but halt for a bit please.", 8 | "Can you slow down a little bit?", 9 | "Halt in there buddy!" 10 | ] 11 | -------------------------------------------------------------------------------- /shard.js: -------------------------------------------------------------------------------- 1 | const { ShardingManager } = require('discord.js'); 2 | const config = require('./src/config.json'); 3 | 4 | const shards = new ShardingManager('./index.js', { 5 | token: config.env.TOKEN, 6 | totalShards: 1 7 | }); 8 | 9 | shards.on('launch', shard => { 10 | console.log(`[${new Date().toString().split(" ", 5).join(" ")}] Launched shard #${shard.id}`); 11 | }); 12 | 13 | shards.on('message', (shard, msg) => { 14 | console.log(`[${new Date().toString().split(" ", 5).join(" ")}] #${shard.id} | ${msg._eval} | ${msg._result}`); 15 | }); 16 | 17 | shards.spawn(); 18 | -------------------------------------------------------------------------------- /src/assets/json/status.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "text": "With over 100000000 users, Not really but who can't dream?", 4 | "type": "PLAYING" 5 | }, 6 | { 7 | "text": "You are never too old to set another goal or to dream a new dream.", 8 | "type": "LISTENING" 9 | }, 10 | { 11 | "text": "What is not started today is never finished tomorrow.", 12 | "type": "WATCHING" 13 | }, 14 | { 15 | "text": "Start where you are. Use what you have. Do what you can.", 16 | "type": "WATCHING" 17 | }, 18 | { 19 | "text": "On a new home... I mean datacenter.", 20 | "type": "PLAYING" 21 | } 22 | ] -------------------------------------------------------------------------------- /src/commands/utility/invite.js: -------------------------------------------------------------------------------- 1 | const { RichEmbed } = require('discord.js'); 2 | 3 | exports.run = async (client, message, args, color, prefix) => { 4 | 5 | let embed = new RichEmbed() 6 | .setColor(color) 7 | .setDescription('**[Click Here](https://discordapp.com/oauth2/authorize?client_id=500547370245685249&scope=bot&permissions=1517419646)** To Invite Me to your server!') 8 | message.channel.send(embed); 9 | 10 | } 11 | 12 | exports.conf = { 13 | aliases: [], 14 | cooldown: "5" 15 | } 16 | 17 | exports.help = { 18 | name: "invite", 19 | description: "invite the bot to your server", 20 | usage: "invite" 21 | } 22 | -------------------------------------------------------------------------------- /src/commands/fun/roast.js: -------------------------------------------------------------------------------- 1 | const { get } = require('node-superfetch'); 2 | 3 | exports.run = async (client, message, args, color, prefix) => { 4 | 5 | let user = message.mentions.users.first() || client.users.get(args[0]); 6 | 7 | if(!user) user = message.author; 8 | 9 | try { 10 | let { body } = await get('https://sharif-api-js.glitch.me/api/roast') 11 | message.channel.send(`**${user.username}**, ${body.response}`) 12 | } catch (e) { 13 | message.channel.send(`Oh no an error occurred :( \`${e.message}\` try again later!`) 14 | } 15 | 16 | 17 | } 18 | 19 | exports.conf = { 20 | aliases: ['insult'], 21 | cooldown: "" 22 | } 23 | 24 | exports.help = { 25 | name: "roast", 26 | description: "Roasts a user.", 27 | usage: "roast [@user]" 28 | } 29 | -------------------------------------------------------------------------------- /src/commands/utility/afk.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | 3 | exports.run = async (client, message, args) => { 4 | let data = JSON.parse(fs.readFileSync('./src/database/afk.json', 'utf8')), 5 | reason = args.join(" "); 6 | if (!reason) reason = ""; 7 | if (Object.keys(data).includes(message.author.id)) return message.reply("You are in AFK mode already!"); 8 | data[message.author.id] = reason; 9 | message.channel.send(`⌨️ | ${message.author.toString()}, I\'ve set you to AFK mode.`); 10 | fs.writeFile('./src/database/afk.json', JSON.stringify(data), (err) => { 11 | if (err) console.log(err.stack); 12 | }); 13 | }; 14 | 15 | exports.conf = { 16 | aliases: [], 17 | cooldown: 1 18 | }; 19 | 20 | exports.help = { 21 | name: "afk", 22 | description: "Run this so that I can tell them you're not around.", 23 | usage: "afk [why-you-afk]", 24 | }; -------------------------------------------------------------------------------- /src/commands/fun/rem.js: -------------------------------------------------------------------------------- 1 | const { get } = require('node-superfetch'); 2 | const { RichEmbed } = require('discord.js'); 3 | 4 | exports.run = async (client, message, args, color, prefix) => { 5 | 6 | const { body } = await get("https://rra.ram.moe/i/r?type=rem"); 7 | 8 | let embed = new RichEmbed() 9 | .setColor(color) 10 | .setDescription(`**[Click here if the image failed to load.](https://cdn.ram.moe/${body.path.replace("/i/", "")})**`) 11 | .setImage(`https://cdn.ram.moe/${body.path.replace("/i/", "")}`) 12 | .setFooter(`Request by: ${message.author.tag} | Powered by Weeb.sh`, message.author.displayAvatarURL) 13 | message.channel.send(embed); 14 | 15 | } 16 | 17 | exports.conf = { 18 | aliases: [], 19 | cooldown: "" 20 | } 21 | 22 | exports.help = { 23 | name: "rem", 24 | description: "give a random rem pictures", 25 | usage: "rem" 26 | } 27 | -------------------------------------------------------------------------------- /src/commands/fun/owo.js: -------------------------------------------------------------------------------- 1 | const { get } = require('node-superfetch'); 2 | const { RichEmbed } = require('discord.js'); 3 | 4 | exports.run = async (client, message, args, color, prefix) => { 5 | 6 | const { body } = await get("https://rra.ram.moe/i/r?type=owo"); 7 | 8 | let embed = new RichEmbed() 9 | .setColor(color) 10 | .setDescription(`**[Click here if the image failed to load.](https://cdn.ram.moe/${body.path.replace("/i/", "")})**`) 11 | .setImage(`https://cdn.ram.moe/${body.path.replace("/i/", "")}`) 12 | .setFooter(`Request by: ${message.author.tag} | Powered by Weeb.sh`, message.author.displayAvatarURL) 13 | message.channel.send(embed); 14 | 15 | } 16 | 17 | exports.conf = { 18 | aliases: ['uwu', 'UwU', 'OwO'], 19 | cooldown: "" 20 | } 21 | 22 | exports.help = { 23 | name: "owo", 24 | description: "OwO, what's this?", 25 | usage: "owo" 26 | } 27 | -------------------------------------------------------------------------------- /src/commands/fun/meme.js: -------------------------------------------------------------------------------- 1 | const { RichEmbed } = require('discord.js'), 2 | { get } = require('node-superfetch'); 3 | 4 | exports.run = async (client, message, args, color) => { 5 | 6 | let m = await message.channel.send(`*Please Wait...*`); 7 | try { 8 | const { body } = await get('https://api-to.get-a.life/meme') 9 | 10 | let memeEmbed = new RichEmbed() 11 | .setColor(color) 12 | .setTitle(body.text) 13 | .setImage(body.url) 14 | .setTimestamp() 15 | .setFooter(`Request by: ${message.author.tag}`); 16 | 17 | message.channel.send(memeEmbed).then(() => { m.delete();}); 18 | } catch (e) { 19 | message.channel.send(`Oh no an error occurred :( \`${e.message}\` try again later!`); 20 | } 21 | } 22 | 23 | exports.conf = { 24 | aliases: [], 25 | cooldown: "5" 26 | } 27 | 28 | exports.help = { 29 | name: "meme", 30 | description: "Get a random meme", 31 | usage: "meme" 32 | } 33 | -------------------------------------------------------------------------------- /src/commands/process/reboot.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | const { owners_id } = require('../../config.json'); 3 | 4 | exports.run = async (client, message, args) => { 5 | 6 | owners_id.forEach(async function(owner) { 7 | if(message.author.id !== owner) return; 8 | 9 | message.channel.send("**Rebooting...**").then(m => { 10 | setTimeout(() => { 11 | m.edit("**Rebooting...**").then(ms => { 12 | setTimeout(() => { 13 | ms.edit("**Done.**") 14 | }, 1000) 15 | }) 16 | }, 1000); 17 | 18 | }) 19 | 20 | .then(message => process.exit()) 21 | .then(() => client.login(process.env.AKARI)) 22 | }); 23 | } 24 | 25 | exports.conf = { 26 | aliases: ['shutdown', 'rb'], 27 | cooldown: '' 28 | } 29 | 30 | exports.help = { 31 | name: 'reboot', 32 | description: 'This will reboot the bot instance.', 33 | usage: 'reboot' 34 | }; -------------------------------------------------------------------------------- /src/commands/fun/kemonomimi.js: -------------------------------------------------------------------------------- 1 | const { get } = require('node-superfetch'); 2 | const { RichEmbed } = require('discord.js'); 3 | 4 | exports.run = async (client, message, args, color, prefix) => { 5 | 6 | try { 7 | const { body } = await get('https://nekobot.xyz/api/image?type=kemonomimi') 8 | 9 | let embed = new RichEmbed() 10 | .setColor(color) 11 | .setDescription(`**[Click here if image failed to load](${body.message})**`) 12 | .setImage(body.message) 13 | .setFooter(`Request by: ${message.author.tag} | ${client.user.username} v${client.version}`) 14 | message.channel.send(embed); 15 | } catch (e) { 16 | message.channel.send(`Oh no an error occurred :( \`${e.message}\` try again later!`) 17 | } 18 | 19 | } 20 | 21 | exports.conf = { 22 | aliases: ['knmm'], 23 | cooldown: "3" 24 | } 25 | 26 | exports.help = { 27 | name: "kemonomimi", 28 | description: "Search for kemonomimi image", 29 | usage: "kemonomimi" 30 | } 31 | -------------------------------------------------------------------------------- /src/commands/fun/belikebill.js: -------------------------------------------------------------------------------- 1 | 2 | const { get } = require('node-superfetch'); 3 | 4 | exports.run = async (client, message, args, color, prefix) => { 5 | 6 | let user = message.mentions.users.first() || client.users.get(args[0]); 7 | 8 | if(!user) user = message.author; 9 | 10 | try { 11 | let { body } = await get('https://sharif-api-js.glitch.me/api/belikebill') 12 | const text = await body.response.replace(/{{name}}/gi, user.username) 13 | message.channel.send(` 14 | This is ${user.username}. 15 | 16 | ${text} 17 | 18 | ${user.username} is smart. 19 | Be like ${user.username}. 20 | `) 21 | } catch (e) { 22 | message.channel.send(`Oh no an error occurred :( \`${e.message}\` try again later!`) 23 | } 24 | 25 | 26 | } 27 | 28 | exports.conf = { 29 | aliases: ['blbl', 'belike'], 30 | cooldown: "" 31 | } 32 | 33 | exports.help = { 34 | name: "belikebill", 35 | description: "Sends a 'Be Like Bill' meme with the name of your choice.", 36 | usage: "belikebill [@user]" 37 | } 38 | -------------------------------------------------------------------------------- /src/commands/utility/ping.js: -------------------------------------------------------------------------------- 1 | const { RichEmbed } = require('discord.js'); 2 | 3 | exports.run = async (client, message, args, color) => { 4 | 5 | try{ 6 | let msgping1 = new Date(); 7 | let msgping2 = new Date() - message.createdAt; 8 | const m = await message.channel.send('Ping...'); 9 | const embed = new RichEmbed() 10 | .setColor(color) 11 | .addField(':stopwatch: Time', `__**${m.createdTimestamp - message.createdTimestamp}ms**__`) 12 | .addField(':hourglass_flowing_sand: Latency', `__**${msgping2}ms**__`) 13 | .addField(':heartbeat: API', `__**${Math.floor(client.ping)}ms**__`) 14 | return m.edit(`🏓 P${'o'.repeat(Math.floor(client.ping)%5 === 0 ? 0 : Math.floor(Math.random()*5))}ng..`, {embed: embed}); 15 | }catch(e){ 16 | return message.channel.send(`Oh no an error occured :( ${e.message} try again later`); 17 | } 18 | 19 | } 20 | 21 | exports.conf = { 22 | aliases: ['pong'], 23 | cooldown: "4" 24 | } 25 | 26 | exports.help = { 27 | name: "ping", 28 | description: "Check bot ping", 29 | usage: "ping" 30 | } 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Sharif 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 | -------------------------------------------------------------------------------- /src/commands/fun/neko.js: -------------------------------------------------------------------------------- 1 | const { get } = require('node-superfetch'); 2 | const { RichEmbed } = require('discord.js'); 3 | 4 | function showNeko (client, msg, args){ 5 | try{ 6 | return exports.getNeko(msg.channel); 7 | } catch (err) { 8 | return msg.channel.send(err.stack, { code: 'ini' }); 9 | } 10 | } 11 | 12 | exports.getNeko = async (channel, extend = '') => { 13 | 14 | try { 15 | const { body } = await get('https://nekobot.xyz/api/image?type=neko') 16 | 17 | let ctx = new RichEmbed() 18 | ctx.setColor('RANDOM') 19 | ctx.setDescription(`**[Click here if image failed to load](${body.message})**`) 20 | ctx.setImage(body.message) 21 | return channel.send(extend, {embed: ctx}); 22 | } catch (e) { 23 | channel.send(`Oh no an error occurred :( \`${e.message}\` try again later!`) 24 | } 25 | 26 | } 27 | 28 | exports.conf = { 29 | aliases: ['nya'], 30 | cooldown: "3" 31 | } 32 | 33 | exports.help = { 34 | name: "neko", 35 | description: "Search for neko image, if you want the bot send a neko every one hours please make a channel named `neko-present` or `bot-spam`.", 36 | usage: "neko" 37 | } 38 | 39 | this.run = showNeko; -------------------------------------------------------------------------------- /src/commands/fun/nekoholo.js: -------------------------------------------------------------------------------- 1 | const { get } = require('node-superfetch'); 2 | const { RichEmbed } = require('discord.js'); 3 | 4 | exports.run = async (client, message, args, color, prefix) => { 5 | 6 | //if(!message.channel.nsfw) return message.channel.send(`**${message.author.username}**, You can't use this command here also i can't send it here because this channel not a **Nsfw** Channel!`) 7 | 8 | try { 9 | const { body } = await get('https://nekobot.xyz/api/image?type=holo') 10 | 11 | let embed = new RichEmbed() 12 | .setColor(color) 13 | .setDescription(`**[Click here if image failed to load](${body.message})**`) 14 | .setImage(body.message) 15 | .setFooter(`Request by: ${message.author.tag} | ${client.user.username} v${client.version}`) 16 | message.channel.send(embed); 17 | } catch (e) { 18 | message.channel.send(`Oh no an error occurred :( \`${e.message}\` try again later!`) 19 | } 20 | 21 | } 22 | 23 | exports.conf = { 24 | aliases: ['nya-holo', 'holo'], 25 | cooldown: "3" 26 | } 27 | 28 | exports.help = { 29 | name: "nekoholo", 30 | description: "Search for neko holo image", 31 | usage: "nekoholo" 32 | } 33 | -------------------------------------------------------------------------------- /src/commands/nsfw/gonewild.js: -------------------------------------------------------------------------------- 1 | const { get } = require('node-superfetch'); 2 | const { RichEmbed } = require('discord.js'); 3 | 4 | exports.run = async (client, message, args, color, prefix) => { 5 | 6 | let nsfw = require('../../assets/json/nsfwAns.json'); 7 | 8 | let nsfwAns = nsfw[Math.floor(Math.random() * nsfw.length)] 9 | 10 | if(!message.channel.nsfw) return message.channel.send(`🚫 | **${message.author.username}**, ${nsfwAns}`) 11 | 12 | try { 13 | const { body } = await get('https://nekobot.xyz/api/image?type=gonewild') 14 | 15 | let embed = new RichEmbed() 16 | .setColor(color) 17 | .setDescription(`**[Click here if image failed to load](${body.message})**`) 18 | .setImage(body.message) 19 | .setFooter(`Request by: ${message.author.tag} | ${client.user.username} v${client.version}`) 20 | message.channel.send(embed); 21 | } catch (e) { 22 | message.channel.send(`Oh no an error occurred :( \`${e.message}\` try again later!`) 23 | } 24 | 25 | } 26 | 27 | exports.conf = { 28 | aliases: [], 29 | cooldown: "3" 30 | } 31 | 32 | exports.help = { 33 | name: "gonewild", 34 | description: "Search for gonewild image", 35 | usage: "gonewild" 36 | } 37 | -------------------------------------------------------------------------------- /src/commands/nsfw/hentai.js: -------------------------------------------------------------------------------- 1 | const { get } = require('node-superfetch'); 2 | const { RichEmbed } = require('discord.js'); 3 | 4 | exports.run = async (client, message, args, color, prefix) => { 5 | 6 | let nsfw = require('../../assets/json/nsfwAns.json'); 7 | 8 | let nsfwAns = nsfw[Math.floor(Math.random() * nsfw.length)] 9 | 10 | if(!message.channel.nsfw) return message.channel.send(`🚫 | **${message.author.username}**, ${nsfwAns}`) 11 | 12 | try { 13 | const { body } = await get('https://nekobot.xyz/api/image?type=hentai') 14 | 15 | let embed = new RichEmbed() 16 | .setColor(color) 17 | .setDescription(`**[Click here if image failed to load](${body.message})**`) 18 | .setImage(body.message) 19 | .setFooter(`Request by: ${message.author.tag} | ${client.user.username} v${client.version}`) 20 | message.channel.send(embed); 21 | } catch (e) { 22 | message.channel.send(`Oh no an error occurred :( \`${e.message}\` try again later!`) 23 | } 24 | 25 | } 26 | 27 | exports.conf = { 28 | aliases: ['hentaigif'], 29 | cooldown: "3" 30 | } 31 | 32 | exports.help = { 33 | name: "hentai", 34 | description: "Search for hentai image", 35 | usage: "hentai" 36 | } 37 | -------------------------------------------------------------------------------- /src/commands/nsfw/lewdneko.js: -------------------------------------------------------------------------------- 1 | const { get } = require('node-superfetch'); 2 | const { RichEmbed } = require('discord.js'); 3 | 4 | exports.run = async (client, message, args, color, prefix) => { 5 | 6 | let nsfw = require('../../assets/json/nsfwAns.json'); 7 | 8 | let nsfwAns = nsfw[Math.floor(Math.random() * nsfw.length)] 9 | 10 | if(!message.channel.nsfw) return message.channel.send(`🚫 | **${message.author.username}**, ${nsfwAns}`) 11 | 12 | try { 13 | const { body } = await get('https://nekobot.xyz/api/image?type=lewdneko') 14 | 15 | let embed = new RichEmbed() 16 | .setColor(color) 17 | .setDescription(`**[Click here if image failed to load](${body.message})**`) 18 | .setImage(body.message) 19 | .setFooter(`Request by: ${message.author.tag} | ${client.user.username} v${client.version}`) 20 | message.channel.send(embed); 21 | } catch (e) { 22 | message.channel.send(`Oh no an error occurred :( \`${e.message}\` try again later!`) 23 | } 24 | 25 | } 26 | 27 | exports.conf = { 28 | aliases: ['nekolewd'], 29 | cooldown: "3" 30 | } 31 | 32 | exports.help = { 33 | name: "lewdneko", 34 | description: "Search for neko lewd image", 35 | usage: "lewdneko" 36 | } 37 | -------------------------------------------------------------------------------- /src/commands/fun/nobully.js: -------------------------------------------------------------------------------- 1 | const { RichEmbed } = require('discord.js'); 2 | const actions = require('../../assets/json/nobully.json'); 3 | 4 | exports.run = async (client, message, args, color) => { 5 | 6 | if (message.mentions.users.first() === client.user) return message.channel.send(`(✿´ ꒳ \` ) am not bulli!!`); 7 | const recipient = message.content.split(/\s+/g).slice(1).join(" "); 8 | if (!recipient) { 9 | const embed = new RichEmbed() 10 | .setColor(color) 11 | .setImage(actions[Math.round(Math.random() * (actions.length - 1))]); 12 | return message.channel.send({ embed: embed }); 13 | } else { 14 | const embed = new RichEmbed() 15 | .setColor(color) 16 | .setDescription(`**${recipient}**, pls no bulli!!`) 17 | .setImage(actions[Math.round(Math.random() * (actions.length - 1))]); 18 | return message.channel.send({ embed: embed }); 19 | } 20 | } 21 | exports.conf = { 22 | aliases: ['antibully'], 23 | cooldown: "" 24 | } 25 | 26 | exports.help = { 27 | name: "nobully", 28 | description: "Transform Anti bully Akari", 29 | usage: "nobully [@user]" 30 | } 31 | -------------------------------------------------------------------------------- /src/commands/nsfw/hentaianal.js: -------------------------------------------------------------------------------- 1 | const { get } = require('node-superfetch'); 2 | const { RichEmbed } = require('discord.js'); 3 | 4 | exports.run = async (client, message, args, color, prefix) => { 5 | 6 | let nsfw = require('../../assets/json/nsfwAns.json'); 7 | 8 | let nsfwAns = nsfw[Math.floor(Math.random() * nsfw.length)] 9 | 10 | if(!message.channel.nsfw) return message.channel.send(`🚫 | **${message.author.username}**, ${nsfwAns}`) 11 | 12 | try { 13 | const { body } = await get('https://nekobot.xyz/api/image?type=hentai_anal') 14 | 15 | let embed = new RichEmbed() 16 | .setColor(color) 17 | .setDescription(`**[Click here if image failed to load](${body.message})**`) 18 | .setImage(body.message) 19 | .setFooter(`Request by: ${message.author.tag} | ${client.user.username} v${client.version}`) 20 | message.channel.send(embed); 21 | } catch (e) { 22 | message.channel.send(`Oh no an error occurred :( \`${e.message}\` try again later!`) 23 | } 24 | 25 | } 26 | 27 | exports.conf = { 28 | aliases: ['analhentai'], 29 | cooldown: "3" 30 | } 31 | 32 | exports.help = { 33 | name: "hentaianal", 34 | description: "Search for hentai anal image", 35 | usage: "hentaianal" 36 | } 37 | -------------------------------------------------------------------------------- /src/commands/nsfw/lewdkitsune.js: -------------------------------------------------------------------------------- 1 | const { get } = require('node-superfetch'); 2 | const { RichEmbed } = require('discord.js'); 3 | 4 | exports.run = async (client, message, args, color, prefix) => { 5 | 6 | let nsfw = require('../../assets/json/nsfwAns.json'); 7 | 8 | let nsfwAns = nsfw[Math.floor(Math.random() * nsfw.length)] 9 | 10 | if(!message.channel.nsfw) return message.channel.send(`🚫 | **${message.author.username}**, ${nsfwAns}`) 11 | 12 | try { 13 | const { body } = await get('https://nekobot.xyz/api/image?type=lewdkitsune') 14 | 15 | let embed = new RichEmbed() 16 | .setColor(color) 17 | .setDescription(`**[Click here if image failed to load](${body.message})**`) 18 | .setImage(body.message) 19 | .setFooter(`Request by: ${message.author.tag} | ${client.user.username} v${client.version}`) 20 | message.channel.send(embed); 21 | } catch (e) { 22 | message.channel.send(`Oh no an error occurred :( \`${e.message}\` try again later!`) 23 | } 24 | 25 | } 26 | 27 | exports.conf = { 28 | aliases: ['kitsunelewd'], 29 | cooldown: "3" 30 | } 31 | 32 | exports.help = { 33 | name: "lewdkitsune", 34 | description: "Search for kitsune lewd image", 35 | usage: "lewdkitsune" 36 | } 37 | -------------------------------------------------------------------------------- /src/commands/economy/balance.js: -------------------------------------------------------------------------------- 1 | let balance = require("../../database/balance.json"); 2 | 3 | exports.run = async (client, message, args) => { 4 | if (message.channel.type == "dm") return; 5 | 6 | let member = message.mentions.users.first() || client.users.get(args[0]); 7 | if (!member) member = message.author; 8 | if (member.bot) return message.channel.send(`**${message.author.username}**, Bot don't have a balance!`); 9 | //!coins 10 | //WAJIB biar ga undefined 11 | if(!balance[member.id]){ 12 | balance[member.id] = { 13 | balance: 0 14 | }; 15 | } 16 | //wajib biar ga undefined 17 | if(!balance[member.id]){ 18 | balance[member.id] = { 19 | balance: 0 20 | }; 21 | } 22 | //buat read json 23 | let uBalance = balance[member.id].balance; 24 | if (uBalance == 0) { 25 | message.channel.send(`**${member.username} do not have a balance yet!**`); 26 | } else { 27 | message.channel.send(`**${member.username}** have a balance of 💴 **${uBalance}**`); 28 | } 29 | } 30 | 31 | exports.conf = { 32 | aliases: ["bal"], 33 | cooldown: "5" 34 | } 35 | 36 | exports.help = { 37 | name: 'balance', 38 | description: 'To show someone Balance Amount', 39 | usage: 'balance [@mention]' 40 | } -------------------------------------------------------------------------------- /src/assets/json/nsfwAns.json: -------------------------------------------------------------------------------- 1 | [ 2 | "G-Gyaaa! This isn't an NSFW channel!", 3 | "This doesn't seem to be an NSFW channel...", 4 | "I'm sorry! But this stuff belongs in NSFW channels!", 5 | "That belongs in NSFW channels!", 6 | "I can't post this here! Please direct me to an NSFW channel!", 7 | "I'm afraid that kind of stuff isn't allowed in here..", 8 | "This doesn't look like an NSFW channel!", 9 | "Please try again in an NSFW channel!", 10 | "u///u, I don't think I can post that in your average channel.", 11 | "Don't make me post that here...", 12 | "💢That doesn't belong here!", 13 | "W-What? I can't post that here!", 14 | "Would you direct me to an NSFW channel?", 15 | "Please try this command again in an NSFW channel!", 16 | "H-Hey.. Some people might not want to see that in here!", 17 | "LEWD! B-Baka! Not in here!", 18 | "B-Baka! I can't post that here!", 19 | "This isn't an NSFW channel! Learn how to make a channel nsfw with `~howto`!", 20 | "You can try `~toggle` to make your channel NSFW!", 21 | "Nya! That was bad! Do that in an NSFW channel!", 22 | "How scandalous! Try that in an NSFW channel!", 23 | "Senpai...don't make me post that here...", 24 | "Nya that was bad senpai! This is an NSFW command!" 25 | ] -------------------------------------------------------------------------------- /src/commands/process/blacklist.js: -------------------------------------------------------------------------------- 1 | 2 | const fs = require("fs"); 3 | const { owners_id } = require('../../config.json'); 4 | let blacklist = require("../../database/blacklist.json"); 5 | 6 | exports.run = async (client, message, args, color) => { 7 | owners_id.forEach(async function(owner) { 8 | if (message.author.id !== owner) return; 9 | 10 | const bl = client.channels.get("503584630037807124"); 11 | 12 | let pUser = message.mentions.users.first() || client.users.get(args[0]); 13 | 14 | if (!pUser) return args.missing(message, 'Baka!!! Mention the user or give me the ID to blacklisted.', client.commands.get('blacklist').help); 15 | 16 | blacklist[pUser.id] = { 17 | checker: 1 18 | }; 19 | 20 | bl.send(`**${pUser.id}** has been excluded from using the bot.`) 21 | 22 | message.delete() 23 | message.channel.send(`**${pUser.id}** has been excluded from using the bot!`); 24 | 25 | fs.writeFile("./src/database/blacklist.json", JSON.stringify(blacklist, null, 2), (err) => { 26 | if(err) console.log(err) 27 | }); 28 | }); 29 | } 30 | 31 | exports.conf = { 32 | aliases: ["bl"] 33 | } 34 | 35 | exports.help = { 36 | name: 'blacklist', 37 | description: 'To blacklist user from using the bot', 38 | usage: 'blacklist <@Mention | ID>' 39 | } -------------------------------------------------------------------------------- /src/commands/admin/kick.js: -------------------------------------------------------------------------------- 1 | exports.run = async (client, message, args, color, prefix) => { 2 | 3 | try { 4 | if (message.member.hasPermission("KICK_MEMBERS")) { 5 | if (message.mentions.users.size != 0) { 6 | if (message.mentions.members.first().kickable) { 7 | message.mentions.members.first().kick().then(m => { 8 | message.channel.send(`**${m.user.username}** has been kicked from **${message.guild.name}**. Bye bye!`); 9 | }); 10 | } else { 11 | message.channel.send(`**${message.mentions.user.first().username}** is too priveledged for me to kick.`); 12 | } 13 | } else { 14 | message.channel.send('Please tag the user you would like to kick.') 15 | } 16 | } else { 17 | message.channel.send(`**${message.author.username}**, You do not have permission to kick. You must have the \`Kick Members\` permission.`); 18 | } 19 | } catch (err) { 20 | message.channel.send(`Either I am unable to kick **${message.mentions.users.first().username},** or I do not have permission to kick members.`); 21 | } 22 | 23 | } 24 | 25 | exports.conf = { 26 | aliases: [], 27 | cooldown: "" 28 | } 29 | 30 | exports.help = { 31 | name: "kick", 32 | description: "kick member you want", 33 | usage: "kick <@user>" 34 | } 35 | -------------------------------------------------------------------------------- /src/commands/admin/unmute.js: -------------------------------------------------------------------------------- 1 | exports.run = async (client, message, args) => { 2 | if (!message.member.hasPermission('MANAGE_MESSAGES')) return message.channel.send(`**${message.author.username}, Sorry, you need \`MANAGE_MESSAGES\` Permission to use this commands**!`).then(msg=>msg.delete(7000)); 3 | if (!message.guild.member(client.user).hasPermission("MANAGE_ROLES")) return message.channel.send(`**${message.author.username}, Sorry, I need the following permission to \`mute\` command to work: \`MANAGE_ROLES\`**!`).then(msg=>msg.delete(7000)); 4 | 5 | let member = message.mentions.members.first() || message.guild.members.get(args[0]); 6 | if (!member) return message.channel.send(`**${message.author.username}, Sorry, I can't find the user you mean**!`).then(msg=>msg.delete(7000)); 7 | 8 | let muterole = message.guild.roles.find(x => x.name === 'Muted'); 9 | if (!member.roles.has(muterole.id)) return message.channel.send(`**${member.user.username} Not muted yet**.`).then(msg=>msg.delete(7000)); 10 | await (member.removeRole(muterole.id)); 11 | message.channel.send(`**${member.user.username} Has been unmuted**.`); 12 | } 13 | 14 | exports.conf = { 15 | aliases: [] 16 | } 17 | 18 | exports.help = { 19 | name: "unmute", 20 | description: "Unmute someone", 21 | usage: "unmute @mention" 22 | } 23 | -------------------------------------------------------------------------------- /src/commands/admin/purge.js: -------------------------------------------------------------------------------- 1 | exports.run = async (client, message, args, color) => { 2 | 3 | if (!message.member.hasPermission('MANAGE_MESSAGES')) return message.channel.send(`**${message.author.username}, Sorry but you need \`MANAGE_MESSAGES\` Permission to use this command.**`).then(m => m.delete(7000)); 4 | 5 | if (!message.guild.member(client.user).hasPermission("MANAGE_MESSAGES")) return message.channel.send(`**${message.author.username}, Uh i want do this but i need following permission to \`purge\` to work: \`MANAGE_MESSAGES\`**`).then(x => x.delete(7000)); 6 | 7 | if (isNaN(args[0])) return message.channel.send(`**${message.author.username}, Please supply a valid amount of messages to purge**!`); 8 | 9 | if (args[0] > 100) return message.channel.send(`**${message.author.username}, Please supply a number less than 100**!`).then(u => u.delete(7000)); 10 | 11 | message.channel.bulkDelete(args[0]) 12 | .then(messages => message.channel.send(`**Successfully deleted \`${messages.size}/${args[0]}\` messages.**`).then(msg => msg.delete({ 13 | timeout: 5000 14 | }))) 15 | 16 | } 17 | 18 | exports.conf = { 19 | aliases: ['prune', 'clear'], 20 | cooldown: "5" 21 | } 22 | 23 | exports.help = { 24 | name: "purge", 25 | description: "Removes last of messages from the channel (up to 99)", 26 | usage: "purge " 27 | } 28 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "//1": "describes your app and its dependencies", 3 | "//2": "https://docs.npmjs.com/files/package.json", 4 | "//3": "updating this file will download and update your packages", 5 | "name": "Akari", 6 | "version": "1.5.2 - Powered by Lolization LLC", 7 | "description": "A simple Discord bot written in discord.js.", 8 | "main": "shard.js", 9 | "scripts": { 10 | "start": "node shard.js" 11 | }, 12 | "dependencies": { 13 | "@discordjs/uws": "^11.149.1", 14 | "anime-scraper": "^3.0.0", 15 | "bufferutil": "^4.0.0", 16 | "canvas": "github:Automattic/node-canvas", 17 | "canvas-constructor": "^3.1.0", 18 | "cards": "^1.0.1", 19 | "cleverbot.io": "^1.0.4", 20 | "common-tags": "^1.8.0", 21 | "cpu-stat": "^2.0.1", 22 | "discord.js": "^11.4.2", 23 | "discordeco.js": "^0.5.0", 24 | "express": "^4.16.4", 25 | "fs": "0.0.1-security", 26 | "moment": "^2.22.2", 27 | "myanimelist": "^0.1.0", 28 | "myanimelists": "^1.0.1", 29 | "node-superfetch": "^0.1.9", 30 | "parse-ms": "^2.0.0", 31 | "quick.db": "^7.0.0-b16", 32 | "random-js": "^2.1.0" 33 | }, 34 | "engines": { 35 | "node": "8.x" 36 | }, 37 | "repository": { 38 | "url": "https://glitch.com/edit/#!/hello-express" 39 | }, 40 | "license": "MIT", 41 | "keywords": [ 42 | "node", 43 | "glitch", 44 | "express" 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /src/commands/process/whitelist.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const fs = require("fs"); 3 | const { owners_id } = require('../../config.json'); 4 | let blacklist = require("../../database/blacklist.json"); 5 | 6 | exports.run = async (client, message, args, color) => { 7 | owners_id.forEach(async function(owner) { 8 | if (message.author.id !== owner) return; 9 | 10 | const bl = client.channels.get("503584630037807124"); 11 | 12 | let pUser = message.mentions.users.first() || client.users.get(args[0]); 13 | 14 | if (!pUser) return args.missing(message, 'Baka!!! Mention the user or give me the ID to whitelisted.', client.commands.get('whitelist').help); 15 | 16 | blacklist[pUser.id] = { 17 | checker: 0 18 | }; 19 | 20 | pUser.send(`You\'ve been **Whitelist** from using **${client.user.username}**, Please don\'t violating our rules again!`) 21 | bl.send(`**${pUser.id}** has been whitelisted.`) 22 | message.channel.send(`**${pUser.id}** has been whitelisted.`); 23 | 24 | fs.writeFile("./src/database/blacklist.json", JSON.stringify(blacklist, null, 2), (err) => { 25 | if(err) console.log(err) 26 | }); 27 | }); 28 | } 29 | 30 | exports.conf = { 31 | aliases: ["wl"] 32 | } 33 | 34 | exports.help = { 35 | name: 'whitelist', 36 | description: 'To whitelist someone from using Conan', 37 | usage: 'whitelist <@Mention | ID>' 38 | } -------------------------------------------------------------------------------- /src/handle/AkariClient.js: -------------------------------------------------------------------------------- 1 | const { Client, Collection } = require('discord.js'); 2 | const Economy = require("discordeco.js"); 3 | 4 | class AkariBot extends Client { 5 | constructor (opt) { 6 | super (opt); 7 | this.health = Object.seal({ 8 | cpu: new Array(96).fill(0), 9 | prc: new Array(96).fill(0), 10 | ram: new Array(96).fill(0), 11 | cmd: new Array(96).fill(0), 12 | pings: new Array(96).fill(0) 13 | }); 14 | 15 | this.eco = new Economy(); 16 | this.snek = require('node-superfetch'); 17 | this.config = require('../config.json'); 18 | this.util = require('./util.js'); 19 | this.userLevel = require('../../src/database/xp'); 20 | this.userBalance = require('../../src/database/balance'); 21 | this.version = require('../../package.json').version; 22 | } 23 | updateStats() { 24 | const { heapTotal, heapUsed } = process.memoryUsage(); 25 | const { loadavg } = require('os'); 26 | this.health.cpu.shift(); 27 | this.health.cpu.push(((loadavg()[0] * 10000) | 0) / 100); 28 | 29 | this.health.prc.shift(); 30 | this.health.prc.push(((100 * (heapTotal / 1048576)) | 0) / 100); 31 | 32 | this.health.ram.shift(); 33 | this.health.ram.push(((100 * (heapUsed / 1048576)) | 0) / 100); 34 | 35 | this.health.cmd.shift(); 36 | this.health.cmd.push(0); 37 | } 38 | } 39 | 40 | module.exports = AkariBot; 41 | -------------------------------------------------------------------------------- /src/events/messageDelete.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | const fs = require('fs'); 3 | const { embed_color } = require('../config.json'); 4 | 5 | module.exports = (client, message) => { 6 | 7 | if (message.author.bot) return; 8 | let editEmbed = new Discord.RichEmbed() 9 | .setAuthor(`${message.author.tag} | Deleted message`, message.author.displayAvatarURL) 10 | .setDescription(` 11 | **Message sent by ${message.author} deleted in ${message.channel.toString()}** 12 | 13 | **Message Content:**\n\n${message.content} 14 | ​ 15 | `) 16 | .setFooter(`ID: ${message.id}`) 17 | .setColor(embed_color).setTimestamp() 18 | 19 | var log = JSON.parse(fs.readFileSync('./src/database/logging.json', 'utf8')) 20 | let logsetting = JSON.parse(fs.readFileSync('./src/database/logonoff.json', 'utf8')); 21 | 22 | if(!logsetting[message.guild.id]){ 23 | logsetting[message.guild.id] = { 24 | checker: 1 25 | }; 26 | } 27 | if(!log[message.guild.id]) return; 28 | let values = logsetting[message.guild.id].checker 29 | 30 | if(values === undefined) return; 31 | if(values === 0) return; 32 | if(values === 1) { 33 | var log = JSON.parse(fs.readFileSync('./src/database/logging.json', 'utf8')) 34 | if(!log) return; 35 | let channel = message.guild.channels.get(`${log[message.guild.id].channel}`); 36 | if(!channel) return; 37 | channel.send(editEmbed); 38 | } 39 | }; -------------------------------------------------------------------------------- /src/commands/process/exec.js: -------------------------------------------------------------------------------- 1 | const { exec } = require('child_process'); 2 | const { RichEmbed } = require('discord.js'); 3 | const { owners_id } = require("../../config.json"); 4 | 5 | exports.run = (client, message, args, color) => { 6 | owners_id.forEach(async function(owner) { 7 | if (message.author.id !== owner) return; 8 | 9 | if(!args.join(' ')) return args.missing(message, 'No parameter to execute. you\'re stuppid', this.help); 10 | const mu = Date.now(); 11 | const emb = new RichEmbed() 12 | .setColor('#81FF00') 13 | exec(args.join(' '), async( error, stdout, stderr)=> { 14 | if(stdout){ 15 | let output = `\`\`\`bash\n${stdout}\`\`\``; 16 | if(stdout.length > 2047){ 17 | output = await client.util.hastebin(stdout); 18 | } 19 | emb.setDescription(output); 20 | }else if(stderr){ 21 | emb.setColor('#FF0000'); 22 | let error = `\`\`\`bash\n${stderr}\`\`\``; 23 | if(stderr.length > 2047){ 24 | error = await client.util.hastebin(stderr); 25 | } 26 | emb.setDescription(error); 27 | }else{ 28 | emb.setDescription('\`\`\`bash\n# Command executed successfully but returned no output.\`\`\`'); 29 | } 30 | return message.channel.send(emb.setFooter(`\`${Date.now() - mu}ms\``)); 31 | }); 32 | }) 33 | } 34 | 35 | exports.conf = { 36 | aliases: ['$', 'bash'] 37 | } 38 | 39 | exports.help = { 40 | name: 'exec', 41 | description: 'Executes a command in the Terminal (Linux/macOS) or Command Prompt (Windows) and shows the output', 42 | usage: 'exec ', 43 | } 44 | -------------------------------------------------------------------------------- /src/commands/economy/setinfo.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | const fs = require('fs'); 3 | let info = require('../../database/note.json'); 4 | 5 | exports.run = async (client, message, args, color) => { 6 | 7 | if(!info[message.author.id]){ 8 | info[message.author.id] = { 9 | note: 'This user has\nNot set info yet.' 10 | } 11 | } 12 | let newInfo = args.join(' '); 13 | let len = 115; 14 | if(!newInfo) return args.missing(message, 'You need to specify the message to set your info box', client.commands.get('setinfo').help); 15 | if(newInfo.length > len) return message.channel.send(`**${message.author.username}** *thats to length*, **Max \`115\` Characters Allowed.**`); 16 | let newsInfo = client.util.chunk(newInfo, 23).join('\n'); 17 | info[message.author.id].note = newsInfo; 18 | let h = await message.channel.send('*Please Wait...*'); 19 | fs.writeFile('./src/database/note.json', JSON.stringify(info, null, 2), (err) => { 20 | 21 | let notesEmbed = new Discord.RichEmbed() 22 | .setColor(color) 23 | .setAuthor(`Your Info box has been set and will be look like this:`, message.author.displayAvatarURL) 24 | .setDescription(newsInfo) 25 | message.channel.send(notesEmbed).then(()=>{ h.delete()}); 26 | }); 27 | 28 | 29 | } 30 | 31 | exports.conf = { 32 | aliases: ['setbio'], 33 | cooldown: "10" 34 | } 35 | 36 | exports.help = { 37 | name: "setinfo", 38 | description: "Set your info then tell your friends about you", 39 | usage: "setinfo " 40 | } 41 | -------------------------------------------------------------------------------- /src/assets/json/cookies.json: -------------------------------------------------------------------------------- 1 | [ 2 | "has given you a chocolate chip cookie!", 3 | "has given you a soft homemade oatmeal cookie!", 4 | "has given you a plain, dry, old cookie. It was the last one in the bag. Gross.", 5 | "gives you a sugar cookie. What, no frosting and sprinkles? 0\/10 would not touch.", 6 | "gives you a chocolate chip cookie. Oh wait, those are raisins. Bleck!", 7 | "gives you an enormous cookie. Poking it gives you more cookies. Weird.", 8 | "gives you a fortune cookie. It reads \"Why aren't you working on any projects?\"", 9 | "gives you a fortune cookie. It reads \"Give that special someone a compliment\"", 10 | "gives you a fortune cookie. It reads \"Take a risk!\"", 11 | "gives you a fortune cookie. It reads \"Go outside.\"", 12 | "gives you a fortune cookie. It reads \"Don't forget to eat your veggies!\"", 13 | "gives you a fortune cookie. It reads \"Do you even lift?\"", 14 | "gives you a fortune cookie. It reads \"m808 pls\"", 15 | "gives you a fortune cookie. It reads \"If you move your hips, you'll get all the ladies.\"", 16 | "gives you a fortune cookie. It reads \"I love you.\"", 17 | "gives you a Golden Cookie. You can't eat it because it is made of gold. Dammit.", 18 | "gives you an Oreo cookie with a glass of milk!", 19 | "gives you a rainbow cookie made with love :heart:", 20 | "gives you an old cookie that was left out in the rain, it's moldy.", 21 | "bakes you fresh cookies, it smells amazing." 22 | ] -------------------------------------------------------------------------------- /src/commands/economy/work.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | const fs = require('fs'); 3 | let bal = require('../../database/balance.json'); 4 | let works = require('../../database/works.json'); 5 | 6 | exports.run = async (client, message, args, color) => { 7 | 8 | if(!bal[message.author.id]){ 9 | bal[message.author.id] = { 10 | balance: 0 11 | }; 12 | } 13 | if(!works[message.author.id]) { 14 | works[message.author.id] = { 15 | work: 0 16 | }; 17 | } 18 | 19 | const Jwork = require('../../../src/work.json'); 20 | const JworkR = Jwork[Math.floor(Math.random() * Jwork.length)]; 21 | var random = Math.floor(Math.random() * 20) + 3; 22 | let curBal = bal[message.author.id].balance 23 | bal[message.author.id].balance = curBal + random; 24 | let curWork = works[message.author.id].work 25 | works[message.author.id].work = curWork + 1; 26 | fs.writeFile('./src/database/works.json', JSON.stringify(works, null, 2), (err) => { 27 | if (err) console.log(err) 28 | }) 29 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 30 | let embed = new Discord.RichEmbed() 31 | .setColor(color) 32 | .setDescription(` 33 | **\💼 | ${message.author.username}**, ${JworkR} 💴 **${random}** 34 | `) 35 | message.channel.send(embed) 36 | if (err) console.log(err) 37 | }); 38 | } 39 | 40 | exports.conf = { 41 | aliases: [], 42 | cooldown: "10" 43 | } 44 | 45 | exports.help = { 46 | name: "work", 47 | description: "Go work and get your reward don\'t be lazy", 48 | usage: "work" 49 | } 50 | -------------------------------------------------------------------------------- /src/events/messageUpdate.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | const fs = require('fs'); 3 | const { embed_color } = require('../config.json'); 4 | 5 | module.exports = (client, oldMessage, newMessage) => { 6 | if (oldMessage.author.bot) return; 7 | let editEmbed = new Discord.RichEmbed() 8 | .setAuthor(`${newMessage.author.tag} | Edited message`, newMessage.author.displayAvatarURL) 9 | .setDescription(`**Message sent by ${newMessage.author} edited in ${oldMessage.channel.toString()}**`) 10 | .addField("Before Edited:", `${oldMessage.content}` || "No content") 11 | .addField("Edited To:", `${newMessage.content}` || "No content") 12 | .addField("Link to message:", newMessage.url || newMessage.link || 'No URL') 13 | .setFooter(`ID: ${newMessage.id}`) 14 | .setColor(embed_color).setTimestamp() 15 | 16 | var log = JSON.parse(fs.readFileSync('./src/database/logging.json', 'utf8')) 17 | let logsetting = JSON.parse(fs.readFileSync('./src/database/logonoff.json', 'utf8')); 18 | 19 | if(!logsetting[oldMessage.guild.id]){ 20 | logsetting[oldMessage.guild.id] = { 21 | checker: 1 22 | }; 23 | } 24 | if(!log[oldMessage.guild.id]) return; 25 | let values = logsetting[oldMessage.guild.id].checker 26 | 27 | if(values === undefined) return; 28 | if(values === 0) return; 29 | if(values === 1) { 30 | var log = JSON.parse(fs.readFileSync('./src/database/logging.json', 'utf8')) 31 | if(!log) return; 32 | let channel = oldMessage.guild.channels.get(`${log[oldMessage.guild.id].channel}`); 33 | if(!channel) return; 34 | channel.send(editEmbed); 35 | } 36 | }; -------------------------------------------------------------------------------- /src/commands/fun/hug.js: -------------------------------------------------------------------------------- 1 | const { RichEmbed } = require('discord.js'); 2 | const { get } = require('node-superfetch'); 3 | 4 | exports.run = async(client, message, args, color) => { 5 | 6 | var user = message.mentions.users.first() || client.users.get(args[0]); 7 | if (!user) return args.missing(message, 'You need to mention user you want to hug', client.commands.get('hug').help); 8 | 9 | const { body } = await get('https://nekos.life/api/v2/img/hug'); 10 | 11 | var embed = new RichEmbed() 12 | if(user.id === message.author.id) { 13 | embed.setDescription(`**${message.author.username}**, Are you alone? Okay here some hug for you.`) 14 | embed.setImage(body.url).setColor(color) 15 | embed.setFooter(`Request by: ${message.author.tag} | ${client.user.username} v${client.version}`) 16 | } else if(user.id === client.user) { 17 | embed.setDescription(`Oh thanks **${message.author.username}** for giving me your hugs, So cute.`) 18 | embed.setImage(body.url).setColor(color) 19 | embed.setFooter(`Request by: ${message.author.tag} | ${client.user.username} v${client.version}`) 20 | } else { 21 | embed.setDescription(`**${message.author.username}** hugs **${user.username}**`) 22 | embed.setImage(body.url) 23 | embed.setFooter(`Request by: ${message.author.tag} | ${client.user.username} v${client.version}`) 24 | } 25 | embed.setColor(color) 26 | return message.channel.send(embed); 27 | 28 | } 29 | exports.conf = { 30 | aliases: [], 31 | cooldown: '0' 32 | } 33 | exports.help = { 34 | name: 'hug', 35 | description: 'give someone a cute hug', 36 | usage: 'hug <@user | id>' 37 | } -------------------------------------------------------------------------------- /src/commands/process/reload.js: -------------------------------------------------------------------------------- 1 | const { owners_id } = require('../../config.json'); 2 | 3 | exports.run = async (client, message, args) => { 4 | let msg = message; 5 | 6 | owners_id.forEach(async function(owner) { 7 | if(message.author.id !== owner) return; 8 | 9 | 10 | if(!args.length) return args.missing(msg, `Must provide a command to reload.`, client.commands.get('reload').help); 11 | 12 | let command; 13 | if (client.commands.has(args[1])) { 14 | command = client.commands.get(args[1]); 15 | } else if (client.aliases.has(args[1])) { 16 | command = client.commands.get(client.aliases.get(args[1])); 17 | } 18 | if(!command) return msg.channel.send(`The command \`${args[1]}\` doesn't seem to exist, nor is it an alias. Try again!`); 19 | 20 | if(command.db) await command.db.close(); 21 | 22 | command = command.help.name; 23 | 24 | delete require.cache[require.resolve(`../../commands/${args[0]}/${command}.js`)]; 25 | let cmd = require(`../../commands/${args[0]}/${command}`); 26 | client.commands.delete(command); 27 | if(cmd.init) cmd.init(client); 28 | client.aliases.forEach((cmd, alias) => { 29 | if (cmd === command) client.aliases.delete(alias); 30 | }); 31 | client.commands.set(command, cmd); 32 | cmd.conf.aliases.forEach(alias => { 33 | client.aliases.set(alias, cmd.help.name); 34 | }); 35 | 36 | msg.channel.send(`The command \`${command}\` has been reloaded`); 37 | }); 38 | }; 39 | 40 | exports.conf = { 41 | aliases: [], 42 | }; 43 | 44 | exports.help = { 45 | name: 'reload', 46 | description: 'Reloads a command that\'s been modified.', 47 | usage: 'reload ' 48 | }; -------------------------------------------------------------------------------- /src/commands/process/debug.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | const fs = require("fs"); 3 | const { owners_id } = require('../../config.json'); 4 | 5 | exports.run = async(client, message, args, color, prefix) => { 6 | owners_id.forEach(async function(owner) { 7 | if (message.author.id !== owner) return; 8 | 9 | function getTime() { 10 | 11 | var date = new Date(); 12 | 13 | var hour = date.getHours(); 14 | hour = (hour < 10 ? "0" : "") + hour; 15 | 16 | var min = date.getMinutes(); 17 | min = (min < 10 ? "0" : "") + min; 18 | 19 | var sec = date.getSeconds(); 20 | sec = (sec < 10 ? "0" : "") + sec; 21 | 22 | return hour + ":" + min + ":" + sec; 23 | } 24 | var time = getTime(); 25 | 26 | function getDateNow() { 27 | 28 | var date = new Date(); 29 | 30 | var year = date.getFullYear(); 31 | 32 | var month = date.getMonth() + 1; 33 | month = (month < 10 ? "0" : "") + month; 34 | 35 | var day = date.getDate(); 36 | day = (day < 10 ? "0" : "") + day; 37 | 38 | 39 | return month + "." + day + "." + year; 40 | } 41 | var date = getDateNow(); 42 | 43 | client.on('debug', (debug) => { 44 | let debugged = debug.replace(client.config.env.AKARI, '[RETACTED: Hidden To Prevent Leaking]') 45 | message.channel.send(`\`\`\`[Time: ${time}] [Date: ${date}]\r\n${debugged}\`\`\``) 46 | fs.appendFile("./logs/debug.txt", (`[Time: ${time}]\r\n[Date: ${date}]\r\n${debugged}\r\n`), (err) => { 47 | 48 | }) 49 | }) 50 | }) 51 | } 52 | 53 | exports.conf = { 54 | aliases: ['debugger'], 55 | cooldown: '0' 56 | } 57 | 58 | exports.help = { 59 | name: 'debug', 60 | description: 'This command just for owner nvm', 61 | usage: 'debug' 62 | } -------------------------------------------------------------------------------- /src/commands/fun/8ball.js: -------------------------------------------------------------------------------- 1 | exports.run = async (client, message, args, color) => { 2 | let wishes = args.slice(0).join(""); 3 | let author = message.author.username; 4 | 5 | function get8ball(wishes, author) { 6 | /** 7 | * Lemme tell you, im not make this manually. 8 | * I have the ABSOLUTLY 8 BALL REFERENCES 9 | * https://en.wikipedia.org/wiki/Magic_8-Ball 10 | */ 11 | const ballRef = [ 12 | "It is certain.", 13 | "It is decidedly so.", 14 | "Without a doubt.", 15 | "Yes - definitely.", 16 | "You may rely on it.", 17 | "As I see it, yes.", 18 | "Most likely.", 19 | "Outlook good.", 20 | "Yes.", 21 | "Signs point to yes.", 22 | "Reply hazy, try again.", 23 | "Ask again later.", 24 | "Better not tell you now.", 25 | "Cannot predict now.", 26 | "Concentrate and try again.", 27 | "Don't count on in.", 28 | "My reply is no.", 29 | "My sources say no.", 30 | "Outlook not so good.", 31 | "Very doubtful." 32 | ] 33 | let randomize = Math.floor(Math.random() * ballRef.length); 34 | if (!wishes) return args.missing(message, "Ask something, please.", client.commands.get('8ball').help) 35 | return `\:8ball\: | ${ballRef[randomize]} \*\*${author}\*\*` 36 | } 37 | message.channel.send(get8ball(wishes, author)); 38 | } 39 | exports.conf = { 40 | aliases: ['8b'], 41 | cooldown: '5' 42 | } 43 | exports.help = { 44 | name: "8ball", 45 | description: "Tell to the mighty 8 Ball about your fortune.", 46 | usage: '8ball ' 47 | } 48 | -------------------------------------------------------------------------------- /src/commands/economy/dailies.js: -------------------------------------------------------------------------------- 1 | 2 | const db = require('quick.db'); 3 | const fs = require("fs"); 4 | var ms = require('parse-ms'); 5 | let balance = require("../../../src/database/balance.json"); 6 | 7 | exports.run = async(client, message, args, color) => { 8 | if (message.channel.type == "dm") return; 9 | 10 | if(!balance[message.author.id]){ 11 | balance[message.author.id] = { 12 | balance: 0 13 | }; 14 | } 15 | 16 | let curcoins = balance[message.author.id].balance; 17 | 18 | 19 | let cooldown = 8.64e+7, 20 | amount = 200 21 | 22 | let lastdaily = await db.fetch(`lastDaily_${message.author.id}`) 23 | if (lastdaily !== null && cooldown - (Date.now() - lastdaily) > 0) { 24 | let timeObj = ms(cooldown - (Date.now() - lastdaily)) 25 | let eh = require('../../../src/handle/cooldownAns.json'); 26 | let ops = eh[Math.floor(Math.random() * eh.length)]; 27 | message.channel.send(`**${message.author.username}**, ${ops} (Ratelimited)\n**You'll be able to collect your next daily in ${timeObj.hours} hours, ${timeObj.minutes} minutes and ${timeObj.seconds} seconds**`) 28 | } else { 29 | db.set(`lastDaily_${message.author.id}`, Date.now()); 30 | balance[message.author.id].balance = curcoins + amount; 31 | 32 | fs.writeFile("./src/database/balance.json", JSON.stringify(balance, null, 2), (err) => { 33 | message.channel.send(`**${message.author.username}, collected daily 💴 ${amount} balance**`); 34 | }) 35 | } 36 | } 37 | 38 | exports.conf = { 39 | aliases: ["daily"], 40 | cooldown: "3" 41 | } 42 | 43 | exports.help = { 44 | name: 'dailies', 45 | description: 'To get your daily everyday', 46 | usage: 'dailies | daily' 47 | } -------------------------------------------------------------------------------- /src/handle/module.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | const fs = require('fs'); 3 | 4 | module.exports = client => { 5 | client.commands = new Discord.Collection(); 6 | client.aliases = new Discord.Collection(); 7 | client.helps = new Discord.Collection(); 8 | 9 | //function loadCmds () { 10 | fs.readdir('./src/commands/', (err, categories) => { 11 | if (err) console.log(err); 12 | console.log(`Found total ${categories.length} category.`); 13 | categories.forEach(category => { 14 | let moduleConf = require(`../commands/${category}/module.json`); 15 | moduleConf.path = `./commands/${category}`; 16 | moduleConf.cmds = []; 17 | client.helps.set(category, moduleConf); 18 | if (!moduleConf) return; 19 | fs.readdir(`./src/commands/${category}`, (err, files) => { 20 | console.log(`Found total ${files.length - 1} command from ${category}.`) 21 | if (err) console.log(err); 22 | let commands = new Array(); 23 | files.forEach(file => { 24 | //delete require.cache[require.resolve(`../commands/${category}/${file}`)]; 25 | if (!file.endsWith('.js')) return; 26 | let prop = require(`../commands/${category}/${file}`); 27 | let cmdName = file.split('.')[0]; 28 | client.commands.set(prop.help.name, prop); 29 | prop.conf.aliases.forEach(alias => { 30 | client.aliases.set(alias, prop.help.name); 31 | }); 32 | client.helps.get(category).cmds.push(prop.help.name) 33 | }); 34 | }); 35 | }); 36 | }); 37 | } 38 | //} 39 | -------------------------------------------------------------------------------- /src/commands/process/snekfetch.js: -------------------------------------------------------------------------------- 1 | const { RichEmbed } = require('discord.js'); 2 | const { clean } = require('./eval.js'); 3 | const { owners_id } = require('../../config.json'); 4 | 5 | exports.run = async (client, msg, args) => { 6 | owners_id.forEach(async function(owner) { 7 | if (msg.author.id !== owner) return; 8 | 9 | if(args.length < 1) return args.missing(msg, 'No code provided', this.help); 10 | const tadi = Date.now(); 11 | const input = client.util.codeblock(args.join(' '), 'js'); 12 | if(input.length > 1024) input = await client.util.hastebin(args.join(' ')); 13 | const embed = new RichEmbed() 14 | .addField('📥 INPUT', input); 15 | try{ 16 | args = args.join(' ').trim().split('--'); 17 | let link = await eval(`client.snek.${args[0]}`); 18 | if(args[1] !== undefined) link = eval(`link.${args[1]}`); 19 | link = require('util').inspect(link); 20 | link = clean(link); 21 | if(link.length > 1024) link = await client.util.hastebin(link); 22 | else link = client.util.codeblock(link, 'js'); 23 | embed.addField('📤 OUTPUT', link); 24 | embed.setColor('#81FF00'); 25 | embed.setFooter(`\`${Date.now()-tadi}ms\``); 26 | return msg.channel.send(embed); 27 | }catch(e){ 28 | let err = clean(e.message); 29 | err = client.util.codeblock(e.message, 'ini'); 30 | if(err.length > 1024) err = await client.util.hastebin(e.message); 31 | embed.addField('⛔ ERROR', err); 32 | embed.setColor('#FF0023'); 33 | embed.setFooter(`\`${Date.now() - tadi}ms\``); 34 | return msg.channel.send(embed); 35 | } 36 | }) 37 | } 38 | 39 | exports.conf = { 40 | aliases: ['snek'], 41 | cooldown: '0' 42 | } 43 | 44 | exports.help = { 45 | name: 'snekfetch', 46 | description: 'make http request using some code', 47 | usage: 'snekfetch ', 48 | example: ['snekfetch https://random.dog/woof.json --body'] 49 | } -------------------------------------------------------------------------------- /src/work.json: -------------------------------------------------------------------------------- 1 | [ 2 | "You work as a flatulence smell reduction underwear maker and earn", 3 | "You work at Grandma's restaurant as a cook and earn", 4 | "You work as a professional snuggler and earn", 5 | "You work as a pumpkin painter and earn", 6 | "You work as a engineer and earn", 7 | "You work as a meerkat behaviour consultant and earn", 8 | "Your job as a fart collector is very interesting and earns you", 9 | "You work as a penguinologist and earn", 10 | "You work as a ear cleaner and earn", 11 | "You develop games and earn", 12 | "You work as a personal shopper and earn", 13 | "You work as a dog surfing instructor and earn", 14 | "You work as a beefeater and earn", 15 | "You work as a comedian and earn", 16 | "You work as the head of elephants and earn", 17 | "You work as an elementary school teacher and earn", 18 | "You work as a voice actor for Spongebob and managed to gain", 19 | "You had a fruitful day at the office today and earned", 20 | "You actually finished the plate of vegetables that your parents made you eat! You were awarded", 21 | "You work as child birth educator and earn", 22 | "You work as a body pillow factory salesman on the Internet for real weebs, the weebs gave you", 23 | "You work as a vibration consultant and earn", 24 | "Work at the icecream shop of your childhood dreams and earn", 25 | "You work as a professional minecraft hacker. You manage to rake in", 26 | "You dabbed so hard that even your mother is proud! You make", 27 | "You work as a professional cleaner. After hiding the body, you're handed", 28 | "You got cloned for sciene. You earned", 29 | "You work as a police officer and earn", 30 | "You work as a bush pruner for Donald Trump and earn", 31 | "You work as a paper towel sniffer and earn", 32 | "You work as a water slide tester and earn", 33 | "You milk a cow for" 34 | ] 35 | -------------------------------------------------------------------------------- /src/commands/admin/mute.js: -------------------------------------------------------------------------------- 1 | exports.run = async (client, message, args) => { 2 | if (!message.member.hasPermission('MUTE_MEMBERS')) return message.channel.send(`**${message.author.username}, Sorry, you need \`MUTE_MEMBERS\` Permission to use this commands**!`).then(msg=>msg.delete(7000)); 3 | if (!message.guild.member(client.user).hasPermission("MANAGE_ROLES")) return message.channel.send(`**${message.author.username}, Sorry, I need the following permission to \`mute\` command to work: \`MANAGE_ROLES\`**`).then(msg=>msg.delete(7000)); 4 | 5 | let member = message.mentions.members.first() || message.guild.members.get(args[0]); 6 | if (!member) return message.channel.send(`**${message.author.username}, Sorry, I can't find the user you mean**!`); 7 | 8 | let muterole = message.guild.roles.find(x => x.name === 'Muted'); 9 | if (!muterole) { 10 | try { 11 | muterole = await message.guild.createRole({ 12 | name: 'Muted', 13 | color: '#000000', 14 | permission: [] 15 | }); 16 | message.guild.channels.forEach(async (channel, id) => { 17 | await channel.overwritePermissions(muterole, { 18 | SEND_MESSAGES: false, 19 | ADD_REACTION: false, 20 | CONNECT: false 21 | }); 22 | }); 23 | } catch(e) { 24 | console.log(e.message); 25 | } 26 | }; 27 | 28 | if (member.roles.has(muterole.id)) return message.channel.send(`**${member.user.username}** Has already muted.`) 29 | await (member.addRole(muterole.id)); 30 | message.channel.send(`**${member.user.username}, Has been muted**.`); 31 | } 32 | 33 | exports.conf = { 34 | aliases: [] 35 | } 36 | 37 | exports.help = { 38 | name: "mute", 39 | description: "Mute someone annoying", 40 | usage: "mute @mention" 41 | } 42 | -------------------------------------------------------------------------------- /src/events/ready.js: -------------------------------------------------------------------------------- 1 | module.exports = async client => { 2 | //setTimeout(async () => { 3 | 4 | let guildsEval = await client.shard.broadcastEval('this.guilds.size') 5 | let channelsEval = await client.shard.broadcastEval('this.channels.size') 6 | let usersEval = await client.shard.broadcastEval('this.users.size') 7 | 8 | var botGuilds = guildsEval.reduce((prev, val) => prev + val) 9 | var botChannels = channelsEval.reduce((prev, val) => prev + val) 10 | var botUsers = usersEval.reduce((prev, val) => prev + val) 11 | 12 | var clientonmessage = ` 13 | | > Logging in... | 14 | | | 15 | | Logged in as ${client.user.tag} | 16 | | Working on ${botGuilds} servers! | 17 | | ${botChannels} channels and ${botUsers} users cached! | 18 | | | 19 | | LET'S GO! | 20 | | | 21 | | Bot created by Sharif#2769 & OwO#8287 | 22 | 23 | -----------------Bot's commands logs------------------` 24 | 25 | console.log(clientonmessage) 26 | const activities = require('../../src/assets/json/status'); 27 | 28 | client.setInterval(() => { 29 | const activity = activities[Math.floor(Math.random() * activities.length)]; 30 | client.user.setActivity(`t.help | ${activity.text}`, { type: activity.type }); 31 | }, 20000); 32 | 33 | setInterval(() => require('quick.db').add('uptime', client.uptime), 3600000) 34 | // update stats 35 | setInterval(() => client.updateStats(), 1000 * 60); 36 | 37 | client.setInterval(() => { 38 | for(const guild of client.guilds.array()){ 39 | const channel = guild.channels.filter(x => x.name === 'neko-present' || x.name === 'bot-spam').first(); 40 | if(!channel) continue; 41 | client.commands.get('neko').getNeko(channel, 'Hourly Neko Present'); 42 | } 43 | }, 3600000); 44 | 45 | //}, 10000) 46 | } -------------------------------------------------------------------------------- /src/assets/json/nobully.json: -------------------------------------------------------------------------------- 1 | [ 2 | "https://img.fireden.net/vg/image/1429/21/1429213405948.gif", 3 | "http://livedoor.4.blogimg.jp/netagazou_okiba/imgs/a/e/ae001952.gif", 4 | "http://i0.kym-cdn.com/photos/images/original/000/958/553/2ea.jpg", 5 | "https://images-cdn.9gag.com/photo/aqbMvxj_700b.jpg", 6 | "https://pics.me.me/its-very-rude-to-bully-pls-no-bully-ok-10430989.png", 7 | "http://i0.kym-cdn.com/entries/icons/facebook/000/018/273/plsnobully.jpg", 8 | "http://i0.kym-cdn.com/photos/images/original/000/843/647/a7e.png", 9 | "https://pics.me.me/d-dont-bully-nenecchi-no-bully-sakai-3630469.png", 10 | "http://pm1.narvii.com/6445/9042292483d2deb544466848cd3d477664d4dc8a_00.jpg", 11 | "http://i.imgur.com/0dKdpUI.jpg", 12 | "https://cdn.discordapp.com/attachments/367095978609868802/367811808725041153/no_bully.jpg", 13 | "https://cdn.discordapp.com/attachments/367095978609868802/367811832351686658/no_bully2.jpg", 14 | "https://cdn.discordapp.com/attachments/367095978609868802/367812653566918657/21909761_126764277976866_862083078284115968_n-anime-satania-gabrieldropout-by-yame-mate.png", 15 | "https://cdn.discordapp.com/attachments/367095978609868802/367812816092004360/bully.jpg", 16 | "https://cdn.discordapp.com/attachments/367095978609868802/367812835516088321/bully2.png", 17 | "https://cdn.discordapp.com/attachments/367095978609868802/367812977862246400/RVZWGDl.jpg", 18 | "https://cdn.discordapp.com/attachments/367095978609868802/367813216492978176/fc550x550creme.png", 19 | "https://cdn.discordapp.com/attachments/367095978609868802/368883747078012939/image.png", 20 | "https://cdn.discordapp.com/attachments/367095978609868802/368883283062292491/2sv4Gw7.png", 21 | "https://cdn.discordapp.com/attachments/367095978609868802/368882854165479456/image.png", 22 | "https://cdn.discordapp.com/attachments/367095978609868802/368882024045346817/image.png", 23 | "https://i.warosu.org/data/jp/img/0126/71/1415419432741.gif" 24 | ] -------------------------------------------------------------------------------- /src/commands/fun/ship.js: -------------------------------------------------------------------------------- 1 | const { get } = require("node-superfetch"); 2 | 3 | exports.run = async (client, message, args, color, prefix) => { 4 | 5 | const shipped = message.mentions.members.size === 2 ? message.mentions.members.array()[1] : message.member; 6 | const shipper = message.mentions.members.size === 1 || message.mentions.members.size === 2 ? message.mentions.members.array()[0] : message.member; 7 | const first_length = Math.round(shipper.displayName.length / 2); 8 | const first_half = shipper.displayName.slice(0, first_length); 9 | const second_length = Math.round(shipped.displayName.length / 2); 10 | const second_half = shipped.displayName.slice(second_length); 11 | const final_name = first_half + second_half; 12 | const score = Math.random() * (0, 100); 13 | const prog_bar = Math.ceil(Math.round(score) / 100 * 10); 14 | const counter = "▰".repeat(prog_bar) + "▱".repeat(10 - prog_bar); 15 | const m = await message.channel.send('*Please Wait...*'); 16 | message.channel.startTyping(); 17 | const { body } = await get(`https://nekobot.xyz/api/imagegen?type=ship&user1=${shipper.user.displayAvatarURL}&user2=${shipped.user.displayAvatarURL}`); 18 | 19 | return message.channel.send({ 20 | embed: { 21 | "title": `${shipper.displayName} ❤ ${shipped.displayName}`, 22 | "description": `**Love %**\n${counter}\n\n${final_name}`, 23 | "url": body.message, 24 | "color": 6192321, 25 | "image": { 26 | "url": body.message 27 | }, 28 | "footer": { 29 | "icon_url": message.author.displayAvatarURL, 30 | "text": `Request by ${message.author.tag} | ${client.user.username} v${client.version}` 31 | } 32 | } 33 | }).then(() => {m.delete(); message.channel.stopTyping();}); 34 | 35 | } 36 | 37 | exports.conf = { 38 | aliases: [], 39 | cooldown: "" 40 | } 41 | 42 | exports.help = { 43 | name: "ship", 44 | description: "Ship user1 and user2", 45 | usage: "ship [@user1] [@user2]" 46 | } 47 | -------------------------------------------------------------------------------- /src/commands/economy/background.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | const fs = require('fs'); 3 | let bg = require('../../database/background.json'); 4 | let bal = require('../../database/balance.json'); 5 | 6 | exports.run = async (client, message, args, color) => { 7 | 8 | if(!bg[message.author.id]){ 9 | bg[message.author.id] = { 10 | background: 'http://bit.ly/2NS6CSb' 11 | }; 12 | } 13 | if(!bal[message.author.id]){ 14 | bal[message.author.id] = { 15 | balance: 0 16 | }; 17 | } 18 | 19 | let amount = 250; 20 | 21 | if (bal[message.author.id].balance < amount) return message.channel.send(`**${message.author.username}**, You not have insufficient balance yet you need 💴 **${amount}** for changes background, Keep active and don't forget to take your daily everyday!`) 22 | 23 | let newBg = message.attachments.first(); 24 | if(!newBg) return args.missing(message, 'You need to upload the image to set new background', client.commands.get('background').help); 25 | bg[message.author.id].background = newBg.url; 26 | let curbal = bal[message.author.id].balance 27 | bal[message.author.id].balance = curbal - amount; 28 | let h = await message.channel.send('*Please Wait...*'); 29 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 30 | if (err) console.log(err) 31 | }); 32 | fs.writeFile('./src/database/background.json', JSON.stringify(bg, null, 2), (err) => { 33 | 34 | let bgEmbed = new Discord.RichEmbed() 35 | .setColor(color) 36 | .setAuthor(`Your background image has been set`, message.author.displayAvatarURL) 37 | .setDescription(`💴 **${amount}** has been deducted from your balance for change the profile card background!`) 38 | message.channel.send(bgEmbed).then(()=>{ h.delete()}); 39 | }); 40 | 41 | 42 | } 43 | 44 | exports.conf = { 45 | aliases: ['bg'], 46 | cooldown: "10" 47 | } 48 | 49 | exports.help = { 50 | name: "background", 51 | description: "Set your profile card background (upload image)", 52 | usage: "background " 53 | } 54 | -------------------------------------------------------------------------------- /src/commands/process/eco.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | let bal = require('../../database/balance.json'); 3 | const fishh = require('../../database/fish.json'); 4 | const { owners_id } = require('../../config.json'); 5 | 6 | exports.run = async (client, message, args, color) => { 7 | 8 | owners_id.forEach(async function(owner){ 9 | if(message.author.id !== owner) return; 10 | 11 | 12 | var user = message.mentions.users.first() || client.users.get(args[1]); 13 | if(!user) return message.channel.send(`**${message.author.username}**, Please mention the user or use the user id to set.`); 14 | 15 | if(!fishh[user.id]){ 16 | fishh[user.id] = { 17 | fish: 0 18 | }; 19 | } 20 | 21 | if(!bal[user.id]){ 22 | bal[user.id] = { 23 | balance: 0 24 | }; 25 | } 26 | 27 | var amount = parseInt(args[2]); 28 | 29 | if(!amount) return message.channel.send(`**${message.author.username}**, Please enter the amount to set.`); 30 | if(isNaN(amount)) return message.channel.send(`**${message.author.username}**, Please enter a valid number!`); 31 | 32 | if(args[0] === 'bal' || args[0] === 'balance'){ 33 | let curBal = bal[user.id].balance; 34 | bal[user.id].balance = amount; 35 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2),(err) => { 36 | message.channel.send(`Balance for **${user.username}** has been set to 💴 **${amount}** \`😃\`!`); 37 | if(err) console.log(err); 38 | }); 39 | } 40 | 41 | if(args[0] === 'fish'){ 42 | let curFish = fishh[user.id].fish; 43 | fishh[user.id].fish = amount; 44 | fs.writeFile('./src/database/fish.json', JSON.stringify(fishh, null, 2),(err) => { 45 | message.channel.send(`Fish for **${user.username}** has been set to 🎣 **${amount}** \`😃\`!`); 46 | if(err) console.log(err); 47 | }); 48 | } 49 | 50 | }); 51 | } 52 | 53 | exports.conf = { 54 | aliases: ['seteco'], 55 | cooldown: "" 56 | } 57 | 58 | exports.help = { 59 | name: "eco", 60 | description: "Set the user economy", 61 | usage: "eco <@user> " 62 | } 63 | -------------------------------------------------------------------------------- /src/commands/economy/transfer.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | let bal = require('../../database/balance.json'); 3 | let ball = require('../../database/balance.json'); 4 | 5 | exports.run = async (client, message, args, color) => { 6 | 7 | let user = message.mentions.users.first() || client.users.get(args[0]); 8 | 9 | if(!user) return message.channel.send(`**${message.author.username}**, No user found! Please mention someone!`); 10 | if (user.id == message.author.id) return message.channel.send('You can\'t transfer to yourselft!'); 11 | if(user.bot) return message.channel.send(`${message.author.username}, You can't transfer your balance to bot!`); 12 | if(!args[1]) return message.channel.send('Please provided the value to transfer'); 13 | if(isNaN(args[1])) return message.channel.send('Type the valid value!'); 14 | 15 | if(!bal[user.id]){ 16 | bal[user.id] = { 17 | balance: 0 18 | }; 19 | } 20 | if(!ball[message.author.id]){ 21 | ball[message.author.id] = { 22 | balance: 0 23 | }; 24 | } 25 | 26 | if(ball[message.author.id].balance < args[1]) return message.channel.send(`Check again **${message.author.username}**, You dont have \💴**${args[1]}**`); 27 | 28 | var curBal = bal[user.id].balance; 29 | let curBall = ball[message.author.id].balance; 30 | 31 | bal[user.id].balance = curBal + parseInt(args[1]) 32 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 33 | user.send(`\🏧 | **Transfer Receipt**\`\`\`You have received 💴 ${args[1]} from user ${message.author.tag}\n(ID: ${message.author.id})\`\`\``); 34 | if(err) console.log(err); 35 | }); 36 | ball[message.author.id].balance = curBall - parseInt(args[1]) 37 | fs.writeFile('./src/database/balance.json', JSON.stringify(ball, null, 2), (err) => { 38 | message.channel.send(`Hey **${user.tag}**, You got \💴 **${args[1]}** from **${message.author.tag}**`); 39 | if(err) console.log(err); 40 | }); 41 | 42 | } 43 | 44 | exports.conf = { 45 | aliases: ['tf'], 46 | cooldown: "5" 47 | } 48 | 49 | exports.help = { 50 | name: "transfer", 51 | description: "Transfer balance to other user", 52 | usage: "transfer <@user|id> " 53 | } 54 | -------------------------------------------------------------------------------- /src/commands/economy/rep.js: -------------------------------------------------------------------------------- 1 | 2 | const db = require('quick.db'); 3 | const fs = require("fs"); 4 | var ms = require('parse-ms'); 5 | let rep = require("../../../src/database/rep.json"); 6 | 7 | exports.run = async(client, message, args, color) => { 8 | 9 | //if (message.author.id !== '444454206800396309') return message.channel.send('Currently in development'); 10 | if (message.channel.type == "dm") return; 11 | 12 | let cooldown = 8.64e+7, 13 | amount = 1 14 | 15 | let lastrep = await db.fetch(`lastRep_${message.author.id}`) 16 | if (lastrep !== null && cooldown - (Date.now() - lastrep) > 0) { 17 | let timeObj = ms(cooldown - (Date.now() - lastrep)) 18 | let eh = require('../../../src/handle/cooldownAns.json'); 19 | let ops = eh[Math.floor(Math.random() * eh.length)]; 20 | message.channel.send(`**${message.author.username}**, ${ops} (Ratelimited)\n**You'll be able give reputation point again in ${timeObj.hours} hours, ${timeObj.minutes} minutes and ${timeObj.seconds} seconds**`) 21 | 22 | } else { 23 | 24 | let user = message.mentions.users.first() || client.users.get(args[0]); 25 | 26 | if(!user) return message.channel.send(`**${message.author.username}**, You can rep someone now,\nYou need to mention user to be given reputation!`); 27 | if (user.bot) return message.channel.send(`**${message.author.username}**, You cannot rep a bot`); 28 | if (user.id == message.author.id) return message.channel.send(`**${message.author.username}**, You cannot rep yourselft!`); 29 | if(!rep[user.id]){ 30 | rep[user.id] = { 31 | rep: 0 32 | }; 33 | } 34 | 35 | let curRep = rep[user.id].rep; 36 | 37 | db.set(`lastRep_${message.author.id}`, Date.now()); 38 | rep[user.id].rep = curRep + amount; 39 | fs.writeFile("./src/database/rep.json", JSON.stringify(rep, null, 2), (err) => { 40 | message.channel.send(`**🎖️ | Hey <@${user.id}>, You got reputation points from ${message.author.tag}**`); 41 | }) 42 | } 43 | } 44 | 45 | exports.conf = { 46 | aliases: ["reputation"], 47 | cooldown: "5" 48 | } 49 | 50 | exports.help = { 51 | name: 'rep', 52 | description: 'Give someone reputation point', 53 | usage: 'rep <@mention>' 54 | } -------------------------------------------------------------------------------- /src/commands/economy/level.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const { Canvas } = require('canvas-constructor'); 3 | let xp = require("../../database/xp.json"); 4 | 5 | exports.run = async (client, message, args, color) => { 6 | if (message.channel.type == "dm") return; 7 | 8 | var user = message.mentions.users.first() || client.users.get(args[0]); 9 | if(!user) user = message.author; 10 | if (user.bot) return message.channel.send(`**${message.author.username}, Bot don't have level!**`); 11 | //wajib biar ga undefined json 12 | if(!xp[user.id]){ 13 | xp[user.id] = { 14 | xp: 0, 15 | level: 1 16 | }; 17 | } 18 | //buat read json 19 | let curxp = xp[user.id].xp; 20 | let curlvl = xp[user.id].level; 21 | let nxtLvlXp = curlvl * 500; 22 | let difference = curxp/nxtLvlXp *297; 23 | let difference2 = nxtLvlXp - curxp; 24 | 25 | try { 26 | async function createCanvas() { 27 | return new Canvas(300,50) 28 | .setColor('lightgrey') 29 | .addRect(0,0,300,200) 30 | .setColor('#f44262') 31 | .addRect(0,0,difference, 200) 32 | .setTextFont('bold 15px Courier New') 33 | .setColor('#000000') 34 | .addText(`${curxp} / ${nxtLvlXp}`, 120,30) 35 | .toBufferAsync() 36 | } 37 | let m = await message.channel.send('*Please Wait...*'); 38 | const gumen = ` 39 | __**\`${user.username}\`'**s level information__ 40 | 41 | Current Level: **${curlvl}** - Total XP : **${curxp}** 42 | Progress: ${getProgbar(curxp, nxtLvlXp, 10)} 43 | Needed XP to reach level **${curlvl +1}** : **${difference2}** 44 | `; 45 | message.channel.send(gumen, {file: new Discord.Attachment(await createCanvas(), 'xp progress till level up.png')}).then(() => {m.delete()}) 46 | } catch (e) { 47 | message.channel.send(`Oh no an error occurred :( \`${e.message}\` try again later.`); 48 | } 49 | } 50 | function getProgbar(current, max, length){ 51 | const curBer = Math.floor((current/max)*length); 52 | let str = ''; 53 | for(let i = 0; i < length; i++){ 54 | str += i < curBer ? '✅' :'⬛' 55 | } 56 | return str; 57 | } 58 | 59 | global.progBar = getProgbar 60 | 61 | exports.conf = { 62 | aliases: ["lvl"], 63 | cooldown: "4" 64 | } 65 | 66 | exports.help = { 67 | name: 'level', 68 | description: 'To check someone level', 69 | usage: 'level [@mention]' 70 | } -------------------------------------------------------------------------------- /src/commands/process/hypesquad.js: -------------------------------------------------------------------------------- 1 | const { owners_id } = require('../../../src/config'); 2 | const { loadImage } = require('canvas'); 3 | const { Canvas } = require('canvas-constructor'); 4 | const { get } = require('node-superfetch'); 5 | const { RichEmbed } = require('discord.js'); 6 | 7 | exports.run = async (client, message, args, color) => { 8 | let user = message.mentions.users.first() || client.users.get(args[1]); 9 | if(!user) user = message.author; 10 | if(!args[0]) return args.missing(message, 'You must select from bravery or balance.', client.commands.get('hypesquad').help); 11 | 12 | if (`${args[0]}` === `bravery`) { 13 | const { body: plate } = await get('https://cdn.discordapp.com/attachments/498790982083543070/498791065101533205/BraveryCadre.png');// link gambarnya, yg di storage aja tuu 14 | const { body: ava } = await get(user.displayAvatarURL.replace(/\.gif/g, '.png')); 15 | const { width, height } = await loadImage(ava); 16 | const attachment = new Canvas(width, height) 17 | .addImage(ava, 0, 0, width, height) 18 | .addImage(plate, 0,0, width, height) 19 | .toBuffer(); 20 | let embed = new RichEmbed() 21 | .setColor(color) 22 | .setAuthor(`${user.username}`, user.displayAvatarURL) 23 | .setTitle('bravery.png') 24 | .attachFile({attachment: attachment, name: 'bravery.png'}) 25 | .setImage('attachment://bravery.png') 26 | return message.channel.send(embed); 27 | } 28 | 29 | if (`${args[0]}` === `balance`) { 30 | const { body: plate } = await get('https://cdn.discordapp.com/attachments/498790982083543070/498791065101533204/Image-2.jpeg');// link gambarnya, yg di storage aja tuu 31 | const { body: ava } = await get(user.displayAvatarURL.replace(/\.gif/g, '.png')); 32 | const { width, height } = await loadImage(ava); 33 | const attachment = new Canvas(width, height) 34 | .addImage(ava, 0, 0, width, height) 35 | .addImage(plate, 0,0, width, height) 36 | .toBuffer(); 37 | let embed2 = new RichEmbed() 38 | .setColor(color) 39 | .setAuthor(`${user.username}`, user.displayAvatarURL) 40 | .setTitle('balance.png') 41 | .attachFile({attachment: attachment, name: 'balance.png'}) 42 | .setImage('attachment://balance.png') 43 | return message.channel.send(embed2); 44 | } 45 | } 46 | 47 | exports.conf = { 48 | aliases: ['hs'], 49 | cooldown: '5' 50 | } 51 | 52 | exports.help = { 53 | name: 'hypesquad', 54 | description: 'draw your/user avatar hypesquad', 55 | usage: 'hypesquad [@user | id]' 56 | } -------------------------------------------------------------------------------- /src/commands/economy/fish.js: -------------------------------------------------------------------------------- 1 | const fishes = require('../../assets/json/fishy'); 2 | let bal = require('../../database/balance.json'); 3 | let fishh = require('../../database/fish.json'); 4 | const fs = require('fs'); 5 | const Discord = require('discord.js'); 6 | 7 | exports.run = async (client, message, args, color) => { 8 | 9 | if(!args[0]){ 10 | if(!bal[message.author.id]){ 11 | bal[message.author.id] = { 12 | balance: 0 13 | }; 14 | } 15 | if(!fishh[message.author.id]){ 16 | fishh[message.author.id] = { 17 | fish: 0 18 | }; 19 | } 20 | 21 | let curFish = fishh[message.author.id].fish; 22 | let curBal = bal[message.author.id].balance; 23 | 24 | const fishID = Math.floor(Math.random() * 10) + 1; 25 | let rarity; 26 | if (fishID < 5) rarity = 'junk'; 27 | else if (fishID < 8) rarity = 'common'; 28 | else if (fishID < 9) rarity = 'uncommon'; 29 | else if (fishID < 10) rarity = 'rare'; 30 | else rarity = 'legendary'; 31 | const fish = fishes[rarity]; 32 | const worth = client.util.randomRange(fish.min, fish.max); 33 | bal[message.author.id].balance = curBal + worth; 34 | fishh[message.author.id].fish = curFish + 1; 35 | fs.writeFile('./src/database/fish.json', JSON.stringify(fishh, null, 2), (err) => { 36 | if (err) console.log(err); 37 | }); 38 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 39 | let embed = new Discord.RichEmbed() 40 | .setColor(color) 41 | .setDescription(`🎣 | **${message.author.username}**, You caught a ${fish.symbol}. I bet it'd sell for around 💴 **${worth}**.`) 42 | return message.channel.send(embed); 43 | }); 44 | } 45 | if(args[0] === 'list' || args[0] === 'reward'){ 46 | 47 | let lEmbed = new Discord.RichEmbed() 48 | .setColor(color) 49 | .setAuthor(`List fish name and reward you can get!`) 50 | .setDescription(` 51 | \`\`\`🔧Junk :: max reward: 5, min reward: 1 52 | 53 | 🐟Common :: max reward: 25, min reward: 10 54 | 55 | 🐠Uncommon :: max reward: 50, min reward: 18 56 | 57 | 🦑Rare :: max reward: 75, min reward: 30 58 | 59 | 🐋Legendary :: max reward: 100, min reward: 50\`\`\` 60 | **All reward are random from max/min** 61 | ​ 62 | `) 63 | .setFooter(`Request by: ${message.author.tag} | ${client.user.username} v${client.version}`) 64 | message.channel.send(lEmbed); 65 | } 66 | 67 | } 68 | 69 | exports.conf = { 70 | aliases: ['fishy', 'fishing'], 71 | cooldown: "17" 72 | } 73 | 74 | exports.help = { 75 | name: "fish", 76 | description: "Go fishing.", 77 | usage: "fish [list]" 78 | } 79 | -------------------------------------------------------------------------------- /src/commands/process/eval.js: -------------------------------------------------------------------------------- 1 | const { RichEmbed } = require('discord.js'); 2 | const { owners_id } = require("../../config.json"); 3 | const snek = require('node-superfetch'); 4 | const path = require("path"); 5 | const db = require('quick.db'); 6 | const Economy = require("discordeco.js"); 7 | const choice = ['🚫'] 8 | 9 | exports.run = async (client, message, args, color) => { 10 | var bot = client; 11 | var msg = message; 12 | 13 | owners_id.forEach(async function(owner) { 14 | if (message.author.id !== owner) return; 15 | 16 | const embed = new RichEmbed() 17 | .setColor(color) 18 | .addField('Input', '```js\n' + args.join(" ") + '```') 19 | 20 | try { 21 | const code = args.join(" "); 22 | if (!code) return args.missing(message, 'BAKA!! I cannot execute anything >:(', client.commands.get('eval').help); 23 | let evaled; 24 | if (code.includes(`token`)) { 25 | evaled = 'Thats bad... Too bad Onii-chan'; 26 | } else { 27 | evaled = eval(code); 28 | } 29 | 30 | if (typeof evaled !== "string") 31 | evaled = require('util').inspect(evaled, { depth: 0}); 32 | 33 | let output = clean(evaled); 34 | if (output.length > 1024) { 35 | const { body } = await snek.post('https://www.hastebin.com/documents').send(output); 36 | embed.addField('Output', `https://www.hastebin.com/${body.key}.js`); 37 | } else { 38 | embed.addField('Output', '```js\n' + output + '```'); 39 | } 40 | message.channel.send(embed); 41 | } catch (e) { 42 | let error = clean(e); 43 | if (error.length > 1024) { 44 | const { body } = await snek.post('https://www.hastebin.com/documents').send(error); 45 | embed.addField('Error', `https://www.hastebin.com/${body.key}.js`); 46 | } else { 47 | embed.addField('Error', '```js\n' + error + '```'); 48 | } 49 | message.channel.send(embed); 50 | } 51 | }); 52 | } 53 | 54 | function clean(text) { 55 | if (typeof(text) === "string") 56 | return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203)); 57 | else 58 | return text; 59 | } 60 | 61 | exports.clean = (text) => { 62 | if (typeof(text) === "string") 63 | return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203)); 64 | else 65 | return text; 66 | } 67 | 68 | exports.conf = { 69 | aliases: ["ev", "e"], 70 | cooldowns: '0' 71 | } 72 | 73 | exports.help = { 74 | name: "eval", 75 | description: "evaluated", 76 | usage: "eval " 77 | } -------------------------------------------------------------------------------- /src/events/channelUpdate.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | const fs = require('fs'); 3 | const { embed_color } = require('../config.json'); 4 | 5 | module.exports = (client, oldChannel, newChannel) => { 6 | var color = embed_color; 7 | 8 | var Changes = { 9 | unknown: 0, 10 | topic: 1, 11 | name: 2 12 | }; 13 | var change = Changes.unknown; 14 | 15 | if(newChannel.name != oldChannel.name) 16 | change = Changes.name; 17 | 18 | if(newChannel.topic != oldChannel.topic) 19 | change = Changes.topic; 20 | 21 | var log = JSON.parse(fs.readFileSync('./src/database/logging.json', 'utf8')) 22 | let logsetting = JSON.parse(fs.readFileSync('./src/database/logonoff.json', 'utf8')); 23 | 24 | if(!logsetting[oldChannel.guild.id]){ 25 | logsetting[oldChannel.guild.id] = { 26 | checker: 1 27 | }; 28 | } 29 | if(!log[oldChannel.guild.id]) return; 30 | let values = logsetting[oldChannel.guild.id].checker 31 | 32 | if(values === undefined) return; 33 | if(values === 0) return; 34 | if(values === 1) { 35 | var log = JSON.parse(fs.readFileSync('./src/database/logging.json', 'utf8')) 36 | if(!log) return; 37 | let channel = oldChannel.guild.channels.get(`${log[oldChannel.guild.id].channel}`); 38 | if(!channel) return; 39 | 40 | if(channel != null) { 41 | switch (change) { 42 | case Changes.unknown: 43 | let embed = new Discord.RichEmbed() 44 | .setColor(color) 45 | .setDescription(`Channel Updated: ${newChannel.name}`) 46 | .setFooter(`ID: ${newChannel.id}`).setTimestamp() 47 | //channel.send(embed) 48 | break; 49 | case Changes.topic: 50 | let embed1 = new Discord.RichEmbed() 51 | .setColor(color) 52 | .setAuthor(`Channel Topic Updated`) 53 | .setDescription(`Channel: ${newChannel.name}`) 54 | .addField('Before', `${oldChannel.topic}` || 'No topic') 55 | .addField('After', `${newChannel.topic}` || 'No topic') 56 | .setFooter(`ID: ${newChannel.id}`).setTimestamp() 57 | channel.send(embed1) 58 | break; 59 | case Changes.name: 60 | let embed2 = new Discord.RichEmbed() 61 | .setColor(color) 62 | .setAuthor(`Channel Name Updated`) 63 | .setDescription(`Channel: ${newChannel}`) 64 | .addField('Before', `${oldChannel.name}` || 'No name') 65 | .addField('After', `${newChannel.name}` || 'No name') 66 | .setFooter(`ID: ${newChannel.id}`).setTimestamp() 67 | channel.send(embed2) 68 | break; 69 | } 70 | } 71 | 72 | } 73 | }; -------------------------------------------------------------------------------- /src/commands/utility/help.js: -------------------------------------------------------------------------------- 1 | const { RichEmbed } = require('discord.js'); 2 | const { owners_id, bot_prefix } = require('../../config.json') 3 | 4 | exports.run = async (client, message, args, color) => { 5 | let prefix = bot_prefix; 6 | if (!args[0]) { 7 | let module = client.helps.array(); 8 | if(!owners_id.includes(message.author.id)) module = client.helps.array().filter(x => !x.hide); 9 | const embed = new RichEmbed() 10 | .setColor(color) 11 | .setAuthor(client.user.username + ' Commands List', client.user.displayAvatarURL) 12 | .setDescription(`\nTo check the command usage, type \`${prefix}help \`\n`) 13 | .setFooter(`Don't include <> or [], it's mean <> is required and [] is optional | ${client.user.username} v${client.version}`) 14 | for (const mod of module) { 15 | embed.addField(`**${mod.name}**`, mod.cmds.map(x => `\`${x}\``).join(', ')); 16 | } 17 | return message.channel.send(embed); 18 | } else { 19 | let cmd = args[0]; 20 | if (client.commands.has(cmd) || client.commands.get(client.aliases.get(cmd))) { 21 | let command = client.commands.get(cmd) || client.commands.get(client.aliases.get(cmd)); 22 | let name = `${command.help.name}`; 23 | let desc = command.help.description; 24 | let aliases = command.conf.aliases; 25 | let usage = `${prefix}${command.help.usage}`; 26 | 27 | let embed = new RichEmbed() 28 | .setThumbnail('https://twemoji.maxcdn.com/2/72x72/2753.png') 29 | .setTitle(`Command: ${name}`) 30 | .addField('📝 | Description', desc) 31 | .addField('✂️ | Aliases', aliases[0] ? `${aliases.join(`, `)}` : `No aliases`) 32 | .addField('🔑 | Usage', usage) 33 | .addField('📰 | Remind', `Hooks such as [] or <> are not to be used when using commands.`) 34 | .setColor(color).setFooter(`Request by: ${message.author.tag} | ${client.user.username} v${client.version}`) 35 | return message.channel.send(embed); 36 | } 37 | if (!client.commands.has(cmd) || !client.commands.get(client.aliases.get(cmd))) { 38 | const xembed = new RichEmbed() 39 | .setColor('#FF1000') 40 | .setTitle('I don\'t have command like this'); 41 | const search = client.commands.keyArray().filter(x => x.includes(args[0])).map(x => `▫ __**${x}**__`); 42 | search.length > 0 ? xembed.setDescription('**Are you mean this? :**\n' + search.join('\n')) : undefined; 43 | return message.channel.send(xembed); 44 | } 45 | 46 | } 47 | } 48 | 49 | exports.conf = { 50 | aliases: ['h', 'cmds', 'cmdlist'], 51 | cooldown: "5" 52 | } 53 | 54 | exports.help = { 55 | name: 'help', 56 | description: 'Show all command list', 57 | usage: 'help [command]' 58 | } 59 | -------------------------------------------------------------------------------- /src/commands/utility/stats.js: -------------------------------------------------------------------------------- 1 | const { RichEmbed, version } = require('discord.js'); 2 | const db = require('quick.db'); 3 | 4 | exports.run = async(client, message, args, color, prefix) => { 5 | 6 | let guildsEval = await client.shard.broadcastEval('this.guilds.size') 7 | let channelsEval = await client.shard.broadcastEval('this.channels.size') 8 | let usersEval = await client.shard.broadcastEval('this.users.size') 9 | let voiceEval = await client.shard.broadcastEval('this.voiceConnections.size') 10 | let botGuilds = guildsEval.reduce((prev, val) => prev + val) 11 | let botChannels = channelsEval.reduce((prev, val) => prev + val) 12 | let botUsers = usersEval.reduce((prev, val) => prev + val) 13 | let commandUsage = await db.fetch('commandUsage'); 14 | let messageRead = await db.fetch('messageRead'); 15 | 16 | const embed = new RichEmbed() 17 | .setColor(color) 18 | .setAuthor(`${client.user.username} statistics`, client.user.displayAvatarURL) 19 | .setThumbnail(client.user.displayAvatarURL) 20 | .setDescription('\`\`\`A statistics monitoring module. Contains essential information regarding our service and bot information. Wrapped with beautiful Discord.js Interactive Library and RichEmbed amazing Constructor. Made with ❤️ by Lolization Support Team.\`\`\`') 21 | .addField('Owners', '\`\`\`• Sharif#9781\n• Riichi_Rusdiana#6815\n• MazureFinnson#5492\`\`\`') 22 | .addField('Special thanks', '\`\`\`• 12042#5754\`\`\`') 23 | .addField('Server information', `\`\`\`• Operating System: Enterprise Linux 7\n• Kernel: 4.18.0-34-Enterprise\n• Processor: Intel(R) Xeon(R) Gold 6140 CPU @ 2.30GHz\n• Architecture: x86_x64\n• Node.js: ${process.version}\n• Discord.js: v${version}\n• Websocket: ${client.ping.toFixed(2)}ms\`\`\``) 24 | .addField('General information', `\`\`\`• Guilds: ${botGuilds.toLocaleString()}\n• Channels: ${botChannels.toLocaleString()}\n• Users: ${botUsers.toLocaleString()}\n• Uptime: ${client.util.parseDur(client.uptime)}\`\`\``) 25 | .addField('Readed information', `\`\`\`• Message Read: ${messageRead.toLocaleString()}\n• Commands Ran: ${commandUsage.toLocaleString()}\`\`\``) 26 | .addField('Usage information', `\`\`\`• Memory usage:\n${(process.memoryUsage().rss / 1024 / 1024).toFixed(2)} MB RSS\n${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB Heap\n\n• CPU usage:\nNode: ${(process.cpuUsage().user / 1024 / 1024).toFixed(2)}%\nSystem: ${(process.cpuUsage().system / 1024 / 1024).toFixed(2)}%\`\`\``) 27 | .setFooter(`Request by: ${message.author.tag} | ${client.user.username} v${client.version}`) 28 | 29 | message.channel.send(embed); 30 | 31 | } 32 | exports.conf = { 33 | aliases: ['about', 'info', 'botstats'], 34 | cooldown:' 5' 35 | } 36 | exports.help = { 37 | name: 'stats', 38 | description: 'show bot statistic and usage information', 39 | usage: 'stats', 40 | example: ['stats'] 41 | } -------------------------------------------------------------------------------- /src/handle/command.js: -------------------------------------------------------------------------------- 1 | const { bot_prefix, embed_color } = require('../config.json'); 2 | const { Collection, RichEmbed } = require('discord.js'); 3 | const cooldowns = new Collection(); 4 | const cooldownAns = require('./cooldownAns.json'); 5 | const fs = require('fs'); 6 | const db = require('quick.db'); 7 | 8 | module.exports = async (client, message) => { 9 | let prefix = message.content.startsWith(bot_prefix) ? bot_prefix : `${client.user.toString()} `; 10 | let color = embed_color; 11 | let args = message.content.slice(prefix.length).trim().split(/ +/g); 12 | let cmd = args.shift().toLowerCase(); 13 | args.missing = argsMissing; 14 | 15 | let blacklist = JSON.parse(fs.readFileSync("./src/database/blacklist.json", "utf8")); 16 | if (!blacklist[message.author.id]) { 17 | blacklist[message.author.id] = { 18 | values: 0 19 | }; 20 | } 21 | let values = blacklist[message.author.id].checker 22 | if (values === 1) { 23 | message.author.send(`Sorry, you\'ve been **BLACKLISTED** from using ${client.user.username} because violating **Our Rules**. Contact Sharif#9781 ( bot owner ) if you want to appeal.`); 24 | } else { 25 | 26 | // cooldowns command 27 | let commandFile = client.commands.get(cmd) || client.commands.get(client.aliases.get(cmd)); 28 | if (!commandFile) return; 29 | if (!cooldowns.has(commandFile.help.name)) { 30 | cooldowns.set(commandFile.help.name, new Collection()); 31 | } 32 | const member = message.member; 33 | const now = Date.now(); 34 | const timestamps = cooldowns.get(commandFile.help.name); 35 | const cooldownAmount = (commandFile.conf.cooldown || 5) * 1000; 36 | const opss = cooldownAns[Math.floor(Math.random() * cooldownAns.length)]; 37 | 38 | if (!timestamps.has(member.id)) { 39 | timestamps.set(member.id, now); 40 | } else { 41 | const expirationTime = timestamps.get(member.id) + cooldownAmount; 42 | 43 | if (now < expirationTime) { 44 | const timeLeft = (expirationTime - now) / 1000; 45 | return message.channel.send(`⏱ | **${member.user.username}**, ${opss} (Ratelimited)\n**You'll be able to use this command again in** **${timeLeft.toFixed(1)} seconds.**`).then(msg=>msg.delete(10000)); 46 | } 47 | 48 | timestamps.set(member.id, now); 49 | setTimeout(() => timestamps.delete(member.id), cooldownAmount); 50 | } 51 | 52 | // command handler 53 | try { 54 | let commands = client.commands.get(cmd) || client.commands.get(client.aliases.get(cmd)); 55 | commands.run(client, message, args, color, prefix); 56 | if (!commands) return; 57 | } catch (e) { 58 | console.error(e) 59 | } finally { 60 | console.info(`${message.author.tag}[${message.author.id}] is using ${message.content.split(" ")[0].replace(prefix, '')} command on shard ﹙${client.shard.id}﹚ ${message.guild.name}[${message.guild.id}]`); 61 | db.add('commandUsage', 1); 62 | } 63 | } 64 | 65 | function argsMissing(message, res, help){ 66 | const embed = new RichEmbed() 67 | .setColor('#FF1000') 68 | .setTitle('⛔ | It\'s not how you use '+ help.name) 69 | .addField('❓ Reason', `\`\`\`${res}\`\`\``) 70 | .addField('<:usage:501551862017818636> Usage', `\`\`\`${help.usage}\`\`\``) 71 | // .addField('Example', help.example.map(x => `\`\`\`${x}\`\`\``)); 72 | return message.channel.send(embed); 73 | } 74 | } -------------------------------------------------------------------------------- /src/commands/fun/hangman.js: -------------------------------------------------------------------------------- 1 | const { RichEmbed } = require('discord.js'); 2 | const { stripIndents } = require('common-tags'); 3 | const { get } = require('node-superfetch'); 4 | 5 | const playing = new Set(); 6 | 7 | exports.run = async(client, message, args, color, prefix) => { 8 | if (playing.has(message.channel.id)) return message.reply('Only one game may be occurring per channel.'); 9 | playing.add(message.channel.id); 10 | try { 11 | const { body } = await get('https://emilia-api.glitch.me/api/hangman') 12 | .set('Authorization', `Bearer ${process.env.EMILIAKEY}`); 13 | 14 | const word = body.word; 15 | let points = 0; 16 | let displayText = null; 17 | let guessed = false; 18 | const confirmation = []; 19 | const incorrect = []; 20 | const display = new Array(word.length).fill('◯'); 21 | while (word.length !== confirmation.length && points < 6) { 22 | const embed = new RichEmbed() 23 | .setColor(color) 24 | .setTitle('Hangman game') 25 | .setDescription(stripIndents` 26 | ${displayText === null ? 'Here we go!' : displayText ? 'Good job!' : 'Nope!'} 27 | \`${display.join(' ')}\`. Which letter do you choose? 28 | Incorrect Tries: ${incorrect.join(', ') || 'None'} 29 | \`\`\` 30 | . ┌─────┐ 31 | . ┃ ┋ 32 | . ┃ ${points > 0 ? 'O' : ''} 33 | . ┃ ${points > 2 ? '/' : ' '}${points > 1 ? '|' : ''}${points > 3 ? '\\' : ''} 34 | . ┃ ${points > 4 ? '/' : ''}${points > 5 ? '\\' : ''} 35 | ============= 36 | \`\`\` 37 | `); 38 | let m = await message.channel.send(embed); 39 | const filter = res => { 40 | const choice = res.content.toLowerCase(); 41 | return res.author.id === message.author.id && !confirmation.includes(choice) && !incorrect.includes(choice); 42 | }; 43 | const guess = await message.channel.awaitMessages(filter, { 44 | max: 1, 45 | time: 30000 46 | }); 47 | //m.delete(); 48 | if (!guess.size) { 49 | await message.reply('Sorry, time is up!'); 50 | break; 51 | } 52 | const choice = guess.first().content.toLowerCase(); 53 | if (choice === 'end') break; 54 | if (choice.length > 1 && choice === word) { 55 | guessed = true; 56 | break; 57 | } else if (word.includes(choice)) { 58 | displayText = true; 59 | for (let i = 0; i < word.length; i++) { 60 | if (word.charAt(i) !== choice) continue; // eslint-disable-line max-depth 61 | confirmation.push(word.charAt(i)); 62 | display[i] = word.charAt(i); 63 | } 64 | } else { 65 | displayText = false; 66 | if (choice.length === 1) incorrect.push(choice); 67 | points++; 68 | } 69 | } 70 | playing.delete(message.channel.id); 71 | if (word.length === confirmation.length || guessed) return message.channel.send(`You won, it was ${word}!`); 72 | return message.channel.send(`Too bad... It was ${word}...`); 73 | } catch (err) { 74 | playing.delete(message.channel.id); 75 | return message.reply(`Oh no, an error occurred :( \`${err.message}\`. Try again later!`); 76 | } 77 | } 78 | exports.conf = { 79 | aliases: ['hm'], 80 | cooldown: '0' 81 | } 82 | exports.help = { 83 | name: 'hangman', 84 | description: 'Prevent a man from being hanged by guessing a word as fast as you can.', 85 | usage: 'hangman' 86 | } 87 | -------------------------------------------------------------------------------- /src/commands/admin/logging.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const Discord = require('discord.js'); 3 | 4 | exports.run = async(client, message, args, color, prefix) => { 5 | 6 | var option = args.join(" ") 7 | if (!option) { 8 | var embed1 = new Discord.RichEmbed() 9 | .setAuthor(`${client.user.username} Logging`, client.user.displayAvatarURL) 10 | .setColor('RANDOM') 11 | .setDescription(` 12 | **Proper Usage:** 13 | • ${prefix}logging set \`#tagchannel\` 14 | • ${prefix}logging on 15 | • ${prefix}logging off 16 | 17 | **Example:** 18 | • ${prefix}logging set \`#mod-log\` 19 | 20 | **After do that, do again:** 21 | • ${prefix}logging on 22 | `) 23 | .setFooter("Logging Announcement") 24 | .setTimestamp() 25 | message.channel.send(embed1); 26 | } else { 27 | if (option.match("set")) { 28 | var channel = JSON.parse(fs.readFileSync("./src/database/logging.json", "utf8")) 29 | if (!message.member.hasPermission("MANAGE_GUILD") && message.author.id !== '475230849239875584') return message.reply(`**${message.author.username}**, Sorry, You need permission \`Manage Guild\` to use this command!`); 30 | var inputmessage = message.mentions.channels.first() 31 | if (args[0]) { 32 | channel[message.guild.id] = { 33 | channel: inputmessage.id 34 | }; 35 | fs.writeFile("./src/database/logging.json", JSON.stringify(channel, null, 2), (err) => { 36 | if (err) console.log(err) 37 | }); 38 | 39 | var embed2 = new Discord.RichEmbed() 40 | .setColor(color) 41 | .setDescription(`Logging channel set to: ${inputmessage}`) 42 | .setTimestamp().setFooter(`Logging channel`, client.user.displayAvatarURL) 43 | message.channel.send(embed2); 44 | } 45 | } 46 | } 47 | 48 | if (option.match("on")) { 49 | var welcomesetting = JSON.parse(fs.readFileSync("./src/database/logonoff.json", "utf8")); 50 | welcomesetting[message.guild.id] = { 51 | checker: 1 52 | }; 53 | fs.writeFile("./src/database/logonoff.json", JSON.stringify(welcomesetting, null, 2), (err) => { 54 | console.error(err) 55 | }) 56 | var embed3 = new Discord.RichEmbed() 57 | .setColor('RANDOM') 58 | .setDescription(`Logging has been set **on**.`) 59 | .setTimestamp() 60 | .setFooter("Logging enable", client.user.displayAvatarURL) 61 | 62 | message.channel.send(embed3); 63 | } 64 | if (option.match("off")) { 65 | var welcomesetting = JSON.parse(fs.readFileSync("./src/database/logonoff.json", "utf8")); 66 | welcomesetting[message.guild.id] = { 67 | checker: 0 68 | }; 69 | fs.writeFile("./src/database/logonoff.json", JSON.stringify(welcomesetting, null, 2), (err) => { 70 | console.error(err) 71 | }) 72 | var embed4 = new Discord.RichEmbed() 73 | .setColor('RANDOM') 74 | .setDescription(`Logging has been set **off**.`) 75 | .setTimestamp() 76 | .setFooter("Logging disable", client.user.displayAvatarURL) 77 | 78 | message.channel.send(embed4); 79 | } 80 | } 81 | 82 | exports.conf = { 83 | aliases: ['log'], 84 | cooldown: '5' 85 | } 86 | exports.help = { 87 | name: 'logging', 88 | description: 'Set the logging to the channel like \`Message Edited\`, \`Message Deleted\` and more!', 89 | usage: 'logging' 90 | } -------------------------------------------------------------------------------- /src/commands/economy/slots.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | let bal = require('../../database/balance.json'); 3 | 4 | exports.run = async (client, message, args, color) => { 5 | 6 | if(!bal[message.author.id]){ 7 | bal[message.author.id] = { 8 | balance: 0 9 | }; 10 | } 11 | 12 | let slots = ['🍇', '🍐', '🍒', '🍋', '🍊', '🥑', '🍉'] 13 | const { shuffle } = client.util 14 | let amount = (args[0]); 15 | 16 | if (!amount) amount = 2; 17 | if (isNaN(amount)) return message.channel.send(`**${message.author.username}**, Please enter valid number!`); 18 | if (amount > 500) amount = 500; 19 | 20 | let random = 5 * amount; 21 | 22 | if(bal[message.author.id].balance < amount) return message.channel.send(`**${message.author.username}**, You not have insufficient balance yet, Keep active and don't forget to take your daily everyday!`); 23 | 24 | const arr1 = shuffle(slots); 25 | const arr2 = shuffle(slots); 26 | const arr3 = shuffle(slots); 27 | const thisMes = await message.channel.send(` 28 | **[ 🎰 | SLOTS ]** 29 | **-----------------** 30 | ${arr1[2]} : ${arr2[0]} : ${arr3[2]} 31 | 32 | ${arr1[1]} : ${arr2[1]} : ${arr3[1]} **«** 33 | 34 | ${arr1[0]} : ${arr2[2]} : ${arr3[0]} 35 | **-----------------** 36 | `); 37 | 38 | for(let i = 0; i < 5; i++){ 39 | arr1.push(arr1.shift()); 40 | arr2.push(arr2.shift()); 41 | arr3.push(arr3.shift()); 42 | 43 | await setTimeout(() => thisMes.edit(` 44 | **[ 🎰 | SLOTS ]** 45 | **-----------------** 46 | ${arr1[0]} : ${arr2[1]} : ${arr3[0]} 47 | 48 | ${arr1[1]} : ${arr2[1]} : ${arr3[1]} **«** 49 | 50 | ${arr1[0]} : ${arr2[2]} : ${arr3[0]} 51 | **-----------------** 52 | `), 800) 53 | 54 | setTimeout(() => thisMes.edit(` 55 | **[ 🎰 | SLOTS ]** 56 | **-----------------** 57 | ${arr1[2]} : ${arr2[1]} : ${arr3[2]} 58 | 59 | ${arr1[0]} : ${arr2[1]} : ${arr3[2]} **«** 60 | 61 | ${arr1[2]} : ${arr2[0]} : ${arr3[1]} 62 | **-----------------** 63 | `), 1300); 64 | 65 | if(arr1[1] === arr2[1] && arr1[1] === arr3[1] || arr1[1] && arr2[1] === arr1[1] && arr3[1] || arr2[1] === arr1[1] && arr2[1] === arr3[1] || arr3[1] === arr2[1] && arr3[1] === arr1[1] || arr3[1] && arr2[1] === arr3[1] && arr1[1] || arr1[1] === arr3[1] && arr3[1] && arr2[1] ) { 66 | let curBal = bal[message.author.id].balance; 67 | bal[message.author.id].balance = curBal + random; 68 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 69 | if(err) console.log(err); 70 | }); 71 | return setTimeout(() => thisMes.edit(` 72 | **[ 🎰 | SLOTS ]** 73 | **-----------------** 74 | ${arr1[2]} : ${arr2[0]} : ${arr3[2]} 75 | 76 | ${arr1[1]} : ${arr2[1]} : ${arr3[1]} **«** 77 | 78 | ${arr1[0]} : ${arr2[2]} : ${arr3[0]} 79 | **-----------------** 80 | | : : : **WIN** : : : | 81 | 82 | **${message.author.username}** used **💴 ${amount}** and won **💴 ${random}** 83 | `), 2300); 84 | } 85 | let curbal = bal[message.author.id].balance; 86 | bal[message.author.id].balance = curbal - amount; 87 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 88 | if(err) console.log(err); 89 | }); 90 | 91 | return setTimeout(() => thisMes.edit(` 92 | **[ 🎰 | SLOTS ]** 93 | **-----------------** 94 | ${arr1[2]} : ${arr2[0]} : ${arr3[2]} 95 | 96 | ${arr1[1]} : ${arr2[1]} : ${arr3[1]} **«** 97 | 98 | ${arr1[0]} : ${arr2[2]} : ${arr3[0]} 99 | **-----------------** 100 | | : : : **LOST** : : : | 101 | 102 | **${message.author.username}** used 💴 **${amount}** and lost everything. 103 | `),2300) 104 | } 105 | 106 | } 107 | 108 | exports.conf = { 109 | aliases: ['slot', 'sl'], 110 | cooldown: "7" 111 | } 112 | 113 | exports.help = { 114 | name: "slots", 115 | description: "Play the slot machine", 116 | usage: "slots [amount]" 117 | } -------------------------------------------------------------------------------- /src/commands/economy/roulette.js: -------------------------------------------------------------------------------- 1 | let fs = require('fs'); 2 | let bal = require('../../database/balance.json'); 3 | const { bot_prefix } = require('../../config.json'); 4 | 5 | function isOdd(num) { 6 | if ((num % 2) == 0) return false; 7 | else if ((num % 2) == 1) return true; 8 | } 9 | 10 | exports.run = (client, message, args) => { 11 | let prefix = bot_prefix; 12 | if(!bal[message.author.id]){ 13 | bal[message.author.id] = { 14 | balance: 0 15 | }; 16 | } 17 | 18 | let colour = args[0]; 19 | let money = args[1]; 20 | 21 | 22 | if (!money) return message.channel.send(`Usage: \`${prefix}roulette \`\nPick any of the colours you want... but some are more likely than others...\n**Black is for Even numbers**... **and Red is for odd**... both of these will provide you with **1.5x your original amount**.\nTake a risk and pick **Green** and you can get **14x the amount of money**... however it's one in 37.`); //help 23 | if (isNaN(money)) return message.channel.send(`**${message.author.username}**, Please enter valid number!`); 24 | if (money > 500) money = 500; 25 | if (bal[message.author.id].balance < money) return message.channel.send(`**${message.author.username}**, Sorry, you are betting more than you have!`); 26 | if (!colour) return message.channel.send(`**${message.author.username}**, You can only bet on Black (1.5x), Red (1.5x), or Green (14x).`); 27 | colour = colour.toLowerCase() 28 | 29 | if (colour == "b" || colour.includes("black")) colour = 0; 30 | else if (colour == "r" || colour.includes("red")) colour = 1; 31 | else if (colour == "g" || colour.includes("green")) colour = 2; 32 | else return message.channel.send(`**${message.author.username}**, You can only bet on Black (1.5x), Red (1.5x), or Green (14x).`); 33 | 34 | let random = Math.floor(Math.random() * 37); 35 | 36 | if (random == 0 && colour == 2) { // Hijau 37 | money *= 14 38 | let curBal1 = bal[message.author.id].balance 39 | bal[message.author.id].balance = curBal1 + money; 40 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 41 | message.channel.send(`**${message.author.username}**, 💚 **JACKPOT** You won 💴 **${money}** 💚 | The Number was **${random}**`); 42 | if(err) console.log(err) 43 | }); 44 | } else if (isOdd(random) && colour == 1) { // Merah 45 | money = money * 1.5 46 | let curBal2 = bal[message.author.id].balance 47 | bal[message.author.id].balance = curBal2 + money 48 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 49 | message.channel.send(`**${message.author.username}**, 🔴 You won 💴 **${money}** 🔴 | The Number was **${random}**`); 50 | if(err) console.log(err) 51 | }); 52 | } else if (!isOdd(random) && colour == 0) { // Hitam 53 | money = money * 1.5 54 | let curBal3 = bal[message.author.id].balance 55 | bal[message.author.id].balance = curBal3 + money 56 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 57 | message.channel.send(`**${message.author.username}**, ⚫ You won 💴 **${money}** ⚫| The Number was **${random}**`); 58 | if(err) console.log(err) ; 59 | }); 60 | } else { // Lost 61 | let curBal4 = bal[message.author.id].balance 62 | bal[message.author.id].balance = curBal4 - money; 63 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 64 | message.channel.send(`**${message.author.username}**, You sadly lost 💴 **${money}** | The Number was **${random}**`); 65 | if(err) console.log(err) 66 | }); 67 | } 68 | 69 | }; 70 | exports.conf = { 71 | aliases: ['rl'], 72 | cooldown: '10' 73 | }; 74 | 75 | exports.help = { 76 | name: 'roulette', 77 | description: 'Allows you to spend your Balance on a game of Roulette.', 78 | usage: 'roulette ' 79 | }; -------------------------------------------------------------------------------- /src/events/message.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | const PREFIX = require('../config.json').bot_prefix; 3 | const { embed_color } = require('../config.json'); 4 | const fs = require("fs"); 5 | const db = require('quick.db'); 6 | let xp = require('../../src/database/xp.json'); 7 | let balance = require('../../src/database/balance.json'); 8 | const timeout = new Set(); 9 | const timeoutxp = new Set(); 10 | 11 | module.exports = async (client, message) => { 12 | 13 | // online stats Haruno Sakura server 14 | const guild = client.guilds.get('492345609928572948'); 15 | guild.channels.get('498353806589820939').setName(`Online : ${guild.members.filter(o => o.presence.status === 'online' || o.presence.status === 'idle' || o.presence.status === 'dnd').size}`) 16 | 17 | // - - - - - - - - - - - 18 | if (message.author.bot || !message.guild) return; 19 | db.add('messageRead', 1) 20 | let prefix = PREFIX.toLowerCase(); 21 | let prefixMention = new RegExp(`^<@!?${client.user.id}> `); 22 | prefixMention = prefix; 23 | let msg = message.content.toLowerCase(); 24 | 25 | if (msg.startsWith(prefix) || msg.startsWith(`${client.user.toString()} `)) return require('../handle/command')(client, message); 26 | 27 | if (msg == `<@${client.user.id}>` || msg == `<@!${client.user.id}>`) { 28 | message.channel.send(`Hye ${message.author}, my prefix is \`${prefix}\``); 29 | } 30 | 31 | const args = message.content.slice(prefix).trim().split(/ +/g); 32 | const command = args.shift().toLowerCase(); 33 | 34 | 35 | let AFKdata = JSON.parse(fs.readFileSync('./src/database/afk.json', 'utf8')); 36 | 37 | if (message.author.id in AFKdata && command !== "afk") { 38 | delete AFKdata[message.author.id]; 39 | fs.writeFile('./src/database/afk.json', JSON.stringify(AFKdata), (err) => { 40 | if (err) console.log(err); 41 | }); 42 | 43 | message.channel.send(`⌨️ | Welcome back ${message.author.toString()} I've removed you from Afk.`); 44 | } 45 | 46 | var AFKcheck = user => { 47 | return user.id in AFKdata; 48 | } 49 | 50 | const AFKandMentioned = message.mentions.users.filter(AFKcheck); 51 | 52 | if (AFKandMentioned.size) { 53 | var reason = AFKandMentioned.map(user => { 54 | return AFKdata[user.id]; 55 | }); 56 | let embed = new Discord.RichEmbed() 57 | embed.setColor(embed_color); 58 | embed.setAuthor(`They are AFK at the moment, please try again later!`) 59 | embed.setDescription(`${reason}`) 60 | message.channel.send(`${message.author.toString()}`, {embed}); 61 | } 62 | 63 | 64 | // balance 65 | if (timeout.has(message.author.id)) return; 66 | let balanceAdd = Math.floor(Math.random() * 1) + 1; 67 | 68 | if(!balance[message.author.id]){ 69 | balance[message.author.id] = { 70 | balance: 0 71 | }; 72 | } 73 | 74 | let curbalance = balance[message.author.id].balance; 75 | balance[message.author.id].balance = curbalance + balanceAdd; 76 | 77 | fs.writeFile("./src/database/balance.json", JSON.stringify(balance, null, 2), (err) => { 78 | if (err) console.log(err) 79 | }); 80 | 81 | timeout.add(message.author.id); 82 | setTimeout(() => timeout.delete(message.author.id), 60000); 83 | 84 | //leveling 85 | let xpAdd = Math.floor(Math.random() * 1) + 1; 86 | if (timeoutxp.has(message.author.id)) return; 87 | if(!xp[message.author.id]){ 88 | xp[message.author.id] = { 89 | xp: 0, 90 | level: 1 91 | }; 92 | } 93 | 94 | let curxp = xp[message.author.id].xp; 95 | let curlvl = xp[message.author.id].level; 96 | let nxtLvl = xp[message.author.id].level * 500; 97 | xp[message.author.id].xp = curxp + xpAdd; 98 | if(nxtLvl <= xp[message.author.id].xp){ 99 | xp[message.author.id].level = curlvl + 1; 100 | 101 | message.channel.send(`\🆙 | ${message.author} You've leveled up to **\`${curlvl + 1}\`**`).then(m => m.delete(7000)); 102 | } 103 | 104 | fs.writeFile("./src/database/xp.json", JSON.stringify(xp, null, 2), (err) => { 105 | if (err) console.log(err) 106 | }); 107 | timeoutxp.add(message.author.id); 108 | setTimeout(() => timeoutxp.delete(message.author.id), 20000); 109 | } -------------------------------------------------------------------------------- /src/commands/economy/leaderboard.js: -------------------------------------------------------------------------------- 1 | let xp = require('../../database/xp'); 2 | let bal = require('../../database/balance'); 3 | let rep = require('../../database/rep'); 4 | let fish = require('../../database/fish'); 5 | let work = require('../../database/works'); 6 | const { RichEmbed } = require('discord.js'); 7 | 8 | exports.run = async (client, message, args, color, prefix) => { 9 | 10 | if(!args[0]) { 11 | let misEmbed = new RichEmbed() 12 | .setColor(color) 13 | .setDescription(` 14 | **Proper usage:** 15 | 16 | \`${prefix}leaderboard rep\` - **Returns the reputation leaderboard** 17 | \`${prefix}leaderboard balance\` - **Returns the balance leaderboard** 18 | \`${prefix}leaderboard fish\` - **Returns the fishing leaderboard** 19 | \`${prefix}leaderboard level\` - **Returns the level leaderboard** 20 | \`${prefix}leaderboard work\` - **Returns the working leaderboard** 21 | `) 22 | .setFooter(`Request by: ${message.author.tag} | ${client.user.username} v${client.version}`) 23 | message.channel.send(misEmbed); 24 | } 25 | 26 | if(args[0] === 'level') { 27 | let board = []; 28 | for(let key of Object.keys(xp)){ 29 | let value = Object.assign({user: client.users.get(key)}, xp[key]); 30 | board.push(value); 31 | } 32 | 33 | board = board.filter(x => x.user); 34 | board = board.sort((a,b) => b.xp-a.xp).splice(0, 10); 35 | top = board.map((x, i) => `[${i+1}] ➢ #${x.user.username}\n Level: ${x.level.toLocaleString()} XP: ${x.xp.toLocaleString()}`).join('\n\n'); 36 | let embed = new RichEmbed() 37 | .setColor(color) 38 | .setDescription(`**🆙 | Top 10 Global XP\n\n**\`\`\`📋 Rank | Name\n\n${top}\`\`\``); 39 | 40 | return message.channel.send(embed); 41 | } 42 | 43 | if(args[0] === 'balance') { 44 | let board = []; 45 | for(let key of Object.keys(bal)){ 46 | let value = Object.assign({user: client.users.get(key)}, bal[key]); 47 | board.push(value); 48 | } 49 | 50 | board = board.filter(x => x.user); 51 | board = board.sort((a,b) => b.balance-a.balance).splice(0, 10); 52 | top = board.map((x, i) => `[${i+1}] ➢ #${x.user.username}\n Balance: ${x.balance.toLocaleString()}`).join('\n\n'); 53 | let embed = new RichEmbed() 54 | .setColor(color) 55 | .setDescription(`**💴 | Top 10 Global Rich User\n\n**\`\`\`📋 Rank | Name\n\n${top}\`\`\``); 56 | 57 | return message.channel.send(embed); 58 | 59 | } 60 | 61 | if(args[0] === 'rep') { 62 | let board = []; 63 | for(let key of Object.keys(rep)){ 64 | let value = Object.assign({user: client.users.get(key)}, rep[key]); 65 | board.push(value); 66 | } 67 | 68 | board = board.filter(x => x.user); 69 | board = board.sort((a,b) => b.rep-a.rep).splice(0, 10); 70 | top = board.map((x, i) => `[${i+1}] ➢ #${x.user.username}\n Reputation: ${x.rep.toLocaleString()}`).join('\n\n'); 71 | let embed = new RichEmbed() 72 | .setColor(color) 73 | .setDescription(`**🎖️ | Top 10 Global Reputation\n\n**\`\`\`📋 Rank | Name\n\n${top}\`\`\``); 74 | 75 | return message.channel.send(embed); 76 | } 77 | 78 | if(args[0] === 'fish') { 79 | let board = []; 80 | for(let key of Object.keys(fish)){ 81 | let value = Object.assign({user: client.users.get(key)}, fish[key]); 82 | board.push(value); 83 | } 84 | 85 | board = board.filter(x => x.user); 86 | board = board.sort((a,b) => b.fish-a.fish).splice(0, 10); 87 | top = board.map((x, i) => `[${i+1}] ➢ #${x.user.username}\n Fish: ${x.fish.toLocaleString()}`).join('\n\n'); 88 | let embed = new RichEmbed() 89 | .setColor(color) 90 | .setDescription(`**🎣 | Top 10 Global Fishing\n\n**\`\`\`📋 Rank | Name\n\n${top}\`\`\``); 91 | 92 | return message.channel.send(embed); 93 | } 94 | 95 | if(args[0] === 'work') { 96 | let board = []; 97 | for(let key of Object.keys(work)){ 98 | let value = Object.assign({user: client.users.get(key)}, work[key]); 99 | board.push(value); 100 | } 101 | 102 | board = board.filter(x => x.user); 103 | board = board.sort((a,b) => b.work-a.work).splice(0, 10); 104 | top = board.map((x, i) => `[${i+1}] ➢ #${x.user.username}\n Working: ${x.work.toLocaleString()} `).join('\n\n'); 105 | let embed = new RichEmbed() 106 | .setColor(color) 107 | .setDescription(`**💼 | Top 10 Global Working\n\n**\`\`\`📋 Rank | Name\n\n${top}\`\`\``); 108 | 109 | return message.channel.send(embed); 110 | } 111 | } 112 | 113 | exports.conf = { 114 | aliases: ['lb'], 115 | cooldown: "5" 116 | } 117 | 118 | exports.help = { 119 | name: "leaderboard", 120 | description: "See the top 10 highest user", 121 | usage: "leaderboard" 122 | } -------------------------------------------------------------------------------- /src/events/guildMemberUpdate.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | const fs = require('fs'); 3 | const { embed_color } = require('../config.json'); 4 | 5 | module.exports = (client, oldMember, newMember) => { 6 | var color = embed_color; 7 | 8 | //declare changes 9 | var Changes = { 10 | unknown: 0, 11 | addedRole: 1, 12 | removedRole: 2, 13 | username: 3, 14 | nickname: 4, 15 | avatar: 5 16 | }; 17 | 18 | var change = Changes.unknown; 19 | 20 | //check if roles were removed 21 | let dif = newMember.roles.filter(r => !oldMember.roles.has(r.id)).first() 22 | let diff = oldMember.roles.filter(r => !newMember.roles.has(r.id)).first() 23 | if (oldMember.roles.size !== newMember.roles.size) { 24 | if (oldMember.roles.size > newMember.roles.size) { 25 | change = Changes.removedRole; 26 | var removedRole = diff.name; 27 | } else if (oldMember.roles.size < newMember.roles.size) { 28 | change = Changes.addedRole; 29 | var addedRole = dif.name; 30 | } 31 | } 32 | 33 | 34 | //check if username changed 35 | if(newMember.user.username != oldMember.user.username) 36 | change = Changes.username; 37 | 38 | //check if nickname changed 39 | if(newMember.nickname != oldMember.nickname) 40 | change = Changes.nickname; 41 | 42 | //check if avatar changed 43 | if(oldMember.user.avatar !== newMember.user.avatar){ 44 | change = Changes.avatar 45 | } 46 | 47 | var log = JSON.parse(fs.readFileSync('./src/database/logging.json', 'utf8')) 48 | let logsetting = JSON.parse(fs.readFileSync('./src/database/logonoff.json', 'utf8')); 49 | 50 | if(!logsetting[oldMember.guild.id]){ 51 | logsetting[oldMember.guild.id] = { 52 | checker: 1 53 | }; 54 | } 55 | if(!log[oldMember.guild.id]) return; 56 | let values = logsetting[oldMember.guild.id].checker 57 | 58 | if(values === undefined) return; 59 | if(values === 0) return; 60 | if(values === 1) { 61 | var log = JSON.parse(fs.readFileSync('./src/database/logging.json', 'utf8')) 62 | if(!log) return; 63 | let channel = oldMember.guild.channels.get(`${log[oldMember.guild.id].channel}`); 64 | if(!channel) return; 65 | 66 | if (channel != null) { 67 | switch(change) { 68 | case Changes.unknown: 69 | let embed = new Discord.RichEmbed() 70 | .setColor(color) 71 | .setDescription('**User Update** ' + newMember) 72 | channel.send(embed); 73 | break; 74 | case Changes.addedRole: 75 | let embed2 = new Discord.RichEmbed() 76 | .setColor(color) 77 | .setAuthor(`${newMember.user.tag} | Added Role`, newMember.user.displayAvatarURL) 78 | .setDescription(`${newMember.user} **was given the \`${addedRole}\` role**`) 79 | .setFooter(`ID: ${newMember.user.id}`).setTimestamp() 80 | channel.send(embed2) 81 | break; 82 | case Changes.removedRole: 83 | let embed3 = new Discord.RichEmbed() 84 | .setColor(color) 85 | .setAuthor(`${newMember.user.tag} | Removed Role`, newMember.user.displayAvatarURL) 86 | .setDescription(`${newMember} **was removed from the \`${removedRole}\` role**`) 87 | .setFooter(`ID: ${newMember.user.id}`).setTimestamp() 88 | channel.send(embed3) 89 | break; 90 | case Changes.username: 91 | let embed4 = new Discord.RichEmbed() 92 | .setColor(color) 93 | .setAuthor(`${newMember.user.username} | Username Changed`, newMember.user.displayAvatarURL) 94 | .setDescription('**Username changed from** ' + 95 | oldMember.user.username + '#' + oldMember.user.discriminator + ' **to** ' + 96 | newMember.user.username + '#' + newMember.user.discriminator) 97 | .setFooter(`ID: ${newMember.id}`).setTimestamp() 98 | channel.send(embed4) 99 | break; 100 | case Changes.nickname: 101 | let embed5 = new Discord.RichEmbed() 102 | .setColor(color) 103 | .setAuthor(`${newMember.user.tag} | Nickname Changed`, newMember.user.displayAvatarURL) 104 | .addField('Before', oldMember.nickname != null ? `${oldMember.nickname}` : `${oldMember.user.tag}`) 105 | .addField('After', newMember.nickname != null ? `${newMember.nickname}` : `${newMember.user.tag}`) 106 | .setFooter(`ID: ${newMember.user.id}`).setTimestamp() 107 | channel.send(embed5) 108 | break; 109 | case Changes.avatar: 110 | let embed6 = new Discord.RichEmbed() 111 | .setColor(color) 112 | .setAuthor(`${newMember.user.tag} | Avatar Changed`, newMember.user.displayAvatarURL) 113 | .setDescription(`**${newMember.user.tag} Changed their avatar**`); 114 | break; 115 | } 116 | 117 | } 118 | } 119 | }; -------------------------------------------------------------------------------- /src/commands/economy/gamble.js: -------------------------------------------------------------------------------- 1 | let fs = require('fs'); 2 | let bal = require('../../database/balance.json'); 3 | const { bot_prefix } = require('../../config.json'); 4 | 5 | function isOdd(num) { 6 | if ((num % 2) == 0) return false; 7 | else if ((num % 2) == 1) return true; 8 | } 9 | 10 | exports.run = (client, message, args) => { 11 | 12 | //if(message.author.id !== '444454206800396309') return message.channel.send('Currently in development!'); 13 | let prefix = bot_prefix; 14 | if(!bal[message.author.id]){ 15 | bal[message.author.id] = { 16 | balance: 0 17 | }; 18 | } 19 | 20 | let money = args[0] 21 | 22 | if (!money) { 23 | money = 10; 24 | } 25 | if (isNaN(money)) return message.channel.send(`**${message.author.username}**, Please enter valid number!`); 26 | if (money > 500) money = 500; 27 | if (bal[message.author.id].balance < money) return message.channel.send(`**${message.author.username}**, Sorry, you are betting more than you have!`); 28 | 29 | let random = Math.floor(Math.random() * 37); 30 | 31 | if (random == 0) { // Jackpot 32 | money *= 10 33 | let curBal1 = bal[message.author.id].balance 34 | bal[message.author.id].balance = curBal1 + money; 35 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 36 | message.channel.send(`🎲 | **${message.author}**, 🎉🎉 **JACKPOT** You won 💴 **${money}** 🎉🎉 Wow Congrats 🎉`); 37 | if(err) console.log(err) 38 | }); 39 | } else if (random == 5) { // win 40 | money = money * 2.50 41 | let curBal2 = bal[message.author.id].balance 42 | bal[message.author.id].balance = curBal2 + money 43 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 44 | message.channel.send(`🎲 | Congrats **${message.author.username}**, 🎉 You won 💴 **${money}** 🎉 and got keep what you had.`); 45 | if(err) console.log(err) 46 | }); 47 | } else if (random == 10) { // win 48 | money = money * 2.50 49 | let curBal2 = bal[message.author.id].balance 50 | bal[message.author.id].balance = curBal2 + money 51 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 52 | message.channel.send(`🎲 | Congrats **${message.author.username}**, 🎉 You won 💴 **${money}** 🎉 and got keep what you had.`); 53 | if(err) console.log(err) 54 | }); 55 | } else if (random == 15) { // Win 56 | money = money * 2.50 57 | let curBal3 = bal[message.author.id].balance 58 | bal[message.author.id].balance = curBal3 + money 59 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 60 | message.channel.send(`🎲 | Congrats **${message.author.username}**, 🎉 You won 💴 **${money}** 🎉 and got keep what you had.`); 61 | if(err) console.log(err) ; 62 | }); 63 | } else if (random == 20) { // win 64 | money = money * 2.50 65 | let curBal4 = bal[message.author.id].balance 66 | bal[message.author.id].balance = curBal4 + money 67 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 68 | message.channel.send(`🎲 | Congrats **${message.author.username}**, 🎉 You won 💴 **${money}** 🎉 and got keep what you had.`); 69 | if(err) console.log(err) 70 | }); 71 | } else if (random == 25) { // Win 72 | money = money * 2.50 73 | let curBal3 = bal[message.author.id].balance 74 | bal[message.author.id].balance = curBal3 + money 75 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 76 | message.channel.send(`🎲 | Congrats **${message.author.username}**, 🎉 You won 💴 **${money}** 🎉 and got keep what you had.`); 77 | if(err) console.log(err) ; 78 | }); 79 | } else if (random == 30) { // Win 80 | money = money * 2.50 81 | let curBal3 = bal[message.author.id].balance 82 | bal[message.author.id].balance = curBal3 + money 83 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 84 | message.channel.send(`🎲 | Congrats **${message.author.username}**, 🎉 You won 💴 **${money}** 🎉 and got keep what you had.`); 85 | if(err) console.log(err) ; 86 | }); 87 | } else { // Lost 88 | let curBal5 = bal[message.author.id].balance 89 | bal[message.author.id].balance = curBal5 - money; 90 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 91 | message.channel.send(`🎲 | **${message.author.username}**, You sadly lost 💴 **${money}**, I hope you do better next time 😦`); 92 | if(err) console.log(err) 93 | }); 94 | } 95 | 96 | }; 97 | exports.conf = { 98 | aliases: ['gambling'], 99 | cooldown: '10' 100 | }; 101 | 102 | exports.help = { 103 | name: 'gamble', 104 | description: 'Allows you to spend your Balance on a game of Gamble.', 105 | usage: 'gamble ' 106 | }; -------------------------------------------------------------------------------- /src/commands/economy/profile.js: -------------------------------------------------------------------------------- 1 | const { Canvas } = require('canvas-constructor'); 2 | const Discord = require('discord.js'); 3 | const { get } = require('node-superfetch'); 4 | 5 | let lepel = require('../../database/xp.json'); 6 | let coin = require('../../database/balance.json'); 7 | let reps = require('../../database/rep.json'); 8 | let info = require('../../database/note.json'); 9 | let bg = require('../../database/background.json'); 10 | let fishh = require('../../database/fish.json'); 11 | let works = require('../../database/works.json'); 12 | 13 | Canvas.registerFont(`${process.cwd()}/src/assets/font/NotoEmoji-Regular.ttf`, "NotoEmoji") 14 | Canvas.registerFont(`${process.cwd()}/src/assets/font/Roboto-Regular.ttf`, "RobotoRegular") 15 | 16 | exports.run = async (client, message, args, color) => { 17 | 18 | let user = message.mentions.users.first() || client.users.get(args[0]); 19 | if (!user) user = message.author; 20 | if (user.bot) return message.channel.send(`**${message.author.username}**, Bot not have a profile!`); 21 | 22 | /** 23 | * Define this all for fix undefined from JSON 24 | */ 25 | if(!works[user.id]){ 26 | works[user.id] = { 27 | work: 0 28 | }; 29 | } 30 | 31 | if(!fishh[user.id]){ 32 | fishh[user.id] = { 33 | fish: 0 34 | }; 35 | } 36 | 37 | if(!bg[user.id]){ 38 | bg[user.id] = { 39 | background: 'https://cdn.discordapp.com/attachments/492914262482878485/499770634172104715/Dreamy_Underwater_Bubbles_Sun_Light_iPhone_6_HD_Wallpaper-320x480.jpg' 40 | }; 41 | } 42 | 43 | if(!coin[user.id]){ 44 | coin[user.id] = { 45 | balance: 0 46 | }; 47 | } 48 | if(!lepel[user.id]){ 49 | lepel[user.id] = { 50 | xp: 0, 51 | level: 1 52 | }; 53 | } 54 | if(!reps[user.id]){ 55 | reps[user.id] = { 56 | rep: 0 57 | }; 58 | } 59 | if(!info[user.id]){ 60 | info[user.id] = { 61 | note: 'No info set' 62 | } 63 | } 64 | 65 | /** 66 | * Takes all from JSON before call it 67 | */ 68 | let xp = lepel[user.id].xp; 69 | let uLevel = lepel[user.id].level; 70 | let nxtLvlXp = uLevel * 500; 71 | let difference = xp/nxtLvlXp *345; 72 | let balance = coin[user.id].balance; 73 | let rep = reps[user.id].rep; 74 | let Info = info[user.id].note 75 | let background = bg[user.id].background; 76 | let fish = fishh[user.id].fish; 77 | let work = works[user.id].work; 78 | 79 | /** 80 | * Create Canvas function 81 | * Use try and catch for any error will caused 82 | */ 83 | try { 84 | async function createCanvas() { 85 | var imageUrlRegex = /\?size=2048$/g; 86 | var namam = user.username; 87 | var jadim = namam.length > 10 ? namam.substring(0, 12) + "..." : namam; 88 | var {body: avatar} = await get(user.displayAvatarURL.replace(imageUrlRegex, "?size128")); 89 | var {body: background1} = await get(background) 90 | var {body: background2} = await get('https://cdn.discordapp.com/attachments/492914262482878485/493210917488558111/1537660968355.png'); 91 | var {body: dIcon} = await get('https://orig00.deviantart.net/2133/f/2016/200/f/a/discord_token_icon_dark_by_flexo013-daaj71i.png') 92 | var {body: FiSh} = await get('https://twemoji.maxcdn.com/2/72x72/1f3a3.png') 93 | var {body: cIcon} = await get('https://cdn.discordapp.com/attachments/492914262482878485/494027120557817866/chat-message-text-bubble-chatbubble-comment-speech-6-14759.png'); 94 | var {body: wIcon} = await get('https://cdn.discordapp.com/attachments/501064603233681411/502354808750080002/1f4bc.png') 95 | const lines = client.util.getWrapText(info, 17); 96 | 97 | return new Canvas(600, 600) 98 | .setColor('#000000') 99 | .addImage(background1, 0,0,600,600) 100 | .addBeveledImage(background2, 0,0,600,600) 101 | .addImage(dIcon, 190,250,55,55) 102 | .addImage(FiSh, 530,370,40,40) 103 | .addImage(wIcon, 530,480,30,30) 104 | .setTextFont('30px NotoEmoji, RobotoRegular') 105 | .addText(`Name: ${jadim}`, 250, 285) 106 | .setTextFont('30px Impact') 107 | .addText(`+Rep:`, 240,330) 108 | .addText(`${rep}`, 340,330) 109 | .setTextFont('30px Impact') 110 | .addText('|', 280,380) 111 | .addText('|', 280,400) 112 | .addText('|', 280,420) 113 | .addText('|', 280,450) 114 | .addText('|', 280,470) 115 | .addText('|', 280,495) 116 | .addText('__ ___', 495,420) 117 | .addText('_______', 495,460) 118 | .addText('__ ___', 495,520) 119 | .addText('_______', 495,560) 120 | .addText('_______________________', 150,500) 121 | .setTextFont('bold 28px Courier New') 122 | // .addImage(cIcon, 300,355,40,40) 123 | .addText('💬 Info box', 290,385) 124 | .setTextFont('17px NotoEmoji') 125 | .addText(`${Info}`, 295, 413) 126 | .setTextFont('bold 30px Courier New') 127 | .addText('Level', 172,390) 128 | .setTextFont('17px RobotoRegular') 129 | .addText('Total XP', 180, 530) 130 | .addText('Balance', 180, 560) 131 | .addText(`${client.util.crFormat(xp)}`, 370, 530) 132 | .addText(`¥${client.util.crFormat(balance)}`, 370, 560) 133 | .setTextAlign('center') 134 | .setTextFont('bold 20px Courier New') 135 | .addText(`${client.util.crFormat(fish)}`,543,455) 136 | .addText(`${client.util.crFormat(work)}`, 543,555) 137 | .setTextFont('bold 40px Courier New') 138 | .addText(`${uLevel}`, 220,450) 139 | .setColor("#459466") 140 | .addRect(150, 570, difference, 34) 141 | .setTextFont("16px RobotoRegular") 142 | .setColor("#000000") 143 | .setTextAlign("center") 144 | .addText(`XP: ${xp} / ${nxtLvlXp}`, 330, 590) 145 | .addRoundImage(avatar, 10, 190, 168, 168, 168/2) 146 | .toBufferAsync(); 147 | } 148 | 149 | let m = await message.channel.send('*Please Wait...*'); 150 | 151 | const gumen = ` 152 | **User profile card for ${user.tag}** 153 | `; message.channel.send(gumen, {file: new Discord.Attachment(await createCanvas(), 'profile.png')}).then(() => {m.delete()}) 154 | 155 | } catch (e) { 156 | message.channel.send(`Oh no an error occurred :( \`${e.message}\` try again later.`); 157 | } 158 | 159 | 160 | } 161 | 162 | exports.conf = { 163 | aliases: [], 164 | cooldown: "10" 165 | } 166 | 167 | exports.help = { 168 | name: "profile", 169 | description: "See your/someone profile", 170 | usage: "profile [@mention|userID]" 171 | } -------------------------------------------------------------------------------- /src/handle/util.js: -------------------------------------------------------------------------------- 1 | const snek = require('node-superfetch'); 2 | const nodeVersion = parseInt(process.versions.node.split('.'), 10); 3 | const MONEY = ['', 'k', 'M', 'G', 'T', 'P', 'E']; 4 | const yes = ['yes', 'y', 'ye', 'yeah', 'yup', 'yea', 'ya']; 5 | const no = ['no', 'n', 'nah', 'nope', 'nop']; 6 | 7 | class Util { 8 | 9 | static async verifyText(channel, user, time = 30000) { 10 | const filter = res => { 11 | const value = res.content.toLowerCase(); 12 | return res.author.id === user.id && (yes.includes(value) || no.includes(value)); 13 | }; 14 | const verify = await channel.awaitMessages(filter, { 15 | max: 1, 16 | time 17 | }); 18 | if (!verify.size) return 0; 19 | const choice = verify.first().content.toLowerCase(); 20 | if (yes.includes(choice)) return true; 21 | if (no.includes(choice)) return false; 22 | return false; 23 | } 24 | 25 | static async getProgbar(current, max, length){ 26 | const curBer = Math.floor((current/max)*length); 27 | let str = ''; 28 | for(let i = 0; i < length; i++){ 29 | str += i < curBer ? '✅' :'⬜' 30 | } 31 | return str; 32 | 33 | } 34 | 35 | static crFormat(number){ 36 | const peringkat = Math.log10(number) / 3 | 0; 37 | if(!peringkat) return number.toString(); 38 | const last = MONEY[peringkat]; 39 | const skala = Math.pow(10, peringkat*3); 40 | const skalad = number / skala; 41 | return `${skalad.toFixed(2)}${last}`; 42 | } 43 | 44 | static timeString(seconds, forceHours = false) { 45 | const hours = Math.floor(seconds / 3600); 46 | const minutes = Math.floor(seconds % 3600 / 60); 47 | 48 | return `${forceHours || hours >= 1 ? `${hours}:` : ''}${hours >= 1 ? `0${minutes}`.slice(-2) : minutes}:${`0${Math.floor(seconds % 60)}`.slice(-2)}`; 49 | } 50 | 51 | static async getWrapText(text, length){ 52 | const temp = []; 53 | for(let i = 0; i < text.length; i+= length){ 54 | temp.push(text.slice(i, i+length)); 55 | } 56 | return temp.map(x => x.trim()); 57 | } 58 | 59 | static delay(ms) { 60 | return new Promise(resolve => setTimeout(resolve, ms)); 61 | } 62 | static randomRange(min, max) { 63 | return Math.floor(Math.random() * (max - min + 1)) + min; 64 | } 65 | static shuffle (array){ 66 | const arr = array.slice(0); 67 | for(let i = arr.length -1; i >= 0; i--){ 68 | const j = Math.floor(Math.random() * (i + 1)); 69 | const temp = arr[i]; 70 | arr[i] = arr[j]; 71 | arr[j] = temp; 72 | } 73 | return arr; 74 | } 75 | static async hastebin(text){ 76 | const { body } = await snek.post('https://www.hastebin.com/documents') 77 | .send(text); 78 | return `https://www.hastebin.com/${body.key}`; 79 | } 80 | static chunk (array, chunkSize){ 81 | const temp = []; 82 | for(let i = 0; i < array.length; i+= chunkSize){ 83 | temp.push(array.slice(i, i+chunkSize)); 84 | } 85 | return temp; 86 | } 87 | static parseDur(ms){ 88 | let seconds = ms / 1000; 89 | let days = parseInt(seconds / 86400); 90 | seconds = seconds % 86400; 91 | let hours = parseInt(seconds / 3600); 92 | seconds = seconds % 3600; 93 | let minutes = parseInt(seconds / 60); 94 | seconds = parseInt(seconds % 60); 95 | 96 | if (days) { 97 | return `${days}d ${hours}h ${minutes}m ${seconds}s`; 98 | } 99 | else if (hours) { 100 | return `${hours}h ${minutes}m ${seconds}s`; 101 | } 102 | else if (minutes) { 103 | return `${minutes}m ${seconds}s`; 104 | } 105 | return `${seconds}s`; 106 | } 107 | static trimArray (array, length = 10){ 108 | const len = array.length - length; 109 | const temp = array.slice(0, length); 110 | temp.push(`...${len} more.`); 111 | return temp; 112 | } 113 | static async verify(user, msg, time = 30000){ 114 | await msg.react('🇾'); 115 | await msg.react('🇳'); 116 | const data = await msg.awaitReactions(reaction => reaction.users.has(user.id), { time: time, max: 1}); 117 | if(data.firstKey() === '🇾') return true; 118 | return false; 119 | } 120 | static codeblock (string, code){ 121 | return `\`\`\`${code}\n${string}\`\`\``; 122 | } 123 | static decodeHtmlEntities (text){ 124 | return text.replace(/&#(\d+);/g, (rep, code) => { 125 | return String.fromCharCode(code) 126 | }); 127 | } 128 | static async scrapeSubreddit(subreddit){ 129 | subreddit = typeof subreddit === "string" && subreddit.length !== 0 ? subreddit : "puppies"; 130 | const { body } = await snek.get(`https://imgur.com/r/${subreddit}/hot.json`); 131 | if(!body.data) return undefined; 132 | const img = body.data[Math.floor(Math.random() * body.data.length)]; 133 | return `http://imgur.com/${img.hash}${img.ext.replace(/\?.*/, "")}`; 134 | } 135 | static promisify(fn){ 136 | if(nodeVersion >= 8) return require('util').promisify(fn); 137 | let name = fn.name; 138 | name = (name || '').replace(/\s|bound(?!$)/g, ''); 139 | function newFunction(...args) { 140 | const arg = []; 141 | for (const key of Object.keys(args)) arg.push(args[key]); 142 | return new Promise((resolve, reject) => 143 | fn.apply(this, [...args, (err, res) => { 144 | if (err) return reject(err); 145 | return resolve(res); 146 | }])); 147 | } 148 | Object.defineProperty(newFunction, 'name', { value: name }); 149 | return newFunction; 150 | } 151 | static promisifyAll(obj, suffix = 'Async'){ 152 | const newObj = Object.getPrototypeOf(obj); 153 | for (const key of Object.keys(obj).concat(Object.keys(newObj))) { 154 | if (typeof obj[key] !== 'function') continue; 155 | obj[`${key}${suffix}`] = this.promisify(obj[key]); 156 | } 157 | return obj; 158 | } 159 | 160 | static wrapText(ctx, text, maxWidth) { 161 | return new Promise(resolve => { 162 | if (ctx.measureText(text).width < maxWidth) return resolve([text]); 163 | const words = text.split(' '); 164 | const lines = []; 165 | let line = ''; 166 | while (words.length > 0) { 167 | let split = false; 168 | while (ctx.measureText(words[0]).width >= maxWidth) { 169 | const temp = words[0]; 170 | words[0] = temp.slice(0, -1); 171 | if (split) { 172 | words[1] = `${temp.slice(-1)}${words[1]}`; 173 | } else { 174 | split = true; 175 | words.splice(1, 0, temp.slice(-1)); 176 | } 177 | } 178 | if (ctx.measureText(`${line}${words[0]}`).width < maxWidth) { 179 | line += `${words.shift()} `; 180 | } else { 181 | lines.push(line.trim()); 182 | line = ''; 183 | } 184 | if (words.length === 0) lines.push(line.trim()); 185 | } 186 | return resolve(lines); 187 | }); 188 | } 189 | 190 | } 191 | 192 | 193 | module.exports = Util; 194 | -------------------------------------------------------------------------------- /src/commands/economy/blackjack.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Source: https://github.com/dragonfire535/xiao/blob/master/commands/games/blackjack.js 3 | * Xiao [ Bot ] 4 | * Thanks to: dragonfire535 5 | */ 6 | 7 | const fs = require('fs'); 8 | let bal = require('../../database/balance.json'); 9 | const suits = ['<:clubes:504575727597781002>', '♥', '♦', '<:spades:504575727560032272>']; 10 | const faces = ['Jack', 'Queen', 'King']; 11 | 12 | const { shuffle, verifyText } = require('../../handle/util'); 13 | 14 | const decks = new Map(); 15 | 16 | exports.run = async (client, message, args) => { 17 | 18 | if(!bal[message.author.id]){ 19 | bal[message.author.id] = { 20 | balance: 0 21 | }; 22 | } 23 | 24 | let amount = parseInt(args[0]); 25 | 26 | if (!amount) return args.missing(message, 'You need to specify amount to bet.', client.commands.get('blackjack').help) 27 | if (isNaN(amount)) return message.channel.send(`**${message.author.username}**, Please enter valid number!`); 28 | if (amount > 9999) return message.channel.send('Bet msx to 999 only'); 29 | 30 | if(bal[message.author.id].balance < amount) return message.channel.send(`**${message.author.username}**, You\'re betting more than you have!`); 31 | 32 | let curBal = bal[message.author.id].balance; 33 | 34 | let deckCount = 4; 35 | 36 | if (decks.has(message.channel.id)) return message.reply('Only one game may be occurring per channel.'); 37 | try { 38 | decks.set(message.channel.id, generateDeck(deckCount)); 39 | const dealerHand = []; 40 | draw(message.channel, dealerHand); 41 | draw(message.channel, dealerHand); 42 | const playerHand = []; 43 | draw(message.channel, playerHand); 44 | draw(message.channel, playerHand); 45 | const dealerInitialTotal = calculate(dealerHand); 46 | const playerInitialTotal = calculate(playerHand); 47 | if (dealerInitialTotal === 21 && playerInitialTotal === 21) { 48 | decks.delete(message.channel.id); 49 | return message.channel.send('Well, both of you just hit blackjack. Right away. Rigged.'); 50 | } else if (dealerInitialTotal === 21) { 51 | decks.delete(message.channel.id); 52 | //return; 53 | bal[message.author.id].balance = curBal - amount; 54 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 55 | if(err) console.log(err); 56 | return message.channel.send(`Ouch, the dealer hit blackjack right away! You lost 💴 **${amount}**, I hope you do better next time!`); 57 | }); 58 | } else if (playerInitialTotal === 21) { 59 | decks.delete(message.channel.id); 60 | //return; 61 | bal[message.author.id].balance = curBal + amount; 62 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 63 | if(err) console.log(err); 64 | return message.channel.send(`Wow, you hit blackjack right away! Lucky and you won 💴 **${amount}**!`); 65 | }); 66 | } 67 | let playerTurn = true; 68 | let win = false; 69 | let reason; 70 | while (!win) { 71 | if (playerTurn) { 72 | let m = await message.channel.send(`**First Dealer Card:** ${dealerHand[0].display}\n**You (${calculate(playerHand)}):**\n${playerHand.map(card => card.display).join('\n')}\n\n_Hit?_ *(yes/no)*`); 73 | const hit = await verifyText(message.channel, message.author); 74 | m.delete(); 75 | if (hit) { 76 | const card = draw(message.channel, playerHand); 77 | const total = calculate(playerHand); 78 | if (total > 21) { 79 | reason = `You drew ${card.display}, total of ${total}! Bust`; 80 | break; 81 | } else if (total === 21) { 82 | reason = `You drew ${card.display} and hit 21`; 83 | win = true; 84 | } 85 | } else { 86 | const dealerTotal = calculate(dealerHand); 87 | await message.channel.send(`Second dealer card is ${dealerHand[1].display}, total of ${dealerTotal}.`); 88 | playerTurn = false; 89 | } 90 | } else { 91 | const inital = calculate(dealerHand); 92 | let card; 93 | if (inital < 17) card = draw(message.channel, dealerHand); 94 | const total = calculate(dealerHand); 95 | if (total > 21) { 96 | reason = `Dealer drew ${card.display}, total of ${total}! Dealer bust`; 97 | win = true; 98 | } else if (total >= 17) { 99 | const playerTotal = calculate(playerHand); 100 | if (total === playerTotal) { 101 | reason = `${card ? `Dealer drew ${card.display}, making it ` : ''}${playerTotal}-${total}`; 102 | break; 103 | } else if (total > playerTotal) { 104 | reason = `${card ? `Dealer drew ${card.display}, making it ` : ''}${playerTotal}-**${total}**`; 105 | break; 106 | } else { 107 | reason = `${card ? `Dealer drew ${card.display}, making it ` : ''}**${playerTotal}**-${total}`; 108 | win = true; 109 | } 110 | } else { 111 | await message.channel.send(`Dealer drew ${card.display}, total of ${total}.`); 112 | } 113 | } 114 | } 115 | decks.delete(message.channel.id); 116 | if (win) { 117 | bal[message.author.id].balance = curBal + amount; 118 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 119 | if(err) console.log(err); 120 | return message.channel.send(`${reason}! You won 💴 **${amount}**!`); 121 | }); 122 | } else { 123 | bal[message.author.id].balance = curBal - amount; 124 | fs.writeFile('./src/database/balance.json', JSON.stringify(bal, null, 2), (err) => { 125 | if(err) console.log(err); 126 | return message.channel.send(`${reason}! You lost 💴 **${amount}**.`); 127 | }); 128 | } 129 | } catch (err) { 130 | decks.delete(message.channel.id); 131 | throw err; 132 | } 133 | } 134 | 135 | function generateDeck(deckCount) { 136 | const deck = []; 137 | for (let i = 0; i < deckCount; i++) { 138 | for (const suit of suits) { 139 | deck.push({ 140 | value: 11, 141 | display: `${suit} Ace` 142 | }); 143 | for (let j = 2; j <= 10; j++) { 144 | deck.push({ 145 | value: j, 146 | display: `${suit} ${j}` 147 | }); 148 | } 149 | for (const face of faces) { 150 | deck.push({ 151 | value: 10, 152 | display: `${suit} ${face}` 153 | }); 154 | } 155 | } 156 | } 157 | return shuffle(deck); 158 | } 159 | 160 | function draw(channel, hand) { 161 | const deck = decks.get(channel.id); 162 | const card = deck[0]; 163 | deck.shift(); 164 | hand.push(card); 165 | return card; 166 | } 167 | 168 | function calculate(hand) { 169 | return hand.sort((a, b) => a.value - b.value).reduce((a, b) => { 170 | let { value } = b; 171 | if (value === 11 && a + value > 21) value = 1; 172 | return a + value; 173 | }, 0); 174 | } 175 | exports.conf = { 176 | aliases: ['bj', '21'], 177 | cooldown: '7' 178 | } 179 | exports.help = { 180 | name: 'blackjack', 181 | description: 'Play a game of blackjack.', 182 | usage: 'blackjack ' 183 | } --------------------------------------------------------------------------------