├── .gitignore ├── .vscode └── launch.json ├── README.md ├── bot.js ├── changelog.txt ├── commands ├── adblock.js ├── addfilter.js ├── addpatron.js ├── addtag.js ├── advice.js ├── announce.js ├── autorole.js ├── avatar.js ├── background.js ├── ban.js ├── bcupdate.js ├── block.js ├── botisdead.js ├── brainfuck.js ├── broadcast.js ├── burn.js ├── cat.js ├── ccmd.js ├── changelog.js ├── clean.js ├── cow.js ├── createcard.js ├── dailies.js ├── dashboard.js ├── deathnote.js ├── deletecmds.js ├── delfilter.js ├── deltag.js ├── discrim.js ├── donate.js ├── embed.js ├── emojify.js ├── encrypt.js ├── eval.js ├── filterconf.js ├── funnfuck.js ├── getsomehelp.js ├── give.js ├── giveaway.js ├── hackban.js ├── help.js ├── hidechannel.js ├── hug.js ├── info.js ├── infobox.js ├── invite.js ├── joindm.js ├── kermit.js ├── kick.js ├── leaderboard.js ├── leveling.js ├── listfilters.js ├── listtags.js ├── lockdown.js ├── lottery.js ├── math.js ├── meme.js ├── modlog.js ├── money.js ├── nickname.js ├── nut.js ├── pardon.js ├── pause.js ├── pconf.js ├── permission.js ├── ping.js ├── play.js ├── poll.js ├── profile.js ├── pun.js ├── punch.js ├── purge.js ├── queue.js ├── reload.js ├── remove.js ├── rep+.js ├── rep-.js ├── restart.js ├── resume.js ├── robohash.js ├── roleme.js ├── say.js ├── setchannel.js ├── sethost.js ├── setprefix.js ├── showrep.js ├── shrug.js ├── skip.js ├── slots.js ├── snek.js ├── softban.js ├── stats.js ├── stop.js ├── strikes.js ├── suggest.js ├── support.js ├── tableflip.js ├── tag.js ├── taginfo.js ├── tex.js ├── thesearch.js ├── togglefun.js ├── togglemusic.js ├── togglesocial.js ├── trivia.js ├── tts.js ├── unflip.js ├── updatesquad.js ├── upvote.js ├── urban.js ├── warn.js ├── whois.js └── ytsearch.js ├── events ├── guildCreate+Delete.js ├── guildMemberAdd.js ├── guildMemberRemove.js ├── message.js ├── messageEdit.js └── modlog.js ├── extensions └── mfs.js ├── fonts ├── SFtoon.fnt └── SFtoon.png ├── functions ├── adblock.js ├── bg.js ├── checkPerm.js ├── espeak.js ├── filter.js ├── framework.js ├── loadCommands.js ├── loadDB.js ├── log.js ├── music.js ├── specialHelp.js ├── storeMessages.js └── strikes.js ├── images ├── bg │ ├── cities │ │ ├── 1.png │ │ ├── 2.png │ │ ├── 3.png │ │ ├── 4.png │ │ ├── 5.png │ │ ├── 6.png │ │ ├── 7.png │ │ ├── 8.png │ │ ├── 9.png │ │ └── cities.png │ ├── default.png │ ├── nightsky │ │ ├── 1.png │ │ ├── 2.png │ │ ├── 3.png │ │ ├── 4.png │ │ ├── 5.png │ │ ├── 6.png │ │ ├── 7.png │ │ ├── 8.png │ │ ├── 9.png │ │ └── nightsky.png │ └── solid │ │ ├── 1.png │ │ ├── 2.png │ │ ├── 3.png │ │ ├── 4.png │ │ ├── 5.png │ │ ├── 6.png │ │ ├── 7.png │ │ ├── 8.png │ │ ├── 9.png │ │ └── solid.png ├── cah.png ├── death.png ├── images │ ├── cross.png │ ├── dickbutt.png │ ├── gladpepe │ │ ├── Unknown-2.png │ │ ├── Unknown-3.png │ │ ├── Unknown-4.png │ │ ├── Unknown-5.png │ │ ├── Unknown.png │ │ ├── images-2.jpeg │ │ ├── images-2.png │ │ ├── images-3.jpeg │ │ ├── images-3.png │ │ ├── images-4.jpeg │ │ ├── images-5.jpeg │ │ ├── images-6.jpeg │ │ ├── images.jpeg │ │ └── images.png │ ├── kim │ │ ├── kim2.jpg │ │ ├── kim3.jpg │ │ ├── kim4.jpg │ │ ├── kim5.jpg │ │ ├── kim6.jpg │ │ ├── kim7.jpg │ │ ├── kim8.jpg │ │ └── kim9.jpg │ ├── sadpepe │ │ ├── images-2.jpeg │ │ ├── images-2.png │ │ ├── images-3.jpeg │ │ ├── images-4.jpeg │ │ ├── images.jpeg │ │ ├── images.png │ │ ├── pepe.png │ │ ├── pepe1.png │ │ ├── pepe10.png │ │ ├── pepe2.png │ │ ├── pepe3.jpg │ │ ├── pepe4.jpg │ │ ├── pepe5.jpg │ │ ├── pepe6.jpg │ │ ├── pepe7.png │ │ ├── pepe8.png │ │ └── pepe9.jpg │ └── smh │ │ ├── bunkwire.gif │ │ ├── giphy.gif │ │ ├── judge.gif │ │ ├── kn.gif │ │ ├── raw.gif │ │ ├── shake.gif │ │ ├── shakingthe.gif │ │ └── tumble.gif ├── kermit.png ├── nut.jpg ├── profile.png ├── stopit.mp3 └── thesearch.png ├── music ├── bot.js ├── commands │ ├── meval.js │ ├── pause.js │ ├── play.js │ ├── queue.js │ ├── remove.js │ ├── resume.js │ ├── setchannel.js │ ├── sethost.js │ ├── skip.js │ └── stop.js ├── events │ └── message.js ├── func │ ├── checkPerms.js │ ├── config.js │ ├── convertPerms.js │ └── loadCommands.js ├── lib │ ├── GenerateQueue.js │ ├── GuildPlayer.js │ ├── Registry.js │ ├── SoundCloudSong.js │ ├── YouTubeSong.js │ ├── apiKeyCheck.js │ └── linkType.js └── node-music.js ├── package-lock.json ├── package.json ├── shard.js ├── struct ├── Bot.js ├── GuildConfig.js ├── Message.js ├── ProfileConfig.js └── SystemConfig.js └── util.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | /config.js -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible Node.js debug attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "program": "${workspaceRoot}/music/bot.js" 12 | }, 13 | { 14 | "type": "node", 15 | "request": "attach", 16 | "name": "Attach to Process", 17 | "address": "localhost", 18 | "port": 5858 19 | } 20 | ] 21 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # This is a very old version of the bot, The updated code can be found at [https://github.com/NitroBots/Rewrite](https://github.com/NitroBots/Rewrite) 2 | 3 | [![Discord Bots](https://discordbots.org/api/widget/264087705124601856.png)](https://discordbots.org/bot/264087705124601856) 4 | ## The Ultimate Discord Bot! 5 | Add it Now! 6 | 7 | 8 | 9 | Creative Commons License
Nitro by Funnbot is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
Based on a work at https://github.com/funnbot/Nitro. 10 | -------------------------------------------------------------------------------- /bot.js: -------------------------------------------------------------------------------- 1 | const Bot = require('./struct/Bot') 2 | 3 | const config = require('./config') 4 | 5 | Bot().then(bot => { 6 | module.exports = bot 7 | require('./events/message') 8 | require('./events/messageEdit') 9 | require('./events/guildCreate+Delete') 10 | require('./events/guildMemberAdd') 11 | require('./events/guildMemberRemove') 12 | require('./events/modlog') 13 | require('./functions/loadCommands').load() 14 | require('./util') 15 | require('./functions/specialHelp') 16 | bot.login(config.token) 17 | }).catch(err => console.log(err)); -------------------------------------------------------------------------------- /changelog.txt: -------------------------------------------------------------------------------- 1 | **In Progress** 2 | > Integrate with Discord.fm 3 | > Pet Sim 4 | > Ban and Kick cases with Reasons 5 | > Giveaway System 6 | **Finished** 7 | > Update Squad 8 | > More Modlog Events 9 | > Dm message on Join 10 | > Strike System 11 | > Reputation System 12 | > Chat Filter 13 | Do you want to decide what shows up here? Join our server: 14 | Or help pay for the server to keep Nitro alive: -------------------------------------------------------------------------------- /commands/addfilter.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | 3 | let prefix = message.guild.prefix 4 | if (!message.args[0]) return send("**To add a keyword filter: `" + prefix + "addfilter \"\"`**") 5 | let filters = message.guild.filter 6 | if (Object.keys(filters).length > 99) return send("**Maximum Keyword Limit Reached: 100**") 7 | 8 | let split = message.content.split("\""); 9 | let bool = message.content.replace(/"/g, ""); 10 | if (bool.length === message.content.length - 1) { 11 | bool = false; 12 | } else { 13 | bool = true 14 | } 15 | if (!split[1] || !bool) { 16 | return message.channel.send("**The new keyword filter must be wrapped in quotes (`\"`)**"); 17 | } 18 | 19 | if (split[1].length < 2) return send("**Invalid Keyword:** Too Short") 20 | if (/^\s+$/g.test(split[1])) return send("**Invalid Keyword**: Illegal Characters") 21 | 22 | if (!filters.keywords) filters.keywords = {} 23 | if (filters.keywords[split[1]]) return send("**Keyword already exists**") 24 | filters.keywords[split[1]] = true 25 | send("**Messages containing the keyword `"+split[1]+"` will now be deleted**") 26 | bot.config.setFilter(message.guild.id, filters) 27 | 28 | } 29 | 30 | exports.conf = { 31 | userPerm: ["MANAGE_GUILD"], 32 | botPerm: ["SEND_MESSAGES", "MANAGE_MESSAGES"], 33 | coolDown: 0, 34 | dm: false, 35 | category: "Filter", 36 | help: "Add a keyword filter", 37 | args: "", 38 | } -------------------------------------------------------------------------------- /commands/addpatron.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | let patrons = bot.system.getPatrons(); 3 | let id = message.suffix.trim().replace(/[^0-9]/g, ""); 4 | if (patrons[id]) { 5 | delete patrons[id]; 6 | send("Deleted " + id); 7 | } else { 8 | patrons[id] = true; 9 | send("Added " + id); 10 | } 11 | bot.system.setPatrons(patrons); 12 | } 13 | 14 | exports.conf = { 15 | userPerm:["DEV"], 16 | botPerm:["SEND_MESSAGES"], 17 | coolDown:0, 18 | dm:true, 19 | category:"DevOnly", 20 | help:"Add a patron.", 21 | args:"", 22 | } -------------------------------------------------------------------------------- /commands/addtag.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | let prefix = message.guild.prefix 3 | if (!message.args[0]) return message.channel.send("To add a tag use: `" + prefix + "addtag `"); 4 | let tags = message.guild.tags 5 | if (Object.keys(tags).length > 100) return send("**You've hit the max amount of tags per server: 100, delete a few first**") 6 | 7 | message.suffix = nu.clean(message.suffix) 8 | message.args.forEach((arg, i) => message.args[i] = nu.clean(arg)) 9 | 10 | if (tags[message.args[0]]) return message.channel.send("**The tag `" + message.args[1] + "` already exists**"); 11 | if (!message.args[1]) return message.channel.send(`Provide the text for the tag after the name.`); 12 | let r = message.suffix.split(" "); 13 | r = r.slice(1) 14 | let text = r.join(" "); 15 | tags[message.args[0]] = { 16 | owner: message.author.id, 17 | text: text, 18 | created: (new Date()).getTime(), 19 | used: 0 20 | }; 21 | message.channel.send("**Adding the tag `" + message.args[0] + "`**.") 22 | return bot.config.setTags(message.guild.id, tags) 23 | } 24 | 25 | exports.conf = { 26 | userPerm: [], 27 | botPerm: ["SEND_MESSAGES"], 28 | coolDown: 0, 29 | dm: false, 30 | category: "Tag", 31 | help: "Add a tag to the server", 32 | args: "", 33 | } -------------------------------------------------------------------------------- /commands/advice.js: -------------------------------------------------------------------------------- 1 | const request = require('request'); 2 | 3 | exports.run = (message, bot, send) => { 4 | let cn = request("http://api.adviceslip.com/advice", function (err, res, body) { 5 | try { 6 | let cnj = JSON.parse(body) 7 | message.channel.send(cnj.slip.advice) 8 | } catch (e) { 9 | return send("**Advice machine :b:roke**") 10 | } 11 | }); 12 | } 13 | 14 | exports.conf = { 15 | userPerm: [], 16 | botPerm: ["SEND_MESSAGES"], 17 | coolDown: 0, 18 | dm: true, 19 | category: "Fun", 20 | help: "Need a little advice?", 21 | args: "", 22 | } -------------------------------------------------------------------------------- /commands/announce.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | let acc = message.guild.announce 3 | if (!message.args[0]) { 4 | message.channel.send(nu.getSpecialHelp("announce", message.guild.prefix)) 5 | } else if (message.args[0] === "channel") { 6 | if (!!acc.channel) { 7 | message.send("**Join/Leave logs will no longer be sent in <#" + acc.channel + ">**"); 8 | delete acc.channel; 9 | bot.config.setAnc(message.guild.id, acc); 10 | } else { 11 | let channel; 12 | if (!message.args[1]) { 13 | channel = message.channel.id; 14 | } else if (message.guild.channels.has(message.args[1])) { 15 | channel = message.guild.channels.get(message.args[1]).id; 16 | } else if (message.args[1].startsWith("<#") && message.args[1].endsWith(">")) { 17 | let id = message.args[1].replace(/[<#>]/g, ""); 18 | if (message.guild.channels.has(id)) { 19 | channel = message.guild.channels.get(id).id; 20 | } 21 | } else { 22 | return message.send("**Failed to resolve a channel from "+message.args[1]+"**") 23 | } 24 | acc.channel = channel; 25 | bot.config.setAnc(message.guild.id, acc); 26 | message.send("**The Join / Leave logs will be sent to <#"+channel+"> , Make sure you configure the welcome and farewell messages next, or nothing will happen.**") 27 | } 28 | return; 29 | } else if (message.args[0] === "welcome") { 30 | if (!message.args[1]) { 31 | if (acc.hasOwnProperty("welcome")) { 32 | message.send("**The welcome message has been deleted, and it will no longer be sent.**"); 33 | delete acc.welcome; 34 | bot.config.setAnc(message.guild.id, acc); 35 | } else { 36 | message.send("**The welcome message is not currently active.**") 37 | } 38 | return; 39 | } else { 40 | let msg = message.suffix.split(" "); 41 | msg.shift(); 42 | msg = msg.join(" "); 43 | acc.welcome = msg; 44 | bot.config.setAnc(message.guild.id, acc); 45 | message.send("**The welcome message: `"+msg+"` will now be sent in the Join/leave log channel. Make sure you configure that aswell.**"); 46 | } 47 | } else if (message.args[0] === "farewell") { 48 | if (!message.args[1]) { 49 | if (acc.hasOwnProperty("farewell")) { 50 | message.send("**The farewell message has been deleted, and it will no longer be sent.**"); 51 | delete acc.farewell; 52 | bot.config.setAnc(message.guild.id, acc); 53 | } else { 54 | message.send("**The farewell message is not currently active.**") 55 | } 56 | return; 57 | } else { 58 | let msg = message.suffix.split(" "); 59 | msg.shift(); 60 | msg = msg.join(" "); 61 | acc.farewell = msg; 62 | bot.config.setAnc(message.guild.id, acc); 63 | message.send("**The farewell message: `"+msg+"` will now be sent in the Join/leave log channel. Make sure you configure that aswell.**"); 64 | } 65 | } else { 66 | message.channel.send(nu.getSpecialHelp("announce")) 67 | } 68 | } 69 | 70 | exports.conf = { 71 | userPerm: ["MANAGE_GUILD"], 72 | botPerm: ["SEND_MESSAGES"], 73 | coolDown: 0, 74 | dm: false, 75 | category: "Utility", 76 | help: "Setup join/leave log.", 77 | args: " ", 78 | } -------------------------------------------------------------------------------- /commands/autorole.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | let oldRole = message.guild.autorole 3 | if (!message.args[0]) { 4 | if (oldRole !== false) { 5 | bot.config.setAuto(message.guild.id, false); 6 | return message.send("**Autorole has been disabled.**") 7 | } else { 8 | return message.send('**Please provide a role for autorole.**') 9 | } 10 | } 11 | if (message.mentions.roles.first()) return message.send("**Type the role name instead of mentioning it**") 12 | if (!message.guild.roles.exists('name', message.suffix)) return message.send("The role **"+message.suffix+"** does not exist on this server."); 13 | if (message.guild.roles.find('name', message.suffix).position > message.guild.member(bot.user).highestRole.position) return message.send("**I cannot assign a role that is higher than my highest role.**"); 14 | bot.config.setAuto(message.guild.id, message.suffix); 15 | message.send("The role **" +message.suffix+ "** will now be assigned to users when they join your server.") 16 | } 17 | 18 | exports.conf = { 19 | userPerm:["MANAGE_GUILD"], 20 | botPerm:["SEND_MESSAGES", "MANAGE_ROLES_OR_PERMISSIONS"], 21 | coolDown:0, 22 | dm:false, 23 | category:"Utility", 24 | help:"Setup autorole on user join.", 25 | args:"", 26 | } -------------------------------------------------------------------------------- /commands/avatar.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | let user = message.mentions.users.first() ? message.mentions.users.first() : message.author 3 | let ava = user.displayAvatarURL 4 | let embed = { 5 | color:0x542437, 6 | description:"Here is "+user.username+"'s avatar: *[url]("+ava+")*", 7 | image:{url:ava} 8 | } 9 | message.channel.send("", {embed}); 10 | } 11 | 12 | exports.conf = { 13 | userPerm:[], 14 | botPerm:["SEND_MESSAGES"], 15 | coolDown:0, 16 | dm:true, 17 | category:"Other", 18 | help:"Retrieve a users avatar.", 19 | args:"<@mention>", 20 | } -------------------------------------------------------------------------------- /commands/background.js: -------------------------------------------------------------------------------- 1 | const bg = require('../functions/bg') 2 | const Canvas = require('canvas') 3 | 4 | exports.run = (message, bot, send) => { 5 | 6 | if (!message.args[0]) return send("**The available backround categories are: `solid`, `nightsky`, and `cities` or set to `default`**") 7 | if (!bg[message.args[0]]) return send("*Invalid category*\n\n**The available backround categories are: `solid`, `nightsky`, and `cities` or set to `default`**") 8 | 9 | if (message.args[0] === "default") { 10 | message.channel.send("**Your background has been reset to default**") 11 | return bot.profile.setBg(message.author.id, "default") 12 | } 13 | 14 | if (!message.args[1]) return message.channel.sendFile(bg[message.args[0]].file, "bg.png", "__**" + message.args[0] + "**__\nSet your background with: `" + message.guild.prefix + "background " + message.args[0] + " `") 15 | 16 | let num = parseInt(message.args[1]) || 0 17 | if (num > 9 || num < 1) return send("Choose a number between 1 and 9") 18 | 19 | //Build Preview 20 | let canvas = new Canvas(400, 400) 21 | let ctx = canvas.getContext('2d') 22 | let img = new Canvas.Image() 23 | 24 | img.src = bg[message.args[0]].fold + "/" + num + ".png" 25 | ctx.drawImage(img, 0, 0, 400, 400) 26 | 27 | canvas.toBuffer((err, buf) => { 28 | 29 | if (err) return console.log(err) 30 | 31 | bot.profile.setBg(message.author.id, [message.args[0], num]) 32 | message.channel.sendFile(buf, "file.png", "**Your background has been set to: **") 33 | 34 | }) 35 | 36 | } 37 | 38 | exports.conf = { 39 | userPerm: [], 40 | botPerm: ["SEND_MESSAGES"], 41 | coolDown: 0, 42 | dm: false, 43 | category: "Social", 44 | help: "Set the background for your profile [WIP]", 45 | args: "", 46 | } -------------------------------------------------------------------------------- /commands/ban.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | if (!message.mentions.users.first()) return message.channel.send("Mention a user or multiple users to ban them.") 3 | let ment = message.mentions.users; 4 | let text = [] 5 | ment.forEach(m => { 6 | 7 | if (!message.guild.member(m).bannable) { 8 | message.channel.send("Something went wrong when banning: "+m.username); 9 | } else { 10 | message.guild.ban(message.guild.member(m)).then(() => { 11 | text.push(m.username) 12 | }).catch(err => message.channel.send("Something went wrong when banning: "+m.username)) 13 | } 14 | }); 15 | setTimeout(function() { 16 | if (text.length === 0) return; 17 | message.channel.send(text.join(", ")+" has been banned.", {split:true}); 18 | console.log(message.guild.name+" Banned "+text.join(", ")) 19 | }, 1000); 20 | } 21 | 22 | exports.conf = { 23 | userPerm: ["BAN_MEMBERS"], 24 | botPerm: ["SEND_MESSAGES", "BAN_MEMBERS"], 25 | coolDown: 0, 26 | dm: false, 27 | category: "Moderation", 28 | help: "Ban a user", 29 | args: "<@mention>", 30 | } -------------------------------------------------------------------------------- /commands/bcupdate.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | 3 | exports.run = (message, bot, send) => { 4 | let update = bot.system.getUpdate() 5 | fs.readFile('./changelog.txt', (err, txt) => { 6 | 7 | let embed = new bot.embed() 8 | 9 | embed.setDescription(txt) 10 | 11 | embed.setColor("#8fbc8f") 12 | 13 | Object.keys(update).forEach(key => { 14 | bot.fetchUser(key).then(user => { 15 | user.send({embed}) 16 | }).catch() 17 | }) 18 | 19 | }) 20 | 21 | } 22 | 23 | exports.conf = { 24 | userPerm: ["DEV"], 25 | botPerm: ["SEND_MESSAGES"], 26 | coolDown: 0, 27 | dm: true, 28 | category: "DevOnly", 29 | help: "Broadcast an update", 30 | args: "", 31 | } -------------------------------------------------------------------------------- /commands/block.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | if (!message.args[0]) return send("Provide ID") 3 | let id = message.args[0] 4 | let blocked = bot.system.getBlocked() 5 | if (blocked[id]) delete blocked[id], send("Unblocking: "+id) 6 | else blocked[id] = true, send("Blocking: "+id) 7 | bot.system.setBlocked(blocked) 8 | } 9 | 10 | exports.conf = { 11 | userPerm:["DEV"], 12 | botPerm:["SEND_MESSAGES"], 13 | coolDown:0, 14 | dm:true, 15 | category:"DevOnly", 16 | help:"Block a user or guild from the bot", 17 | args:"", 18 | } -------------------------------------------------------------------------------- /commands/botisdead.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | send("Is the bot offline on your server? Go Here => discord.gg/aZ2PYhn and get updates on when it will come back.") 3 | } 4 | 5 | exports.conf = { 6 | userPerm:[], 7 | botPerm:["SEND_MESSAGES"], 8 | coolDown:0, 9 | dm:true, 10 | category:"Other", 11 | help:"Is the bot offline on your server? Use this command.", 12 | args:"", 13 | } -------------------------------------------------------------------------------- /commands/broadcast.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | bot.guilds.forEach(g => { 3 | 4 | if (g.id !== "110373943822540800" && g.id !== "267855028914618369") { 5 | 6 | let text = "Nitro has gone through a Major Rewrite, including his Database.\nThis means that the prefix was reset to `n!` and all other settings aswell.\nBesides this, downtimes should become non-existant, and new features are on their way." 7 | 8 | //g.defaultChannel.send(text) 9 | 10 | } 11 | 12 | }) 13 | } 14 | 15 | exports.conf = { 16 | userPerm:["DEV"], 17 | botPerm:["SEND_MESSAGES"], 18 | coolDown:0, 19 | dm:true, 20 | category:"DevOnly", 21 | help:"Broadcast to all the servers", 22 | args:"", 23 | } -------------------------------------------------------------------------------- /commands/burn.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | if (!message.mentions.users.first()) return message.channel.send('Mention someone.') 3 | message.channel.send(`**${message.author.username}** *burned* **${message.mentions.users.first().username}**\nYou need some ice for that bud? :snowflake:\nhttps://cdn.discordapp.com/attachments/186920285285384192/262348996784291840/image.gif`) 4 | } 5 | 6 | exports.conf = { 7 | userPerm: [], 8 | botPerm: ["SEND_MESSAGES"], 9 | coolDown: 0, 10 | dm: false, 11 | category: "Fun", 12 | help: "Burn a user.", 13 | args: "", 14 | } -------------------------------------------------------------------------------- /commands/cat.js: -------------------------------------------------------------------------------- 1 | const request = require('request'); 2 | 3 | exports.run = (message, bot) => { 4 | var r = request.get('http://thecatapi.com/api/images/get.php/gif.php?type=gif', function(err, res, body) { 5 | if (err) { 6 | message.channel.send("Service Offline"); 7 | return; 8 | } 9 | message.channel.sendFile(r.uri.href); 10 | }); 11 | } 12 | 13 | exports.conf = { 14 | userPerm:[], 15 | botPerm:["SEND_MESSAGES"], 16 | coolDown:0, 17 | dm:true, 18 | category:"Fun", 19 | help:"Cats!!", 20 | args:"", 21 | } -------------------------------------------------------------------------------- /commands/changelog.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | 3 | exports.run = (message, bot) => { 4 | fs.readFile('./changelog.txt', (err, txt) => { 5 | 6 | let embed = new bot.embed() 7 | 8 | embed.setDescription(txt) 9 | 10 | embed.setColor("#8fbc8f") 11 | 12 | message.channel.sendEmbed(embed) 13 | 14 | }) 15 | } 16 | 17 | exports.conf = { 18 | userPerm:[], 19 | botPerm:["SEND_MESSAGES"], 20 | coolDown:0, 21 | dm:true, 22 | category:"Other", 23 | help:"See the most recent changes to Nitro", 24 | args:"" 25 | } 26 | -------------------------------------------------------------------------------- /commands/clean.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | let num = (!!message.args[0]) ? parseInt(message.args[0]) || 20 : 20; 3 | message.channel.fetchMessages({limit:num}).then(msgs => { 4 | let ms = msgs.filter(m => m.author.id === bot.user.id); 5 | if (ms.size === 1) { ms.first().delete(); return send("**Cleaning up Nitro's messages**") } 6 | if (ms.size < 1) return send("**No messages found to clean**") 7 | message.channel.bulkDelete(ms, true).then(() => send("**Cleaning up Nitro's messages**")) 8 | }) 9 | } 10 | 11 | exports.conf = { 12 | userPerm:["MANAGE_MESSAGES"], 13 | botPerm:["SEND_MESSAGES", "MANAGE_MESSAGES"], 14 | coolDown:0, 15 | dm: false, 16 | category:"Utility", 17 | help:"Clean messages sent by Nitro", 18 | args:"", 19 | } -------------------------------------------------------------------------------- /commands/cow.js: -------------------------------------------------------------------------------- 1 | const cows = require('cows'); 2 | const rn = require('random-number'); 3 | 4 | exports.run = (message, bot) => { 5 | var options = { 6 | min: 0, 7 | max: cows().length - 1, 8 | integer: true 9 | } 10 | let random = rn(options); 11 | message.channel.sendCode("", cows()[random]) 12 | } 13 | 14 | exports.conf = { 15 | userPerm: [], 16 | botPerm: ["SEND_MESSAGES"], 17 | coolDown: 0, 18 | dm: true, 19 | category: "Fun", 20 | help: "Random Ascii Cow", 21 | args: "", 22 | } -------------------------------------------------------------------------------- /commands/createcard.js: -------------------------------------------------------------------------------- 1 | const jimp = require('jimp'); 2 | 3 | exports.run = (message, bot) => { 4 | let prefix = message.guild.prefix 5 | if (!message.args[0]) return message.channel.send("To create a card: " + prefix + "createcard This text is on the question card | this text is on the anwser card"); 6 | let text = message.suffix.split("|"); 7 | if (!text[1]) return message.channel.send("Please include text for the second card, and the delimeter `|`"); 8 | jimp.read('./images/cah.png', (err, image) => { 9 | if (err) return console.log(err); 10 | jimp.loadFont(jimp.FONT_SANS_64_WHITE).then(font => { 11 | image.print(font, 70, 70, text[0], 500) 12 | jimp.loadFont(jimp.FONT_SANS_64_BLACK).then(font2 => { 13 | image.print(font2, 680, 70, text[1], 500) 14 | image.getBuffer(jimp.AUTO, (err, buf) => { 15 | if (err) return console.log(err); 16 | message.channel.sendFile(buf).catch(console.log) 17 | }) 18 | }) 19 | }) 20 | }) 21 | } 22 | 23 | exports.conf = { 24 | userPerm: [], 25 | botPerm: ["SEND_MESSAGES"], 26 | coolDown: 0, 27 | dm: true, 28 | category: "Fun", 29 | help: "Create a Custom Cards Against Humanity Question and Anwser Card.", 30 | args: "", 31 | } -------------------------------------------------------------------------------- /commands/dailies.js: -------------------------------------------------------------------------------- 1 | const rn = require('random-number'); 2 | const pretty = require('pretty-ms'); 3 | const prof = require('../bot').profile 4 | let done = {}; 5 | 6 | exports.run = (message, bot, send) => { 7 | let id = message.author.id; 8 | if (!!done[id] && (new Date).getTime() - done[id] < 21600000) { 9 | let r = (new Date).getTime() - done[id]; 10 | r = 21600000 - r; 11 | send('**:atm: | Daily :dollar: refreshes in '+pretty(r, {verbose:true})+'**'); 12 | } else { 13 | let r = rn({min:45, max:208, integer:true}); 14 | let money = prof.getMoney(id); 15 | prof.setMoney(id, money+r); 16 | send('**:moneybag: | Heres your daily $'+r+'**') 17 | done[id] = (new Date).getTime() 18 | } 19 | } 20 | 21 | exports.conf = { 22 | userPerm:[], 23 | botPerm:["SEND_MESSAGES"], 24 | coolDown:0, 25 | dm:true, 26 | category:"Social", 27 | help:"Get your daily 💵", 28 | args:"", 29 | } -------------------------------------------------------------------------------- /commands/dashboard.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | send("The dashboard is WIP."); 3 | // send("Nitro's Dashboard can be found at http://nitro.ws/dashboard") 4 | } 5 | 6 | exports.conf = { 7 | userPerm: [], 8 | botPerm: ["SEND_MESSAGES"], 9 | coolDown: 0, 10 | dm: true, 11 | category: "Other", 12 | help: "Nitro's Dashboard", 13 | args: "", 14 | } -------------------------------------------------------------------------------- /commands/deathnote.js: -------------------------------------------------------------------------------- 1 | const Canvas = require('canvas'); 2 | const fs = require('fs'); 3 | 4 | exports.run = (message, bot) => { 5 | let user; 6 | if (message.mentions.users.first()) { 7 | user = message.mentions.users.first().username; 8 | } else { 9 | return message.channel.send("You need to mention a user."); 10 | } 11 | let Image = Canvas.Image, 12 | canvas = new Canvas(520, 283), 13 | ctx = canvas.getContext('2d'); 14 | fs.readFile('./images/death.png', (err, image) => { 15 | if (err) return console.log(err); 16 | let img = new Image 17 | img.src = image; 18 | ctx.drawImage(img, 0, 0, 520, 283); 19 | ctx.font = "18px Papyrus"; 20 | ctx.fillText(user, 275, 80) 21 | canvas.toBuffer((err, buff) => { 22 | if (err) return console.log(err); 23 | message.channel.send("**" + message.author.username + "** *has added* **" + user + "** *to their death note*") 24 | message.channel.sendFile(buff) 25 | }) 26 | }) 27 | } 28 | 29 | exports.conf = { 30 | userPerm: [], 31 | botPerm: ["SEND_MESSAGES"], 32 | coolDown: 0, 33 | dm: true, 34 | category: "Fun", 35 | help: "Add a user to your deathnote", 36 | args: "" 37 | } -------------------------------------------------------------------------------- /commands/deletecmds.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | let del = message.guild.deletem 3 | if (del) { 4 | send("**Disabling command deletion**") 5 | del = false 6 | } else { 7 | send("**Enabling command deletion**") 8 | del = true 9 | } 10 | bot.config.setDeletem(message.guild.id, del) 11 | } 12 | 13 | exports.conf = { 14 | userPerm: [], 15 | botPerm: ["SEND_MESSAGES"], 16 | coolDown: 0, 17 | dm: false, 18 | category: "Utility", 19 | help: "Toggle deleting command messages", 20 | args: "", 21 | } -------------------------------------------------------------------------------- /commands/delfilter.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | 3 | let prefix = message.guild.prefix 4 | if (!message.args[0]) return send("**To delete a keyword filter: `" + prefix + "delfilter \"\"`**") 5 | let filters = message.guild.filter 6 | 7 | let split = message.content.split("\""); 8 | let bool = message.content.replace(/"/g, ""); 9 | if (bool.length === message.content.length - 1) { 10 | bool = false; 11 | } else { 12 | bool = true 13 | } 14 | if (!split[1] || !bool) { 15 | return message.channel.send("**The keyword filter to delete must be wrapped in quotes (`\"`)**"); 16 | } 17 | 18 | if (split[1].length < 2) return send("**Keyword does not exist**") 19 | if (/^\s+$/g.test(split[1])) return send("**Keyword does not exist**") 20 | 21 | if (!filters.keywords) return send("**Keyword does not exist**") 22 | if (!filters.keywords[split[1]]) return send("****Keyword does not exist****") 23 | delete filters.keywords[split[1]] 24 | send("**Deleting the keyword `"+split[1]+"`**") 25 | bot.config.setFilter(message.guild.id, filters) 26 | 27 | } 28 | 29 | exports.conf = { 30 | userPerm: ["MANAGE_GUILD"], 31 | botPerm: ["SEND_MESSAGES"], 32 | coolDown: 0, 33 | dm: false, 34 | category: "Filter", 35 | help: "Delete a filter", 36 | args: "", 37 | } -------------------------------------------------------------------------------- /commands/deltag.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | 3 | let prefix = message.guild.prefix 4 | if (!message.args[0]) return message.channel.send("To remove a tag use: `" + prefix + "tag delete `"); 5 | let tags = message.guild.tags 6 | 7 | message.suffix = nu.clean(message.suffix) 8 | message.args.forEach((arg, i) => message.args[i] = nu.clean(arg)) 9 | 10 | if (!tags[message.args[0]]) return message.channel.send("**The tag `" + message.args[0] + "` does not exist.**"); 11 | let tag = tags[message.args[0]]; 12 | if (message.author.id === tag.owner || message.channel.permissionsFor(message.member).has("MANAGE_GUILD")) { 13 | delete tags[message.args[0]]; 14 | bot.config.setTags(message.guild.id, tags) 15 | return message.channel.send("**The tag `" + message.args[0] + "` has been deleted**"); 16 | } else { 17 | return message.channel.send("**Only the owner of this tag or a user with the permission `MANAGE_GUILD` can delete it.** ") 18 | } 19 | } 20 | 21 | exports.conf = { 22 | userPerm: [], 23 | botPerm: ["SEND_MESSAGES"], 24 | coolDown: 0, 25 | dm: false, 26 | category: "Tag", 27 | help: "Delete a tag", 28 | args: "", 29 | } -------------------------------------------------------------------------------- /commands/discrim.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | if (!message.args[0]) message.args[0] = message.author.discriminator 3 | if (message.args[0].length !== 4) return send("Discriminators are 4 numbers") 4 | let disc = message.args[0].replace(/[^0123456789]/g, "") 5 | if (disc.length !== 4) return send("Discriminators are 4 numbers") 6 | 7 | bot.shard.broadcastEval("this.users.filter(u => u.discriminator === '"+disc+"').map(u => u.username)").then(ret => { 8 | for (i=0;i { 2 | let msg = "Maintaining Nitro costs a good amount of money and every bit helps :)\nhttps://www.patreon.com/user?u=4661783" 3 | message.channel.send(msg) 4 | } 5 | 6 | exports.conf = { 7 | userPerm:[], 8 | botPerm:["SEND_MESSAGES"], 9 | coolDown:0, 10 | dm:true, 11 | category:"Other", 12 | help:"Donate to my patreon", 13 | args:"", 14 | } -------------------------------------------------------------------------------- /commands/embed.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | let embed 3 | try { 4 | embed = JSON.parse(message.suffix) 5 | } catch(e) { 6 | return send("**"+e+"**") 7 | } 8 | message.channel.send("", {embed}).catch(e => send("**"+e+"**")) 9 | } 10 | 11 | exports.conf = { 12 | userPerm: [], 13 | botPerm: ["SEND_MESSAGES"], 14 | coolDown: 0, 15 | dm: true, 16 | category: "Other", 17 | help: "Create a discord embed", 18 | args: "", 19 | } -------------------------------------------------------------------------------- /commands/emojify.js: -------------------------------------------------------------------------------- 1 | let special = { 2 | "0": ":zero:", 3 | "1": ":one:", 4 | "2": ":two:", 5 | "3": ":three:", 6 | "4": ":four:", 7 | "5": ":five:", 8 | "6": ":six:", 9 | "7": ":seven:", 10 | "8": ":eight:", 11 | "9": ":nine:", 12 | "<": ":arrow_backward:", 13 | ">": ":arrow_forward:", 14 | "!": ":exclamation:", 15 | "?": ":question:", 16 | "^": ":arrow_up_small:", 17 | "+": ":heavy_plus_sign:", 18 | "-": ":heavy_minus_sign:", 19 | "÷": ":heavy_division_sign:", 20 | ".": ":radio_button:" 21 | } 22 | 23 | exports.run = (message, bot) => { 24 | var emoji = message.suffix.toLowerCase().split(""); 25 | let done = ""; 26 | 27 | for (c = 0; c < emoji.length; c++) { 28 | if (/\s/g.test(emoji[c])) { 29 | done += " "; 30 | } else if (/[abcdefghijklmnopqrstuvwxyz]/g.test(emoji[c])) { 31 | done += emoji[c].replace(emoji[c], " :regional_indicator_" + emoji[c] + ":"); 32 | } else if (Object.keys(special).indexOf(emoji[c]) > -1) { 33 | done += emoji[c].replace(emoji[c], " " + special[emoji[c]]); 34 | } else { 35 | done += " " + emoji[c] + " " 36 | } 37 | 38 | } 39 | message.channel.send(done) 40 | } 41 | 42 | exports.conf = { 43 | userPerm: [], 44 | botPerm: ["SEND_MESSAGES"], 45 | coolDown: 0, 46 | dm: true, 47 | category: "Fun", 48 | help: "Emojify a message", 49 | args: "", 50 | } -------------------------------------------------------------------------------- /commands/encrypt.js: -------------------------------------------------------------------------------- 1 | const en = { 2 | binary: function(msg) { 3 | let output = "" 4 | for (var i = 0; i < msg.length; i++) { 5 | if (msg[i] === " ") output += "00100000" 6 | else output += 0+msg[i].charCodeAt(0).toString(2); 7 | } 8 | return output; 9 | }, 10 | //morse: function(msg) { 11 | 12 | //}, 13 | pig: function(msg) { 14 | let m = msg.split(" "); 15 | let output = ""; 16 | m.forEach(l => { 17 | let split = l.split(""); 18 | let first = split[0]; 19 | output += l.slice(1)+first+"ay " 20 | }) 21 | return output.toLowerCase(); 22 | } 23 | } 24 | 25 | exports.run = (message, bot, send) => { 26 | if (!message.args[0]) return send("**The available encryptions are: `" + Object.keys(en).join("` ,`") + "` **"); 27 | if (!en[message.args[0]]) return send("*`" + message.args[0] + "` is not an available encryption*\n**The available encryptions are: `" + Object.keys(en).join("` ,`") + "` **"); 28 | if (!message.args[1]) return send("**Provide a message to be encrypted in `" + message.args[0] + "`"); 29 | let funct = message.args[0]; 30 | message.args.shift(); 31 | message.args = message.args.join(" "); 32 | let crypt = en[funct](message.args); 33 | send("`" + crypt + "`"); 34 | } 35 | 36 | exports.conf = { 37 | userPerm: [], 38 | botPerm: ["SEND_MESSAGES"], 39 | coolDown: 0, 40 | dm: true, 41 | category: "Fun", 42 | help: "Encrypt a message.", 43 | args: "", 44 | } -------------------------------------------------------------------------------- /commands/eval.js: -------------------------------------------------------------------------------- 1 | const util = require('util'); 2 | const config = require("../config.js"); 3 | const snekfetch = require("snekfetch"); 4 | const r = require("rethinkdbdash")({ 5 | db: "Nitro", 6 | password: config.rethink 7 | }) 8 | 9 | exports.run = async(message, bot, send) => { 10 | if (message.author.id !== "163735744995655680") return 11 | if (message.suffix.length < 1) { 12 | let txt = evalTxt("Funnbot", "Output", "100000", "An idiot who does not provide code when he evals.") 13 | return send(txt) 14 | } 15 | let processtime, 16 | start = (new Date()).getTime() 17 | try { 18 | let evaled = await eval(message.suffix) 19 | processtime = (new Date()).getTime() - start 20 | if (typeof evaled === "object" || typeof evaled === "function") evaled = util.inspect(evaled) 21 | if (typeof evaled === "string") evaled = evaled.substring(0, 1800).replace("`", "") 22 | let txt = evalTxt(message.suffix, "Output", processtime, evaled) 23 | txt = clean(txt) 24 | return send(txt) 25 | } catch (e) { 26 | console.log(e); 27 | processtime = (new Date()).getTime() - start 28 | let txt = evalTxt(message.suffix, "Error", processtime, e) 29 | txt = clean(txt) 30 | return send(txt) 31 | } 32 | 33 | } 34 | 35 | let evalTxt = (a, b, c, d) => { 36 | return ` 37 | :inbox_tray: **Input:** 38 | \`\`\`js 39 | ${a}\`\`\` 40 | :outbox_tray: **${b}:** 41 | \`\`\`${b === "Output" ? "js" : "prolog"} 42 | ${d}\`\`\` 43 | \`Execution Time: ${c}MS\`` 44 | } 45 | 46 | let clean = (t) => { 47 | let split = config.token.split(".") 48 | let r = new RegExp(`(${split[1]})|(${split[2]})`, "g") 49 | t = t.toString().replace(r, "[SECRET]") 50 | return t 51 | } 52 | 53 | 54 | exports.conf = { 55 | userPerm: ["DEV"], 56 | botPerm: ["SEND_MESSAGES"], 57 | coolDown: 0, 58 | dm: true, 59 | category: "DevOnly", 60 | help: "Eval a bit o code", 61 | args: "" 62 | } -------------------------------------------------------------------------------- /commands/filterconf.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | 3 | if (!message.args[0]) return send("**The available subcommands are:**\n**info** - Get info about the current keyword config\n**exception** - Add/Remove exceptions from filtering\n**notify** - Toggles notification when a message is filtered\n**msg** - Change the message DM'd to the user when the message is filtered\n**strikes** - Enable or Disable strikes from using restricted keywords, see `" + message.guild.prefix + "pconf` for more info") 4 | let filters = message.guild.filter 5 | let sub = message.args[0] 6 | if (sub === "info") { 7 | 8 | let num = (!filters.keywords ? "None" : (Object.keys(filters.keywords).length > 0 ? Object.keys(filters.keywords).length : "None")) 9 | let ex 10 | if (filters.ex) { 11 | let channel = (!filters.ex.channel ? "0 Channels" : (Object.keys(filters.ex.channel).length > 1 ? Object.keys(filters.ex.channel).length + " Channels" : "1 Channel")) 12 | let role = (!filters.ex.role ? "0 Roles" : (Object.keys(filters.ex.role).length > 1 ? Object.keys(filters.ex.role).length + " Roles" : "1 Role")) 13 | let user = (!filters.ex.user ? "0 Users" : (Object.keys(filters.ex.user).length > 1 ? Object.keys(filters.ex.user).length + " Users" : "1 Users")) 14 | ex = `${channel}, ${role}, ${user}` 15 | } else ex = "0 Channels, 0 Roles, 0 Users" 16 | let embed = new bot.embed() 17 | embed.setColor(0x9E1D42) 18 | embed.setTitle("Filter Info") 19 | embed.addField("# Of Filters", num, true) 20 | embed.addField("Notify", filters.notify ? "true" : "false", true) 21 | embed.addField("Strikes", filters.strikes ? "true" : "false", true) 22 | embed.addField("Exceptions", ex) 23 | embed.addField("Message", filters.msg ? filters.msg : "**Your message was deleted because it contained a restricted word**") 24 | return send("", { 25 | embed 26 | }) 27 | 28 | } else if (sub === "exception") { 29 | 30 | return send("Coming Soon!") 31 | 32 | } else if (sub === "strikes") { 33 | 34 | let strikes = message.guild.strikes 35 | if (filters.strikes) { 36 | message.send("**Disabling keyword strikes**") 37 | delete filters.strikes 38 | } else { 39 | message.send("**Enabling keyword strikes**") 40 | filters.strikes = true 41 | } 42 | 43 | } else if (sub === "notify") { 44 | 45 | return send("Coming Soon!") 46 | 47 | } else if (sub === "msg") { 48 | 49 | return send("Coming Soon!") 50 | 51 | } else { 52 | send("**The available subcommands are:**\n**info** - Get info about the current keyword config\n**exception** - Add/Remove exceptions from filtering\n**notify** - Toggles notification when a message is filtered\n**msg** - Change the message sent when a message is filtered") 53 | } 54 | bot.config.setFilter(message.guild.id, filters) 55 | 56 | } 57 | 58 | exports.conf = { 59 | userPerm: ["MANAGE_GUILD"], 60 | botPerm: ["SEND_MESSAGES"], 61 | coolDown: 0, 62 | dm: false, 63 | category: "Filter", 64 | help: "Change keyword filter configuration", 65 | args: "", 66 | } -------------------------------------------------------------------------------- /commands/getsomehelp.js: -------------------------------------------------------------------------------- 1 | exports.run = async (message, bot, send) => { 2 | let id = message.author.id; 3 | let patrons = bot.system.getPatrons(); 4 | if (!patrons[id]) 5 | return send("**You must be a patron to use this command, donate at **") 6 | 7 | try { 8 | await message.guild.fetchMember(message.author); 9 | await message.guild.fetchMember(bot.user); 10 | } catch(e) { 11 | return send("**Something went wrong.**"); 12 | } 13 | let member = message.member; 14 | if (!member.voiceChannel) return send("**You must be in a voice channel for this command.**") 15 | if (message.guild.member(bot.user).voiceChannel) return send("**Im already playing something.**") 16 | 17 | member.voiceChannel.join().then(voiceConnection => { 18 | voiceConnection.playFile("./images/stopit.mp3") 19 | setTimeout(() => voiceConnection.disconnect(), 4000) 20 | }).catch(console.log) 21 | } 22 | 23 | exports.conf = { 24 | userPerm: [], 25 | botPerm: ["SEND_MESSAGES"], 26 | coolDown: 0, 27 | dm: false, 28 | category: "Special", 29 | help: "Plays a secret message in VC. Donators only.", 30 | args: "", 31 | } -------------------------------------------------------------------------------- /commands/give.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | 3 | let user = message.author 4 | 5 | if (!message.mentions.users.first()) return send('**Mention a user to give them money**') 6 | 7 | let target = message.mentions.users.first() 8 | 9 | if (target.id === message.author.id) return send("**You can't give youself money :stuck_out_tongue_closed_eyes:**") 10 | 11 | if (!message.args[1]) return send("**How much money?**") 12 | 13 | let num = parseInt(message.args[0]) || parseInt(message.args[1]) || false 14 | 15 | if (!num || num < 1) return send("**Invalid Number Provided**") 16 | 17 | let money = bot.profile.getMoney(user.id) 18 | 19 | if (num > money) return send("**You do not have that much money**") 20 | 21 | let newMoney = money - num 22 | 23 | let targetMoney = bot.profile.getMoney(target.id) 24 | 25 | let newTargetMoney = targetMoney + num 26 | 27 | bot.profile.setMoney(user.id, newMoney) 28 | bot.profile.setMoney(target.id, newTargetMoney) 29 | 30 | message.channel.send("**"+target.username+" has received "+num+" :dollar:**") 31 | 32 | } 33 | 34 | exports.conf = { 35 | userPerm: [], 36 | botPerm: ["SEND_MESSAGES"], 37 | coolDown: 0, 38 | dm: false, 39 | category: "Social", 40 | help: "Give your money to someone else", 41 | args: "", 42 | } -------------------------------------------------------------------------------- /commands/giveaway.js: -------------------------------------------------------------------------------- 1 | const msg = ` 2 | **Hello wonderful people, I'm doing a giveaway!!** 3 | The winner of this giveaway will be given access to **patron only commands** (current ones and future ones) up until the next giveaway. 4 | 5 | **How to enter:** 6 | Go to 7 | Click the big login button in the top right, where you can safely login using your discord account. 8 | Finally go to and click the upvote button. 9 | On Sunday morning (PST) I will be picking one or more random upvoters, depending on the total entries. 10 | *You must be in the official discord server to be picked: *. 11 | 12 | **Good Luck!!**` 13 | 14 | exports.run = (message, bot, send) => { 15 | bot.shard.broadcastEval(` 16 | for (let guild of this.guilds.values()) { 17 | let conf = this.config.getAnc(guild.id); 18 | if (!conf) continue; 19 | if (!conf.channel) continue; 20 | let chan = guild.channels.get(conf.channel); 21 | if (!chan) continue; 22 | chan.send(\`${msg}\`) 23 | .then(() => console.log("Sent: " + guild.id)) 24 | .catch(() => console.log("Failed: " + guild.id)); 25 | } 26 | `).then(console.log).catch(console.log); 27 | } 28 | 29 | exports.conf = { 30 | userPerm: ["DEV"], 31 | botPerm: ["SEND_MESSAGES"], 32 | coolDown: 0, 33 | dm: false, 34 | category: "DevOnly", 35 | help: "thing", 36 | args: "", 37 | } -------------------------------------------------------------------------------- /commands/hackban.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | if (!message.args[0]) return message.channel.send("Ban a user by their ID. Use for people who are not currently in your server."); 3 | message.guild.ban(message.args[0]).then(() => { 4 | message.channel.send("Banning the ID `"+message.args[0]+"`") 5 | }).catch(err => { 6 | message.channel.send("The ID `"+message.args[0]+"` is not a valid user."); 7 | }) 8 | } 9 | 10 | exports.conf = { 11 | userPerm:["BAN_MEMBERS"], 12 | botPerm:["SEND_MESSAGES", "BAN_MEMBERS"], 13 | coolDown:0, 14 | dm:true, 15 | category:"Moderation", 16 | help:"Ban a user by their ID, even if they haven't joined your server.", 17 | args:"", 18 | } -------------------------------------------------------------------------------- /commands/help.js: -------------------------------------------------------------------------------- 1 | const Commands = require('../functions/loadCommands.js'); 2 | 3 | exports.run = (message, bot, send) => { 4 | let cmds = Commands.getCmds() 5 | let mods = message.guild.modules 6 | console.log(mods) 7 | let prefix = message.guild.prefix 8 | let temp = {} 9 | let fields = [] 10 | forEach(cmds, (c, k) => { 11 | if (c.conf.category !== "DevOnly" && !mods[c.conf.category.toLowerCase()]) { 12 | if (!temp.hasOwnProperty(c.conf.category)) temp[c.conf.category] = [] 13 | temp[c.conf.category].push("• " + prefix + k + " - " + c.conf.help) 14 | } 15 | }) 16 | forEach(temp, (c, k) => { 17 | fields.push({ 18 | name: k, 19 | value: c.join('\n'), 20 | inline: true 21 | }) 22 | }) 23 | let embed = { 24 | description: "The prefix for your server is: " + prefix + "\n[Invite](https://discordapp.com/oauth2/authorize?client_id=264087705124601856&scope=bot&permissions=268435510) | [Support](https://discord.gg/aZ2PYhn) | [Patreon](https://patreon.com/user?u=4661783) | [Github](https://github.com/funnbot/Nitro)", 25 | fields, 26 | color: 0x155CA8 27 | } 28 | if (message.channel.type === "text") message.channel.send("**Sliding Into Your DM's**").then(m => m.delete(3000)) 29 | message.author.send('', { 30 | embed 31 | }) 32 | } 33 | 34 | exports.conf = { 35 | userPerm: [], 36 | botPerm: [], 37 | dm: true, 38 | coolDown: 100, 39 | category: "Other", 40 | help: "Get a list of Nitro's commands.", 41 | args: "" 42 | } 43 | 44 | let forEach = function (obj, loop) { 45 | let a = Object.keys(obj) 46 | for (i = 0; i < a.length; i++) { 47 | loop(obj[a[i]], a[i]) 48 | } 49 | return 50 | } -------------------------------------------------------------------------------- /commands/hidechannel.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | let num = parseInt(message.args[0]) || false; 3 | if (num > 3600) return message.channel.send("Channel hiding must last less than an hour."); 4 | if (num <= 1) return message.channel.send("Channel hide time too short."); 5 | let prefix = bot.config.getPrefix(message.guild.id); 6 | if (!message.args[0] || num === false) return message.channel.send("You can hide a channel with:\n" + prefix + "hidechannel "); 7 | message.channel.send("**This channel has been hidden for " + num + " seconds.**\nYou can end hiding by typing `unlock` in chat or by waiting the alloted time.").then((m) => { 8 | let before = m.channel.permissionOverwrites.get(message.guild.id); 9 | if (before) { 10 | if (before.allow & 1 << 10) before = true 11 | else if (before.deny & 1 << 10) before = false 12 | else before = null 13 | } else before = null 14 | message.channel.overwritePermissions(message.guild.id, { 15 | READ_MESSAGES: false 16 | }).then(() => { 17 | let collect = message.channel.createCollector(ms => ms.author.id === message.author.id, { 18 | time: num * 1000 19 | }); 20 | collect.on('collect', (msg) => { 21 | if (msg.content === "unlock") { 22 | m.channel.overwritePermissions(message.guild.id, { 23 | READ_MESSAGES: before 24 | }).then(() => { 25 | clearTimeout(timer); 26 | m.channel.send("**The hiding has ended**"); 27 | collect.stop(); 28 | }); 29 | } 30 | }) 31 | let timer = setTimeout(function () { 32 | m.channel.overwritePermissions(message.guild.id, { 33 | READ_MESSAGES: before 34 | }).then(() => { 35 | m.channel.send("**The hiding has ended**"); 36 | collect.stop(); 37 | }); 38 | }, num * 1000); 39 | }) 40 | }); 41 | } 42 | 43 | exports.conf = { 44 | userPerm: ["MANAGE_CHANNELS", "MANAGE_GUILD"], 45 | botPerm: ["SEND_MESSAGES", "MANAGE_CHANNELS"], 46 | coolDown: 0, 47 | dm: true, 48 | category: "Moderation", 49 | help: "Hide a channel for a number of seconds", 50 | args: "", 51 | } -------------------------------------------------------------------------------- /commands/hug.js: -------------------------------------------------------------------------------- 1 | const hug = ["https://s-media-cache-ak0.pinimg.com/originals/49/a2/1e/49a21e182fcdfb3e96cc9d9421f8ee3f.gif", "https://s-media-cache-ak0.pinimg.com/originals/16/46/f7/1646f720af76ea58853ef231028bafb1.gif", "https://media.giphy.com/media/xJlOdEYy0r7ZS/giphy.gif", "http://i.imgur.com/2WywS3T.gif", "http://i.imgur.com/8ruodNJ.gif", "https://myanimelist.cdn-dena.com/s/common/uploaded_files/1461071296-7451c05f5aae134e2cceb276b085a871.gif", "http://i0.kym-cdn.com/photos/images/original/000/931/030/394.gif", "https://media.tenor.co/images/1171c186f9130d1efa4a186ad4371e8c/tenor.gif", "http://cdn.smosh.com/sites/default/files/ftpuploads/bloguploads/0413/epic-hugs-friends-pikachu.gif"] 2 | const rn = require('random-number') 3 | 4 | exports.run = (message, bot) => { 5 | if (!message.mentions.users.first()) return message.channel.send("Well you can't hug the air..."); 6 | let r = rn({ 7 | min: 0, 8 | max: hug.length - 1, 9 | integer: true 10 | }); 11 | let image = hug[r]; 12 | message.channel.send('**' + message.author.username + '** *sends a hug to* **' + message.mentions.users.first().username + '** :heart:\n' + image); 13 | } 14 | 15 | exports.conf = { 16 | userPerm: [], 17 | botPerm: ["SEND_MESSAGES"], 18 | coolDown: 0, 19 | dm: true, 20 | category: "Fun", 21 | help: "Hug a user", 22 | args: "", 23 | } -------------------------------------------------------------------------------- /commands/info.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | let embed = new bot.embed() 3 | let a = "[Click Me!](https://nitro.ws/)" 4 | let b = "[Click Me!](https://discordapp.com/oauth2/authorize?client_id=264087705124601856&scope=bot&permissions=268435510)" 5 | let c = "[Click Me!](https://github.com/funnbot/Nitro)" 6 | let d = "[Click Me!](https://trello.com/b/1xFxc2oG/nitro-discord-bot)" 7 | let e = "[Click Me!](https://www.patreon.com/user?u=4661783)" 8 | let f = "[Click Me!](https://discord.gg/aZ2PYhn)" 9 | let g = "[Click Me!](https://docs.google.com/spreadsheets/d/1Hpnkiej8l3opTgH15SqY-erZOwHF9p007nHURSGiJvc/edit#gid=0)" 10 | let h = "[Click Me!](https://docs.google.com/forms/d/e/1FAIpQLSe464Z32WS3AvO-LOs_tedmkRprTUNH-gvcIhB-w5wY43yLHA/viewform?usp=sf_link)" 11 | embed.setColor("#adff2f") 12 | embed.setAuthor("Nitro's Links", bot.user.avatarURL) 13 | embed.addField("Website", a, true) 14 | embed.addField("Invite", b, true) 15 | embed.addField("Github", c, true) 16 | embed.addField("Trello", d, true) 17 | embed.addField("Patreon", e, true) 18 | embed.addField("Support Server", f, true) 19 | embed.addField("Commands and Suggestions", g, true) 20 | embed.addField("Suggest a Command", h, true) 21 | message.channel.send("", {embed}) 22 | } 23 | 24 | exports.conf = { 25 | userPerm:[], 26 | botPerm:["SEND_MESSAGES"], 27 | coolDown:0, 28 | dm:true, 29 | category:"Other", 30 | help:"A collections of links", 31 | args:"", 32 | } -------------------------------------------------------------------------------- /commands/infobox.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | if (!message.args[0]) return send("**Provide the message to be set as your info box**"); 3 | if (message.suffix.length > 120) return send("**Your info box message must be less than 120 characters.**"); 4 | bot.profile.setShout(message.author.id, message.suffix); 5 | send("**Your info box message was set to: **\n" + message.suffix) 6 | } 7 | 8 | exports.conf = { 9 | userPerm: [], 10 | botPerm: ["SEND_MESSAGES"], 11 | coolDown: 0, 12 | dm: false, 13 | category: "Social", 14 | help: "Set the info box message on your profile.", 15 | args: "", 16 | } -------------------------------------------------------------------------------- /commands/invite.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | let text = "Invite Nitro to *Your* server for the next level of Server Management now!\nhttps://discordapp.com/oauth2/authorize?client_id=264087705124601856&scope=bot&permissions=268435510"; 3 | message.channel.send(text) 4 | } 5 | 6 | exports.conf = { 7 | userPerm:[], 8 | botPerm:["SEND_MESSAGES"], 9 | coolDown:0, 10 | dm:true, 11 | category:"Other", 12 | help:"Invite Nitro to your server.", 13 | args:"", 14 | } -------------------------------------------------------------------------------- /commands/joindm.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | let joindm = message.guild.joindm 3 | if (!message.args[0]) return send("**`" + message.guild.prefix + "joindm ` - message is the message sent when the user joins your server, set to `off` to disable**\n" + (joindm ? "**The current message is: `" + joindm + "`**" : "")) 4 | 5 | if (message.suffix === "off") { 6 | bot.config.setJDM(message.guild.id, false) 7 | return send("**Join DM has been disabled**") 8 | } else { 9 | bot.config.setJDM(message.guild.id, message.suffix) 10 | return send("**Join DM has been set to: `" + message.suffix + "`**") 11 | } 12 | 13 | } 14 | 15 | exports.conf = { 16 | userPerm: ["MANAGE_GUILD"], 17 | botPerm: ["SEND_MESSAGES"], 18 | coolDown: 0, 19 | dm: false, 20 | category: "Utility", 21 | help: "Set a message to be DM'd to a user when they join.", 22 | args: "", 23 | } -------------------------------------------------------------------------------- /commands/kermit.js: -------------------------------------------------------------------------------- 1 | const Canvas = require('canvas'); 2 | const fs = require('fs'); 3 | 4 | exports.run = (message, bot) => { 5 | message.channel.sendFile("./images/kermit.png") 6 | } 7 | 8 | exports.conf = { 9 | userPerm:[], 10 | botPerm:["SEND_MESSAGES"], 11 | coolDown:0, 12 | dm:true, 13 | category:"Fun", 14 | help:"But thats none of my business", 15 | args:"", 16 | } -------------------------------------------------------------------------------- /commands/kick.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | if (!message.mentions.users.first()) return message.channel.send("**Mention a user or multiple users to kick them.**") 3 | let ment = message.mentions.users; 4 | let text = [] 5 | ment.forEach(m => { 6 | if (!message.guild.member(m).kickable) { 7 | message.channel.send("**Something went wrong when kicking:* "+m.username); 8 | } else { 9 | message.guild.member(m).kick().then(() => { 10 | text.push(m.username) 11 | }).catch(err => message.channel.send("**Something went wrong when kicking:** "+m.username)) 12 | } 13 | }); 14 | setTimeout(function() { 15 | if (text.length === 0) return; 16 | message.channel.send(text.join(", ")+" **has been kicked.**", {split:true}); 17 | }, 1000); 18 | } 19 | 20 | exports.conf = { 21 | userPerm:["KICK_MEMBERS"], 22 | botPerm:["SEND_MESSAGES", "KICK_MEMBERS"], 23 | coolDown:0, 24 | dm:true, 25 | category:"Moderation", 26 | help:"Kick a user.", 27 | args:"", 28 | } -------------------------------------------------------------------------------- /commands/leaderboard.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | 3 | let sort = bot.profile.leaderboard(bot) 4 | let txt = [] 5 | for (i = 0; i < 10; i++) { 6 | let cur = bot.profile.profiles[sort[i]].money ? bot.profile.profiles[sort[i]].money : 0 7 | txt.push("**" + (i + 1) + ". " + bot.users.get(sort[i]).username + " - $" + cur + "**") 8 | } 9 | message.channel.send(txt) 10 | 11 | 12 | } 13 | 14 | exports.conf = { 15 | userPerm: [], 16 | botPerm: ["SEND_MESSAGES"], 17 | coolDown: 0, 18 | dm: true, 19 | category: "Social", 20 | help: "Leaderboard of the top ten richest users", 21 | args: "", 22 | } -------------------------------------------------------------------------------- /commands/leveling.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | let level = bot.config.getLevel(message.guild.id); 3 | if (level) { 4 | level = false; 5 | send("**Disabling level up messages in your server**"); 6 | } else { 7 | level = true; 8 | send("**Enabling level up messages in your server**"); 9 | } 10 | bot.config.setLevel(message.guild.id, level); 11 | } 12 | 13 | exports.conf = { 14 | userPerm:["MANAGE_GUILD"], 15 | botPerm:["SEND_MESSAGES"], 16 | coolDown:0, 17 | dm:false, 18 | category:"Utility", 19 | help:"Toggle level up messages in your server", 20 | args:"", 21 | } -------------------------------------------------------------------------------- /commands/listfilters.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | 3 | let filters = message.guild.filter 4 | if (!filters.keywords) return send("**There are no keywords set**") 5 | if (Object.keys(filters.keywords).length === 0) return send("**There are no keywords set**") 6 | 7 | let txt = Object.keys(filters.keywords).join(" **||** ") 8 | return send("**The filtered keywords are:**\n"+txt) 9 | 10 | } 11 | 12 | exports.conf = { 13 | userPerm: ["MANAGE_GUILD"], 14 | botPerm: ["SEND_MESSAGES"], 15 | coolDown: 0, 16 | dm: false, 17 | category: "Filter", 18 | help: "List the currently filtered keywords", 19 | args: "", 20 | } -------------------------------------------------------------------------------- /commands/listtags.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | let tags = message.guild.tags 3 | let keys = Object.keys(tags); 4 | let filter = keys.filter(k => tags[k].owner === message.author.id); 5 | let text = (keys.length === 0) ? "**There are no tags on this server.**" : "**The tags on this server are:**\n"+keys.join(", "); 6 | let owned = (filter.length === 0) ? "**"+message.author.username+" does not own any tags**" : "**"+message.author.username+" owns the tags:**\n"+filter.join(", "); 7 | let msg = (keys.length === 0) ? text : text+"\n"+owned; 8 | message.channel.send(msg, {split: true}); 9 | } 10 | 11 | exports.conf = { 12 | userPerm:[], 13 | botPerm:["SEND_MESSAGES"], 14 | coolDown:0, 15 | dm:false, 16 | category:"Tag", 17 | help:"List the tags on this server.", 18 | args:"", 19 | } -------------------------------------------------------------------------------- /commands/lockdown.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | let num = parseInt(message.args[0]) || false; 3 | if (num > 3600) return message.channel.send("Lockdown must last less than an hour."); 4 | if (num <= 1) return message.channel.send("Lockdown time too short."); 5 | let prefix = bot.config.getPrefix(message.guild.id); 6 | if (!message.args[0] || num === false) return message.channel.send("You can lockdown a channel with:\n" + prefix + "lockdown "); 7 | message.channel.send("**This channel has been locked down for " + num + " seconds.**\nYou can end lockdown by typing `unlock` in chat or by waiting the alloted time.").then((m) => { 8 | let before = m.channel.permissionOverwrites.get(message.guild.id); 9 | if (before) { 10 | if (before.allow & 1 << 11) before = true 11 | else if (before.deny & 1 << 11) before = false 12 | else before = null 13 | } else before = null 14 | message.channel.overwritePermissions(message.guild.id, { 15 | SEND_MESSAGES: false 16 | }).then(() => { 17 | let collect = message.channel.createCollector(ms => ms.author.id === message.author.id, { 18 | time: num * 1000 19 | }); 20 | collect.on('message', (msg) => { 21 | if (msg.content === "unlock") { 22 | m.channel.overwritePermissions(message.guild.id, { 23 | SEND_MESSAGES: before 24 | }).then(() => { 25 | clearTimeout(timer); 26 | m.channel.send("**The lockdown has ended**"); 27 | collect.stop(); 28 | }); 29 | } 30 | }) 31 | let timer = setTimeout(function () { 32 | m.channel.overwritePermissions(message.guild.id, { 33 | SEND_MESSAGES: before 34 | }).then(() => { 35 | m.channel.send("**The lockdown has ended**"); 36 | collect.stop(); 37 | }); 38 | }, num * 1000); 39 | }) 40 | }); 41 | } 42 | 43 | exports.conf = { 44 | userPerm: ["MANAGE_CHANNELS", "MANAGE_GUILD"], 45 | botPerm: ["SEND_MESSAGES", "MANAGE_CHANNELS"], 46 | coolDown: 0, 47 | dm: true, 48 | category: "Moderation", 49 | help: "Lockdown a channel for a set ammount of seconds.", 50 | args: "", 51 | } -------------------------------------------------------------------------------- /commands/lottery.js: -------------------------------------------------------------------------------- 1 | const rn = require('random-number'); 2 | const pretty = require('pretty-ms'); 3 | const bot = require('../bot') 4 | const prof = bot.profile 5 | let lot = false; 6 | 7 | function go() { 8 | let store = lot; 9 | if (lot) { 10 | let members = Object.keys(lot.members); 11 | if (members.length === 0) { 12 | lot = {}; 13 | lot.members = {}; 14 | lot.started = (new Date).getTime(); 15 | lot.jackpot = 0; 16 | return; 17 | } 18 | let all = []; 19 | members.forEach(m => { 20 | let mem = store.members[m]; 21 | if (!!mem.tickets && mem.tickets !== 0) { 22 | for (i = 0; i < mem.tickets; i++) { 23 | all.push(m); 24 | } 25 | } 26 | }); 27 | let r = rn({ 28 | min: 0, 29 | max: all.length - 1, 30 | integer: true 31 | }); 32 | let win = all[r]; 33 | members.forEach(m => { 34 | let mem = store.members[m]; 35 | if (m === win) { 36 | bot.fetchUser(m).then(user => { 37 | user.send(`:tada: :tada:\n **Congratulations** \n **You have won the Lottery Jackpot of:**\n **$${store.jackpot} :dollar: **\n:tada: :tada:`) 38 | }) 39 | let mo = prof.getMoney(m); 40 | prof.setMoney(m, mo + store.jackpot); 41 | } else { 42 | bot.fetchUser(m).then(user => { 43 | user.send(`:slight_frown: | **You have lost $${mem.tickets*100} in the lottery, better luck next time **| :slight_frown:`) 44 | }) 45 | } 46 | }) 47 | } 48 | lot = {}; 49 | lot.members = {}; 50 | lot.started = (new Date).getTime(); 51 | lot.jackpot = 0; 52 | } 53 | 54 | go() 55 | 56 | setInterval(() => { 57 | go() 58 | }, 14400000) 59 | 60 | exports.run = (message, bot, send) => { 61 | if (!lot) return send("**The Lottery Is Not Currently Active**"); 62 | let id = message.author.id; 63 | let left = (new Date).getTime() - lot.started; 64 | left = 14400000 - left; 65 | let k = pretty(left); 66 | let num = parseInt(message.args[0]) || "k"; 67 | let there = (!lot.members[id] || !lot.members[id].tickets) ? 0 : lot.members[id].tickets; 68 | if (!message.args[0]) return send(`:moneybag: **Lottery** :moneybag:\n**Jackpot: $${lot.jackpot}**\n**Next Drawing: ${k}**\n**You Have ${there} ticket(s)**\n\n**You can buy tickets with \`n!lottery \`**\n**Each ticket costs $100**`); 69 | if (num > 20) return send("**:arrow_down_small: | You can not buy more than 20 tickets**"); 70 | if (num < 1) return send("**:arrow_up_small: | You must choose a number 1 or higher**"); 71 | if (num === "k") return send("**:1234: | Choose a number between 1 and 20**"); 72 | let money = prof.getMoney(id); 73 | let current = (!lot.members[id]) ? 0 : lot.members[id].tickets; 74 | if (current >= 20) return send("**:no_entry_sign: | You already have the max of 20 tickets**"); 75 | let buying = (current + num >= 20) ? 20 - current : num; 76 | let cash = buying * 100; 77 | if (money < cash) return send("**:money_with_wings: | You can not afford " + buying + " ticket(s)**") 78 | prof.setMoney(id, money - cash); 79 | lot.jackpot = lot.jackpot + cash; 80 | if (!lot.members[id]) lot.members[id] = {}; 81 | lot.members[id].tickets = current + buying; 82 | return send(`** :thumbsup: | You have bought ${buying} lottery ticket(s) for $${cash} :**`); 83 | } 84 | 85 | exports.conf = { 86 | userPerm: [], 87 | botPerm: ["SEND_MESSAGES"], 88 | coolDown: 0, 89 | dm: false, 90 | category: "Social", 91 | help: "Play in the lottery.", 92 | args: "", 93 | } -------------------------------------------------------------------------------- /commands/math.js: -------------------------------------------------------------------------------- 1 | const math = require('mathjs'); 2 | 3 | exports.run = (message, bot) => { 4 | let repo; 5 | try { 6 | repo = math.eval(message.suffix); 7 | } catch (err) { 8 | repo = err 9 | } 10 | message.channel.send("**Input**\n```js\n" + message.suffix + "```\n**Output**\n```js\n" + repo + "```") 11 | } 12 | 13 | exports.conf = { 14 | userPerm: [], 15 | botPerm: ["SEND_MESSAGES"], 16 | coolDown: 0, 17 | dm: true, 18 | category: "Other", 19 | help: "Do some math.", 20 | args: "", 21 | } -------------------------------------------------------------------------------- /commands/meme.js: -------------------------------------------------------------------------------- 1 | const auth = require('../config.js') 2 | const Imgflipper = require('imgflipper') 3 | const imgflipper = new Imgflipper(auth.flipuser, auth.flippass) 4 | 5 | const meme = { 6 | "brace": 61546, 7 | "mostinteresting": 61532, 8 | "takemymoney": 176908, 9 | "onedoesnot": 61579, 10 | "yuno": 61527, 11 | "success": 61544, 12 | "allthethings": 61533, 13 | "doge": 8072285, 14 | "drevil": 40945639, 15 | "skeptical": 101711, 16 | "notime": 442575, 17 | "yodawg": 101716, 18 | "awkwardpenguin": 61584, 19 | "gears": 356615, 20 | "captiannow": 29617627, 21 | "arthurfist": 74191766, 22 | "kevinhart": 265789, 23 | "attachedgf": 100952, 24 | "puffin": 7761261 25 | }; 26 | 27 | exports.run = (message, bot, send) => { 28 | if (!meme.hasOwnProperty(message.args[0])) { 29 | return send("Invalid Meme Type, Heres the list:\n `brace, mostinteresting, takemymoney, onedoesnot, yuno, success, allthethings, doge, drevil, skeptical, notime, yodawg, awkwardpenguin, gears, captiannow, arthurfist, kevinhart, attachedgf, puffin`") 30 | } 31 | let tags = message.content.split('"'); 32 | let memetype = message.args[0] 33 | imgflipper.generateMeme(meme[memetype], tags[1] ? tags[1] : "", tags[3] ? tags[3] : "", function (err, image) { 34 | if (err) { 35 | let pre = message.guild.prefix 36 | send("Please format your memes as follows. " + pre + "meme "+memetype+" \"toptext\" \"bottomtext\"") 37 | } 38 | message.channel.send(image); 39 | }); 40 | } 41 | 42 | exports.conf = { 43 | userPerm: [], 44 | botPerm: ["SEND_MESSAGES"], 45 | coolDown: 0, 46 | dm: true, 47 | category: "Fun", 48 | help: "Generate a classic Top text, Bottom text meme.", 49 | args: "", 50 | } -------------------------------------------------------------------------------- /commands/modlog.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | send("**To set a channel as Nitro's modlog, change its Topic to *exactly*: `nitro-modlog` **") 3 | } 4 | 5 | exports.conf = { 6 | userPerm:["MANAGE_GUILD"], 7 | botPerm:["SEND_MESSAGES"], 8 | coolDown:0, 9 | dm:true, 10 | category:"Utility", 11 | help:"Set Nitro's modlog", 12 | args:"", 13 | } -------------------------------------------------------------------------------- /commands/money.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | let user = (!message.mentions.users.first()) ? message.author : message.mentions.users.first(); 3 | let mon = bot.profile.getMoney(user.id); 4 | send("**:atm: | " + user.username + " has " + mon + " :dollar:**") 5 | } 6 | 7 | exports.conf = { 8 | userPerm: [], 9 | botPerm: ["SEND_MESSAGES"], 10 | coolDown: 0, 11 | dm: true, 12 | category: "Social", 13 | help: "Get your current balance", 14 | args: "", 15 | } -------------------------------------------------------------------------------- /commands/nickname.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | if (!message.args[0]) { 3 | send("**Please provide a new nickname.**") 4 | return; 5 | } 6 | if (message.author.id === message.guild.owner.id) { 7 | send("**Unfortunately I cannot change the owners nickname.**") 8 | return; 9 | } 10 | if (message.member.highestRole.position < message.guild.member(bot.user).highestRole.position) { 11 | message.member.setNickname(message.suffix); 12 | send("**Your nickname is now:** " + message.suffix) 13 | } else { 14 | send("**Infortunately I cannot change your nickname because your role is higher than mine.**") 15 | } 16 | } 17 | 18 | exports.conf = { 19 | userPerm:[], 20 | botPerm:["SEND_MESSAGES", "MANAGE_NICKNAMES"], 21 | coolDown:0, 22 | dm:false, 23 | category:"Other", 24 | help:"Change *your* nickname using emojis and other special characters", 25 | args:"", 26 | } -------------------------------------------------------------------------------- /commands/nut.js: -------------------------------------------------------------------------------- 1 | const jimp = require('jimp') 2 | 3 | exports.run = (message, bot) => { 4 | if (!message.args[0]) message.suffix = "When the user who ran this command is currently participating in a gay orgy, because he didn't put any text after the command." 5 | jimp.read('./images/nut.jpg', (err, image) => { 6 | if (err) return console.log(err); 7 | var text = new jimp(630, 150, function(err, text) { 8 | if (err) return console.log(err); 9 | jimp.loadFont(jimp.FONT_SANS_32_BLACK).then(function(font) { 10 | text.print(font, 0, 0, message.suffix, 650); 11 | image.composite(text, 15, 5) 12 | image.getBuffer(jimp.AUTO, (err, buffer) => { 13 | if (err) return console.log(err); 14 | message.channel.sendFile(buffer) 15 | }) 16 | }); 17 | }); 18 | }); 19 | } 20 | 21 | exports.conf = { 22 | userPerm:[], 23 | botPerm:["SEND_MESSAGES"], 24 | coolDown:0, 25 | dm:true, 26 | category: "Fun", 27 | help:"Put text in the Nut meme", 28 | args:"", 29 | } -------------------------------------------------------------------------------- /commands/pardon.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | 3 | if (!message.mentions.users.first()) return send("**Mention a user to pardon a strike**") 4 | let user = message.mentions.users.first() 5 | let strikes = message.guild.strikes 6 | if (!strikes.users || !strikes.users[user.id] ||strikes.users[user.id] === 0) return send("**This user does not have any strikes**") 7 | strikes.users[user.id]-- 8 | console.log(strikes.users[user.id]) 9 | bot.config.setStrike(message.guild.id, strikes) 10 | let num = strikes.users[user.id] === 1 ? strikes.users[user.id] + "` strike**" : strikes.users[user.id] + "` strikes**" 11 | send("**This user now has `"+num) 12 | 13 | } 14 | 15 | exports.conf = { 16 | userPerm:["MANAGE_GUILD"], 17 | botPerm:["SEND_MESSAGES"], 18 | coolDown:0, 19 | dm:false, 20 | category:"Moderation", 21 | help:"Remove a strike from a user", 22 | args:"", 23 | } -------------------------------------------------------------------------------- /commands/pause.js: -------------------------------------------------------------------------------- 1 | 2 | exports.run = (message, bot) => { 3 | 4 | } 5 | 6 | exports.conf = { 7 | userPerm:[], 8 | botPerm:["SEND_MESSAGES"], 9 | coolDown:0, 10 | dm:false, 11 | category:"Music", 12 | help:"Pause currently playing music", 13 | args:"", 14 | } -------------------------------------------------------------------------------- /commands/pconf.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | 3 | if (!message.args[0]) return send("**Available subcommands:**\n**kick** - Set the number of strikes it takes to kick a user, max is 50, 0 to disable\n**ban** - Set the number of strikes it takes to ban a user, max is 50, 0 to disable") 4 | let strikes = message.guild.strikes 5 | let sub = message.args[0] 6 | if (sub === "kick") { 7 | if (!message.args[1]) return send("**Set the number of strikes it takes to kick a user, max is 50, 0 to disable**") 8 | let num = isNaN(parseInt(message.args[1])) ? -1 : parseInt(message.args[1]) 9 | if (num < 0 || num > 50) return send("**Invalid Number: Must be between 0 and 50**") 10 | if (num === 0) { 11 | if (strikes.kick) delete strikes.kick 12 | send("**Disabling auto kick**") 13 | } else { 14 | strikes.kick = num 15 | send("**Number of strikes to kick set to: "+num+"**") 16 | } 17 | } else if (sub === "ban") { 18 | if (!message.args[1]) return send("**Set the number of strikes it takes to ban a user, max is 50, 0 to disable**") 19 | let num = isNaN(parseInt(message.args[1])) ? -1 : parseInt(message.args[1]) 20 | if (num < 0 || num > 50) return send("**Invalid Number: Must be between 0 and 50**") 21 | if (num === 0) { 22 | if (strikes.ban) delete strikes.ban 23 | send("**Disabling auto ban**") 24 | } else { 25 | strikes.ban = num 26 | send("**Number of strikes to ban set to: "+num+"**") 27 | } 28 | } else { 29 | return send("**Available subcommands:**\n**kick** - Set the number of strikes it takes to kick a user, max is 50, 0 to disable\n**ban** - Set the number of strikes it takes to ban a user, max is 50, 0 to disable") 30 | } 31 | bot.config.setStrike(message.guild.id, strikes) 32 | } 33 | 34 | exports.conf = { 35 | userPerm: ["MANAGE_GUILD"], 36 | botPerm: ["SEND_MESSAGES", "KICK_MEMBERS", "BAN_MEMBERS"], 37 | coolDown: 0, 38 | dm: false, 39 | category: "Utility", 40 | help: "Configure a punishment based on a user's strikes", 41 | args: "", 42 | } -------------------------------------------------------------------------------- /commands/permission.js: -------------------------------------------------------------------------------- 1 | const Commands = require('../functions/loadCommands') 2 | 3 | let Permissions = [ 4 | "CREATE_INSTANT_INVITE", 5 | "KICK_MEMBERS", 6 | "BAN_MEMBERS", 7 | "ADMINISTRATOR", 8 | "MANAGE_CHANNELS", 9 | "MANAGE_GUILD", 10 | "ADD_REACTIONS", 11 | "READ_MESSAGES", 12 | "SEND_MESSAGES", 13 | "SEND_TTS_MESSAGES", 14 | "MANAGE_MESSAGES", 15 | "EMBED_LINKS", 16 | "ATTACH_FILES", 17 | "READ_MESSAGE_HISTORY", 18 | "MENTION_EVERYONE", 19 | "EXTERNAL_EMOJIS", 20 | "CONNECT", 21 | "SPEAK", 22 | "MUTE_MEMBERS", 23 | "DEAFEN_MEMBERS", 24 | "MOVE_MEMBERS", 25 | "USE_VAD", 26 | "CHANGE_NICKNAME", 27 | "MANAGE_NICKNAMES", 28 | "MANAGE_ROLES_OR_PERMISSIONS", 29 | "MANAGE_WEBHOOKS", 30 | "MANAGE_EMOJIS" 31 | ] 32 | 33 | exports.run = (message, bot, send) => { 34 | 35 | if (!message.args[0]) return send("**Set custom permissions for specific commands**\nUse `" + message.guild.prefix + "permission ` to get the permissions for a command.\nThis works on custom commands aswell.\n*Be careful to not mess up permissions*") 36 | 37 | let cmds = Commands.getCmds() 38 | let custom = message.guild.custom 39 | if (!cmds[message.args[0]] && !custom[message.args[0]]) return send("**Invalid Command Name**") 40 | 41 | let entered = message.args[0] 42 | 43 | let cmd = cmds[message.args[0]] 44 | 45 | if (cmd && (cmd.conf.userPerm.indexOf('DEV') > -1 || cmd.conf.userPerm.indexOf('dev') > -1)) return send("**Invalid Command Name**") 46 | 47 | let cmdPerms = cmd ? cmd.conf.userPerm.slice(0) : [] 48 | 49 | let perms = message.guild.perms 50 | 51 | if (perms[entered]) { 52 | 53 | Object.keys(perms[entered]).forEach(p => { 54 | 55 | if (perms[entered][p] === "delete") nu.removeA(cmdPerms, p) 56 | 57 | if (perms[entered][p] === "add") cmdPerms.push(p) 58 | 59 | }) 60 | 61 | } 62 | 63 | let a, b 64 | cmdPerms.length > 1 ? a = "s" : a = "" 65 | cmdPerms.length > 1 ? b = "are" : b = "is" 66 | 67 | if (!message.args[1] && cmdPerms.length < 1) return send("**There are no permissions set for this command**") 68 | 69 | if (!message.args[1]) return send(`**The current permission${a} for the command \`${message.args[0]}\` ${b}:** \`${cmdPerms.join(", ")}\``) 70 | 71 | if (Permissions.indexOf(message.args[1]) === -1) return send("**`" + message.args[1] + "` is not a Resolvable Permission**\n**Valid Permissions:**\n`" + Permissions.join("` | `") + "`") 72 | 73 | let arg = message.args[1] 74 | 75 | if (cmdPerms.indexOf(arg) > -1) { 76 | 77 | if (perms[entered] && perms[entered][arg]) { 78 | 79 | delete perms[entered][arg] 80 | 81 | if (Object.keys(perms[entered]).length < 1) delete perms[entered] 82 | 83 | } else { 84 | 85 | if (!perms[entered]) perms[entered] = {} 86 | 87 | perms[entered][arg] = "delete" 88 | 89 | } 90 | 91 | } else { 92 | 93 | if (perms[entered] && perms[entered][arg]) { 94 | 95 | delete perms[entered][arg] 96 | 97 | if (Object.keys(perms[entered]).length < 1) delete perms[entered] 98 | 99 | } else { 100 | 101 | if (!perms[entered]) perms[entered] = {} 102 | 103 | perms[entered][arg] = "add" 104 | 105 | } 106 | 107 | } 108 | 109 | let newPerms = cmd ? cmd.conf.userPerm.slice(0) : [] 110 | 111 | if (perms[entered]) { 112 | 113 | Object.keys(perms[entered]).forEach(p => { 114 | 115 | if (perms[entered][p] === "delete") nu.removeA(newPerms, p) 116 | 117 | if (perms[entered][p] === "add") newPerms.push(p) 118 | 119 | }) 120 | 121 | } 122 | 123 | send("**Changed the permission(s) for the command `" + message.args[0] + "` to:** `" + newPerms.join("` | `") + " `") 124 | 125 | bot.config.setPerms(message.guild.id, perms) 126 | 127 | } 128 | 129 | exports.conf = { 130 | userPerm: ["MANAGE_GUILD"], 131 | botPerm: ["SEND_MESSAGES"], 132 | coolDown: 0, 133 | dm: true, 134 | category: "Utility", 135 | help: "Customize specific permissions for each command.", 136 | args: "", 137 | } -------------------------------------------------------------------------------- /commands/ping.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | send("Pong!"); 3 | } 4 | 5 | exports.conf = { 6 | userPerm: [], 7 | botPerm: ["SEND_MESSAGES"], 8 | coolDown: 0, 9 | dm: true, 10 | category: "Other", 11 | help: "Ping! Pong!", 12 | args: "" 13 | } -------------------------------------------------------------------------------- /commands/play.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | exports.run = (message, bot) => { 4 | } 5 | 6 | exports.conf = { 7 | userPerm: [], 8 | botPerm: ["SEND_MESSAGES"], 9 | coolDown: 0, 10 | dm: false, 11 | category: "Music", 12 | help: "Queue a soundcloud/youtube link or search with a phrase.", 13 | args: "", 14 | } -------------------------------------------------------------------------------- /commands/poll.js: -------------------------------------------------------------------------------- 1 | let poll = {}; 2 | 3 | 4 | exports.run = (message, bot, send) => { 5 | let prefix = message.guild.prefix 6 | let id = message.channel.id; 7 | if (poll[id]) return send("**:no_entry: | There is already a poll running in this channel.**") 8 | if (!message.args[0]) return send(`**To Create A Poll:**\n\`${prefix}poll ||| ||| ||| ||| { 31 | ar.push(num + ". " + opt[r].text) + ""; 32 | num++ 33 | }) 34 | let text = "__**" + poll[id].question + "**__\n\n*You can vote with `" + prefix + "vote `*\n\n**" + ar.join("\n") + "**\n\n*The creator of this poll or a server admin can end the poll early by typing `endpoll` in chat. Otherwise it will go for 2 minutes.*" 35 | message.channel.send(text, { 36 | split: true 37 | }); 38 | let collect = message.channel.createCollector(m => { 39 | if (m.author.bot) return false; 40 | if (m.content.startsWith(prefix + "vote") || m.content === "endpoll") return true 41 | else return false; 42 | }, { 43 | time: 180000 44 | }); 45 | collect.on('collect', (m) => { 46 | let id = m.channel.id; 47 | if (m.content === "endpoll") { 48 | if (poll[id].auth === m.author.id) return collect.stop('early') 49 | else if (m.channel.permissionsFor(m.member).has("MANAGE_CHANNELS")) return collect.stop('early') 50 | else return; 51 | } else { 52 | m.delete() 53 | if (poll[id].voted[m.author.id]) return m.channel.send("**You have already voted.**"); 54 | let sp = m.content.split(" "); 55 | if (!sp[1]) return m.channel.send("**Provide the option number you are voting on**"); 56 | let tot = Object.keys(poll[id].opt).length; 57 | let num = parseInt(sp[1]) || 0; 58 | if (num < 1 || num > tot) return m.channel.send("**The option number must be between 1 and " + tot + "**"); 59 | poll[id].voted[m.author.id] = true; 60 | poll[id].opt[num.toString()].votes++ 61 | } 62 | }); 63 | collect.on('end', (col, reas) => { 64 | if (reas === "time" && col.size < 1) return message.channel.send("**The poll has ended without any votes.**") 65 | else if (reas === "early" && col.size < 2) return message.channel.send("**The poll has ended without any votes.**") 66 | else done(col.first()); 67 | }); 68 | } 69 | 70 | function done(message) { 71 | let id = message.channel.id; 72 | let opt = []; 73 | let votes = Object.keys(poll[id].opt); 74 | votes = votes.sort((a, b) => { 75 | return poll[id].opt[b].votes - poll[id].opt[a].votes; 76 | }) 77 | let num = 1; 78 | let arr = []; 79 | votes.forEach(p => { 80 | let i = poll[id].opt[p]; 81 | arr.push("**" + num + ". " + i.text + " = " + i.votes + "**") 82 | num++ 83 | }); 84 | let text = "*Here are the results:*\n\n__**" + poll[id].question + "**__\n\n" + arr.join("\n"); 85 | message.channel.send(text); 86 | return delete poll[id]; 87 | } 88 | 89 | exports.conf = { 90 | userPerm: [], 91 | botPerm: ["SEND_MESSAGES"], 92 | coolDown: 0, 93 | dm: false, 94 | category: "Utility", 95 | help: "Create a poll", 96 | args: "", 97 | } 98 | -------------------------------------------------------------------------------- /commands/pun.js: -------------------------------------------------------------------------------- 1 | const request = require('request') 2 | const Entities = require('html-entities').AllHtmlEntities; 3 | 4 | exports.run = (message, bot) => { 5 | entities = new Entities(); 6 | request('http://www.punoftheday.com/cgi-bin/arandompun.pl', function(err, res, body) { 7 | if (err) message.channel.send("Service Offline") 8 | else { 9 | body = entities.decode(body); 10 | body = body.slice(16); 11 | body = body.slice(0, body.indexOf("'")) 12 | body = body.slice(0, body.length - 6) 13 | message.channel.send(body) 14 | } 15 | }); 16 | } 17 | 18 | exports.conf = { 19 | userPerm:[], 20 | botPerm:["SEND_MESSAGES"], 21 | coolDown:0, 22 | dm:true, 23 | category:"Fun", 24 | help:"Knock em dead with Puns.", 25 | args:"", 26 | } -------------------------------------------------------------------------------- /commands/punch.js: -------------------------------------------------------------------------------- 1 | const jimp = require('jimp'); 2 | 3 | exports.run = (message, bot) => { 4 | if (!message.mentions.users.first()) return message.channel.send("Good job you punched the air, maybe try mentioning someone next time.") 5 | let authorURL = message.author.displayAvatarURL.endsWith(".webp") ? message.author.displayAvatarURL.slice(0, -5) + ".png" : message.author.displayAvatarURL; 6 | let targetPerson = message.mentions.users.first() 7 | let targetURL = targetPerson.displayAvatarURL.endsWith(".webp") ? targetPerson.displayAvatarURL.slice(0, -5) + ".png" : targetPerson.displayAvatarURL; 8 | jimp.read("https://image.freepik.com/free-icon/person-fight-punch_318-29637.jpg", (err, image) => { 9 | if (err) return console.log(err); 10 | jimp.read(authorURL, (err, author) => { 11 | if (err) return console.log(err); 12 | author.resize(100, 100); 13 | jimp.read(targetURL, (err, target) => { 14 | if (err) return console.log(err); 15 | target.resize(100, 100); 16 | target.rotate(-4) 17 | image.composite(author, 110, 30); 18 | image.composite(target, 400, 40); 19 | image.getBuffer(jimp.AUTO, (err, buff) => { 20 | if (err) return console.log(err); 21 | message.channel.send(`**${message.author.username}** *sucker punches* **${message.mentions.users.first().username}**`); 22 | message.channel.sendFile(buff); 23 | }) 24 | }) 25 | }) 26 | }) 27 | } 28 | 29 | exports.conf = { 30 | userPerm: [], 31 | botPerm: ["SEND_MESSAGES"], 32 | coolDown: 0, 33 | dm: true, 34 | category: "Fun", 35 | help: "Sucker punch a user", 36 | args: "", 37 | } -------------------------------------------------------------------------------- /commands/purge.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | let embed = new bot.embed() 3 | embed.addField(message.guild.prefix + "purge ", "Purge messages. If NaN defaults to 20. Discords API makes it impossible to delete messages older than 14 days.") 4 | embed.addField(message.guild.prefix + "purge <@mentions...>", "Purge messages but filter by mentioned users. If no number provided defaults to 20.") 5 | embed.addField(message.guild.prefix + "purge -b", "Use the `-b` flag to only purge messages sent by bots.") 6 | embed.addField(message.guild.prefix + "purge search ", "Search through the past 100 messages and purge those containing ") 7 | if (!message.args[0]) return message.send({ 8 | embed 9 | }) 10 | 11 | if (message.args[0] === "search") return purgeSearch(message, bot) 12 | else return purge(message, bot) 13 | } 14 | 15 | function purgeSearch(message, bot) { 16 | 17 | let query = message.args.slice(1).join(" ") 18 | 19 | message.channel.send("`Collecting...`").then(top => { 20 | 21 | message.channel.fetchMessages({limit:100}).then(msgs => { 22 | 23 | msgs = msgs.filter(m => m.content.includes(query) && m.id !== message.id) 24 | 25 | if (msgs.size < 1) return top.edit("No messages were found matching the query `"+query+"`") 26 | 27 | if (msgs.size === 1) return msgs.first().delete(), top.edit("Purging 1 message matching the query `"+query+"`") 28 | 29 | message.channel.bulkDelete(msgs, true).then(() => { 30 | 31 | top.edit("Purging "+msgs.size+" message matching the query `"+query+"`") 32 | 33 | }).catch(() => top.edit("`Purge Failed...`")) 34 | 35 | }) 36 | }) 37 | 38 | } 39 | 40 | function purge(message, bot) { 41 | 42 | message.channel.send("`Collecting...`").then(top => { 43 | 44 | let num = message.args[0] || "no" 45 | if (num === "no") return message.send("`Not a valid number`") 46 | num = parseInt(num) || 10 47 | if (num < 2) num = 2 48 | num++ 49 | if (num > 100) num = 100 50 | console.log(num) 51 | 52 | message.channel.fetchMessages({ 53 | limit: num 54 | }) 55 | .then(msgs => { 56 | 57 | msgs = filter(message, msgs) 58 | 59 | top.edit("`"+msgs.size+" collected. Filtering...`") 60 | .then(top => { 61 | 62 | if (msgs.size < 2) return top.edit("`Not enough messages to purge.`") 63 | 64 | message.channel.bulkDelete(msgs, true).then(() => { 65 | 66 | top.edit("`" + message.author.username + " purged " + msgs.size + " in " + message.channel.name + "`") 67 | 68 | }).catch(() => top.edit("`Purge Failed...`")) 69 | 70 | }) 71 | 72 | }).catch(() => top.edit("`Purge Failed...`")) 73 | 74 | }) 75 | 76 | } 77 | 78 | function filter(message, msgs) { 79 | 80 | msgs = msgs.filter(m => { 81 | 82 | let fail = true 83 | 84 | if (message.content.includes(" -b") && !m.author.bot) return false 85 | 86 | if (message.mentions.users.first()) { 87 | 88 | fail = false 89 | 90 | message.mentions.users.forEach(user => { 91 | 92 | if (m.author.id === user.id) fail = true 93 | 94 | }) 95 | 96 | } 97 | 98 | if (fail) return true 99 | return false 100 | 101 | }) 102 | 103 | return msgs 104 | 105 | } 106 | 107 | exports.conf = { 108 | userPerm: ["MANAGE_MESSAGES"], 109 | botPerm: ["SEND_MESSAGES", "MANAGE_MESSAGES"], 110 | coolDown: 0, 111 | dm: false, 112 | category: "Moderation", 113 | help: "Purge messages in a channel.", 114 | args: " >", 115 | } -------------------------------------------------------------------------------- /commands/queue.js: -------------------------------------------------------------------------------- 1 | 2 | exports.run = (message, bot) => { 3 | 4 | } 5 | 6 | exports.conf = { 7 | userPerm:[], 8 | botPerm:["SEND_MESSAGES"], 9 | coolDown:0, 10 | dm:false, 11 | category:"Music", 12 | help:"Get the current queue", 13 | args:"", 14 | } -------------------------------------------------------------------------------- /commands/reload.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const cmd = require('../functions/loadCommands.js'); 3 | 4 | exports.run = (message, bot) => { 5 | fs.readdir('./commands/', (err, files) => { 6 | if (err) return console.log(err); 7 | files.forEach(f => { 8 | if (message.args[0] + ".js" === f) { 9 | let t = cmd.reload(message.args[0]); 10 | if (!t.worked) { 11 | message.channel.send("Errored when reloading command: "+f+"```js\n"+t.error+"```"); 12 | } else { 13 | message.channel.send("Reload successful"); 14 | } 15 | return; 16 | } 17 | }); 18 | }); 19 | } 20 | 21 | function reload(file) { 22 | try { 23 | let check = require(file); 24 | delete require.cache[require.resolve(file)] 25 | let good = require(file); 26 | return { 27 | worked: true 28 | }; 29 | } catch (err) { 30 | return { 31 | worked: false, 32 | error: err 33 | }; 34 | } 35 | } 36 | 37 | exports.conf = { 38 | userPerm: ["DEV"], 39 | botPerm: ["SEND_MESSAGES"], 40 | coolDown: 0, 41 | dm: true, 42 | category: "DevOnly", 43 | help: "Reload a module", 44 | args: "" 45 | } 46 | -------------------------------------------------------------------------------- /commands/remove.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | } 3 | 4 | exports.conf = { 5 | userPerm:[], 6 | botPerm:["SEND_MESSAGES"], 7 | coolDown:0, 8 | dm:false, 9 | category:"Music", 10 | help:"Remove a song from the queue", 11 | args:"", 12 | } -------------------------------------------------------------------------------- /commands/rep+.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js') 2 | 3 | exports.run = (message, bot, send) => { 4 | let user = message.mentions.users.first() 5 | if (!user) return send("**Mention a user to rep+ them**") 6 | if (user.id === message.author.id) return send("**You can't rep yourself**") 7 | let msg = message.args[1] ? message.args.slice(1).join(" ") : false 8 | let auth = message.author 9 | let type = 1 10 | let tag = auth.tag 11 | 12 | let rep = bot.profile.getRep(user.id) 13 | if (rep[auth.id]) { 14 | if (rep[auth.id].type === 2) { 15 | rep[auth.id] = {type, msg, tag} 16 | send("**Successfuly added positive reputation to " + user.tag + "**") 17 | } else { 18 | return send("**You have already +rep'd this user**") 19 | } 20 | } else { 21 | rep[auth.id] = {type, msg, tag} 22 | send("**Successfuly added positive reputation to " + user.tag + "**") 23 | } 24 | bot.profile.setRep(user.id, rep) 25 | } 26 | 27 | exports.conf = { 28 | userPerm: [], 29 | botPerm: ["SEND_MESSAGES"], 30 | coolDown: 0, 31 | dm: false, 32 | category: "Reputation", 33 | help: "Give positive reputation to a user", 34 | args: "" 35 | } -------------------------------------------------------------------------------- /commands/rep-.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js') 2 | 3 | exports.run = (message, bot, send) => { 4 | let user = message.mentions.users.first() 5 | if (!user) return send("**Mention a user to rep- them**") 6 | if (user.id === message.author.id) return send("**You can't rep yourself**") 7 | let msg = message.args[1] ? message.args.slice(1).join(" ") : false 8 | let auth = message.author 9 | let type = 2 10 | let tag = auth.tag 11 | 12 | let rep = bot.profile.getRep(user.id) 13 | if (rep[auth.id]) { 14 | if (rep[auth.id].type === 1) { 15 | rep[auth.id] = {type, msg, tag} 16 | send("**Successfuly added negative reputation to " + user.tag + "**") 17 | } else { 18 | return send("**You have already -rep'd this user**") 19 | } 20 | } else { 21 | rep[auth.id] = {type, msg, tag} 22 | send("**Successfuly added negative reputation to " + user.tag + "**") 23 | } 24 | bot.profile.setRep(user.id, rep) 25 | } 26 | 27 | exports.conf = { 28 | userPerm: [], 29 | botPerm: ["SEND_MESSAGES"], 30 | coolDown: 0, 31 | dm: false, 32 | category: "Reputation", 33 | help: "Give negative reputation to a user", 34 | args: "" 35 | } -------------------------------------------------------------------------------- /commands/restart.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | message.channel.send("Restarting...").then(m => { 3 | m.delete().then(() => { 4 | bot.destroy().then(() => { 5 | process.exit(1) 6 | }) 7 | }) 8 | }) 9 | } 10 | 11 | exports.conf = { 12 | userPerm:["DEV"], 13 | botPerm:["SEND_MESSAGES"], 14 | coolDown:0, 15 | dm:true, 16 | category:"DevOnly", 17 | help:"Restart the bot", 18 | args:"" 19 | } 20 | -------------------------------------------------------------------------------- /commands/resume.js: -------------------------------------------------------------------------------- 1 | 2 | exports.run = (message, bot) => { 3 | 4 | } 5 | 6 | exports.conf = { 7 | userPerm: [], 8 | botPerm: ["SEND_MESSAGES"], 9 | coolDown: 0, 10 | dm: false, 11 | category: "Music", 12 | help: "Resume paused music.", 13 | args: "", 14 | } -------------------------------------------------------------------------------- /commands/robohash.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | let suffix = message.args[0] ? message.suffix : message.author.id 3 | message.channel.sendFile(`https://robohash.org/${suffix}.png`) 4 | } 5 | 6 | exports.conf = { 7 | userPerm:[], 8 | botPerm:["SEND_MESSAGES"], 9 | coolDown:0, 10 | dm:true, 11 | category:"Fun", 12 | help:"Generate a robohash with provided text.", 13 | args:"", 14 | } -------------------------------------------------------------------------------- /commands/roleme.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | let roles = message.guild.roleme 3 | let prefix = message.guild.prefix 4 | roles.forEach(r => { 5 | if (!message.guild.roles.exists('name', r)) { 6 | roles = nu.removeA(roles, r); 7 | } 8 | }) 9 | 10 | if (!message.args[0]) { 11 | return message.send("**The Available roles are:**\n` " + (roles.length !== 0 ? roles.join(", ") : "\u200B ")+"`\n**you can add a role with:** `"+prefix+"roleme `\n\n*Admins:*\n**You can add or remove an option from roleme with:**\n`" + prefix + "roleme add ` *or* `" + prefix + "roleme remove `"); 12 | } 13 | 14 | if (message.args[0] === "add") { 15 | if (!message.channel.permissionsFor(message.member).has("MANAGE_GUILD")) { 16 | return message.send("You need the `MANAGE_GUILD` permission to manage roleme."); 17 | } 18 | if (!message.args[1]) { 19 | return message.send("Please define an existing role to add to roleme."); 20 | } 21 | let name = message.suffix.split(" "); 22 | name.shift(); 23 | name = name.join(" "); 24 | if (message.guild.roles.exists('name', name)) { 25 | if (message.guild.member(bot.user).highestRole.position > message.guild.roles.find('name', name).position) { 26 | if (message.guild.roles.filter(r => r.name === name).size === 1) { 27 | if (roles.indexOf(name) === -1) { 28 | roles.push(name); 29 | bot.config.setRoleMe(message.guild.id, roles); 30 | message.send("The role " + name + " has been added to roleme.") 31 | } else { 32 | message.send("That role is already added to roleme."); 33 | } 34 | } else { 35 | message.send("There are duplicates of this role and I dont know which to assign."); 36 | } 37 | } else { 38 | message.send("I cannot assign users a role that is higher than mine."); 39 | } 40 | } else { 41 | message.send("The role " + name + " does not exist on this server."); 42 | } 43 | return; 44 | } 45 | 46 | if (message.args[0] === "remove") { 47 | if (!message.channel.permissionsFor(message.member).has("MANAGE_GUILD")) { 48 | return message.send("You need the `MANAGE_GUILD` permission to manage roleme."); 49 | } 50 | if (!message.args[1]) { 51 | return message.send("Please define the role to remove from roleme"); 52 | } 53 | let name = message.suffix.split(" "); 54 | name.shift(); 55 | name = name.join(" "); 56 | if (roles.indexOf(name) > -1) { 57 | roles = nu.removeA(roles, name); 58 | bot.config.setRoleMe(message.guild.id, roles); 59 | message.send("The role " + name + " has been removed from roleme"); 60 | } else { 61 | message.send("The role " + name + " is not currently added to roleme.") 62 | } 63 | return; 64 | } 65 | let role = message.suffix; 66 | if (message.member.roles.exists('name', role)) { 67 | if (roles.indexOf(role) > -1) { 68 | if (message.guild.member(bot.user).highestRole.position > message.guild.roles.find('name', role).position) { 69 | message.send("Removing role " + role); 70 | message.member.removeRole(message.guild.roles.find('name', role)); 71 | } else { 72 | message.send("I cannot remove this role because it has been moved above my highest role"); 73 | } 74 | } else { 75 | message.send("The role you wish to remove is not apart of the roleme config.") 76 | } 77 | return; 78 | } 79 | if (roles.indexOf(role) === -1) { 80 | return message.send("**The Available roles are:**\n` " + (roles.length !== 0 ? roles.join(", ") : "\u200B ")+"`\n**you can add a role with:** `"+prefix+"roleme `\n\n*Admins:*\n**You can add or remove an option from roleme with:**\n`" + prefix + "roleme add ` *or* `" + prefix + "roleme remove `"); 81 | } 82 | if (message.guild.member(bot.user).highestRole.position > message.guild.roles.find('name', role).position) { 83 | message.member.addRole(message.guild.roles.find('name', role)); 84 | message.send("You have been given the role: " + role + "\nYou can use `" + prefix + "roleme " + role + "` at anytime to remove this role."); 85 | } else { 86 | message.send("I cannot assign you this role because it has been moved above my highest role.") 87 | } 88 | } 89 | 90 | exports.conf = { 91 | userPerm: [], 92 | botPerm: ["SEND_MESSAGES", "MANAGE_ROLES_OR_PERMISSIONS"], 93 | coolDown: 0, 94 | dm: false, 95 | category: "Utility", 96 | help: "Give yourself one of the available Role Me roles.", 97 | args: "" 98 | } 99 | -------------------------------------------------------------------------------- /commands/say.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | message.delete().catch() 3 | message.channel.send(message.suffix, {disableEveryone:true}) 4 | } 5 | 6 | exports.conf = { 7 | userPerm:['MANAGE_MESSAGES'], 8 | botPerm:["SEND_MESSAGES"], 9 | coolDown:0, 10 | dm: false, 11 | category:"Utility", 12 | help:"Make Nitro say a message", 13 | args:"", 14 | } 15 | -------------------------------------------------------------------------------- /commands/setchannel.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | 3 | } 4 | 5 | exports.conf = { 6 | userPerm:[], 7 | botPerm:["SEND_MESSAGES"], 8 | coolDown:0, 9 | dm:false, 10 | category:"Music", 11 | help:"Set the channel that next song messages are sent to.", 12 | args:"", 13 | } -------------------------------------------------------------------------------- /commands/sethost.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | exports.run = (message, bot) => { 4 | 5 | } 6 | 7 | exports.conf = { 8 | userPerm: [], 9 | botPerm: ["SEND_MESSAGES"], 10 | coolDown: 0, 11 | dm: false, 12 | category: "Music", 13 | help: "Set the host for the current music session.", 14 | args: "<@mention>", 15 | } -------------------------------------------------------------------------------- /commands/setprefix.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | let split = message.content.split("\""); 3 | let bool = message.content.replace(/"/g, ""); 4 | if (bool.length === message.content.length - 1) { 5 | bool = false; 6 | } else { 7 | bool = true 8 | } 9 | if (!split[1] || !bool) { 10 | return message.channel.send("Looks like you didnt format setting the prefix correctly,\nThe proper way is: `" + message.guild.prefix + "setprefix \"newPrefix\"`\n*example: to set the prefix to `nitro, ` use,*\n`" + message.guild.prefix + "setprefix \"nitro, \"`"); 11 | } 12 | if (split[1].length > 20) return message.channel.send("**Invalid Prefix**: Too Long") 13 | 14 | if (split[1].startsWith(" ")) return message.channel.send("**Invalid Prefix**: Illegal Characters") 15 | if (/^\s+$/g.test(split[1])) return message.channel.send("**Invalid Prefix**: Illegal Characters") 16 | bot.config.setPrefix(message.guild.id, split[1]); 17 | message.channel.send("**The prefix for this server has been changed to '" + bot.config.getPrefix(message.guild.id) + "'**") 18 | } 19 | 20 | exports.conf = { 21 | userPerm: ["MANAGE_GUILD"], 22 | botPerm: ["SEND_MESSAGES"], 23 | coolDown: 0, 24 | dm: false, 25 | category: "Utility", 26 | help: "Set Nitro's prefix. Write the new prefix inside \" \"", 27 | args: "\"\"" 28 | } 29 | -------------------------------------------------------------------------------- /commands/showrep.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | let user = message.mentions.users.first() || message.author 3 | let rep = bot.profile.getRep(user.id) 4 | let keys = Object.keys(rep) 5 | let total = 0 6 | let txt = [] 7 | keys.forEach(k => { 8 | if (rep[k].type === 1) total++ 9 | if (rep[k].type === 2) total-- 10 | txt.push(`**${rep[k].type === 1 ? "[ + ]" : "[ - ]"} ${rep[k].tag} ${rep[k].msg ? "- " + rep[k].msg : ""}**`) 11 | }) 12 | let embed = new bot.embed() 13 | embed.setTitle(`${user.tag}'s reputation: ${total}`) 14 | embed.setDescription(txt.join("\n")) 15 | embed.setColor("#87ceeb") 16 | send("", {embed}) 17 | 18 | } 19 | 20 | exports.conf = { 21 | userPerm: [], 22 | botPerm: ["SEND_MESSAGES"], 23 | coolDown: 0, 24 | dm: false, 25 | category: "Reputation", 26 | help: "Show the reputation for a user", 27 | args: "", 28 | } -------------------------------------------------------------------------------- /commands/shrug.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | message.channel.send("¯\\_(ツ)_/¯").then(m => { 3 | setTimeout(() => { 4 | m.edit("¯\\\\\\-(ツ)-/¯").then(ms => { 5 | setTimeout(() => { 6 | ms.edit("¯\\_(ツ)_/¯") 7 | }, 500) 8 | }) 9 | }, 500) 10 | 11 | }) 12 | } 13 | 14 | exports.conf = { 15 | userPerm: [], 16 | botPerm: ["SEND_MESSAGES"], 17 | coolDown: 0, 18 | dm: true, 19 | category: "Fun", 20 | help: "Animated Shrug", 21 | args: "", 22 | } -------------------------------------------------------------------------------- /commands/skip.js: -------------------------------------------------------------------------------- 1 | 2 | exports.run = (message, bot) => { 3 | } 4 | 5 | exports.conf = { 6 | userPerm: [], 7 | botPerm: ["SEND_MESSAGES"], 8 | coolDown: 0, 9 | dm: false, 10 | category: "Music", 11 | help: "Skip a currently playing song", 12 | args: "", 13 | } -------------------------------------------------------------------------------- /commands/slots.js: -------------------------------------------------------------------------------- 1 | const rn = require('random-number'); 2 | 3 | const thing = { 4 | cherry: '🍒', 5 | grape: '🍇', 6 | money: '💰' 7 | } 8 | 9 | exports.run = (message, bot, send) => { 10 | if (!message.args[0]) return send('**:confused: | Provide a bet**'); 11 | let id = message.author.id; 12 | let money = bot.profile.getMoney(id); 13 | let bet = parseInt(message.args[0]) || "no"; 14 | if (bet < 100 || bet > 2000 || bet === "no") return send("**:cherries: | Your bet must be an amount between $100 and $2000**"); 15 | if (money < bet) return send("**You cannot afford that bet**") 16 | let win = run3() 17 | let did = (win[4] === win[5] && win[5] === win[6]) ? true : false; 18 | let multiply; 19 | if (did && win[4] === "money" && win[5] === "money" && win[6] === "money") multiply = 8 20 | else if (did && win[4] === "cherry" && win[5] === "cherry" && win[6] === "cherry") multiply = 6 21 | else if (did && win[4] === "grape" && win[5] === "grape" && win[6] === "grape") multiply = 4 22 | else multiply = false; 23 | let earned = (multiply) ? bet*multiply : false; 24 | let m = (earned) ? "**You have won $"+earned+"**" : "**You have lost your bet of $"+bet+"**" 25 | let slot = "**----------Slots----------**\n:white_large_square: "+thing[win[1]]+" "+thing[win[2]]+" "+thing[win[3]]+" :white_large_square: \n:arrow_forward: "+thing[win[4]]+" "+thing[win[5]]+" "+thing[win[6]]+" :arrow_backward: \n:white_large_square: "+thing[win[7]]+" "+thing[win[8]]+" "+thing[win[9]]+" :white_large_square:\n**--------------------------**\n"+m 26 | send(slot) 27 | if (earned) bot.profile.setMoney(id, money+earned) 28 | else bot.profile.setMoney(id, money-bet); 29 | } 30 | 31 | exports.conf = { 32 | userPerm: [], 33 | botPerm: ["SEND_MESSAGES"], 34 | coolDown: 0, 35 | dm: false, 36 | category: "Social", 37 | help: "Play slots", 38 | args: "", 39 | } 40 | 41 | function run3() { 42 | let chosen = {}; 43 | let item = Object.keys(thing); 44 | for (i=0;i<9;i++) { 45 | let r = rn({min:0, max:2, integer:true}); 46 | chosen[i+1] = item[r]; 47 | } 48 | return chosen; 49 | } 50 | -------------------------------------------------------------------------------- /commands/snek.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | message.channel.sendFile("https://cdn.discordapp.com/attachments/222197033908436994/324717206548119573/Snek-is-love-snek-is-life.jpg") 3 | } 4 | 5 | exports.conf = { 6 | userPerm:[], 7 | botPerm:["SEND_MESSAGES"], 8 | coolDown:0, 9 | dm:true, 10 | category:"Fun", 11 | help:"snek", 12 | args:"", 13 | } -------------------------------------------------------------------------------- /commands/softban.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | if (!message.mentions.users.first()) return message.channel.send("Mention a user or multiple users to softban them. Kicks them and deletes all messages they have sent.") 3 | let ment = message.mentions.users; 4 | let text = [] 5 | ment.forEach(m => { 6 | if (!message.guild.member(m).bannable) { 7 | message.channel.send("Something went wrong when softbanning: "+m.username); 8 | } else { 9 | let id = m.id; 10 | message.guild.ban(message.guild.member(m), 7).then(() => { 11 | message.guild.unban(id).then(() => { 12 | text.push(m.username); 13 | }) 14 | }).catch(err => message.channel.send("Something went wrong when softbanning: "+m.username)) 15 | } 16 | }); 17 | setTimeout(function() { 18 | if (text.length === 0) return; 19 | message.channel.send("`"+text.join(", ")+"` has been softbanned.", {split:true}); 20 | }, 1000); 21 | } 22 | 23 | exports.conf = { 24 | userPerm:["BAN_MEMBERS"], 25 | botPerm:["SEND_MESSAGES", "BAN_MEMBERS"], 26 | coolDown:0, 27 | dm:true, 28 | category:"Moderation", 29 | help:"Bans and unbans (a) user(s) to delete their messages.", 30 | args:"<@mention>", 31 | } -------------------------------------------------------------------------------- /commands/stats.js: -------------------------------------------------------------------------------- 1 | const os = require('os'); 2 | 3 | function convertMS(ms) { 4 | var d, h, m, s; 5 | s = Math.floor(ms / 1000); 6 | m = Math.floor(s / 60); 7 | s = s % 60; 8 | h = Math.floor(m / 60); 9 | m = m % 60; 10 | d = Math.floor(h / 24); 11 | h = h % 24; 12 | return { 13 | d: d, 14 | h: h, 15 | m: m, 16 | s: s 17 | }; 18 | }; 19 | 20 | exports.run = (message, bot) => { 21 | var cpu = os.loadavg(); 22 | let u = convertMS(bot.uptime); 23 | let uptime = u.d + " D - " + u.h + " H - " + u.m + " M - " + u.s + " S" 24 | 25 | let embed = new bot.embed() 26 | embed.setDescription("\nNitro is the next best thing in Server Managment\nIt can handle any type of server, with loads of customization to spare") 27 | embed.setTitle("`[ Stats ]`") 28 | embed.setColor("#4DD0D9") 29 | embed.addField("Creator", "Funnbot#8830", true) 30 | embed.addField("Uptime", uptime, true) 31 | embed.addField("Memory", Math.round(process.memoryUsage().rss / 1024 / 1024) + "MB", true) 32 | embed.addField("CPU", Math.ceil(cpu[1] * 100) / 10 + "%", true) 33 | embed.addField("Framework", "Discord.js V11.3", true) 34 | embed.addField("On Shard " + (bot.shard.id + 1) + "/" + bot.shard.count, "**Guilds: **" + bot.guilds.size + " | **Channels: **" + bot.channels.size + " | **Users: **" + bot.users.size, true) 35 | getSharded(bot).then((res) => { 36 | embed.addField("On All Shards", "**Guilds: **" + res[0] + " | **Channels: **" + res[1] + " | **Users: **" + res[2], true) 37 | message.channel.send("", { 38 | embed 39 | }).catch(console.error); 40 | }).catch(() => { 41 | message.channel.send("", {embed}).catch(console.error); 42 | }) 43 | 44 | } 45 | 46 | exports.conf = { 47 | userPerm: [], 48 | botPerm: ["SEND_MESSAGES"], 49 | coolDown: 0, 50 | dm: true, 51 | category: "Other", 52 | help: "Statistics for Nitro", 53 | args: "", 54 | } 55 | 56 | let getSharded = (bot) => { 57 | 58 | return new Promise((resolve, reject) => { 59 | 60 | bot.shard.fetchClientValues('guilds.size').then(results => { 61 | results = results.reduce((prev, val) => prev + val, 0) 62 | bot.shard.fetchClientValues('channels.size').then(result => { 63 | result = result.reduce((prev, val) => prev + val, 0) 64 | bot.shard.fetchClientValues('users.size').then(res => { 65 | res = res.reduce((prev, val) => prev + val, 0) 66 | return resolve([results, result, res]) 67 | }) 68 | }) 69 | }) 70 | 71 | }) 72 | 73 | } -------------------------------------------------------------------------------- /commands/stop.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | } 3 | 4 | exports.conf = { 5 | userPerm: [], 6 | botPerm: ["SEND_MESSAGES"], 7 | coolDown: 0, 8 | dm: false, 9 | category: "Music", 10 | help: "Stop currently playing music", 11 | args: "", 12 | } -------------------------------------------------------------------------------- /commands/strikes.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | let strikes = message.guild.strikes 3 | let user = message.mentions.users.first() || message.author 4 | if (!strikes.users || !strikes.users[user.id] || strikes.users[user.id] === 0) return send(`**${user.tag} has \`0\` strikes**`) 5 | return send(`**${user.tag} has \`${strikes.users[user.id]}\` strikes**`) 6 | } 7 | 8 | exports.conf = { 9 | userPerm:[], 10 | botPerm:["SEND_MESSAGES"], 11 | coolDown:0, 12 | dm:true, 13 | category:"Moderation", 14 | help:"See how many strikes a user has", 15 | args:"", 16 | } -------------------------------------------------------------------------------- /commands/suggest.js: -------------------------------------------------------------------------------- 1 | const config = require('../config') 2 | const Discord = require('discord.js') 3 | const Trello = require('node-trello') 4 | const t = new Trello(config.trelloKey, config.trelloToken) 5 | const listid = "593619639c37afba108f097e" 6 | const web = new Discord.WebhookClient("323966823890419712", "Wx2Rmm0A6CCTP8_lSCBpvMbl6XIs0irrSzxJHqre5A_XTO5SLDPFOGqvpOOxuPp3FXud") 7 | 8 | exports.run = (message, bot, send) => { 9 | if (!message.args[0]) return send("**Suggest a new command or feature**") 10 | if (!message.args[1]) return send("**I'll need more information than that**") 11 | 12 | let msg = message.suffix 13 | let user = message.author.tag 14 | web.send("**" + user + " -** " + msg) 15 | 16 | let card = { 17 | name: msg, 18 | pos: "top", 19 | due: null, 20 | idList: listid, 21 | desc: "Suggester: "+user 22 | } 23 | 24 | t.post("/1/cards/", card, (err) => { 25 | if (err) return console.log(err) 26 | }) 27 | message.reply("Thank you for your suggestion!") 28 | } 29 | 30 | exports.conf = { 31 | userPerm: [], 32 | botPerm: ["SEND_MESSAGES"], 33 | coolDown: 0, 34 | dm: true, 35 | category: "Other", 36 | help: "Suggest a command or feature", 37 | args: "", 38 | } -------------------------------------------------------------------------------- /commands/support.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | message.channel.send("Need Help? Or just want to hang out with some cool people? Come on down to Nitro's Closet where you can suggest and push the progress of Nitro wherever *you* want:\nhttps://discord.gg/aZ2PYhn\nHosting Nitro costs a bit of money, and if you can spare a coin to support me, I would be extremely grateful https://patreon.com/user?u=4661783.") 3 | } 4 | 5 | exports.conf = { 6 | userPerm:[], 7 | botPerm:["SEND_MESSAGES"], 8 | coolDown:0, 9 | dm:true, 10 | category:"Other", 11 | help:"Support for Nitro", 12 | args:"", 13 | } -------------------------------------------------------------------------------- /commands/tableflip.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | message.channel.send("(°-°)\\ ┬─┬").then(m => { 3 | setTimeout(() => { 4 | m.edit("(╯°□°)╯ ]").then(ms => { 5 | setTimeout(() => { 6 | ms.edit("(╯°□°)╯ ︵ ┻━┻") 7 | }, 500) 8 | }) 9 | }, 500); 10 | 11 | }); 12 | } 13 | 14 | exports.conf = { 15 | userPerm: [], 16 | botPerm: ["SEND_MESSAGES"], 17 | coolDown: 0, 18 | dm: true, 19 | category: "Fun", 20 | help: "Animated Table Flip", 21 | args: "", 22 | } -------------------------------------------------------------------------------- /commands/tag.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | 3 | let tags = message.guild.tags 4 | 5 | if (tags[message.args[0]]) { 6 | 7 | message.channel.send(tags[message.args[0]].text); 8 | if (!tags[message.args[0]].used) tags[message.args[0]].used = 0 9 | tags[message.args[0]].used++ 10 | bot.config.setTags(message.guild.id, tags) 11 | 12 | } else { 13 | 14 | message.channel.send("**The tag `" + message.args[0] + "` does not exist.**") 15 | 16 | } 17 | 18 | } 19 | 20 | exports.conf = { 21 | userPerm: [], 22 | botPerm: ["SEND_MESSAGES"], 23 | coolDown: 0, 24 | dm: true, 25 | category: "Tag", 26 | help: "Get a tag", 27 | args: "", 28 | } -------------------------------------------------------------------------------- /commands/taginfo.js: -------------------------------------------------------------------------------- 1 | const moment = require('moment') 2 | 3 | exports.run = (message, bot, send) => { 4 | 5 | let prefix = message.guild.prefix 6 | if (!message.args[0]) return send("To get info for a tag use: `" + prefix + "taginfo `") 7 | let tags = message.guild.tags 8 | if (!tags[message.args[0]]) return send("**The tag `"+message.args[0]+"` does not exist**") 9 | let tag = tags[message.args[0]] 10 | let embed = new bot.embed() 11 | embed.setTitle("Tag Info: `"+message.args[0]+"`") 12 | embed.addField("Owner", bot.users.get(tag.owner) ? bot.users.get(tag.owner).username : "Unknown", true) 13 | embed.addField("Created On", moment(tag.created).format("MMM Do, YYYY"), true) 14 | let used = tag.used === 0 ? "Never" : tag.used === 1 ? "1 Time" : tag.used > 1 ? tag.used + " Times" : 0 15 | embed.addField("Used", used, true) 16 | embed.setColor(0xfe8507) 17 | message.channel.send("", {embed}) 18 | 19 | } 20 | 21 | exports.conf = { 22 | userPerm: [], 23 | botPerm: ["SEND_MESSAGES"], 24 | coolDown: 0, 25 | dm: false, 26 | category: "Tag", 27 | help: "Get info about a tag", 28 | args: "", 29 | } -------------------------------------------------------------------------------- /commands/tex.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | send("", {files: ["http://oi53.tinypic.com/qyv588.gif"]}) 3 | } 4 | 5 | exports.conf = { 6 | userPerm:[], 7 | botPerm:["SEND_MESSAGES"], 8 | coolDown:0, 9 | dm:true, 10 | category:"Donator", 11 | help:"A daily dose of awesome.", 12 | args:"", 13 | } 14 | -------------------------------------------------------------------------------- /commands/thesearch.js: -------------------------------------------------------------------------------- 1 | const Jimp = require('jimp') 2 | 3 | exports.run = (message, bot) => { 4 | if (!message.args[0]) message.suffix = "I didn't provide text" 5 | Jimp.read("./images/thesearch.png", function(err, image) { 6 | if (err) console.error(err); 7 | var text = new Jimp(160, 70, function(err, text) { 8 | Jimp.loadFont('./fonts/SFtoon.fnt').then(function(font) { 9 | text.print(font, 0, 0, message.suffix, 130); 10 | image.composite(text, 65, 330) 11 | image.getBuffer(Jimp.AUTO, function(err, result) { 12 | message.channel.sendFile(result); 13 | }); 14 | }); 15 | }); 16 | }); 17 | } 18 | 19 | exports.conf = { 20 | userPerm: [], 21 | botPerm: ["SEND_MESSAGES"], 22 | coolDown: 0, 23 | dm: false, 24 | category: "Fun", 25 | help: "The search continues meme.", 26 | args: "", 27 | } -------------------------------------------------------------------------------- /commands/togglefun.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | let mods = message.guild.modules 3 | if (mods.fun) { 4 | delete mods.fun; 5 | message.channel.send("**The `fun` module has been enabled.**") 6 | } else { 7 | mods.fun = true; 8 | message.channel.send("**The `fun` module has been disabled.**") 9 | } 10 | bot.config.setMod(message.guild.id, mods); 11 | } 12 | 13 | exports.conf = { 14 | userPerm:["MANAGE_GUILD"], 15 | botPerm:["SEND_MESSAGES"], 16 | coolDown:0, 17 | dm: false, 18 | category:"Module", 19 | help:"Toggle the Fun Module.", 20 | args:"", 21 | } -------------------------------------------------------------------------------- /commands/togglemusic.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | let mods = message.guild.modules 3 | if (mods.music) { 4 | delete mods.music; 5 | message.channel.send("**The `music` module has been enabled.**") 6 | } else { 7 | mods.music = true; 8 | message.channel.send("**The `music` module has been disabled.**") 9 | } 10 | bot.config.setMod(message.guild.id, mods); 11 | } 12 | 13 | exports.conf = { 14 | userPerm:["MANAGE_GUILD"], 15 | botPerm:["SEND_MESSAGES"], 16 | coolDown:0, 17 | dm: false, 18 | category:"Module", 19 | help:"Toggle the Music Module.", 20 | args:"", 21 | } -------------------------------------------------------------------------------- /commands/togglesocial.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | let mods = message.guild.modules 3 | if (mods.social) { 4 | delete mods.social; 5 | message.channel.send("**The `social` module has been enabled.**") 6 | } else { 7 | mods.social = true; 8 | message.channel.send("**The `social` module has been disabled.**") 9 | } 10 | bot.config.setMod(message.guild.id, mods); 11 | } 12 | 13 | exports.conf = { 14 | userPerm:["MANAGE_GUILD"], 15 | botPerm:["SEND_MESSAGES"], 16 | coolDown:0, 17 | dm: false, 18 | category:"Module", 19 | help:"Toggle the Social Module.", 20 | args:"", 21 | } -------------------------------------------------------------------------------- /commands/tts.js: -------------------------------------------------------------------------------- 1 | const speak = require("../functions/espeak.js") 2 | 3 | exports.run = async(message, bot, send) => { 4 | let txt = message.suffix.length > 0 ? message.suffix : "Provide text to change this message." 5 | let id = message.author.id; 6 | let patrons = bot.system.getPatrons(); 7 | if (!patrons[id]) 8 | return send("**You must be a patron to use this command, donate at **") 9 | 10 | try { 11 | await message.guild.fetchMember(message.author); 12 | await message.guild.fetchMember(bot.user); 13 | } catch (e) { 14 | return send("**Something went wrong.**"); 15 | } 16 | txt = txt.replace(/[^a-zA-Z0-9\s]/g, "") 17 | txt = txt.replace(/\n/g, ""); 18 | if (txt.replace(/\s/g, "").length < 16) return send("The text was too short.") 19 | if (txt.length > 500) return send("The text must be less than 500 characters.") 20 | let member = message.member; 21 | if (!member.voiceChannel) return send("**You must be in a voice channel for this command.**") 22 | if (message.guild.member(bot.user).voiceChannel) return send("**Im already playing something.**") 23 | 24 | member.voiceChannel.join().then(voiceConnection => { 25 | speak(txt, { 26 | format: "mp3", 27 | buffer: true, 28 | cb: function(err, buffer) { 29 | if (err) { 30 | console.log(err) 31 | send("**An error occured**"); 32 | return voiceConnection.disconnect(); 33 | } 34 | let stream = bufferToStream(buffer.getContents()); 35 | let dis = voiceConnection.playStream(stream) 36 | dis.on("end", () => { 37 | voiceConnection.disconnect() 38 | }) 39 | setTimeout(() => { 40 | if (voiceConnection.status !== 4) voiceConnection.disconnect(); 41 | }, 15000) 42 | } 43 | }) 44 | }).catch(() => { 45 | if (bot.voiceChannel && bot.voiceChannel.connection) { 46 | bot.voiceChannel.connection.leave(); 47 | } 48 | }) 49 | } 50 | 51 | exports.conf = { 52 | userPerm: [], 53 | botPerm: ["SEND_MESSAGES", "CONNECT", "SPEAK"], 54 | coolDown: 0, 55 | dm: false, 56 | category: "Special", 57 | help: "Plays in a voice channel. Donators only.", 58 | args: "", 59 | } 60 | 61 | let Duplex = require('stream').Duplex; 62 | function bufferToStream(buffer) { 63 | let stream = new Duplex(); 64 | stream.push(buffer); 65 | stream.push(null); 66 | return stream; 67 | } -------------------------------------------------------------------------------- /commands/unflip.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | message.channel.send("(╯°□°)╯ ︵ ┻━┻").then(m => { 3 | setTimeout(() => { 4 | m.edit("(╯°□°)╯ ]").then(ms => { 5 | setTimeout(() => { 6 | ms.edit("(°-°)\\ ┬─┬") 7 | }, 500) 8 | }) 9 | }, 500); 10 | 11 | }); 12 | } 13 | 14 | exports.conf = { 15 | userPerm: [], 16 | botPerm: ["SEND_MESSAGES"], 17 | coolDown: 0, 18 | dm: true, 19 | category: "Fun", 20 | help: "Animated Table Unflip", 21 | args: "", 22 | } -------------------------------------------------------------------------------- /commands/updatesquad.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | let update = bot.system.getUpdate() 3 | let id = message.author.id 4 | if (update[id]) delete update[id], send("**You have been removed from Nitro's Update Squad.**") 5 | else update[id] = true, send("**You have been added to Nitro's Update Squad, you will get DM's for each update.**") 6 | bot.system.setUpdate(update) 7 | } 8 | 9 | exports.conf = { 10 | userPerm:[], 11 | botPerm:["SEND_MESSAGES"], 12 | coolDown:0, 13 | dm:true, 14 | category:"Other", 15 | help:"Enable Update Notifications", 16 | args:"", 17 | } -------------------------------------------------------------------------------- /commands/upvote.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | const msg = ` 3 | **__Heres how to upvote Nitro.__** 4 | **Go to , click the Login button, and sign in with your discord account. 5 | Now go to and click the Upvote button and make it green. 6 | Congrats!** 7 | ` 8 | send(msg); 9 | } 10 | 11 | exports.conf = { 12 | userPerm: [], 13 | botPerm: ["SEND_MESSAGES"], 14 | coolDown: 0, 15 | dm: true, 16 | category: "Special", 17 | help: "Show your love for Nitro by upvoting it.", 18 | args: "", 19 | } -------------------------------------------------------------------------------- /commands/urban.js: -------------------------------------------------------------------------------- 1 | const urban = require('urban') 2 | 3 | exports.run = (message, bot, send) => { 4 | try { 5 | var search = urban(message.suffix); 6 | } catch (e) { 7 | return send("**There were no results for this search term**"); 8 | } 9 | if (!search || !search.first || typeof search.first !== "function") return; 10 | search.first(function (json) { 11 | if (json) { 12 | if (!json.definition || !json.example) return; 13 | if (json.definition.length > 1000) json.definition = json.definition.substr(0, 1000); 14 | if (json.example.length > 1000) json.example = json.example.substr(0, 1000); 15 | message.channel.send("", { 16 | "embed": { 17 | "title": "**" + message.suffix + "**", 18 | "url": json.permalink, 19 | "color": 0xD71A75, 20 | "author": { 21 | "name": "Urban Dictionary", 22 | "icon_url": message.guild.iconURL 23 | }, 24 | "fields": [{ 25 | "name": "**Definition**", 26 | "value": json.definition 27 | }, { 28 | "name": "**Example**", 29 | "value": json.example 30 | }], 31 | "footer": { 32 | "text": "Powered By Urban Dictionary", 33 | "icon_url": "http://www.extension.zone/wp-content/uploads/2015/11/Urban-Dictionary-logo.png" 34 | } 35 | } 36 | }) 37 | } else { 38 | send("**There were no results for this search term**") 39 | } 40 | }); 41 | } 42 | 43 | exports.conf = { 44 | userPerm: [], 45 | botPerm: ["SEND_MESSAGES"], 46 | coolDown: 0, 47 | dm: true, 48 | category: "Fun", 49 | help: "Search on Urban Dictionary", 50 | args: "", 51 | } -------------------------------------------------------------------------------- /commands/warn.js: -------------------------------------------------------------------------------- 1 | const strikes = require('../functions/strikes') 2 | 3 | exports.run = (message, bot, send) => { 4 | if (!message.args[0]) { 5 | let pre = message.guild.prefix 6 | return send("**To warn a user:** `" + pre + "warn <@user> `") 7 | } 8 | if (!message.mentions.users.first()) { 9 | return send("**To warn a user please mention them**") 10 | } 11 | if (!message.args[1]) { 12 | return send("**Please provide a reason for the warn.**") 13 | } 14 | let user = message.mentions.users.first(); 15 | let msg = message.suffix.substr(message.suffix.indexOf(" ") + 1); 16 | let embed = { 17 | title: ":cop: You have been warned by: " + message.author.username, 18 | color: 0xFF0000, 19 | description: ":question: Reason: " + msg + "\n\u200B", 20 | timestamp: new Date() 21 | } 22 | bot.users.get(user.id).send("", { 23 | embed 24 | }).then(send(message.mentions.users.first().username + " **Has been warned and given a strike.**")).catch(err => { 25 | console.log(err) 26 | send("**This user has Direct Messages disabled.**") 27 | }) 28 | strikes(message.guild.id, user.id, 1) 29 | } 30 | 31 | exports.conf = { 32 | userPerm: ["MANAGE_MESSAGES"], 33 | botPerm: ["SEND_MESSAGES"], 34 | coolDown: 0, 35 | dm: false, 36 | category: "Moderation", 37 | help: "Warn a user.", 38 | args: "", 39 | } -------------------------------------------------------------------------------- /commands/whois.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot) => { 2 | let user = message.mentions.users.first() ? message.mentions.users.first() : message.author 3 | let member = message.guild.member(user); 4 | let roles = []; 5 | if (member.roles.size > 0) { 6 | member.roles.forEach(r => { 7 | if (!r.name.includes("everyone")) { 8 | roles.push(r.name); 9 | } 10 | }) 11 | } else { 12 | roles = "no"; 13 | } 14 | let ttt = (member.roles.size > 0) ? roles.length : "0"; 15 | let wato = (roles.length > 0) ? roles.join(", ") : "None"; 16 | let game = (!!user.presence && user.presence !== null && user.presence.game !== null && user.presence.game.name !== null) ? user.presence.game.name : "Nothing" 17 | let embed = { 18 | author: { 19 | name: "Who Is: " + user.username, 20 | icon_url: (user.avatarURL !== null) ? user.avatarURL : "https://maxcdn.icons8.com/Share/icon/Logos//discord_logo1600.png" 21 | }, 22 | color: 0x47D70C, 23 | thumbnail: { 24 | url: (user.avatarURL !== null) ? user.avatarURL : "https://maxcdn.icons8.com/Share/icon/Logos//discord_logo1600.png" 25 | }, 26 | fields: [{ 27 | name: "User", 28 | value: user.username + "#" + user.discriminator, 29 | inline: true 30 | }, { 31 | name: "ID", 32 | value: user.id, 33 | inline: true 34 | }, { 35 | name: "Nickname", 36 | value: (member.nickname !== null) ? member.nickname : user.username, 37 | inline: true 38 | }, { 39 | name: "Game", 40 | value: "Playing " + game, 41 | inline: true 42 | }, { 43 | name: "Status", 44 | value: (user.presence !== null && user.presence.status !== null) ? user.presence.status : "Offline", 45 | inline: true 46 | }, { 47 | name: "Joined On", 48 | value: member.joinedAt.toString(), 49 | inline: true 50 | }, { 51 | name: "Account Created On", 52 | value: user.createdAt, 53 | inline: true 54 | }, { 55 | name: "Roles (" + ttt + ")", 56 | value: wato, 57 | inline: true 58 | }] 59 | } 60 | message.channel.send("", { 61 | embed 62 | }); 63 | } 64 | 65 | exports.conf = { 66 | userPerm: [], 67 | botPerm: ["SEND_MESSAGES"], 68 | coolDown: 0, 69 | dm: false, 70 | category: "Other", 71 | help: "Find out info about a user.", 72 | args: "<@mention>" 73 | } -------------------------------------------------------------------------------- /commands/ytsearch.js: -------------------------------------------------------------------------------- 1 | const search = require('youtube-search') 2 | const config = require('../config') 3 | 4 | exports.run = (message, bot, send) => { 5 | if (!message.args[0]) return send("**Provide the search query**") 6 | 7 | search(message.suffix, { 8 | maxResults: 1, 9 | key: config.googleApiToken 10 | }, (err, res) => { 11 | if (err) return send("**No results found**") 12 | if (!res[0]) return send("**No results found**") 13 | 14 | message.channel.send(res[0].link) 15 | }) 16 | 17 | } 18 | 19 | exports.conf = { 20 | userPerm: [], 21 | botPerm: ["SEND_MESSAGES"], 22 | coolDown: 0, 23 | dm: true, 24 | category: "Utility", 25 | help: "Search youtube for a video", 26 | args: "", 27 | } -------------------------------------------------------------------------------- /events/guildCreate+Delete.js: -------------------------------------------------------------------------------- 1 | const bot = require('../bot.js') 2 | const request = require('request'); 3 | const auth = require('../config') 4 | 5 | 6 | bot.on('guildCreate', (g) => { 7 | let channels = g.channels 8 | channels = channels.filter(c => c.type === "text") 9 | let defaultChannel = channels.first() 10 | if (defaultChannel && defaultChannel.send) defaultChannel.send('**Hello! I am Nitro, your helpful server management and community assistant Discord:tm: Bot**\n**You can get started `n!help`**\n**Changing the prefix is simply `n!setprefix "!"`**\n\n**The permission system uses Discords permissions,**\nIf you have permission to ban people normally, then you can aswell with Nitro,\nand the same goes with changing\nthe prefix and the Manage Server permission\n*You can view and edit required permissions for a command with `n!permission `*\n\n**Links and Support**\nWebsite: \nOfficial Server: \nDonate: + \nGithub: \n*If you like Nitro, upvote on dbots at *') 11 | dBots() 12 | carbon() 13 | discordBots() 14 | }) 15 | 16 | bot.on('guildDelete', (g) => { 17 | bot.config.guildLeave(g.id); 18 | dBots() 19 | carbon() 20 | discordBots() 21 | }) 22 | 23 | function dBots() { 24 | request({ 25 | url: "https://bots.discord.pw/api/bots/264087705124601856/stats", 26 | method: "POST", 27 | json: true, 28 | headers: { 29 | "Authorization": auth.dbots 30 | }, 31 | body: { 32 | "shard_id": bot.shard.id, 33 | "shard_count": bot.shard.count, 34 | "server_count": bot.guilds.size 35 | } 36 | }, function (error, response, body) {}); 37 | } 38 | 39 | function discordBots() { 40 | request({ 41 | url: "https://discordbots.org/api/bots/264087705124601856/stats", 42 | method: "POST", 43 | json: true, 44 | headers: { 45 | Authorization: auth.discordbots 46 | }, 47 | body: { 48 | "shard_id": bot.shard.id, 49 | "shard_count": bot.shard.count, 50 | "server_count": bot.guilds.size 51 | } 52 | }) 53 | } 54 | 55 | async function carbon() { 56 | let guildcount = await fetchGuildCount() 57 | request({ 58 | url: "https://www.carbonitex.net/discord/data/botdata.php", 59 | method: "POST", 60 | json: true, 61 | body: { 62 | key: auth.carbon, 63 | servercount: guildcount, 64 | shardcount: bot.shard.count 65 | } 66 | }, (error, res, body) => {}) 67 | } 68 | 69 | async function fetchGuildCount() { 70 | let results = await bot.shard.fetchClientValues('guilds.size') 71 | results = results.reduce((prev, val) => prev + val, 0) 72 | return results 73 | } 74 | -------------------------------------------------------------------------------- /events/guildMemberAdd.js: -------------------------------------------------------------------------------- 1 | const bot = require('../bot.js') 2 | 3 | bot.on('guildMemberAdd', (member) => { 4 | joindm(member); 5 | autorole(member); 6 | welcome(member); 7 | }) 8 | 9 | let welcome = member => { 10 | let acc = bot.config.getAnc(member.guild.id); 11 | if (!acc.channel) return; 12 | if (!acc.welcome) return; 13 | if (!member.guild.channels.has(acc.channel)) return; 14 | let msg = acc.welcome; 15 | msg = msg.replace(/{member}/g, member); 16 | msg = msg.replace(/{name}/g, member.user.username); 17 | msg = msg.replace(/{total}/g, member.guild.memberCount); 18 | bot.channels.get(acc.channel).send(msg, { 19 | split: true 20 | }).catch(err => console.log(err)); 21 | } 22 | 23 | let autorole = member => { 24 | let autorole = bot.config.getAuto(member.guild.id) 25 | if (autorole !== false) { 26 | if (!member.guild.member(bot.user).hasPermission("MANAGE_ROLES_OR_PERMISSIONS")) return; 27 | if (!member.guild.roles.exists('name', autorole)) return; 28 | if (member.guild.roles.find('name', autorole).position > member.guild.member(bot.user).highestRole.position) return; 29 | member.addRole(member.guild.roles.find('name', autorole)); 30 | } 31 | } 32 | 33 | let joindm = member => { 34 | let joindm = bot.config.getJDM(member.guild.id) 35 | if (joindm) member.send(joindm) 36 | } -------------------------------------------------------------------------------- /events/guildMemberRemove.js: -------------------------------------------------------------------------------- 1 | const bot = require('../bot.js') 2 | 3 | bot.on('guildMemberRemove', (member) => { 4 | let acc = bot.config.getAnc(member.guild.id); 5 | if (!acc.channel) return; 6 | if (!acc.farewell) return; 7 | if (!member.guild.channels.has(acc.channel)) return; 8 | let msg = acc.farewell; 9 | msg = msg.replace(/{name}/g, member.user.username); 10 | msg = msg.replace(/{total}/g, member.guild.members.size); 11 | bot.channels.get(acc.channel).send(msg, {split:true}).catch(err => console.log(err)); 12 | }) -------------------------------------------------------------------------------- /events/messageEdit.js: -------------------------------------------------------------------------------- 1 | const bot = require('../bot.js') 2 | const Adblock = require('../functions/adblock') 3 | const Message = require('../struct/Message') 4 | const Filter = require('../functions/filter') 5 | 6 | bot.on('messageUpdate', (oldMessage, message) => { 7 | 8 | if (oldMessage.content === message.content) return 9 | 10 | message = Message(message) 11 | 12 | Adblock(message) 13 | 14 | Filter(message) 15 | 16 | }) -------------------------------------------------------------------------------- /events/modlog.js: -------------------------------------------------------------------------------- 1 | const bot = require('../bot') 2 | const moment = require('moment') 3 | 4 | exports.fire = (text, guild) => { 5 | if (!guild.channels) return 6 | let channel = guild.channels.find(c => c.topic && c.topic.includes("nitro-modlog")); 7 | if (!channel) return 8 | let time = `**\`[${moment().format("M/D/YY - hh:mm")}]\`** ` 9 | channel.send(time + text, { 10 | split: true 11 | }).catch(console.log); 12 | } 13 | 14 | bot.on('messageDelete', msg => { 15 | if (msg.channel.type !== "text") return 16 | if (msg.channel.topic && msg.channel.topic.includes("nitro-modlog")) return; 17 | exports.fire(`**#${msg.channel.name} | ${msg.author.tag}'s message was deleted:** \`${msg.content}\``, msg.guild) 18 | }) 19 | 20 | bot.on('messageUpdate', (msg, newMsg) => { 21 | if (msg.content === newMsg.content) return 22 | exports.fire(`**#${msg.channel.name} | ${msg.author.tag} edited their message:**\n**before:** \`${msg.content}\`\n**+after:** \`${newMsg.content}\``, msg.guild) 23 | }) 24 | 25 | bot.on('guildMemberUpdate', (old, nw) => { 26 | let txt 27 | if (old.roles.size !== nw.roles.size) { 28 | if (old.roles.size > nw.roles.size) { 29 | //Taken 30 | let dif = old.roles.filter(r => !nw.roles.has(r.id)).first() 31 | txt = `**${nw.user.tag} | Role taken -> \`${dif.name}\`**` 32 | } else if (old.roles.size < nw.roles.size) { 33 | //Given 34 | let dif = nw.roles.filter(r => !old.roles.has(r.id)).first() 35 | txt = `**${nw.user.tag} | Role given -> \`${dif.name}\`**` 36 | } 37 | } else if (old.nickname !== nw.nickname) { 38 | txt = `**${nw.user.tag} | Changed their nickname to -> \`${nw.nickname}\`**` 39 | } else return 40 | exports.fire(txt, nw.guild) 41 | }) 42 | 43 | bot.on('roleCreate', (role) => { 44 | exports.fire("**New role created**", role.guild) 45 | }) 46 | 47 | bot.on('roleDelete', (role) => { 48 | exports.fire("**Role deleted -> `" + role.name + "`**", role.guild) 49 | }) 50 | 51 | bot.on('roleUpdate', (old, nw) => { 52 | let txt 53 | if (old.name !== nw.name) { 54 | txt = `**${old.name} | Role name updated to -> \`${nw.name}\`**` 55 | } else return 56 | exports.fire(txt, nw.guild) 57 | }) 58 | 59 | bot.on('guildBanAdd', (guild, user) => { 60 | exports.fire(`**User banned -> \`${user.tag}\`**`, guild) 61 | }) 62 | 63 | bot.on('guildBanRemove', (guild, user) => { 64 | exports.fire(`**User unbanned -> \`${user.tag}\`**`, guild) 65 | }) 66 | -------------------------------------------------------------------------------- /extensions/mfs.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | 3 | const readdir = dir => 4 | new Promise((resolve, reject) => { 5 | fs.readdir(dir, (err, files) => { 6 | if (err) return reject(err); 7 | resolve(files); 8 | }) 9 | }) 10 | 11 | const readFile = file => 12 | new Promise((resolve, reject) => { 13 | fs.readdir(file, (err, data) => { 14 | if (err) return reject(err); 15 | resolve(data); 16 | }) 17 | }) 18 | 19 | /** 20 | * Read every file in a folder with fs.readFile. 21 | * @param {String} folder - The folder to read. 22 | * @param {String|Array} limit - Limit extensions that are read. 23 | * @returns {Array} 24 | */ 25 | exports.readFiles = async function (folder, limit) { 26 | const files = await readdir(folder); 27 | let result = []; 28 | for (file of files) { 29 | let split = file.split("."); 30 | const ext = split.pop(); 31 | if (Array.isArray(limit)) 32 | if (!limit.includes(ext)) continue; 33 | else if (limit !== undefined) 34 | if (limit !== ex) continue; 35 | try { 36 | var read = await readFile(folder + "/" + file); 37 | result.push(read); 38 | } catch (e) { 39 | console.log(`Error Reading: ${folder}/${file}`, e); 40 | } 41 | } 42 | return result; 43 | } -------------------------------------------------------------------------------- /fonts/SFtoon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/fonts/SFtoon.png -------------------------------------------------------------------------------- /functions/adblock.js: -------------------------------------------------------------------------------- 1 | const bot = require('../bot') 2 | const strikes = require('./strikes') 3 | const inviteRegex = /discord\.gg\/\w+/gim; 4 | 5 | module.exports = message => { 6 | if (message.channel.type !== "text") return; 7 | if (message.author.id === bot.user.id) return; 8 | if (message.author.id === message.guild.ownerID) return; 9 | let ad = message.guild.adblock; 10 | if (!ad.on) return; 11 | if (ad.ex && ad.ex.users && ad.ex.users[message.author.id]) return; 12 | if (ad.ex && ad.ex.channels && ad.ex.channels[message.channel.id]) return; 13 | if (message.content.length < 10) return; 14 | if (!inviteRegex.test(message.content)) return; 15 | const roles = (ad.ex && ad.ex.roles) ? Object.keys(ad.ex.roles) : null; 16 | let notEx = true; 17 | if (roles) { 18 | for (let r of roles) { 19 | if (message.member && message.member.roles.has(r)) 20 | notEx = false; 21 | } 22 | } 23 | if (notEx) { 24 | message.delete(); 25 | message.author.send("**AdBlock**: " + message.author + ", Please Do Not Advertise.").catch(e => e); 26 | strikes(message.guild.id, message.author.id) 27 | if (!!ad.notify) { 28 | let owner = bot.users.get(message.guild.owner.id); 29 | owner.send(`*The user* **${message.author.tag}** *Advertised in* **${message.guild.name} #${message.channel.name}** *with the message*\n${message.content}`); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /functions/bg.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 3 | solid:{ 4 | file: "./images/bg/solid/solid.png", 5 | fold: "./images/bg/solid" 6 | }, 7 | nightsky: { 8 | file: "./images/bg/nightsky/nightsky.png", 9 | fold: "./images/bg/nightsky" 10 | }, 11 | cities: { 12 | file: "./images/bg/cities/cities.png", 13 | fold: "./images/bg/cities" 14 | }, 15 | default: { 16 | file: "./images/bg/default.png" 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /functions/checkPerm.js: -------------------------------------------------------------------------------- 1 | const bot = require('../bot.js') 2 | 3 | exports.Mcheck = (perms, message) => { 4 | let custom = bot.config.getPerms(message.guild.id) 5 | if (perms.length === 0) return { 6 | has: true, 7 | miss: [] 8 | }; 9 | let can = { 10 | has: true, 11 | miss: [] 12 | }; 13 | perms.forEach(p => { 14 | if (p.toLowerCase() === "dev") { 15 | if (message.author.id !== "163735744995655680") { 16 | can.has = false; 17 | can.miss.push(p); 18 | } 19 | } else { 20 | let perm = message.channel.permissionsFor(message.author); 21 | if (!perm && message.author.id !== message.guild.owner.user.id && message.author.id !== "163735744995655680") { 22 | can.has = false; 23 | can.miss.push(p); 24 | } 25 | } 26 | }) 27 | return can; 28 | } 29 | 30 | exports.Bcheck = (perms, message) => { 31 | if (perms.length === 0) return { 32 | has: true, 33 | miss: [] 34 | }; 35 | let can = { 36 | has: true, 37 | miss: [] 38 | }; 39 | perms.forEach(p => { 40 | let perm = message.channel.permissionsFor(message.guild.member(bot.user)).has(p); 41 | if (!perm) { 42 | can.has = false; 43 | can.miss.push(p); 44 | } 45 | }) 46 | return can; 47 | } -------------------------------------------------------------------------------- /functions/espeak.js: -------------------------------------------------------------------------------- 1 | var spawn = require('child_process').spawn, 2 | fs = require('fs'), 3 | streamBuffers = require('stream-buffers'); 4 | 5 | 6 | /** 7 | * @module node_API 8 | */ 9 | 10 | /** 11 | * @function speak 12 | * 13 | * @param {String} text text to speak 14 | * 15 | * @param {Object} o 16 | * @param {String} [o.lang='en'] language to use. ex: en, fr, es, pt... 17 | * @param {String} [o.format='mp3'] format. can be either mp3 or ogg. 18 | * 19 | * @param {Number} [o.amplitude=200] espeak parameter. amplitude ~ volume. 20 | * @param {Number} [o.pitch=40] espeak parameter. voice pitch. 21 | * @param {Number} [o.speed=150] espeak parameter. narration speed. 22 | * @param {Number} [o.wordgap=3] espeak parameter. time between words. 23 | * 24 | * @param {String} [o.filename] filename of file to save the rendering to (mutually exclusive with stream) 25 | * @param {Stream} [o.stream] stream where to write the rendering to (mutually exclusive with filename) 26 | */ 27 | var speak = function (text, o) { 28 | if (!('lang' in o)) { 29 | o.lang = 'en'; 30 | } 31 | if (!('format' in o)) { 32 | o.format = 'mp3'; 33 | } 34 | 35 | if (!('amplitude' in o)) { 36 | o.amplitude = 200; 37 | } else { 38 | o.amplitude = parseInt(o.amplitude, 10); 39 | } 40 | if (!('pitch' in o)) { 41 | o.pitch = 40; 42 | } else { 43 | o.pitch = parseInt(o.pitch, 10); 44 | } 45 | if (!('speed' in o)) { 46 | o.speed = 150; 47 | } else { 48 | o.speed = parseInt(o.speed, 10); 49 | } 50 | if (!('wordgap' in o)) { 51 | o.wordgap = 3; 52 | } else { 53 | o.wordgap = parseInt(o.wordgap, 10); 54 | } 55 | 56 | var f; 57 | 58 | if ('filename' in o) { 59 | f = fs.createWriteStream(o.filename + '.' + o.format, { 60 | encoding: 'binary' 61 | }); 62 | } else if ('stream' in o) { 63 | f = o.stream; 64 | } else if ('buffer' in o) { 65 | f = new streamBuffers.WritableStreamBuffer(); 66 | } else { 67 | throw 'either stream or filename must be passed in!'; 68 | } 69 | 70 | var converter = (o.format === 'ogg') ? 'oggenc' : 'lame'; 71 | 72 | text = text.replace(/\!/g, '\\!'); 73 | text = text.replace(/'/g, '\\'); 74 | 75 | 76 | var cmd = [ 77 | 'echo', '-e', '"' + text + '"', 78 | '|', 79 | 'espeak', 80 | '--stdin', 81 | '--stdout', 82 | '-v', o.lang, 83 | '-a', o.amplitude, 84 | '-p', o.pitch, 85 | '-s', o.speed, 86 | '-g', o.wordgap, 87 | '|', 88 | converter, 89 | '--quiet', 90 | '-b', 16, // bit rate 91 | ]; 92 | if (o.format === 'mp3') { 93 | cmd = cmd.concat([ 94 | '-h', // quality 95 | //'-m', 'm', // mono 96 | ]); 97 | } else { 98 | cmd = cmd.concat([ 99 | '-q', -1, // quality 100 | //'--downmix', // mono 101 | ]); 102 | } 103 | 104 | cmd.push('-'); 105 | cmd = cmd.join(' '); 106 | 107 | 108 | //console.log(cmd); 109 | 110 | var child = spawn('bash', ['-c', cmd], { 111 | cwd: __dirname 112 | }); 113 | 114 | child.stdout.on('data', function (data) { 115 | f.write(data, 'binary'); 116 | }); 117 | 118 | child.stderr.on('data', function (data) { 119 | if (o.cb) { 120 | return o.cb(data.toString(), null); 121 | } else { 122 | throw data; 123 | } 124 | }); 125 | 126 | child.on('exit', function (code) { 127 | f.end(); 128 | if ('cb' in o) { 129 | if (code !== 0) { 130 | return o.cb('Process returned error code=' + code, null); 131 | } 132 | o.cb(null, f); 133 | } 134 | }); 135 | 136 | }; 137 | 138 | module.exports = speak; -------------------------------------------------------------------------------- /functions/filter.js: -------------------------------------------------------------------------------- 1 | const bot = require('../bot') 2 | const strike = require('./strikes') 3 | 4 | module.exports = (message) => { 5 | 6 | if (message.channel.type !== "text") return 7 | if (message.author.id === bot.user.id) return 8 | 9 | let filters = message.guild.filter 10 | let keys = filters.keywords ? Object.keys(filters.keywords) : false 11 | if (!keys || keys.length < 1) return 12 | if (message.member && message.member.hasPermission("ADMINISTRATOR")) return 13 | let low = message.content.toLowerCase() 14 | if (keys.some(word => ~low.indexOf(word.toLowerCase()))) { 15 | message.delete() 16 | let w 17 | keys.forEach(k => low.includes(k.toLowerCase()) ? w = k : 0) 18 | strike(message.guild.id, message.author.id) 19 | message.author.send(filters.msg ? filters.msg : "**Your message was deleted because it contained a restricted keyword: **"+w).catch(e => e + "") 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /functions/framework.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js") 2 | 3 | let start = async (bot) => { 4 | let webhook = new Discord.WebhookClient("336196327975419906", "LfGQ70qrtgMQMfQYGNY2WrLWfNYzdRMAE6d7cEOB1cQ5PLJlJSPkFEGwHiHNzIOXsKps") 5 | let embed = new bot.embed() 6 | if (bot.shard) { 7 | embed.addField("Shard", "**" + (bot.shard.id + 1) + "/" + bot.shard.count + "**", true) 8 | .addField("Module", "**" + bot.module + "**", true) 9 | .addField("Bot", "**" + bot.user.tag + " " + bot.user.id + "**") 10 | try { 11 | let app = await bot.fetchApplication() 12 | embed.addField("Owner", "**" + app.owner.tag + " " + app.owner.id + "**") 13 | } catch (err) { 14 | console.log(err) 15 | embed.addField("Owner", "**Unknown**") 16 | } 17 | embed.setColor("#387ee5") 18 | embed.setTitle("NitroMain") 19 | embed.setTimestamp(new Date()) 20 | return webhook.send("", {embeds: [embed]}) 21 | } else { 22 | embed.addField("Module", "**" + bot.module + "**") 23 | .addField("Bot", "**" + bot.user.tag + " " + bot.user.id + "**") 24 | try { 25 | let app = await bot.fetchApplication(bot.user) 26 | embed.addField("Owner", "**" + app.user.tag + " " + bot.user.id + "**") 27 | } catch (err) { 28 | embed.addField("Owner", "**Unknown**") 29 | } 30 | embed.setColor("#1E88E5") 31 | embed.setTitle("NitroMain") 32 | embed.setTimestamp(new Date()) 33 | return webhook.send("", {embeds: [embed]}) 34 | } 35 | } 36 | 37 | let crash = (bot) => { 38 | 39 | } 40 | 41 | module.exports = {start, crash} 42 | -------------------------------------------------------------------------------- /functions/loadCommands.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | var cmds = {} 3 | 4 | exports.load = () => { 5 | fs.readdir('./commands/', (err, files) => { 6 | if (err) return console.log(err); 7 | files.forEach(f => { 8 | try { 9 | let cmd = require("../commands/"+f); 10 | let name = f.slice(0, -3); 11 | cmds[name] = {run:cmd.run, conf:cmd.conf}; 12 | } catch(err) { 13 | console.log(err); 14 | } 15 | }) 16 | }) 17 | } 18 | 19 | exports.reload = (cmd) => { 20 | try { 21 | let check = require('../commands/'+cmd); 22 | delete require.cache[require.resolve('../commands/'+cmd)] 23 | let good = require('../commands/'+cmd); 24 | cmds[cmd] = {run:good.run, conf:good.conf}; 25 | return {worked:true}; 26 | } catch (err) { 27 | delete cmds[cmd] 28 | return {worked:false, error:err}; 29 | } 30 | } 31 | 32 | exports.getCmds = () => { 33 | return cmds; 34 | } 35 | -------------------------------------------------------------------------------- /functions/loadDB.js: -------------------------------------------------------------------------------- 1 | const r = require('rethinkdb') 2 | const auth = require('../config') 3 | const store = require('./storeMessages') 4 | 5 | 6 | module.exports = () => { 7 | 8 | return new Promise((resolve, reject) => { 9 | 10 | r.connect({ 11 | 12 | host: "localhost", 13 | port: '28015', 14 | db: "Nitro", 15 | password: auth.rethink 16 | 17 | }).then(conn => { 18 | 19 | let connection = conn 20 | 21 | store.connect(conn) 22 | 23 | loadConfig(connection, (err, config) => { 24 | 25 | if (err) return reject(err) 26 | 27 | loadProfile(connection, (err, profile) => { 28 | 29 | if (err) return reject(err) 30 | 31 | loadSystem(connection, (err, system) => { 32 | 33 | if (err) return reject(err) 34 | 35 | return resolve({ 36 | connection, 37 | config, 38 | profile, 39 | system 40 | }) 41 | 42 | }) 43 | 44 | }) 45 | 46 | }) 47 | 48 | }).catch(err => reject(err)); 49 | 50 | }) 51 | 52 | } 53 | 54 | function loadConfig(connection, callback) { 55 | 56 | r.table("config").run(connection, (err, res) => { 57 | 58 | if (err) return callback(err, false) 59 | 60 | res.toArray((err, data) => { 61 | 62 | return callback(false, data) 63 | 64 | }) 65 | 66 | }) 67 | 68 | } 69 | 70 | function loadProfile(connection, callback) { 71 | 72 | r.table("profile").run(connection, (err, res) => { 73 | 74 | if (err) return callback(err, false) 75 | 76 | res.toArray((err, data) => { 77 | 78 | return callback(false, data) 79 | 80 | }) 81 | }) 82 | } 83 | 84 | function loadSystem(connection, callback) { 85 | 86 | r.table('system').run(connection, (err, res) => { 87 | 88 | if (err) return callback(err, false) 89 | 90 | res.toArray((err, data) => { 91 | 92 | return callback(false, data) 93 | 94 | }) 95 | 96 | }) 97 | 98 | } -------------------------------------------------------------------------------- /functions/log.js: -------------------------------------------------------------------------------- 1 | const moment = require('moment') 2 | 3 | exports.g = (message) => { 4 | let msg = `[${moment().format("HH:mm:ss")}]{${message.guild.name}|${message.channel.name}|${message.author.username}} ${message.content}` 5 | //console.log(msg) 6 | } 7 | 8 | exports.dm = (message) => { 9 | let msg = `[${moment().format("HH:mm:ss")}]{${message.author.username}} ${message.content}` 10 | console.log(msg) 11 | } -------------------------------------------------------------------------------- /functions/specialHelp.js: -------------------------------------------------------------------------------- 1 | nu.getSpecialHelp = (t, p) => { 2 | let obj = { 3 | announce: "**[ Announce Help ]**\r\n*#Nitro\'s announce feature allows you to setup messages for when users join or leave.*\r\nFirst you must set the channel with:\r\n`"+p+"announce channel` which will set to your current channel, you can also mention or type an ID to specify another channel.\r\nThen you set the Welcome and Farewell messages. For the welcome message:\r\n`"+p+"announce welcome `\r\nYou can use a few variables in this message aswell.\r\nplace `{member}` which will mention the joining player\r\nplace `{name}` which will write the players name as plain text\r\nplace `{total}` to write your current guild total after the new member\r\nFor the farewell message:\r\n`"+p+"announce farewell `\r\nYou can use the same variables as above except `{member}`\r\nIf you ever want to disable Announcements run the channel command again to completely disable it\r\nor run either the farewell or welcome command *without a message* to only stop sending one of them. ", 4 | adblock: "**[ AdBlock Help ]**\r\nNitro allows for advanced ad blocking, which stops users from posting httpś:\/\/d\isc\òrd\.\gg\/ links in your server.\r\nTo enable ad blocking use `"+p+"adblock on` (replace `on` with `off` to disable)\r\n**Notifications**\r\nUse `"+p+"adblock notify` to enable\r\nThe server owner will be sent a PM when a user advertises on your server\r\n**Strikes**\nUse `"+p+"adblock strikes` to toggle on or off\nWhen on, users will recieve a strike if they advertise, see `"+p+"pconf` for more info\n**Exceptions**\r\nUse `"+p+"adblock exception add @user` (or @role)\r\nThis will allow that user (or anyone in that role) to be exempt from AdBlock\r\nUse `"+p+"adblock exception remove @user` (or @role) to remove\r\nand `"+p+"adblock exception list` to view all exceptions.\r\n", 5 | autorole: "**[ AutoRole Help ]**\nNitro's autorole will automatically give a user a specified role on server join\nUse `n!autorole <@role>` to enable or disable a role." 6 | } 7 | if (obj.hasOwnProperty(t)) { 8 | return obj[t]; 9 | } else { 10 | return false 11 | } 12 | } -------------------------------------------------------------------------------- /functions/storeMessages.js: -------------------------------------------------------------------------------- 1 | const r = require('rethinkdb') 2 | let connection 3 | 4 | let queue = [] 5 | 6 | exports.connect = (con) => { 7 | connection = con 8 | } 9 | 10 | exports.add = (message, idb) => { 11 | if (idb !== "264087705124601856") return 12 | let c = message.content 13 | let i = message.author.id 14 | let id = message.id 15 | queue.push({id, c, i}) 16 | } 17 | 18 | let store = () => { 19 | if (queue.length === 0) return 20 | r.table('messages').insert(queue).run(connection, (err, res) => { 21 | if (err) return console.log(err) 22 | queue = [] 23 | }) 24 | } 25 | 26 | setInterval(() => store(), 20000) -------------------------------------------------------------------------------- /functions/strikes.js: -------------------------------------------------------------------------------- 1 | const bot = require('../bot') 2 | 3 | module.exports = (guildid, userid) => { 4 | 5 | let strikes = bot.config.getStrike(guildid) 6 | if (!strikes.users) strikes.users = {} 7 | if (!strikes.users[userid]) strikes.users[userid] = 0 8 | let kmax = strikes.kick || 0 9 | let bmax = strikes.ban || 0 10 | strikes.users[userid] = strikes.users[userid] + 1 11 | bot.config.setStrike(guildid, strikes) 12 | let guild = bot.guilds.get(guildid) 13 | let user = bot.users.get(userid) 14 | if (kmax !== 0) { 15 | if (strikes.users[userid] === kmax - 1 && kmax !== 1) { 16 | return user.send("**You are `1` strike away from being kicked from `" + guild.name + "`**") 17 | } 18 | if (strikes.users[user.id] === kmax) { 19 | return user.send("**You have been kicked from `" + guild.name + "`**").then(u => guild.member(userid).kick().catch()) 20 | } 21 | } 22 | 23 | if (bmax !== 0) { 24 | if (strikes.users[userid] === bmax - 1 && bmax !== 1) { 25 | return user.send("**You are `1` strike away from being banned from `" + guild.name + "`**") 26 | } 27 | if (strikes.users[userid] >= bmax) { 28 | return user.send("**You have been banned from `" + guild.name + "`**").then(u => guild.ban(userid).catch()) 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /images/bg/cities/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/cities/1.png -------------------------------------------------------------------------------- /images/bg/cities/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/cities/2.png -------------------------------------------------------------------------------- /images/bg/cities/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/cities/3.png -------------------------------------------------------------------------------- /images/bg/cities/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/cities/4.png -------------------------------------------------------------------------------- /images/bg/cities/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/cities/5.png -------------------------------------------------------------------------------- /images/bg/cities/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/cities/6.png -------------------------------------------------------------------------------- /images/bg/cities/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/cities/7.png -------------------------------------------------------------------------------- /images/bg/cities/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/cities/8.png -------------------------------------------------------------------------------- /images/bg/cities/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/cities/9.png -------------------------------------------------------------------------------- /images/bg/cities/cities.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/cities/cities.png -------------------------------------------------------------------------------- /images/bg/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/default.png -------------------------------------------------------------------------------- /images/bg/nightsky/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/nightsky/1.png -------------------------------------------------------------------------------- /images/bg/nightsky/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/nightsky/2.png -------------------------------------------------------------------------------- /images/bg/nightsky/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/nightsky/3.png -------------------------------------------------------------------------------- /images/bg/nightsky/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/nightsky/4.png -------------------------------------------------------------------------------- /images/bg/nightsky/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/nightsky/5.png -------------------------------------------------------------------------------- /images/bg/nightsky/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/nightsky/6.png -------------------------------------------------------------------------------- /images/bg/nightsky/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/nightsky/7.png -------------------------------------------------------------------------------- /images/bg/nightsky/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/nightsky/8.png -------------------------------------------------------------------------------- /images/bg/nightsky/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/nightsky/9.png -------------------------------------------------------------------------------- /images/bg/nightsky/nightsky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/nightsky/nightsky.png -------------------------------------------------------------------------------- /images/bg/solid/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/solid/1.png -------------------------------------------------------------------------------- /images/bg/solid/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/solid/2.png -------------------------------------------------------------------------------- /images/bg/solid/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/solid/3.png -------------------------------------------------------------------------------- /images/bg/solid/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/solid/4.png -------------------------------------------------------------------------------- /images/bg/solid/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/solid/5.png -------------------------------------------------------------------------------- /images/bg/solid/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/solid/6.png -------------------------------------------------------------------------------- /images/bg/solid/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/solid/7.png -------------------------------------------------------------------------------- /images/bg/solid/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/solid/8.png -------------------------------------------------------------------------------- /images/bg/solid/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/solid/9.png -------------------------------------------------------------------------------- /images/bg/solid/solid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/bg/solid/solid.png -------------------------------------------------------------------------------- /images/cah.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/cah.png -------------------------------------------------------------------------------- /images/death.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/death.png -------------------------------------------------------------------------------- /images/images/cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/cross.png -------------------------------------------------------------------------------- /images/images/dickbutt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/dickbutt.png -------------------------------------------------------------------------------- /images/images/gladpepe/Unknown-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/gladpepe/Unknown-2.png -------------------------------------------------------------------------------- /images/images/gladpepe/Unknown-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/gladpepe/Unknown-3.png -------------------------------------------------------------------------------- /images/images/gladpepe/Unknown-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/gladpepe/Unknown-4.png -------------------------------------------------------------------------------- /images/images/gladpepe/Unknown-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/gladpepe/Unknown-5.png -------------------------------------------------------------------------------- /images/images/gladpepe/Unknown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/gladpepe/Unknown.png -------------------------------------------------------------------------------- /images/images/gladpepe/images-2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/gladpepe/images-2.jpeg -------------------------------------------------------------------------------- /images/images/gladpepe/images-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/gladpepe/images-2.png -------------------------------------------------------------------------------- /images/images/gladpepe/images-3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/gladpepe/images-3.jpeg -------------------------------------------------------------------------------- /images/images/gladpepe/images-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/gladpepe/images-3.png -------------------------------------------------------------------------------- /images/images/gladpepe/images-4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/gladpepe/images-4.jpeg -------------------------------------------------------------------------------- /images/images/gladpepe/images-5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/gladpepe/images-5.jpeg -------------------------------------------------------------------------------- /images/images/gladpepe/images-6.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/gladpepe/images-6.jpeg -------------------------------------------------------------------------------- /images/images/gladpepe/images.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/gladpepe/images.jpeg -------------------------------------------------------------------------------- /images/images/gladpepe/images.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/gladpepe/images.png -------------------------------------------------------------------------------- /images/images/kim/kim2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/kim/kim2.jpg -------------------------------------------------------------------------------- /images/images/kim/kim3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/kim/kim3.jpg -------------------------------------------------------------------------------- /images/images/kim/kim4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/kim/kim4.jpg -------------------------------------------------------------------------------- /images/images/kim/kim5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/kim/kim5.jpg -------------------------------------------------------------------------------- /images/images/kim/kim6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/kim/kim6.jpg -------------------------------------------------------------------------------- /images/images/kim/kim7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/kim/kim7.jpg -------------------------------------------------------------------------------- /images/images/kim/kim8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/kim/kim8.jpg -------------------------------------------------------------------------------- /images/images/kim/kim9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/kim/kim9.jpg -------------------------------------------------------------------------------- /images/images/sadpepe/images-2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/sadpepe/images-2.jpeg -------------------------------------------------------------------------------- /images/images/sadpepe/images-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/sadpepe/images-2.png -------------------------------------------------------------------------------- /images/images/sadpepe/images-3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/sadpepe/images-3.jpeg -------------------------------------------------------------------------------- /images/images/sadpepe/images-4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/sadpepe/images-4.jpeg -------------------------------------------------------------------------------- /images/images/sadpepe/images.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/sadpepe/images.jpeg -------------------------------------------------------------------------------- /images/images/sadpepe/images.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/sadpepe/images.png -------------------------------------------------------------------------------- /images/images/sadpepe/pepe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/sadpepe/pepe.png -------------------------------------------------------------------------------- /images/images/sadpepe/pepe1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/sadpepe/pepe1.png -------------------------------------------------------------------------------- /images/images/sadpepe/pepe10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/sadpepe/pepe10.png -------------------------------------------------------------------------------- /images/images/sadpepe/pepe2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/sadpepe/pepe2.png -------------------------------------------------------------------------------- /images/images/sadpepe/pepe3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/sadpepe/pepe3.jpg -------------------------------------------------------------------------------- /images/images/sadpepe/pepe4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/sadpepe/pepe4.jpg -------------------------------------------------------------------------------- /images/images/sadpepe/pepe5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/sadpepe/pepe5.jpg -------------------------------------------------------------------------------- /images/images/sadpepe/pepe6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/sadpepe/pepe6.jpg -------------------------------------------------------------------------------- /images/images/sadpepe/pepe7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/sadpepe/pepe7.png -------------------------------------------------------------------------------- /images/images/sadpepe/pepe8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/sadpepe/pepe8.png -------------------------------------------------------------------------------- /images/images/sadpepe/pepe9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/sadpepe/pepe9.jpg -------------------------------------------------------------------------------- /images/images/smh/bunkwire.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/smh/bunkwire.gif -------------------------------------------------------------------------------- /images/images/smh/giphy.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/smh/giphy.gif -------------------------------------------------------------------------------- /images/images/smh/judge.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/smh/judge.gif -------------------------------------------------------------------------------- /images/images/smh/kn.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/smh/kn.gif -------------------------------------------------------------------------------- /images/images/smh/raw.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/smh/raw.gif -------------------------------------------------------------------------------- /images/images/smh/shake.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/smh/shake.gif -------------------------------------------------------------------------------- /images/images/smh/shakingthe.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/smh/shakingthe.gif -------------------------------------------------------------------------------- /images/images/smh/tumble.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/images/smh/tumble.gif -------------------------------------------------------------------------------- /images/kermit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/kermit.png -------------------------------------------------------------------------------- /images/nut.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/nut.jpg -------------------------------------------------------------------------------- /images/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/profile.png -------------------------------------------------------------------------------- /images/stopit.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/stopit.mp3 -------------------------------------------------------------------------------- /images/thesearch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/funnbot/Nitro/defa34c72cbf565692589303dbeae5acdfaf1826/images/thesearch.png -------------------------------------------------------------------------------- /music/bot.js: -------------------------------------------------------------------------------- 1 | const Eris = require('eris') 2 | const config = require('../config.js') 3 | 4 | const bot = new Eris(config.token, {maxShards: 5, messageLimit: 10}) 5 | 6 | const music = require('./node-music') 7 | bot.music = music 8 | bot.music.registry = new music.Registry() 9 | 10 | module.exports = bot 11 | require('./func/config') 12 | require('./func/loadCommands').load() 13 | require('./events/message') 14 | require('../util') 15 | 16 | bot.on('ready', () => { 17 | console.log("Music Module Ready On "+bot.shards.size+" Shards") 18 | }) 19 | 20 | process.on("unhandledRejection", (err) => { 21 | console.log(err) 22 | }) 23 | 24 | bot.connect() 25 | -------------------------------------------------------------------------------- /music/commands/meval.js: -------------------------------------------------------------------------------- 1 | const auth = require("../../config.js"); 2 | const r = require("rethinkdbdash")({ 3 | db: "Nitro", 4 | password: auth.rethink 5 | }) 6 | const util = require('util') 7 | 8 | exports.run = (message, bot, send) => { 9 | if (message.author.id === "163735744995655680") { 10 | 11 | try { 12 | let toeval = eval(message.suffix); 13 | let inspect = util.inspect(toeval); 14 | 15 | if (inspect.length > 1900) { 16 | inspect = inspect.substr(0, 1900); 17 | } 18 | send("**Input**\n" + message.suffix + "\n\n**Output**\n```js\n" + inspect + "```") 19 | .then(m => setTimeout( 20 | () => m.delete() 21 | , 20000)).catch(console.log); 22 | } catch (err) { 23 | send("**```prolog\nError:\n\n" + err + "```**") 24 | .then(m => setTimeout( 25 | () => m.delete() 26 | , 20000)).catch(console.log); 27 | } 28 | } 29 | } 30 | 31 | exports.conf = { 32 | userPerm: [], 33 | botPerm: ["SEND_MESSAGES"], 34 | coolDown: 0, 35 | dm: true, 36 | category: "DevOnly", 37 | help: "Eval code", 38 | args: "", 39 | } -------------------------------------------------------------------------------- /music/commands/pause.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | 3 | if (!bot.music.registry.has(message.channel.guild.id)) return message.channel.createMessage("**There is no music playing**") 4 | 5 | let player = bot.music.registry.get(message.channel.guild.id) 6 | 7 | if (player.checkPerm(message)) return; 8 | 9 | if (player.connection.paused) return message.channel.createMessage("**The music is already paused**") 10 | 11 | player.pause() 12 | 13 | send("**Pausing Music**") 14 | 15 | } 16 | 17 | exports.conf = { 18 | userPerm:[], 19 | botPerm:["SEND_MESSAGES"], 20 | coolDown:0, 21 | dm:true, 22 | category:"", 23 | help:"", 24 | args:"", 25 | } -------------------------------------------------------------------------------- /music/commands/play.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | 3 | if (!message.member.voiceState.channelID) return message.channel.createMessage("**You must be in a voice channel to queue music.**") 4 | 5 | if (!message.args[0]) return message.channel.createMessage("**Provide a link or search query to queue a song**") 6 | 7 | let member = message.channel.guild.members.find(m => m.id === bot.user.id) 8 | 9 | let voiceChannel, player 10 | 11 | 12 | voiceChannel = message.member.voiceState.channelID 13 | 14 | 15 | 16 | bot.joinVoiceChannel(voiceChannel).then(connection => { 17 | 18 | player = bot.music.registry.createGuildPlayer(connection, message, bot) 19 | 20 | queue(message, player) 21 | 22 | }).catch(console.log) 23 | 24 | 25 | } 26 | 27 | exports.conf = { 28 | userPerm: [], 29 | botPerm: ["SEND_MESSAGES"], 30 | coolDown: 0, 31 | dm: false, 32 | category: "", 33 | help: "", 34 | args: "", 35 | } 36 | 37 | function queue(message, player) { 38 | 39 | let requester = { 40 | id: message.author.id, 41 | name: message.author.username, 42 | discrim: message.author.discriminator 43 | } 44 | 45 | player.queue(message.suffix, requester).then(data => { 46 | 47 | if (Array.isArray(data)) message.channel.createMessage("**Adding `" + data.length + "` songs from playlist**") 48 | else message.channel.createMessage("**Adding song `" + data.title + "`**") 49 | 50 | player.play() 51 | 52 | }).catch(err => message.channel.createMessage("**" + err + "**")) 53 | 54 | } -------------------------------------------------------------------------------- /music/commands/queue.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | 3 | if (!bot.music.registry.has(message.channel.guild.id)) return message.channel.createMessage("**There is no music playing**") 4 | 5 | let player = bot.music.registry.get(message.channel.guild.id) 6 | 7 | let num = message.args[0] || 1 8 | 9 | num = nu.range(num, 1, 11) 10 | 11 | player.getQueue(message, num) 12 | 13 | } 14 | 15 | exports.conf = { 16 | userPerm:[], 17 | botPerm:["SEND_MESSAGES"], 18 | coolDown:0, 19 | dm:true, 20 | category:"", 21 | help:"", 22 | args:"", 23 | } -------------------------------------------------------------------------------- /music/commands/remove.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | 3 | if (!bot.music.registry.has(message.channel.guild.id)) return message.channel.createMessage("**There is no music playing**") 4 | 5 | let player = bot.music.registry.get(message.channel.guild.id) 6 | 7 | if (player.checkPerm(message)) return 8 | 9 | if (!message.args[0]) return send("**Provide the index of the song to remove from the queue**") 10 | 11 | let num = parseInt(message.args[0]) || 0 12 | 13 | if (num < 1) return send("**Invalid song index**") 14 | 15 | if (num === 1) return send("**Cannot remove the currently playing song, use skip instead**") 16 | 17 | let playlist = player.getArray() 18 | 19 | if (playlist.length === 1) return send("**Not enough songs to remove from**") 20 | 21 | if (num > playlist.length) return send("**There are only "+playlist.length+" songs in the queue**") 22 | 23 | send("**Removed song:** "+playlist[num-1].title) 24 | 25 | player.remove(num - 1) 26 | 27 | } 28 | 29 | exports.conf = { 30 | userPerm:[], 31 | botPerm:["SEND_MESSAGES"], 32 | coolDown:0, 33 | dm:true, 34 | category:"", 35 | help:"", 36 | args:"", 37 | } -------------------------------------------------------------------------------- /music/commands/resume.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | 3 | if (!bot.music.registry.has(message.channel.guild.id)) return send("**There is no paused music**") 4 | 5 | let player = bot.music.registry.get(message.channel.guild.id) 6 | 7 | if (player.checkPerm(message)) return 8 | 9 | if (!player.connection.paused) return send("**The music is already playing**") 10 | 11 | player.resume() 12 | 13 | send("**Resuming Music**") 14 | 15 | } 16 | 17 | exports.conf = { 18 | userPerm:[], 19 | botPerm:["SEND_MESSAGES"], 20 | coolDown:0, 21 | dm:true, 22 | category:"", 23 | help:"", 24 | args:"", 25 | } -------------------------------------------------------------------------------- /music/commands/setchannel.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | 3 | if (!bot.music.registry.has(message.channel.guild.id)) return send("**There is no music playing**") 4 | 5 | let player = bot.music.registry.get(message.channel.guild.id) 6 | 7 | if (player.checkPerm(message)) return 8 | 9 | player.setChannel(message.channel.id) 10 | 11 | send("**Now Playing messages will be sent to this channel**") 12 | 13 | } 14 | 15 | exports.conf = { 16 | userPerm:[], 17 | botPerm:["SEND_MESSAGES"], 18 | coolDown:0, 19 | dm:true, 20 | category:"", 21 | help:"", 22 | args:"", 23 | } -------------------------------------------------------------------------------- /music/commands/sethost.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | 3 | if (!bot.music.registry.has(message.channel.guild.id)) return send("**There is no music playing**") 4 | 5 | if (!message.mentions[0]) return send("**Mention a user to make them host**") 6 | 7 | let player = bot.music.registry.get(message.channel.guild.id) 8 | 9 | if (player.checkPerm(message)) return 10 | 11 | player.setHost(message.mentions[0].id) 12 | 13 | send("**Host set to "+message.mentions[0].username+"**") 14 | 15 | } 16 | 17 | exports.conf = { 18 | userPerm:[], 19 | botPerm:["SEND_MESSAGES"], 20 | coolDown:0, 21 | dm:true, 22 | category:"", 23 | help:"", 24 | args:"", 25 | } -------------------------------------------------------------------------------- /music/commands/skip.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | 3 | if (!bot.music.registry.has(message.channel.guild.id)) return send("**There is no music playing**") 4 | 5 | let player = bot.music.registry.get(message.channel.guild.id) 6 | 7 | if (player.checkPerm(message)) return 8 | 9 | send("**Skipping**") 10 | 11 | player.skip() 12 | 13 | } 14 | 15 | exports.conf = { 16 | userPerm: [], 17 | botPerm: ["SEND_MESSAGES"], 18 | coolDown: 0, 19 | dm: true, 20 | category: "", 21 | help: "", 22 | args: "", 23 | } -------------------------------------------------------------------------------- /music/commands/stop.js: -------------------------------------------------------------------------------- 1 | exports.run = (message, bot, send) => { 2 | 3 | if (!bot.music.registry.has(message.channel.guild.id)) return send("**There is no music playing**") 4 | 5 | let player = bot.music.registry.get(message.channel.guild.id) 6 | 7 | if (player.checkPerm(message)) return 8 | 9 | bot.music.registry.destroy(message.channel.guild.id) 10 | 11 | send("**Stopping music**") 12 | 13 | } 14 | 15 | exports.conf = { 16 | userPerm:[], 17 | botPerm:["SEND_MESSAGES"], 18 | coolDown:0, 19 | dm:true, 20 | category:"", 21 | help:"", 22 | args:"", 23 | } -------------------------------------------------------------------------------- /music/events/message.js: -------------------------------------------------------------------------------- 1 | const bot = require('../bot') 2 | const Commands = require('../func/loadCommands') 3 | const config = require('../func/config') 4 | const checkPerm = require('../func/checkPerms') 5 | 6 | bot.on('messageCreate', message => { 7 | 8 | if (message.author.bot) return 9 | if (!message.channel.guild) return 10 | let Music = config.getMusic(message.channel.guild.id) 11 | if (Music) return 12 | 13 | message.prefix = config.getPrefix(message.channel.guild.id) 14 | if (!message.content.startsWith(message.prefix)) return 15 | 16 | let cutPrefix = message.content.slice(message.prefix.length) 17 | message.args = cutPrefix.split(" ") 18 | message.command = message.args[0] 19 | message.args = message.args.slice(1) 20 | message.suffix = message.args.join(" ") 21 | 22 | let cmds = Commands.getCmds() 23 | if (!cmds.hasOwnProperty(message.command)) return 24 | let check = checkPerm.Mcheck(message) 25 | if (check) return 26 | 27 | 28 | try { 29 | console.log(message.channel.guild.id + " - " + message.content) 30 | cmds[message.command].run(message, bot, message.channel.createMessage.bind(message.channel)) 31 | 32 | } catch (err) { 33 | 34 | console.log(err) 35 | 36 | message.channel.createMessage("```js\n" + err + "```") 37 | 38 | } 39 | 40 | }) -------------------------------------------------------------------------------- /music/func/checkPerms.js: -------------------------------------------------------------------------------- 1 | const bot = require('../bot.js') 2 | const config = require('./config') 3 | const convert = require("./convertPerms") 4 | 5 | exports.Mcheck = (message) => { 6 | let custom = config.getPerms(message.channel.guild.id) 7 | let perms = [] 8 | if (custom[message.command]) { 9 | Object.keys(custom[message.command]).forEach(p => { 10 | let perm = custom[message.command][p] 11 | if (perm === "add") perms.push(p) 12 | }) 13 | } 14 | if (perms.length === 0) return false 15 | let can = { 16 | has: true, 17 | miss: [] 18 | }; 19 | perms.forEach(p => { 20 | 21 | let cp = convert(p) 22 | let perm = cp !== false ? message.channel.permissionsOf(message.author.id).has(cp) : false 23 | if (!perm && message.author.id !== "163735744995655680") { 24 | can.has = false; 25 | can.miss.push(p); 26 | } 27 | console.log(can+ "|"+ perm) 28 | }) 29 | if (can.has === false) return true; 30 | else return false 31 | 32 | } -------------------------------------------------------------------------------- /music/func/config.js: -------------------------------------------------------------------------------- 1 | const r = require('rethinkdb') 2 | const auth = require('../../config.js') 3 | 4 | let config = {} 5 | 6 | r.connect({ 7 | host: "localhost", 8 | port: '28015', 9 | db: "Nitro", 10 | password: auth.rethink 11 | }).then(connection => { 12 | 13 | r.table('config').run(connection, (err, table) => { 14 | 15 | table.toArray((err, array) => { 16 | 17 | if (err) return console.log(err) 18 | 19 | array.forEach(p => { 20 | 21 | config[p.id] = p.data 22 | 23 | }) 24 | 25 | }) 26 | 27 | }) 28 | 29 | r.table('config').changes().run(connection, (err, change) => { 30 | 31 | if (err) return console.log(err) 32 | 33 | change.each((err, row) => { 34 | 35 | if (err) return console.log(err) 36 | 37 | if (!row.new_val) return 38 | 39 | config[row.new_val.id] = row.new_val.data 40 | 41 | }) 42 | 43 | }) 44 | 45 | }).catch(console.log) 46 | 47 | exports.getPrefix = (id) => { 48 | if (!!config[id] && !!config[id].prefix) { 49 | return config[id].prefix 50 | } else { 51 | return "n!"; 52 | } 53 | } 54 | 55 | exports.getMusic = (id) => { 56 | if (!!config[id] && !!config[id].modules && !!config[id].modules.music) { 57 | return true 58 | } else { 59 | return false; 60 | } 61 | } 62 | 63 | exports.getPerms = (id) => { 64 | if (!!config[id] && !!config[id].perms) { 65 | return config[id].perms 66 | } else { 67 | return {}; 68 | } 69 | } -------------------------------------------------------------------------------- /music/func/convertPerms.js: -------------------------------------------------------------------------------- 1 | module.exports = (perm) => { 2 | if (convert.hasOwnProperty(perm)) return convert[perm] 3 | else return false 4 | } 5 | 6 | const convert = { 7 | ADMINISTRATOR: "administrator", 8 | CREATE_INSTANT_INVITE: "createInstantInvite", 9 | KICK_MEMBERS: "kickMembers", 10 | BAN_MEMBERS: "banMembers", 11 | MANAGE_CHANNELS: "manageChannels", 12 | MANAGE_GUILD: "manageGuild", 13 | READ_MESSAGES: "readMessages", 14 | SEND_MESSAGES: "sendMessages", 15 | SEND_TTS_MESSAGES: "sendTTSMessages", 16 | MANAGE_MESSAGES: "manageMessages", 17 | EMBED_LINKS: "embedLinks", 18 | ATTACH_FILES: "attachFiles", 19 | READ_MESSAGE_HISTORY: "readMessageHistory", 20 | MENTION_EVERYONE: "mentionEveryone", 21 | USE_EXTERNAL_EMOJIS: "externalEmojis", 22 | CONNECT: "voiceConnect", 23 | SPEAK: "voiceSpeak", 24 | MUTE_MEMBERS: "voiceMuteMembers", 25 | DEAFEN_MEMBERS: "voiceDeafenMembers", 26 | MOVE_MEMBERS: "voiceMoveMembers", 27 | USE_VAD: "voiceUseVAD", 28 | CHANGE_NICKNAME: "changeNickname", 29 | MANAGE_NICKNAMES: "manageNicknames", 30 | MANAGE_ROLES: "manageRoles", 31 | MANAGE_WEBHOOKS: "manageWebhooks", 32 | MANAGE_EMOJIS: "manageEmojis", 33 | } -------------------------------------------------------------------------------- /music/func/loadCommands.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | var cmds = {} 3 | 4 | exports.load = () => { 5 | fs.readdir('./music/commands', (err, files) => { 6 | if (err) return console.log(err); 7 | files.forEach(f => { 8 | try { 9 | let cmd = require("../commands/"+f); 10 | let name = f.slice(0, -3); 11 | cmds[name] = {run:cmd.run, conf:cmd.conf}; 12 | } catch(err) { 13 | console.log(err); 14 | } 15 | }) 16 | }) 17 | } 18 | 19 | exports.reload = (cmd) => { 20 | try { 21 | let check = require('../commands/'+cmd); 22 | delete require.cache[require.resolve('../commands/'+cmd)] 23 | let good = require('../commands/'+cmd); 24 | cmds[cmd] = {run:good.run, conf:good.conf}; 25 | return {worked:true}; 26 | } catch (err) { 27 | return {worked:false, error:err}; 28 | } 29 | } 30 | 31 | exports.getCmds = () => { 32 | return cmds; 33 | } 34 | -------------------------------------------------------------------------------- /music/lib/GenerateQueue.js: -------------------------------------------------------------------------------- 1 | const paginate = require('Paginate') 2 | const pretty = require('pretty-ms') 3 | 4 | function makeQueue(playlist, num) { 5 | let pager = new paginate(playlist, 20) 6 | let page = pager.page(num) 7 | let list = [] 8 | let TotalPages = Math.ceil(playlist.length / 20) 9 | if (num > TotalPages) num = TotalPages 10 | page.forEach((p, i) => { 11 | let duration = pretty(p.duration) 12 | let itemNumber = num != 1 ? ((((num - 1) * 20) + i) + 1) : i + 1 13 | list.push(`${itemNumber}. **${p.title}** - ${p.owner} (${duration})`) 14 | }) 15 | list.push(`Page ${num}/${TotalPages}`) 16 | return list 17 | } 18 | 19 | module.exports = makeQueue -------------------------------------------------------------------------------- /music/lib/Registry.js: -------------------------------------------------------------------------------- 1 | let GuildPlayer = require('./GuildPlayer.js') 2 | 3 | class Registry { 4 | 5 | constructor() { 6 | 7 | this.GuildPlayers = {} 8 | 9 | } 10 | 11 | createGuildPlayer(connection, message, bot) { 12 | 13 | if (!connection && !message) throw new Error("(!connection || !message)") 14 | 15 | if (this.GuildPlayers[message.channel.guild.id] && !this.GuildPlayers[message.channel.guild.id].killing) return this.GuildPlayers[message.channel.guild.id] 16 | 17 | return this.GuildPlayers[message.channel.guild.id] = new GuildPlayer(connection, message, bot), this.GuildPlayers[message.channel.guild.id] 18 | 19 | } 20 | 21 | get(id) { 22 | 23 | return this.GuildPlayers[id] ? this.GuildPlayers[id] : null 24 | 25 | } 26 | 27 | has(id) { 28 | 29 | return this.GuildPlayers[id] ? true : false 30 | 31 | } 32 | 33 | destroy(id) { 34 | 35 | this.GuildPlayers[id] ? this.GuildPlayers[id]._kill() : 0 36 | return delete this.GuildPlayers[id] 37 | 38 | } 39 | 40 | } 41 | 42 | module.exports = Registry 43 | -------------------------------------------------------------------------------- /music/lib/SoundCloudSong.js: -------------------------------------------------------------------------------- 1 | const request = require('request') 2 | const { soundCloudID } = require('../../config') 3 | const linkType = require('./linkType') 4 | 5 | class SoundCloudSong { 6 | 7 | constructor( { title, owner, stream, url, duration, regionsAllowed, requester} ) { 8 | 9 | this.title = title 10 | 11 | this.owner = owner 12 | 13 | this.stream = stream.endsWith("?client_id="+soundCloudID) ? stream : stream+"?client_id="+soundCloudID 14 | 15 | this.url = url 16 | 17 | this.duration = duration 18 | 19 | this.regionsAllowed = regionsAllowed 20 | 21 | this.requester = requester 22 | 23 | } 24 | 25 | get type() { 26 | 27 | return linkType(this.url) 28 | 29 | } 30 | 31 | getStream() { 32 | 33 | return new Promise((resolve, reject) => { 34 | 35 | try { 36 | 37 | let stream = request({ 38 | 39 | uri: this.stream, 40 | followAllRedirects: true 41 | 42 | }) 43 | 44 | return resolve(stream) 45 | 46 | } catch(err) { 47 | 48 | return reject(stream) 49 | 50 | } 51 | 52 | }) 53 | 54 | } 55 | 56 | } 57 | 58 | module.exports = SoundCloudSong -------------------------------------------------------------------------------- /music/lib/YouTubeSong.js: -------------------------------------------------------------------------------- 1 | const ytdl = require('ytdl-core') 2 | 3 | class YouTubeSong { 4 | 5 | constructor( { title, owner, stream, url, duration, regionsAllowed, requester} ) { 6 | 7 | this.title = title 8 | 9 | this.owner = owner 10 | 11 | this.stream = stream 12 | 13 | this.url = url 14 | 15 | this.duration = duration 16 | 17 | this.regionsAllowed = regionsAllowed 18 | 19 | this.requester = requester 20 | 21 | } 22 | 23 | getStream() { 24 | 25 | return new Promise((resolve, reject) => { 26 | 27 | try { 28 | 29 | let stream = ytdl(this.stream, {audioonly: true}) 30 | 31 | stream.on('error', (err) => { 32 | console.log(err) 33 | }) 34 | 35 | return resolve(stream) 36 | 37 | } catch(err) { 38 | 39 | return reject(err) 40 | 41 | } 42 | }) 43 | 44 | } 45 | 46 | } 47 | 48 | module.exports = YouTubeSong -------------------------------------------------------------------------------- /music/lib/apiKeyCheck.js: -------------------------------------------------------------------------------- 1 | const resolve = require('soundcloud-resolve') 2 | 3 | exports.scKey = (key, callback) => { 4 | resolve(key, "https://soundcloud.com/lubxtpf/whateverhappened", (err, data) => { 5 | if (err) return callback(true) 6 | return callback(false) 7 | }) 8 | } 9 | 10 | exports.ytKey = (key, callback) => { 11 | return callback(false) 12 | } -------------------------------------------------------------------------------- /music/lib/linkType.js: -------------------------------------------------------------------------------- 1 | const _url = require('url') 2 | 3 | module.exports = (url) => { 4 | url = _url.parse(url, true); 5 | if (/(?:www\.)?(?:youtu\.be|youtube\.com)/i.test(url.hostname)) { 6 | if (url.query.list) return 'yt-playlist'; 7 | if (!url.query.v) return 'yt-be'; 8 | return 'yt' 9 | } 10 | if (/(?:www\.)?(?:soundcloud\.com)/i.test(url.hostname)) { 11 | if (/\/sets\//i.test(url.path)) return 'sc-playlist'; 12 | return 'sc'; 13 | } 14 | return 'nal'; 15 | } -------------------------------------------------------------------------------- /music/node-music.js: -------------------------------------------------------------------------------- 1 | //Next Song Event 2 | const { EventEmitter } = require('events') 3 | module.exports = new EventEmitter() 4 | 5 | 6 | //GuildPlayer Registry 7 | module.exports.Registry = require('./lib/Registry') 8 | 9 | 10 | //Utilites 11 | module.exports.linkType = require('./lib/linkType') 12 | 13 | module.exports.apiCheck = require('./lib/apiKeyCheck') -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nitro", 3 | "version": "1.0.0", 4 | "description": "A discord bot", 5 | "main": "bot.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "Funnbot", 10 | "license": "MIT", 11 | "dependencies": { 12 | "Paginate": "0.0.1", 13 | "bufferutil": "^2.0.0", 14 | "canvas": "^1.6.7", 15 | "cows": "^1.1.0", 16 | "discord.js": "^11.2.1", 17 | "eris": "^0.7.2", 18 | "erlpack": "github:hammerandchisel/erlpack", 19 | "express": "^4.15.3", 20 | "ffmpeg": "0.0.4", 21 | "html2plaintext": "^2.0.1", 22 | "imgflipper": "^1.0.1", 23 | "is-var-name": "^1.0.0", 24 | "jimp": "^0.2.27", 25 | "mathjs": "^3.8.1", 26 | "mixpanel": "^0.7.0", 27 | "moment": "^2.17.1", 28 | "node-opus": "^0.2.7", 29 | "node-trello": "^1.2.1", 30 | "pretty-ms": "^2.1.0", 31 | "random-number": "0.0.7", 32 | "request": "^2.79.0", 33 | "rethinkdb": "^2.3.3", 34 | "rethinkdbdash": "^2.3.31", 35 | "short-number": "^1.0.6", 36 | "soundcloud-resolve": "^1.0.2", 37 | "soundcloudr": "^1.1.0", 38 | "stream-buffers": "^3.0.1", 39 | "string-similarity": "^1.2.0", 40 | "urban": "^0.3.1", 41 | "uws": "^8.14.1", 42 | "youtube-api": "^2.0.6", 43 | "youtube-info": "^1.1.1", 44 | "youtube-playlist-info": "^0.1.0", 45 | "youtube-search": "^1.0.7", 46 | "ytdl-core": "^0.7.24" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /shard.js: -------------------------------------------------------------------------------- 1 | const config = require('./config.js') 2 | const Discord = require('discord.js'); 3 | const Manager = new Discord.ShardingManager('./bot.js', { 4 | totalShards: 5, 5 | token: config.token 6 | }); 7 | Manager.spawn(); 8 | 9 | setTimeout(() => { 10 | console.log("restarting") 11 | procss.exit(1); 12 | }, 5184e5); 13 | 14 | //Guild Api 15 | /*const express = require('express') 16 | 17 | const app = express() 18 | const router = express.Router() 19 | const port = process.env.PORT || 2904 20 | 21 | router.use(function (req, res, next) { 22 | console.log(req.url); 23 | next(); 24 | }); 25 | 26 | router.use('/api/inguild', (req, res) => { 27 | if (req.headers.guildid) { 28 | let id = req.headers.guildid 29 | Manager.broadcastEval(`this.guilds.has("${id}")`).then(results => { 30 | bool = results.indexOf(true) > -1 ? true : false 31 | if (bool) { 32 | return res.send(JSON.stringify({has: true})) 33 | } else { 34 | return res.send(JSON.stringify({has: false})) 35 | } 36 | }).catch(console.log) 37 | } else { 38 | return res.send("Provide guild ID in header") 39 | } 40 | }) 41 | 42 | app.use("/", router); 43 | 44 | app.listen(port, () => { 45 | console.log("inguild listening on port " + port) 46 | })*/ -------------------------------------------------------------------------------- /struct/Bot.js: -------------------------------------------------------------------------------- 1 | console.log("Blooping...") 2 | let start = (new Date()).getTime() 3 | 4 | const Discord = require('discord.js') 5 | const loadDB = require('../functions/loadDB') 6 | const GuildConfig = require('../struct/GuildConfig') 7 | const ProfileConfig = require('../struct/ProfileConfig') 8 | const SystemConfig = require('../struct/SystemConfig') 9 | const Framework = require('../functions/framework') 10 | 11 | const Bot = () => { 12 | 13 | return new Promise((resolve, reject) => { 14 | 15 | loadDB().then((data) => { 16 | 17 | let bot = new Discord.Client({ 18 | disabledEvents: ['TYPING_START'], 19 | messageCacheMaxSize: 25, 20 | messageCacheLifetime: 120, 21 | messageSweepInterval: 120 22 | }) 23 | 24 | bot.config = new GuildConfig(data) 25 | bot.profile = new ProfileConfig(data) 26 | bot.system = new SystemConfig(data) 27 | bot.embed = Discord.RichEmbed 28 | 29 | bot.on('ready', () => { 30 | console.log("Bloop took: " + ((new Date).getTime() - start) + "MS") 31 | Framework.start(bot) 32 | 33 | if (bot.shard) { 34 | console.log("Shard #"+bot.shard.id+" active with "+bot.guilds.size+" guilds") 35 | bot.user.setPresence({ game: { name: "@Nitro help | Shard " + (bot.shard.id + 1) + "/" + bot.shard.count, type: 0 } }) 36 | } else { 37 | console.log("Shard #0 active with "+bot.guilds.size+" guilds") 38 | bot.user.setPresence({ game: { name: "@Nitro help | "+bot.guilds.size+" guilds", type: 0 } }) 39 | } 40 | }) 41 | 42 | /*bot.on("debug", msg => { 43 | if (!/heartbeat/i.test(msg)) console.log(msg); 44 | });*/ 45 | bot.on("error", console.error) 46 | return resolve(bot); 47 | }).catch(err => reject(err)) 48 | 49 | }) 50 | 51 | } 52 | 53 | module.exports = Bot; 54 | -------------------------------------------------------------------------------- /struct/Message.js: -------------------------------------------------------------------------------- 1 | const bot = require('../bot') 2 | 3 | function Message(message) { 4 | let id; 5 | if (message.channel.type === "text" && message.guild) id = message.guild.id 6 | else if (!message.guild) { 7 | let fakeGuild = {} 8 | id = message.author.id 9 | Object.defineProperty(message, 'guild', { 10 | get: () => fakeGuild 11 | }) 12 | } else { 13 | id = message.author.id 14 | } 15 | 16 | message.guild.prefix = bot.config.getPrefix(id) 17 | message.guild.announce = bot.config.getAnc(id) 18 | message.guild.adblock = bot.config.getAd(id) 19 | message.guild.autorole = bot.config.getAuto(id) 20 | message.guild.tags = bot.config.getTags(id) 21 | message.guild.level = bot.config.getLevel(id) 22 | message.guild.custom = bot.config.getCustom(id) 23 | message.guild.modules = bot.config.getMod(id) 24 | message.guild.roleme = bot.config.getRoleMe(id) 25 | message.guild.perms = bot.config.getPerms(id) 26 | message.guild.filter = bot.config.getFilter(id) 27 | message.guild.joindm = bot.config.getJDM(id) 28 | message.guild.strikes = bot.config.getStrike(id) 29 | message.guild.deletem = bot.config.getDeletem(id) 30 | 31 | let nopre = message.content.slice(message.guild.prefix.length) 32 | let split = nopre.split(" ") 33 | message.command = split[0] 34 | split = split.slice(1) 35 | message.args = split 36 | message.suffix = split.join(" ") 37 | message.send = (...args) => message.channel.send(...args); 38 | return message; 39 | } 40 | 41 | module.exports = Message; -------------------------------------------------------------------------------- /struct/ProfileConfig.js: -------------------------------------------------------------------------------- 1 | const r = require('rethinkdbdash') 2 | const Discord = require('discord.js') 3 | 4 | class ProfileConfig { 5 | 6 | constructor(data) { 7 | 8 | this.profiles = {} 9 | data.profile.forEach(d => { 10 | this.profiles[d.id] = d.data; 11 | }) 12 | this.conn = data.connection 13 | } 14 | 15 | update(id) { 16 | r.table('profile').insert({ 17 | id, 18 | data: this.profiles[id] 19 | }, { 20 | conflict: "replace" 21 | }).run(this.conn, (err, res) => { 22 | if (err) console.log(err) 23 | }) 24 | } 25 | 26 | 27 | 28 | Get(id, name, def) { 29 | if (this.profiles[id] && this.profiles[id][name]) return this.profiles[id][name] 30 | else return def 31 | } 32 | 33 | Set(id, name, n) { 34 | if (!this.profiles[id]) this.profiles[id] = {}; 35 | this.profiles[id][name] = n; 36 | this.update(id); 37 | } 38 | 39 | addMsg(id) { 40 | let sent = this.getSent(id) 41 | sent++ 42 | this.setSent(id, sent) 43 | } 44 | 45 | getLvl(id) { 46 | let sent = this.getSent(id) 47 | return Math.floor(sent / 259) + 1 48 | } 49 | 50 | getRank(id) { 51 | if (!this.profiles[id] || !this.profiles[id].sent) return "9999999" 52 | let keys = Object.keys(this.profiles) 53 | let sort = keys.sort((a, b) => { 54 | return this.profiles[b].sent - this.profiles[a].sent 55 | }) 56 | let place = sort.indexOf(id) + 1 57 | return place 58 | } 59 | 60 | leaderboard(bot) { 61 | let keys = Object.keys(this.profiles) 62 | let sort = keys.sort((a, b) => { 63 | return (!this.profiles[b].money ? 0 : this.profiles[b].money) - (!this.profiles[a].money ? 0 : this.profiles[a].money) 64 | }) 65 | sort = sort.filter(i => bot.users.get(i) ? true : false) 66 | return sort.slice(0, 10) 67 | } 68 | 69 | addMoney(id, money) { 70 | let cur = this.Get(id, 'money', 0) 71 | cur = cur + money 72 | this.Set(id, 'money', cur) 73 | } 74 | 75 | subMoney(id, money) { 76 | let cur = this.Get(id, 'money', 0) 77 | cur = cur - money 78 | this.Set(id, 'money', cur) 79 | } 80 | 81 | getSent(id) { 82 | return this.Get(id, 'sent', 0) 83 | } 84 | 85 | setSent(id, sent) { 86 | this.Set(id, 'sent', sent) 87 | } 88 | 89 | getMoney(id) { 90 | return this.Get(id, 'money', 0) 91 | } 92 | 93 | setMoney(id, money) { 94 | this.Set(id, 'money', money) 95 | } 96 | 97 | getShout(id, prefix) { 98 | return this.Get(id, 'shout', "Use " + prefix + "infobox to set this message.") 99 | } 100 | 101 | setShout(id, shout) { 102 | this.Set(id, 'shout', shout) 103 | } 104 | 105 | getBg(id) { 106 | return this.Get(id, 'background', 'default') 107 | } 108 | 109 | setBg(id, background) { 110 | this.Set(id, 'background', background) 111 | } 112 | 113 | getRep(id) { 114 | return this.Get(id, 'rep', {}) 115 | } 116 | 117 | setRep(id, rep) { 118 | return this.Set(id, 'rep', rep) 119 | } 120 | 121 | } 122 | 123 | module.exports = ProfileConfig 124 | -------------------------------------------------------------------------------- /struct/SystemConfig.js: -------------------------------------------------------------------------------- 1 | const r = require('rethinkdb') 2 | 3 | class SystemConfig { 4 | 5 | constructor(data) { 6 | 7 | this.system = {} 8 | 9 | data.system.forEach(d => { 10 | this.system[d.id] = d.data; 11 | }) 12 | 13 | this.conn = data.connection 14 | 15 | r.table('system').changes().run(this.conn, (err, change) => { 16 | 17 | if (err) return console.log(err) 18 | 19 | change.each((err, row) => { 20 | 21 | if (err) return console.log(err) 22 | 23 | if (!row.new_val) return 24 | 25 | this.system[row.new_val.id] = row.new_val.data 26 | 27 | }) 28 | 29 | }) 30 | } 31 | 32 | update(i) { 33 | 34 | r.table('system').insert({ 35 | id: i, 36 | data: this.system[i] 37 | }, { 38 | conflict: "replace" 39 | }).run(this.conn, (err, res) => { 40 | 41 | if (err) console.log(err) 42 | 43 | }) 44 | 45 | } 46 | 47 | G(b) { 48 | return this.system[b] ? this.system[b] : {} 49 | } 50 | 51 | S(b, a) { 52 | this.system[b] = a 53 | this.update(b) 54 | } 55 | 56 | getBlocked() { 57 | return this.G('blocked') 58 | } 59 | 60 | setBlocked(blocked) { 61 | this.S('blocked', blocked) 62 | } 63 | 64 | getUpdate() { 65 | return this.G('update') 66 | } 67 | 68 | setUpdate(update) { 69 | this.S('update', update) 70 | } 71 | 72 | getPatrons() { 73 | return this.G("patrons") 74 | } 75 | 76 | setPatrons(patrons) { 77 | this.S("patrons", patrons) 78 | } 79 | 80 | } 81 | 82 | module.exports = SystemConfig -------------------------------------------------------------------------------- /util.js: -------------------------------------------------------------------------------- 1 | let f = {}; 2 | 3 | f.log = (m) => { 4 | if (m.guild !== null) { 5 | console.log(new Date() + " [" + m.guild.name + ": " + m.channel.name + "] <" + m.author.username + "> " + m.content); 6 | } else { 7 | console.log(new Date() + " [" + m.author.username + "] " + m.content) 8 | } 9 | } 10 | 11 | f.removeA = (array, search_term) => { 12 | for (var i = array.length - 1; i >= 0; i--) { 13 | if (array[i] === search_term) { 14 | array.splice(i, 1); 15 | return array; 16 | } 17 | } 18 | } 19 | 20 | f.clean = (content) => { 21 | content = content.replace(/`/g, '') 22 | content = content.replace(/\*/g, '') 23 | return content 24 | } 25 | 26 | f.range = (input, minimum, maximum) => { 27 | if (input < minimum) input = minimum 28 | if (input > maximum) input = maximum 29 | return input 30 | } 31 | 32 | global.nu = f --------------------------------------------------------------------------------