├── README.md ├── src ├── BaseEvent.js ├── Commands │ ├── Other │ │ ├── Vote.js │ │ ├── Invite.js │ │ ├── Uptime.js │ │ ├── Ping.js │ │ ├── RateLimit.js │ │ └── Help.js │ ├── Facts │ │ ├── CatFact.js │ │ ├── DogFact.js │ │ └── MonkeyFact.js │ ├── Attachments │ │ ├── Dog.js │ │ └── Monkey.js │ ├── Fun │ │ ├── 8ball.js │ │ ├── Reverse.js │ │ └── Shuffle.js │ ├── Canvas │ │ ├── dither565.js │ │ ├── 80s.js │ │ ├── gay.js │ │ ├── PetPet.js │ │ ├── circle.js │ │ ├── invert.js │ │ ├── sepia.js │ │ ├── greyscale.js │ │ ├── pixelate.js │ │ ├── contrast.js │ │ ├── Brightness.js │ │ └── resize.js │ ├── Config │ │ ├── prefix.js │ │ └── ChatChannel.js │ └── Owner │ │ └── Eval.js ├── Events │ ├── ready.js │ ├── guildCreate.js │ ├── guildDelete.js │ └── messageCreate.js ├── BaseCommand.js ├── ExtendedMap.js ├── Database │ └── GuildManager.js ├── ZoopoClient.js └── MessageCollector.js ├── package.json ├── Config.example.json ├── .gitignore ├── Zoopo.js └── LICENSE /README.md: -------------------------------------------------------------------------------- 1 | # Zoopo 2 | Zoopo - A discord bot that uses MonkeDev's API. (https://api.monkedev.com) 3 | 4 | 5 | ## Invite link 6 | https://discord.com/api/oauth2/authorize?client_id=807048838362955798&permissions=52224&redirect_uri=https%3A%2F%2Fmonkedev.com&scope=bot -------------------------------------------------------------------------------- /src/BaseEvent.js: -------------------------------------------------------------------------------- 1 | class BaseCommand { 2 | constructor(bot, event) { 3 | this.bot = bot; 4 | 5 | if(!event.name) throw new Error('No command name.'); 6 | this.name = event.name; 7 | 8 | }; 9 | }; 10 | 11 | module.exports = BaseCommand; -------------------------------------------------------------------------------- /src/Commands/Other/Vote.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | module.exports = class Help extends Base { 3 | constructor(bot) { 4 | super(bot, { 5 | name: 'vote', 6 | desc: 'Please vote!', 7 | usage: 'vote' 8 | }); 9 | }; 10 | 11 | async run(msg, args, data){ 12 | 13 | msg.channel.createMessage(''); 14 | } 15 | }; -------------------------------------------------------------------------------- /src/Events/ready.js: -------------------------------------------------------------------------------- 1 | const Base = require('../BaseEvent'); 2 | module.exports = class messageCreate extends Base { 3 | constructor(bot) { 4 | super(bot, { 5 | name: 'ready' 6 | }); 7 | }; 8 | 9 | async run() { 10 | console.log(this.bot.user.username + '#' + this.bot.user.discriminator + ' is ready!'); 11 | this.bot.editStatus('idle', { 12 | name: 'Ping for prefix!', 13 | }); 14 | }; 15 | }; -------------------------------------------------------------------------------- /src/BaseCommand.js: -------------------------------------------------------------------------------- 1 | class BaseCommand { 2 | constructor(bot, cmd) { 3 | this.bot = bot; 4 | 5 | if(!cmd.name) throw new Error('No command name.'); 6 | this.name = cmd.name; 7 | this.alli = cmd.alli || []; 8 | this.desc = cmd.desc || 'No description'; 9 | this.category = cmd.category || 'Other'; 10 | this.usage = cmd.usage || 'None'; 11 | 12 | this.bPerms = cmd.bPerms || ['embedLinks', 'sendMessages']; 13 | this.mPerms = cmd.mPerms || []; 14 | 15 | }; 16 | }; 17 | 18 | module.exports = BaseCommand; -------------------------------------------------------------------------------- /src/Commands/Other/Invite.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | module.exports = class Help extends Base { 3 | constructor(bot) { 4 | super(bot, { 5 | name: 'invite', 6 | desc: 'Get a link to invite me to your server!', 7 | usage: 'invite' 8 | }); 9 | }; 10 | 11 | async run(msg, args, data){ 12 | 13 | msg.channel.createMessage({ 14 | content: `` 15 | }); 16 | 17 | }; 18 | }; -------------------------------------------------------------------------------- /src/Events/guildCreate.js: -------------------------------------------------------------------------------- 1 | const Base = require('../BaseEvent'); 2 | module.exports = class messageCreate extends Base { 3 | constructor(bot) { 4 | super(bot, { 5 | name: 'guildCreate' 6 | }); 7 | }; 8 | 9 | async run(guild) { 10 | 11 | const logGuild = await this.bot.guilds.get(this.bot.config.logs.guildID); 12 | const logChannel = logGuild.channels.get(this.bot.config.logs.channelID); 13 | 14 | logChannel.createMessage({ 15 | content: `__**New Guild**__\nName: ${guild.name}\nMemberCount: ${guild.memberCount}`, 16 | }); 17 | 18 | } 19 | } -------------------------------------------------------------------------------- /src/Events/guildDelete.js: -------------------------------------------------------------------------------- 1 | const Base = require('../BaseEvent'); 2 | module.exports = class messageCreate extends Base { 3 | constructor(bot) { 4 | super(bot, { 5 | name: 'guildDelete' 6 | }); 7 | }; 8 | 9 | async run(guild) { 10 | 11 | const logGuild = await this.bot.guilds.get(this.bot.config.logs.guildID); 12 | const logChannel = logGuild.channels.get(this.bot.config.logs.channelID); 13 | 14 | logChannel.createMessage({ 15 | content: `__**Left a Guild**__\nName: ${guild.name}\nMemberCount: ${guild.memberCount}`, 16 | }); 17 | 18 | } 19 | } -------------------------------------------------------------------------------- /src/Commands/Facts/CatFact.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'), 2 | fetch = require('node-fetch'); 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'cat-fact', 7 | desc: 'Get a random cat fact.', 8 | usage: 'cat-fact', 9 | category: 'Facts', 10 | alli: ['catfact', 'cf'] 11 | }); 12 | }; 13 | 14 | async run(msg, args, data){ 15 | 16 | const res = await (await (fetch(`${this.bot.baseApiUrl}/facts/cat?key=${this.bot.config.apiKey}`))).json(); 17 | 18 | msg.channel.createMessage(res.fact); 19 | 20 | }; 21 | }; -------------------------------------------------------------------------------- /src/Commands/Facts/DogFact.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'), 2 | fetch = require('node-fetch'); 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'dog-fact', 7 | desc: 'Get a random cat fact.', 8 | usage: 'dog-fact', 9 | category: 'Facts', 10 | alli: ['dogfact', 'df'] 11 | }); 12 | }; 13 | 14 | async run(msg, args, data){ 15 | 16 | const res = await (await (fetch(`${this.bot.baseApiUrl}/facts/dog?key=${this.bot.config.apiKey}`))).json(); 17 | 18 | msg.channel.createMessage(res.fact); 19 | 20 | }; 21 | }; -------------------------------------------------------------------------------- /src/Commands/Attachments/Dog.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'), 2 | fetch = require('node-fetch'); 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'bird', 7 | desc: 'Get a random bird image/gif.', 8 | usage: 'bird', 9 | category: 'Attachments', 10 | }); 11 | }; 12 | 13 | async run(msg, args, data){ 14 | 15 | const res = await (await (fetch(`${this.bot.baseApiUrl}/attachments/bird?key=${this.bot.config.apiKey}`))).json(); 16 | 17 | msg.channel.createMessage({embed: {color: this.bot.colors.main, image: { url: res.url}}}); 18 | 19 | }; 20 | }; -------------------------------------------------------------------------------- /src/Commands/Facts/MonkeyFact.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'), 2 | fetch = require('node-fetch'); 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'monkey-fact', 7 | desc: 'Get a random cat fact.', 8 | usage: 'monkey-fact', 9 | category: 'Facts', 10 | alli: ['monkeyfact', 'mf'] 11 | }); 12 | }; 13 | 14 | async run(msg, args, data){ 15 | 16 | const res = await (await (fetch(`${this.bot.baseApiUrl}/facts/monkey?key=${this.bot.config.apiKey}`))).json(); 17 | 18 | msg.channel.createMessage(res.fact); 19 | 20 | }; 21 | }; -------------------------------------------------------------------------------- /src/Commands/Attachments/Monkey.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'), 2 | fetch = require('node-fetch'); 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'monkey', 7 | desc: 'Get a random monkey image/gif.', 8 | usage: 'monkey', 9 | category: 'Attachments', 10 | }); 11 | }; 12 | 13 | async run(msg, args, data){ 14 | 15 | const res = await (await (fetch(`${this.bot.baseApiUrl}/attachments/monkey?key=${this.bot.config.apiKey}`))).json(); 16 | 17 | msg.channel.createMessage({embed: {color: this.bot.colors.main, image: { url: res.url}}}); 18 | 19 | }; 20 | }; -------------------------------------------------------------------------------- /src/ExtendedMap.js: -------------------------------------------------------------------------------- 1 | module.exports = class ExtendedMap extends Map { 2 | constructor(){ 3 | super(); 4 | } 5 | 6 | /** 7 | * 8 | * @param {Function} filter 9 | * @param {Boolean} returnArray 10 | */ 11 | filter(filter, returnArray){ 12 | if(!filter) new Error("A filter is required"); 13 | if(returnArray) { 14 | let array = []; 15 | for(const keys of this){ 16 | if(filter({value: keys[1], key: keys[0]})) array.push(keys[1]); 17 | }; 18 | return array; 19 | } else { 20 | let newMap = new ExtendedMap(); 21 | for(const keys of this){ 22 | if(filter({value: keys[1], key: keys[0]})) newMap.set(keys[0], keys[1]); 23 | }; 24 | return newMap; 25 | }; 26 | }; 27 | 28 | }; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "zoopo", 3 | "version": "1.0.0", 4 | "description": "Zoopo - An invite manager", 5 | "main": "Zoopo.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/Mafia-7777/Zoopo.git" 12 | }, 13 | "author": "", 14 | "license": "ISC", 15 | "bugs": { 16 | "url": "https://github.com/Mafia-7777/Zoopo/issues" 17 | }, 18 | "homepage": "https://github.com/Mafia-7777/Zoopo#readme", 19 | "dependencies": { 20 | "body-parser": "^1.19.0", 21 | "eris": "github:MonkeDev/erisInlines", 22 | "express": "^4.17.1", 23 | "extendedmap": "^1.0.4", 24 | "haste-pls": "^1.0.3", 25 | "mongoose": "^5.11.15", 26 | "node-fetch": "^2.6.1", 27 | "node-schedule": "^2.0.0", 28 | "pretty-ms": "^7.0.1" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Commands/Other/Uptime.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const pm = require('pretty-ms'); 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'uptime', 7 | desc: 'Shows you the bots uptime.', 8 | usage: 'uptime' 9 | }); 10 | }; 11 | 12 | async run(msg, args, data){ 13 | const toSend = { 14 | embed: { 15 | fields: [], 16 | color: this.bot.colors.main 17 | } 18 | } 19 | 20 | const pUp = pm(process.uptime() * 1000); 21 | const bUp = pm(this.bot.uptime); 22 | 23 | toSend.embed.fields.push({name: '__Bot-Uptime__:', value: bUp, inline: true}); 24 | toSend.embed.fields.push({name: '__Process-Uptime__:', value: pUp, inline: true}); 25 | 26 | msg.channel.createMessage(toSend); 27 | } 28 | }; -------------------------------------------------------------------------------- /src/Commands/Fun/8ball.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const fetch = require('node-fetch').default; 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: '8ball', 7 | desc: 'The magik 8ball will answer a question', 8 | usage: '8ball ', 9 | category: 'Fun' 10 | }); 11 | }; 12 | 13 | async run(msg, args, data){ 14 | if(!args[0]) return msg.channel.createMessage(`What is your question? | \`${data.guild.prefix}8ball \``); 15 | const res = await (await (fetch(`${this.bot.baseApiUrl}/fun/8ball?key=${this.bot.config.apiKey}`))).json(); 16 | msg.channel.createMessage({ embed: { 17 | color: this.bot.colors.main, 18 | title: `:question: | __Question__: \`${args.join(' ').slice(0, 210)}\``, 19 | description: `:mag_right: | **__Answer__**: \`${res.answer}\`` 20 | }}); 21 | } 22 | }; -------------------------------------------------------------------------------- /src/Database/GuildManager.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'), 2 | config = require('../../Config.json'); 3 | 4 | const Schema = mongoose.model('facts', new mongoose.Schema({ 5 | id: { type: String }, 6 | users: { type: Array, default: [] }, 7 | prefix: { type: String, default: config.defaultPrefix }, 8 | chatChannel: { type: String, require: false } 9 | })); 10 | 11 | module.exports = class GuildManager { 12 | constructor() { 13 | this.cache = new Map(); 14 | this.schema = Schema; 15 | 16 | Schema.find().then(data => { 17 | data.forEach(guildData => { 18 | this.cache.set(guildData.id, guildData); 19 | }) 20 | }); 21 | }; 22 | 23 | async get(id) { 24 | let data = await this.cache.get(id); 25 | if(data === undefined) { 26 | data = await Schema.findOne({id: id}); 27 | if(!data) data = await new Schema({id: id}).save(); 28 | this.cache.set(id, data); 29 | }; 30 | return data; 31 | }; 32 | 33 | }; -------------------------------------------------------------------------------- /src/Commands/Canvas/dither565.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const fetch = require('node-fetch').default; 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'dither565', 7 | desc: 'Place a dither565 filter on a image', 8 | usage: 'dither565 [imgUrl | user]', 9 | category: 'Canvas', 10 | bPerms: ['attachFiles'], 11 | }); 12 | }; 13 | 14 | async run(msg, args, data){ 15 | 16 | const user = msg.mentions[0] || this.bot.users.get(args[0]); 17 | 18 | const imgUrl = user ? user.staticAvatarURL : null || this.bot.isUrl(args[0]) ? args[0] : null || msg.channel.lastAttachment ? msg.channel.lastAttachment.proxy_url : null; 19 | 20 | if(!imgUrl) return msg.channel.createMessage('I could not find a image in this channel, Please provide me with a user or a image URL.'); 21 | if(!this.bot.isUrl(imgUrl)) return msg.channel.createMessage('Please give me a **valid** URL.'); 22 | 23 | const buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/dither565?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}`))).buffer(); 24 | 25 | msg.channel.createMessage('', {file: buffer, name: `dither565.png`}); 26 | }; 27 | }; -------------------------------------------------------------------------------- /src/Commands/Fun/Reverse.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const fetch = require('node-fetch').default; 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'reverse', 7 | desc: 'reverse some text', 8 | usage: 'reverse ', 9 | category: 'Fun' 10 | }); 11 | }; 12 | 13 | async run(msg, args, data){ 14 | if(!args[0]) return msg.channel.createMessage(`Add an argument please, \`${data.guild.prefix}reverse \``); 15 | const res = await (await (fetch(`${this.bot.baseApiUrl}/fun/reverse?key=${this.bot.config.apiKey}&content=${encodeURI(args.join(' ').slice(0, 1000) || 'What would you like to shuffle?')}`))).json(); 16 | msg.channel.createMessage({ embed: { 17 | color: this.bot.colors.main, 18 | fields: [ 19 | { 20 | name: "__Original__:", 21 | value: `\`${args.join(' ').slice(0, 1000)}\``, 22 | inline: true 23 | }, 24 | { 25 | name: "__Reversed__:", 26 | value: `\`${res.result}\``, 27 | inline: true 28 | } 29 | ] 30 | }}); 31 | } 32 | }; -------------------------------------------------------------------------------- /src/Commands/Fun/Shuffle.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const fetch = require('node-fetch').default; 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'shuffle', 7 | desc: 'shuffle some text', 8 | usage: 'shuffle ', 9 | category: 'Fun' 10 | }); 11 | }; 12 | 13 | async run(msg, args, data){ 14 | if(!args[0]) return msg.channel.createMessage(`Add an argument please, \`${data.guild.prefix}shuffle \``); 15 | const res = await (await (fetch(`${this.bot.baseApiUrl}/fun/shuffle?key=${this.bot.config.apiKey}&content=${encodeURI(args.join(' ').slice(0, 1000) || 'What would you like to shuffle?')}`))).json(); 16 | msg.channel.createMessage({ embed: { 17 | color: this.bot.colors.main, 18 | fields: [ 19 | { 20 | name: "__Original__:", 21 | value: `\`${args.join(' ').slice(0, 1000)}\``, 22 | inline: true 23 | }, 24 | { 25 | name: "__Shuffled__:", 26 | value: `\`${res.result}\``, 27 | inline: true 28 | } 29 | ] 30 | }}); 31 | } 32 | }; -------------------------------------------------------------------------------- /src/Commands/Canvas/80s.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const fetch = require('node-fetch').default; 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: '80s', 7 | usage: '80s [imgUrl | user]', 8 | category: 'Canvas', 9 | bPerms: ['attachFiles'], 10 | }); 11 | }; 12 | 13 | async run(msg, args, data){ 14 | 15 | const user = msg.mentions[0] || this.bot.users.get(args[0]); 16 | 17 | const imgUrl = user ? user.staticAvatarURL : null || this.bot.isUrl(args[0]) ? args[0] : null || msg.channel.lastAttachment ? msg.channel.lastAttachment.proxy_url : null; 18 | 19 | if(!imgUrl) return msg.channel.createMessage('I could not find a image in this channel, Please provide me with a user or a image URL.'); 20 | if(!this.bot.isUrl(imgUrl)) return msg.channel.createMessage('Please give me a **valid** URL.'); 21 | 22 | let buffer; 23 | try{ 24 | buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/80s?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}`))).buffer() 25 | } catch (err) { 26 | console.log(`${__filename} - ${err}`) 27 | return msg.channel.createMessage('An error happened, Joined my support server for help! ||||'); 28 | } 29 | 30 | msg.channel.createMessage('', {file: buffer, name: `80s.png`}); 31 | }; 32 | }; -------------------------------------------------------------------------------- /src/Commands/Other/Ping.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const pm = require('pretty-ms'); 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'ping', 7 | desc: 'Pong', 8 | usage: 'ping', 9 | alli: ['latency'] 10 | }); 11 | }; 12 | 13 | async run(msg, args, data){ 14 | 15 | const toSend = { 16 | embed: { 17 | color: this.bot.colors.main, 18 | fields: [ 19 | { 20 | name: '__Database__:', 21 | value: this.bot.emojis.loading 22 | }, 23 | { 24 | name: `__Shard | ${msg.channel.guild.shard.id}__:`, 25 | value: this.bot.emojis.loading 26 | }, 27 | { 28 | name: '__Message Response__:', 29 | value: this.bot.emojis.loading 30 | } 31 | ] 32 | } 33 | } 34 | 35 | 36 | const message = await msg.channel.createMessage(toSend); 37 | const End = Date.now() - message.createdAt 38 | 39 | toSend.embed.fields[0].value = pm(data.ping); 40 | toSend.embed.fields[1].value = pm(msg.channel.guild.shard.latency); 41 | toSend.embed.fields[2].value = pm(End); 42 | 43 | message.edit(toSend); 44 | 45 | 46 | 47 | 48 | } 49 | }; -------------------------------------------------------------------------------- /src/Commands/Canvas/gay.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const fetch = require('node-fetch').default; 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'gay', 7 | desc: 'Huh', 8 | usage: 'gay [imgUrl | user]', 9 | category: 'Canvas', 10 | bPerms: ['attachFiles'], 11 | }); 12 | }; 13 | 14 | async run(msg, args, data){ 15 | 16 | 17 | const user = msg.mentions[0] || this.bot.users.get(args[0]); 18 | 19 | const imgUrl = user ? user.staticAvatarURL : null || this.bot.isUrl(args[0]) ? args[0] : null || msg.channel.lastAttachment ? msg.channel.lastAttachment.proxy_url : null; 20 | 21 | if(!imgUrl) return msg.channel.createMessage('I could not find a image in this channel, Please provide me with a user or a image URL.'); 22 | if(!this.bot.isUrl(imgUrl)) return msg.channel.createMessage('Please give me a **valid** URL.'); 23 | let buffer; 24 | try{ 25 | buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/gay?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}`))).buffer() 26 | } catch (err) { 27 | console.log(`${__filename} - ${err}`) 28 | return msg.channel.createMessage('An error happened, Joined my support server for help! ||||'); 29 | } 30 | 31 | 32 | msg.channel.createMessage('', {file: buffer, name: `gay.png`}); 33 | 34 | 35 | 36 | } 37 | }; -------------------------------------------------------------------------------- /src/Commands/Config/prefix.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'), 2 | mc = require('../../MessageCollector'); 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'prefix', 7 | desc: 'Change my prefix!', 8 | mPerms: ['manageGuild'], 9 | usage: 'prefix', 10 | category: 'Config' 11 | }); 12 | }; 13 | 14 | async run(msg, args, data){ 15 | 16 | const message = await msg.channel.createMessage('Please respond with a new prefix, If you want to cancel this respond with `cancel`. You have 10 seconds!') 17 | const collector = new mc(msg.channel, { 18 | filter: x => x.author.id == msg.author.id, 19 | }); 20 | collector.startCollecting(); 21 | 22 | collector.on('collect', m => { 23 | if(m.content == 'cancel') { 24 | message.edit('Action canceled.'); 25 | } else { 26 | const newPrefix = m.content.toLowerCase(); 27 | if(newPrefix == data.guild.prefix) return message.edit(`The prefix on this server is already \`${newPrefix}\`.`); 28 | if(newPrefix.length >= 10) return message.edit(`Your new prefix has to be under 10 characters.`); 29 | 30 | data.guild.prefix = newPrefix; 31 | data.guild.save().then(d => { 32 | message.edit(`My prefix on this server is now \`${d.prefix}\`!`); 33 | }); 34 | 35 | }; 36 | }); 37 | 38 | }; 39 | }; -------------------------------------------------------------------------------- /src/Commands/Config/ChatChannel.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'), 2 | mc = require('../../MessageCollector'); 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'chat-channel', 7 | desc: 'Set up my chat feature', 8 | mPerms: ['manageGuild'], 9 | usage: 'chat-channel <#channel | none>', 10 | category: 'Config', 11 | alli: ['cc', 'chatchannel'] 12 | }); 13 | }; 14 | 15 | async run(msg, args, data){ 16 | 17 | if(!args[0]) return msg.channel.send(`Invalid args, \`${data.guild.prefix}${this.usage}.\``); 18 | 19 | if(args[0].toLowerCase() == 'none') { 20 | if(data.guild.chatChannel) { 21 | data.guild.chatChannel = null; 22 | data.guild.save(); 23 | return msg.channel.send('Chat channel has been removed!'); 24 | } else { 25 | return msg.channel.send('You do not have a chat channel set.'); 26 | }; 27 | }; 28 | 29 | const channel = msg.channelMentions[0] ? msg.channel.guild.channels.get(msg.channelMentions[0]) : null || msg.channel.guild.channels.find(x => x.name.toLowerCase() == args[0].toLowerCase()); 30 | 31 | if(!channel) return msg.channel.send(`Invalid args, \`${data.guild.prefix}${this.usage}.\``); 32 | data.guild.chatChannel = channel.id; 33 | data.guild.save(); 34 | 35 | msg.channel.send(`<#${data.guild.chatChannel}> is now your chat channel!`); 36 | 37 | 38 | }; 39 | }; -------------------------------------------------------------------------------- /src/Commands/Other/RateLimit.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const fetch = require('node-fetch'); 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'rate-limit', 7 | desc: 'See the rate-limit of the API that the bot uses.', 8 | usage: 'rate-limit', 9 | alli: ['rl'] 10 | }); 11 | }; 12 | 13 | async run(msg, args, data){ 14 | 15 | const res = await (await (fetch(`${this.bot.baseApiUrl}/info/ratelimit?key=${this.bot.config.apiKey}`))).json(); 16 | 17 | const green = res.max / 2.8; 18 | const yellow = res.max / 1.22; 19 | 20 | 21 | msg.channel.createMessage( 22 | { 23 | embed: { 24 | title: `Rate-limit: ${res.used < green ? 'Good' : null || res.used < yellow ? 'Decent' : null || 'Bad'}`, 25 | color: res.used < green ? this.bot.colors.green : null || res.used < yellow ? this.bot.colors.yellow : null || this.bot.colors.red, 26 | fields: [ 27 | { 28 | name: '__Used__:', 29 | value: res.used, 30 | inline: true 31 | }, 32 | { 33 | name: '__Max__:', 34 | value: res.max, 35 | inline: true 36 | } 37 | ] 38 | } 39 | } 40 | ); 41 | 42 | } 43 | }; -------------------------------------------------------------------------------- /Config.example.json: -------------------------------------------------------------------------------- 1 | { 2 | "token": "", 3 | "mongoURI": "", 4 | "apiKey": "", 5 | "defaultPrefix": "z!", 6 | "mongooseOptions": { 7 | "useUnifiedTopology": true, 8 | "useNewUrlParser": true 9 | }, 10 | "logs": { 11 | "guildID": "767569427935133736", 12 | "channelID": "808833177493438465" 13 | }, 14 | "ZoopoOptions": { 15 | "allowedMentions": { 16 | "everyone": false, 17 | "roles": false, 18 | "users": true, 19 | "repliedUser": true 20 | }, 21 | "defaultImageFormat": "png", 22 | "defaultImageSize": 512, 23 | "disableEvents": [ 24 | "CHANNEL_CREATE", 25 | "CHANNEL_DELETE", 26 | "GUILD_BAN_ADD", 27 | "GUILD_BAN_REMOVE", 28 | "GUILD_CREATE", 29 | "GUILD_DELETE", 30 | "GUILD_MEMBER_UPDATE", 31 | "GUILD_ROLE_CREATE", 32 | "GUILD_ROLE_DELETE", 33 | "GUILD_ROLE_UPDATE", 34 | "MESSAGE_DELETE", 35 | "MESSAGE_DELETE_BULK", 36 | "MESSAGE_UPDATE", 37 | "PRESENCE_UPDATE", 38 | "TYPING_START", 39 | "USER_UPDATE", 40 | "VOICE_STATE_UPDATE" 41 | ], 42 | "intents": [ 43 | "guilds", 44 | "guildMembers", 45 | "guildInvites", 46 | "guildMessages" 47 | ], 48 | "messageLimit": 10, 49 | "ratelimiterOffset": 200, 50 | "reconnectDelay": 3000, 51 | "restMode": true 52 | }, 53 | "onceEvents": ["ready"] 54 | } -------------------------------------------------------------------------------- /src/Commands/Canvas/PetPet.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const fetch = require('node-fetch').default; 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'petpet', 7 | desc: 'petpet :yum:', 8 | usage: 'petpet [imgUrl | user]', 9 | category: 'Canvas', 10 | bPerms: ['attachFiles'], 11 | }); 12 | }; 13 | 14 | async run(msg, args, data){ 15 | 16 | const user = msg.mentions[0] || this.bot.users.get(args[0]); 17 | 18 | const imgUrl = user ? user.staticAvatarURL : null || this.bot.isUrl(args[0]) ? args[0] : null || msg.channel.lastAttachment ? msg.channel.lastAttachment.proxy_url : null; 19 | 20 | if(!imgUrl) return msg.channel.createMessage('I could not find a image in this channel, Please provide me with a user or a image URL.'); 21 | if(!this.bot.isUrl(imgUrl)) return msg.channel.createMessage('Please give me a **valid** URL.'); 22 | 23 | // const buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/petpet?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}`))).buffer(); 24 | let buffer; 25 | try{ 26 | buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/petpet?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}`))).buffer() 27 | } catch (err) { 28 | console.log(`${__filename} - ${err}`); 29 | return msg.channel.createMessage('An error happened, Joined my support server for help! ||||'); 30 | } 31 | 32 | msg.channel.createMessage('', {file: buffer, name: `petpet.gif`}); 33 | }; 34 | }; -------------------------------------------------------------------------------- /src/Commands/Canvas/circle.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const fetch = require('node-fetch').default; 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'circle', 7 | desc: 'Circle a image', 8 | usage: 'circle [imgUrl | user]', 9 | category: 'Canvas', 10 | bPerms: ['attachFiles'], 11 | }); 12 | }; 13 | 14 | async run(msg, args, data){ 15 | 16 | const user = msg.mentions[0] || this.bot.users.get(args[0]); 17 | 18 | const imgUrl = user ? user.staticAvatarURL : null || this.bot.isUrl(args[0]) ? args[0] : null || msg.channel.lastAttachment ? msg.channel.lastAttachment.proxy_url : null; 19 | 20 | if(!imgUrl) return msg.channel.createMessage('I could not find a image in this channel, Please provide me with a user or a image URL.'); 21 | if(!this.bot.isUrl(imgUrl)) return msg.channel.createMessage('Please give me a **valid** URL.'); 22 | 23 | // const buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/circle?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}`))).buffer(); 24 | let buffer; 25 | try{ 26 | buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/circle?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}`))).buffer() 27 | } catch (err) { 28 | console.log(`${__filename} - ${err}`) 29 | return msg.channel.createMessage('An error happened, Joined my support server for help! ||||'); 30 | } 31 | 32 | msg.channel.createMessage('', {file: buffer, name: `circle.png`}); 33 | }; 34 | }; -------------------------------------------------------------------------------- /src/Commands/Canvas/invert.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const fetch = require('node-fetch').default; 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'invert', 7 | desc: 'invert a image', 8 | usage: 'invert [imgUrl | user]', 9 | category: 'Canvas', 10 | bPerms: ['attachFiles'], 11 | }); 12 | }; 13 | 14 | async run(msg, args, data){ 15 | 16 | const user = msg.mentions[0] || this.bot.users.get(args[0]); 17 | 18 | const imgUrl = user ? user.staticAvatarURL : null || this.bot.isUrl(args[0]) ? args[0] : null || msg.channel.lastAttachment ? msg.channel.lastAttachment.proxy_url : null; 19 | 20 | if(!imgUrl) return msg.channel.createMessage('I could not find a image in this channel, Please provide me with a user or a image URL.'); 21 | if(!this.bot.isUrl(imgUrl)) return msg.channel.createMessage('Please give me a **valid** URL.'); 22 | 23 | // const buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/invert?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}`))).buffer(); 24 | let buffer; 25 | try{ 26 | buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/invert?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}`))).buffer() 27 | } catch (err) { 28 | console.log(`${__filename} - ${err}`) 29 | return msg.channel.createMessage('An error happened, Joined my support server for help! ||||'); 30 | } 31 | 32 | msg.channel.createMessage('', {file: buffer, name: `invert.png`}); 33 | }; 34 | }; -------------------------------------------------------------------------------- /src/Commands/Canvas/sepia.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const fetch = require('node-fetch').default; 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'sepia', 7 | desc: 'Add a sepia filter on a image', 8 | usage: 'sepia [imgUrl | user]', 9 | category: 'Canvas', 10 | bPerms: ['attachFiles'], 11 | }); 12 | }; 13 | 14 | async run(msg, args, data){ 15 | 16 | const user = msg.mentions[0] || this.bot.users.get(args[0]); 17 | 18 | const imgUrl = user ? user.staticAvatarURL : null || this.bot.isUrl(args[0]) ? args[0] : null || msg.channel.lastAttachment ? msg.channel.lastAttachment.proxy_url : null; 19 | 20 | if(!imgUrl) return msg.channel.createMessage('I could not find a image in this channel, Please provide me with a user or a image URL.'); 21 | if(!this.bot.isUrl(imgUrl)) return msg.channel.createMessage('Please give me a **valid** URL.'); 22 | 23 | // const buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/sepia?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}`))).buffer(); 24 | let buffer; 25 | try{ 26 | buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/sepia?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}`))).buffer() 27 | } catch (err) { 28 | console.log(`${__filename} - ${err}`) 29 | return msg.channel.createMessage('An error happened, Joined my support server for help! ||||'); 30 | } 31 | msg.channel.createMessage('', {file: buffer, name: `sepia.png`}); 32 | }; 33 | }; -------------------------------------------------------------------------------- /src/Commands/Canvas/greyscale.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const fetch = require('node-fetch').default; 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'greyscale', 7 | desc: 'greyscale a image', 8 | usage: 'greyscale [imgUrl | user]', 9 | category: 'Canvas', 10 | bPerms: ['attachFiles'], 11 | }); 12 | }; 13 | 14 | async run(msg, args, data){ 15 | 16 | const user = msg.mentions[0] || this.bot.users.get(args[0]); 17 | 18 | const imgUrl = user ? user.staticAvatarURL : null || this.bot.isUrl(args[0]) ? args[0] : null || msg.channel.lastAttachment ? msg.channel.lastAttachment.proxy_url : null; 19 | 20 | if(!imgUrl) return msg.channel.createMessage('I could not find a image in this channel, Please provide me with a user or a image URL.'); 21 | if(!this.bot.isUrl(imgUrl)) return msg.channel.createMessage('Please give me a **valid** URL.'); 22 | 23 | // const buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/greyscale?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}`))).buffer(); 24 | let buffer; 25 | try{ 26 | buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/greyscale?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}`))).buffer(); 27 | } catch (err) { 28 | console.log(`${__filename} - ${err}`); 29 | return msg.channel.createMessage('An error happened, Joined my support server for help! ||||'); 30 | } 31 | 32 | msg.channel.createMessage('', {file: buffer, name: `greyscale.png`}); 33 | }; 34 | }; -------------------------------------------------------------------------------- /src/Commands/Canvas/pixelate.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const fetch = require('node-fetch').default; 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'pixelate', 7 | desc: 'pixelate a image', 8 | usage: 'pixelate [imgUrl | user]', 9 | category: 'Canvas', 10 | bPerms: ['attachFiles'], 11 | }); 12 | }; 13 | 14 | async run(msg, args, data){ 15 | 16 | const user = msg.mentions[0] || this.bot.users.get(args[0]); 17 | 18 | const imgUrl = user ? user.staticAvatarURL : null || this.bot.isUrl(args[0]) ? args[0] : null || msg.channel.lastAttachment ? msg.channel.lastAttachment.proxy_url : null; 19 | 20 | if(!imgUrl) return msg.channel.createMessage('I could not find a image in this channel, Please provide me with a user or a image URL.'); 21 | if(!this.bot.isUrl(imgUrl)) return msg.channel.createMessage('Please give me a **valid** URL.'); 22 | 23 | // const buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/pixelate?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}&val=7`))).buffer(); 24 | let buffer; 25 | try{ 26 | buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/pixelate?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}&val=7`))).buffer(); 27 | } catch (err) { 28 | console.log(`${__filename} - ${err}`) 29 | return msg.channel.createMessage('An error happened, Joined my support server for help! ||||'); 30 | } 31 | 32 | msg.channel.createMessage('', {file: buffer, name: `pixelate.png`}); 33 | }; 34 | }; -------------------------------------------------------------------------------- /src/Commands/Canvas/contrast.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const fetch = require('node-fetch').default; 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'contrast', 7 | desc: 'Place a contrast filter on a image', 8 | usage: 'contrast [imgUrl | user]', 9 | category: 'Canvas', 10 | bPerms: ['attachFiles'], 11 | }); 12 | }; 13 | 14 | async run(msg, args, data){ 15 | 16 | const user = msg.mentions[0] || this.bot.users.get(args[0]); 17 | 18 | const imgUrl = user ? user.staticAvatarURL : null || this.bot.isUrl(args[0]) ? args[0] : null || msg.channel.lastAttachment ? msg.channel.lastAttachment.proxy_url : null; 19 | 20 | if(!imgUrl) return msg.channel.createMessage('I could not find a image in this channel, Please provide me with a user or a image URL.'); 21 | if(!this.bot.isUrl(imgUrl)) return msg.channel.createMessage('Please give me a **valid** URL.'); 22 | 23 | // const buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/contrast?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}&val=.5`))).buffer(); 24 | let buffer; 25 | try{ 26 | buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/contrast?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}&val=.5`))).buffer() 27 | } catch (err) { 28 | console.log(`${__filename} - ${err}`) 29 | return msg.channel.createMessage('An error happened, Joined my support server for help! ||||'); 30 | } 31 | 32 | msg.channel.createMessage('', {file: buffer, name: `contrast.png`}); 33 | }; 34 | }; -------------------------------------------------------------------------------- /src/Commands/Owner/Eval.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const { inspect } = require("util"); 3 | const hastePls = require('haste-pls'); 4 | 5 | module.exports = class Help extends Base { 6 | constructor(bot) { 7 | super(bot, { 8 | name: 'eval', 9 | desc: 'EVAL', 10 | usage: 'EVAL', 11 | category: 'Owner' 12 | }); 13 | }; 14 | 15 | async run(msg, args, data){ 16 | 17 | if(msg.author.id != '695520751842885672') return; 18 | 19 | let input = args.join(" "), 20 | hasAwait = input.includes("await"), 21 | hasReturn = input.includes("return"), 22 | evaled, 23 | startTime = Date.now() 24 | if(!input) return msg.channel.send({ 25 | content: "Give me input bruh", 26 | }) 27 | 28 | try{ 29 | evaled = hasAwait ? await eval(`(async () => { ${hasReturn ? " " : "return"} ${input} })()`) : eval(input); 30 | if(typeof evaled != "string"){ 31 | evaled = inspect(evaled, { 32 | depth: Number(msg.content.slice(-1)) || +!(inspect(evaled, { depth: 2 })) 33 | //depth: 1 34 | }); 35 | } 36 | }catch(err){ 37 | evaled = err; 38 | } 39 | 40 | evaled = evaled.toString(); 41 | 42 | evaled = evaled.split(this.bot.config.token).join("botToken"); 43 | 44 | if(evaled.length > 1900) { 45 | const bin = await new hastePls(evaled).post() 46 | msg.channel.send(bin.link); 47 | // evaled = evaled.slice(0, 1900); 48 | } else msg.channel.send(`${Date.now() - startTime} \`\`\`js\n${evaled}\`\`\``); 49 | 50 | 51 | 52 | 53 | } 54 | }; -------------------------------------------------------------------------------- /src/Commands/Canvas/Brightness.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const fetch = require('node-fetch').default; 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'brightness', 7 | usage: 'brightness [imgUrl | user] [val]', 8 | category: 'Canvas', 9 | bPerms: ['attachFiles'], 10 | }); 11 | }; 12 | 13 | async run(msg, args, data){ 14 | 15 | const user = msg.mentions[0] || this.bot.users.get(args[0]); 16 | 17 | const imgUrl = user ? user.staticAvatarURL : null || this.bot.isUrl(args[0]) ? args[0] : null || msg.channel.lastAttachment ? msg.channel.lastAttachment.proxy_url : null; 18 | 19 | if(!imgUrl) return msg.channel.createMessage('I could not find a image in this channel, Please provide me with a user or a image URL.'); 20 | if(!this.bot.isUrl(imgUrl)) return msg.channel.createMessage('Please give me a **valid** URL.'); 21 | 22 | // const buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/brightness?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}&val=${Number(args[1]) && Number(args[1]) <= 1 && Number(args[1]) >= .1 ? args[1] : null || '.7'}`))).buffer(); 23 | let buffer; 24 | try{ 25 | buffer = await (await (fetch(`${this.bot.baseApiUrl}/canvas/brightness?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}&val=${Number(args[1]) && Number(args[1]) <= 1 && Number(args[1]) >= .1 ? args[1] : null || '.7'}`))).buffer() 26 | } catch (err) { 27 | console.log(`${__filename} - ${err}`) 28 | return msg.channel.createMessage('An error happened, Joined my support server for help! ||||'); 29 | } 30 | 31 | msg.channel.createMessage('', {file: buffer, name: `brightness.png`}); 32 | }; 33 | }; -------------------------------------------------------------------------------- /src/Commands/Other/Help.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | module.exports = class Help extends Base { 3 | constructor(bot) { 4 | super(bot, { 5 | name: 'help', 6 | desc: 'If you don\'t know how to use me use this!', 7 | usage: 'help [command]' 8 | }); 9 | }; 10 | 11 | async run(msg, args, data){ 12 | 13 | const toSend = { 14 | content: 'Support server: https://discord.gg/5q8rQeA3m2', 15 | embed: { 16 | color: this.bot.colors.main, 17 | fields: [], 18 | description: `Use \`${data.guild.prefix}help \`, For more help on a command!` 19 | } 20 | } 21 | 22 | const allCategorys = [ ...new Set( this.bot.commands.filter(x => x.value.category, true).map(x => x.category) ) ]; 23 | 24 | if(!args[0]) { 25 | allCategorys.forEach(c => { 26 | if(c == 'Owner') return; 27 | const allCommands = [ ...new Set( this.bot.commands.filter(x => x.value.category == c, true).map(x => x.name) ) ]; 28 | toSend.embed.fields.push({name: c, value: `\`${allCommands.join('`, `')}\``}); 29 | }); 30 | } else { 31 | const cmd = await this.bot.commands.get(args[0].toLowerCase()) || this.bot.commands.get(this.bot.alli.get(args[0].toLowerCase())); 32 | if(!cmd) return msg.channel.createMessage({ 33 | embed: { 34 | color: this.bot.colors.red, 35 | description: `**${args[0].slice(0, 100)}** is not a command.` 36 | } 37 | }); 38 | toSend.embed.description = cmd.desc; 39 | toSend.embed.title = `Command ${cmd.name}`; 40 | 41 | toSend.embed.fields.push({name: '__Usage__:', value: cmd.usage == 'None' ? cmd.usage : `\`${data.guild.prefix}${cmd.usage}\``}); 42 | toSend.embed.fields.push({name: '__Alias(es)__:', value: cmd.alli[0] ? `\`${cmd.alli.join('`, `')}\`` : 'None'}); 43 | }; 44 | 45 | 46 | msg.channel.createMessage(toSend); 47 | } 48 | }; -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | Config.json 106 | .DS_Store 107 | -------------------------------------------------------------------------------- /src/Commands/Canvas/resize.js: -------------------------------------------------------------------------------- 1 | const Base = require('../../BaseCommand'); 2 | const fetch = require('node-fetch').default; 3 | module.exports = class Help extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'resize', 7 | desc: 'pixelate a image', 8 | usage: 'pixelate [imgUrl | user] ', 9 | category: 'Canvas', 10 | bPerms: ['attachFiles'], 11 | }); 12 | }; 13 | 14 | async run(msg, args, data){ 15 | 16 | const user = msg.mentions[0] || this.bot.users.get(args[0]); 17 | 18 | const imgUrl = user ? user.staticAvatarURL : null || this.bot.isUrl(args[0]) ? args[0] : null || msg.channel.lastAttachment ? msg.channel.lastAttachment.proxy_url : null; 19 | 20 | if(!imgUrl) return msg.channel.createMessage('I could not find a image in this channel, Please provide me with a user or a image URL.'); 21 | if(!this.bot.isUrl(imgUrl)) return msg.channel.createMessage('Please give me a **valid** URL.'); 22 | 23 | const x = parseInt(args[1]) || null; 24 | const y = parseInt(args[2]) || null; 25 | 26 | if(x && x > 2000) { 27 | return msg.channel.createMessage('**X** can not be larger then 2000.'); 28 | }; 29 | if(y && y > 2000) { 30 | return msg.channel.createMessage('**Y** can not be larger then 2000.'); 31 | }; 32 | 33 | if(!x && !y) return msg.channel.createMessage('Missing both **X** and **Y** you have to give at-least one.') 34 | // const res = await ( await fetch(encodeURI(`${this.bot.baseApiUrl}/canvas/resize?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}${x ? `&x=${x}` : ''}${y ? `&y=${y}` : ''}`))).buffer(); 35 | let buffer; 36 | try{ 37 | buffer = await (await (fetch(encodeURI(`${this.bot.baseApiUrl}/canvas/resize?key=${this.bot.config.apiKey}&imgUrl=${imgUrl}${x ? `&x=${x}` : ''}${y ? `&y=${y}` : ''}`)))).buffer(); 38 | } catch (err) { 39 | console.log(`${__filename} - ${err}`); 40 | return msg.channel.createMessage('An error happened, Joined my support server for help! ||||'); 41 | } 42 | 43 | msg.channel.createMessage('', {file: buffer, name: 'resized.png'}); 44 | 45 | }; 46 | }; -------------------------------------------------------------------------------- /src/ZoopoClient.js: -------------------------------------------------------------------------------- 1 | const { Client } = require('eris'), 2 | fs = require('fs'), 3 | mongoose = require('mongoose'), 4 | ExtendedMap = require('./ExtendedMap'); 5 | 6 | class ZoopoClient extends Client { 7 | constructor(token, options, config) { 8 | super(token, options); 9 | 10 | this.config = config; 11 | 12 | this.commands = new ExtendedMap(); 13 | this.alli = new ExtendedMap(); 14 | 15 | this.db = { 16 | guilds: new (require('./Database/GuildManager'))() 17 | }; 18 | 19 | this.colors = { 20 | main: 0xf7c38e, 21 | red: 0xff1800, 22 | yellow: 0xFFFF00, 23 | green: 0x008000 24 | }; 25 | 26 | this.emojis = { 27 | loading: '' 28 | }; 29 | 30 | this.baseApiUrl = 'https://api.monkedev.com' 31 | }; 32 | 33 | loadCommands(dir) { 34 | const Commands = fs.readdirSync(dir); 35 | Commands.forEach(cmd => { 36 | if(!cmd.endsWith('.js')) return this.loadCommands(dir + `/${cmd}`); 37 | 38 | const file = new (require(dir + `/${cmd}`))(this); 39 | this.commands.set(file.name, file); 40 | file.alli.forEach(alli => { 41 | this.alli.set(alli, file.name); 42 | }); 43 | 44 | console.log(`Command ${file.name} loaded!`); 45 | }); 46 | }; 47 | 48 | loadEvents(dir) { 49 | const Events = fs.readdirSync(dir); 50 | Events.forEach(event => { 51 | if(!event.endsWith('.js')) return this.loadEvents(dir + `/${event}`); 52 | 53 | const file = new (require(dir + `/${event}`))(this); 54 | if(this.config.onceEvents.includes(file.name)) { 55 | this.once(file.name, (...args) => file.run(...args)); 56 | console.log(`Event ${file.name} loaded as once event!`); 57 | } else { 58 | this.on(file.name, (...args) => file.run(...args)); 59 | console.log(`Event ${file.name} loaded!`); 60 | } 61 | }); 62 | }; 63 | 64 | async connectDatabase() { 65 | await mongoose.connect(this.config.mongoURI, this.config.mongooseOptions); 66 | console.log('MongoDB connected!'); 67 | }; 68 | 69 | isUrl(url) { 70 | const pattern = new RegExp('^((ft|htt)ps?:\\/\\/)?'+ 71 | '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ 72 | '((\\d{1,3}\\.){3}\\d{1,3}))'+ 73 | '(\\:\\d+)?'+ 74 | '(\\/[-a-z\\d%@_.~+&:]*)*'+ 75 | '(\\?[;&a-z\\d%@_.,~+&:=-]*)?'+ 76 | '(\\#[-a-z\\d_]*)?$','i'); 77 | if(!pattern.test(url)) return false; 78 | else return url; 79 | }; 80 | 81 | }; 82 | 83 | module.exports = ZoopoClient; -------------------------------------------------------------------------------- /Zoopo.js: -------------------------------------------------------------------------------- 1 | const ZoopoClient = require('./src/ZoopoClient'), 2 | Config = require('./Config.json'), 3 | Zoopo = new ZoopoClient(Config.token, Config.ZoopoOptions, Config); 4 | 5 | const Init = async () => { 6 | Zoopo.loadCommands(__dirname + '/src/Commands'); 7 | Zoopo.loadEvents(__dirname + '/src/Events'); 8 | await Zoopo.connectDatabase(); 9 | 10 | Zoopo.connect(); 11 | }; 12 | 13 | Init(); 14 | 15 | // Up time thingeeee 16 | /* 17 | const http = require('http'); 18 | http.createServer(function (req, res) { 19 | res.writeHead(200, {'Content-Type': 'text/plain'}); 20 | res.end('ok'); 21 | }).listen(25569); 22 | */ 23 | 24 | function getRandomColor() { 25 | var letters = '0123456789ABCDEF'; 26 | var color = '0x'; 27 | for (var i = 0; i < 6; i++) { 28 | color += letters[Math.floor(Math.random() * 16)]; 29 | } 30 | return color; 31 | } 32 | 33 | const app = require('express')(); 34 | const bodyParser = require('body-parser'); 35 | const fetch = require('node-fetch').default; 36 | 37 | // Uptime 38 | app.get('/', (req, res) => { 39 | res.status(200).send('ok'); 40 | }); 41 | 42 | // Votes 43 | app.post('/vote', bodyParser.json(), (req, res) => { 44 | // console.log(req.headers, req.body); 45 | const { authorization } = req.headers; 46 | const { bot, user } = req.body; 47 | if(authorization != Config['top.gg_auth']) { 48 | console.log(`No auth from ${req.headers['user-agent']}, auth: ${authorization}`); 49 | return res.status(400).send('Wrong auth :sob:'); 50 | }; 51 | const howMany = Math.floor(Math.random() * 3000); 52 | // Wassup <@!${user}>, Thank you for voting for Zoopo, You earned ${howMany} points! 53 | Zoopo.createMessage('779441136719757323', { 54 | content: `<@!${user}>`, 55 | embed: { 56 | description: `Thank you for voting for me!`, 57 | fields: [ 58 | { 59 | name: 'Points gained', 60 | value: `${howMany}`, 61 | inline: true 62 | }, 63 | { 64 | name: 'Vote link', 65 | value: '[Click ME](https://top.gg/bot/807048838362955798/vote)', 66 | inline: true 67 | } 68 | ], 69 | color: Number(getRandomColor()) 70 | } 71 | }) 72 | // console.log(user) 73 | // 74 | 75 | fetch('https://afk.monkedev.com/points/add', { method: 'POST', headers: { userid: user, howmany: howMany, auth: Config.adminKey }}); 76 | res.status(200).send('ok'); 77 | }); 78 | 79 | const port = process.env.PORT || 25569; 80 | app.listen(port, () => console.log('On port: ' + port)); 81 | 82 | // Server count 83 | setInterval(() => { 84 | fetch('https://top.gg/api/bots/807048838362955798/stats', { 85 | method: 'POST', 86 | body: JSON.stringify({ 87 | server_count: Zoopo.guilds.size, 88 | shard_count: Zoopo.shards.size 89 | }), 90 | headers: { 91 | Authorization: Config['top.gg_token'], 92 | 'Content-Type': 'application/json' 93 | } 94 | }); 95 | }, 1000 * 60); // 1 min -------------------------------------------------------------------------------- /src/Events/messageCreate.js: -------------------------------------------------------------------------------- 1 | const Base = require('../BaseEvent'); 2 | const fetch = require('node-fetch').default; 3 | module.exports = class messageCreate extends Base { 4 | constructor(bot) { 5 | super(bot, { 6 | name: 'messageCreate' 7 | }); 8 | 9 | this.chatCooldown = new Map(); 10 | }; 11 | 12 | async run(msg) { 13 | 14 | msg.channel.send = msg.channel.createMessage; 15 | // if(msg.channel.guild.id != this.bot.config.logs.guildID) return; 16 | 17 | const { content, guildID, member, channel } = msg; 18 | 19 | const data = {}; 20 | 21 | const start = Date.now(); 22 | data.guild = await this.bot.db.guilds.get(guildID); 23 | data.ping = Date.now() - start; 24 | 25 | if(data.guild.chatChannel === msg.channel.id) { 26 | if(msg.author.bot) return; 27 | 28 | if(this.chatCooldown.has(msg.author.id)) return 29 | else { 30 | this.chatCooldown.set(msg.author.id, Date.now()); 31 | setTimeout(() => { 32 | this.chatCooldown.delete(msg.author.id); 33 | }, 1500); 34 | 35 | const res = await (await fetch(`${this.bot.baseApiUrl}/fun/chat?key=${this.bot.config.apiKey}&msg=${encodeURIComponent(msg.content)}&uid=${msg.author.id}`)).json(); 36 | return msg.channel.send({ 37 | content: res.response, 38 | messageReference: { messageID: msg.id } 39 | }); 40 | }; 41 | }; 42 | 43 | if(msg.content == `<@${this.bot.user.id}>` || msg.content == `<@!${this.bot.user.id}>`) { 44 | msg.channel.createMessage({ 45 | embed: { 46 | color: this.bot.colors.main, 47 | title: `Hello, ${msg.author.username} :wave:`, 48 | description: `My prefix in **${msg.channel.guild.name}** is **${data.guild.prefix}**.\nI'm a bot created by [MonkeDev](https://monkedev.com) with the purpose of using their [API](https://api.monkedev.com), if you need help join my [support server](https://discord.gg/5q8rQeA3m2)!` 49 | } 50 | }) 51 | } 52 | if(msg.attachments[0]) { 53 | if (msg.attachments[0].url.endsWith('.png') || msg.attachments[0].url.endsWith('.jpeg') || msg.attachments[0].url.endsWith('.jpg')) { 54 | msg.channel.lastAttachment = msg.attachments[0]; 55 | }; 56 | }; 57 | 58 | if(msg.author.bot || !msg.guildID) return; 59 | 60 | 61 | if(!content.toLowerCase().startsWith(data.guild.prefix.toLowerCase())) return; 62 | 63 | 64 | const args = content.split(/ +/); 65 | 66 | const cmd = this.bot.commands.get(args[0].slice(data.guild.prefix.length).toLowerCase()) || this.bot.commands.get(this.bot.alli.get(args[0].slice(data.guild.prefix.length).toLowerCase())); 67 | 68 | if(!cmd) return; 69 | 70 | const ME = await msg.channel.guild.members.get(this.bot.user.id); 71 | if(!msg.channel.permissionsOf(this.bot.user.id).has('sendMessages') || !msg.channel.permissionsOf(this.bot.user.id).has('embedLinks')) return; 72 | 73 | const neededMperms = []; 74 | cmd.mPerms.forEach(perm => { 75 | if(!member.permissions.json[perm]) neededMperms.push(perm); 76 | }); 77 | 78 | const neededBperms = []; 79 | cmd.bPerms.forEach(perm => { 80 | if(!ME.permissions.json[perm]) neededBperms.push(perm); 81 | }); 82 | 83 | if(neededMperms[0]) return channel.createMessage({ 84 | embed: { 85 | color: this.bot.colors.red, 86 | title: 'Missing permission(s)', 87 | description: `You're missing \`${neededMperms.join('` & `')}\` permission(s), Therefore you can't execute this command.` 88 | } 89 | }); 90 | if(neededBperms[0]) return channel.createMessage({ 91 | embed: { 92 | color: this.bot.colors.red, 93 | title: 'Missing permission(s)', 94 | description: `I'm missing \`${neededBperms.join('` & `')}\` permission(s), Therefore I can't execute this command.` 95 | } 96 | }); 97 | 98 | 99 | cmd.run(msg, args.slice(1), data).catch(err => { 100 | msg.channel.send('An error has happened, Join my support server for help! || https://discord.gg/5q8rQeA3m2 ||'); 101 | throw err; 102 | }); 103 | } 104 | } -------------------------------------------------------------------------------- /src/MessageCollector.js: -------------------------------------------------------------------------------- 1 | const { EventEmitter } = require('events'); 2 | const { Collection, Message } = require('eris'); 3 | const { scheduleJob, rescheduleJob } = require('node-schedule'); 4 | const defaults = { 5 | idle: 10000, 6 | maxCount: 1, 7 | filter: (msg) => msg.content.length > 0 8 | } 9 | 10 | class MessageCollector extends EventEmitter { 11 | constructor(channel, options = {}) { 12 | super(); 13 | const cOptions = Object.assign(defaults, options); 14 | this.channel = channel; 15 | this.timeout = cOptions.timeout; 16 | this.maxCount = cOptions.maxCount; 17 | this.filter = cOptions.filter; 18 | this.collecting = false; 19 | this.idle = cOptions.idle; 20 | this.messages = new Collection(Message); 21 | 22 | this._onMessage = this._onMessage.bind(this); 23 | this._onMessageUpdate = this._onMessageUpdate.bind(this); 24 | this._onMessageDelete = this._onMessageDelete.bind(this); 25 | this._onGuildDelete = this._onGuildDelete.bind(this); 26 | this._onChannelDelete = this._onChannelDelete.bind(this); 27 | 28 | this.onCollect = this.onCollect.bind(this); 29 | this.onUpdate = this.onUpdate.bind(this); 30 | this.onDelete = this.onDelete.bind(this); 31 | } 32 | 33 | /** 34 | * 35 | * @private 36 | */ 37 | _onMessage(msg) { 38 | if (!this.collecting) return; 39 | if (this.channel.id != msg.channel.id) return; 40 | if (this.idle && typeof this.idle == "number") rescheduleJob(`${this.channel.id}`, Date.now() + this.idle); 41 | if (!this.filter(msg)) return; 42 | this.emit('collect', msg); 43 | } 44 | 45 | /** 46 | * 47 | * @private 48 | */ 49 | _onGuildDelete(guild) { 50 | if (this.channel.guild.id == guild.id) this.stop(); 51 | } 52 | 53 | /** 54 | * 55 | * @private 56 | */ 57 | _onChannelDelete(channel) { 58 | if (this.channel.id == channel.id) this.stop(); 59 | } 60 | 61 | /** 62 | * @private 63 | */ 64 | _onMessageUpdate(msg, oldMsg) { 65 | if (!this.collecting) return; 66 | if (this.channel.id != msg.channel.id) return; 67 | if (!this.filter(msg)) return this.messages.remove(msg); 68 | if (!this.messages.has(oldMsg.id)) return this.emit('collect', msg); 69 | this.emit('update', msg); 70 | } 71 | 72 | /** 73 | * @private 74 | */ 75 | _onMessageDelete(msg) { 76 | if (!this.collecting) return; 77 | if (!this.messages.has(msg.id)) return; 78 | this.emit('delete', msg); 79 | } 80 | 81 | /** 82 | * 83 | * @private 84 | */ 85 | onCollect(msg) { 86 | this.messages.add(msg); 87 | if (this.maxCount && this.messages.size == this.maxCount) { 88 | this.stop(); 89 | } 90 | } 91 | 92 | /** 93 | * 94 | * @private 95 | */ 96 | onUpdate(msg) { 97 | this.messages.update(msg); 98 | } 99 | 100 | /** 101 | * 102 | * @private 103 | */ 104 | onDelete(msg) { 105 | this.messages.delete(msg); 106 | } 107 | 108 | startCollecting() { 109 | this.collecting = true; 110 | if (this.idle && typeof this.idle == "number") scheduleJob(`${this.channel.id}`, Date.now() + this.idle, () => this.stop()); 111 | return new Promise((res) => { 112 | this.channel.client.setMaxListeners(this.getMaxListeners() + 1); 113 | this.channel.client.on('messageCreate', this._onMessage); 114 | 115 | this.channel.client.on('guildDelete', this._onGuildDelete); 116 | this.channel.client.on('channelDelete', this._onChannelDelete); 117 | 118 | this.setMaxListeners(this.getMaxListeners() + 1); 119 | this.on('collect', this.onCollect); 120 | this.on('update', this.onUpdate); 121 | this.on('delete', this.onDelete); 122 | 123 | if (this.timeout) setTimeout(() => this.stop(), this.timeout); 124 | this.once('stop', () => res(this)); 125 | }); 126 | } 127 | 128 | stop() { 129 | this.messages.clear(); 130 | this.collecting = false; 131 | this.channel.client.setMaxListeners(this.getMaxListeners() - 1); 132 | this.channel.client.off('messageCreate', this._onMessage); 133 | this.channel.client.off('guildDelete', this._onGuildDelete); 134 | this.channel.client.off('channelDelete', this._onChannelDelete); 135 | 136 | this.setMaxListeners(this.getMaxListeners() - 1); 137 | this.channel.client.off('collect', this.onCollect); 138 | this.channel.client.off('update', this.onUpdate); 139 | this.channel.client.off('delete', this.onDelete); 140 | this.emit("stop"); 141 | return this; 142 | } 143 | 144 | setIdle(time) { 145 | if (isNaN(time)) return; 146 | this.idle = time; 147 | rescheduleJob(`${this.channel.id}`, Date.now() + this.idle); 148 | return this; 149 | } 150 | } 151 | module.exports = MessageCollector; -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------