diff --git a/commands/admin/autoresponse.js b/commands/admin/autoresponse.js index 0639cbe..cad071b 100644 --- a/commands/admin/autoresponse.js +++ b/commands/admin/autoresponse.js @@ -2,82 +2,82 @@ const fs = require('fs'); const { Command } = require('discord-akairo'); class autoresponseCommand extends Command { - constructor() { - super('autoresponse', { - aliases: ['autoresponse'], - category: 'admin', - args: [ - { - id: 'text', - type: 'string' - }, - { - id: 'all', - type: 'string' - } - ], - userPermissions: ['ADMINISTRATOR'], - channelRestriction: 'guild', - description: { - content: 'enable/disable autoresponse', - usage: '[enable/disable] (optional) [all]', - examples: ['enable all'] - } - }); - } + constructor() { + super('autoresponse', { + aliases: ['autoresponse'], + category: 'admin', + args: [ + { + id: 'text', + type: 'string' + }, + { + id: 'all', + type: 'string' + } + ], + userPermissions: ['ADMINISTRATOR'], + channelRestriction: 'guild', + description: { + content: 'enable/disable autoresponse', + usage: '[enable/disable] (optional) [all]', + examples: ['enable all'] + } + }); + } - async exec(message, args) { - let text = args.text; - let all = args.all; + async exec(message, args) { + let text = args.text; + let all = args.all; - let autoresponse = {}; - let json = JSON.stringify(autoresponse); + let autoresponse = {}; + let json = JSON.stringify(autoresponse); - if (all == 'all') { - const guild = this.client.guilds.get(message.guild.id); + if (all == 'all') { + const guild = this.client.guilds.get(message.guild.id); - fs.readFile('./json/autoresponse.json', 'utf8', function readFileCallback(err, data) { - if (err) { - fs.close(); - console.log(err); - } else { + fs.readFile('./json/autoresponse.json', 'utf8', function readFileCallback(err, data) { + if (err) { + fs.close(); + console.log(err); + } else { - autoresponse = JSON.parse(data); //now it an object - guild.channels.forEach(channel => autoresponse[channel] = text); - json = JSON.stringify(autoresponse); //convert it back to json - json = json.replace(/[<#>]/g, ''); - fs.writeFile('./json/autoresponse.json', json, 'utf8', function (err) { - if (err) { - fs.close(); - return console.log(err); - } - }) - } - }); + autoresponse = JSON.parse(data); //now it an object + guild.channels.forEach(channel => autoresponse[channel] = text); + json = JSON.stringify(autoresponse); //convert it back to json + json = json.replace(/[<#>]/g, ''); + fs.writeFile('./json/autoresponse.json', json, 'utf8', function (err) { + if (err) { + fs.close(); + return console.log(err); + } + }); + } + }); - fs.close(); - return message.channel.send('Auto response have been disable/enable on every channel'); + fs.close(); + return message.channel.send('Auto response have been disable/enable on every channel'); - } else if (text == 'disable' || 'enable') { - fs.readFile('./json/autoresponse.json', 'utf8', function readFileCallback(err, data) { - if (err) { - console.log(err); - } else { - autoresponse = JSON.parse(data); //now it an object - autoresponse[message.channel.id] = text; - json = JSON.stringify(autoresponse); //convert it back to json - fs.writeFile('./json/autoresponse.json', json, 'utf8', function (err) { - if (err) { - fs.close(); - return console.log(err); - } - }) - } - }) - }; + } else if (text == 'disable' || 'enable') { + fs.readFile('./json/autoresponse.json', 'utf8', function readFileCallback(err, data) { + if (err) { + console.log(err); + } else { + autoresponse = JSON.parse(data); //now it an object + autoresponse[message.channel.id] = text; + json = JSON.stringify(autoresponse); //convert it back to json + fs.writeFile('./json/autoresponse.json', json, 'utf8', function (err) { + if (err) { + fs.close(); + return console.log(err); + } + }); + } + }); + } - fs.close(); - return message.channel.send(`Autoresponse have been ${text}d`); - } + fs.close(); + return message.channel.send(`Autoresponse have been ${text}d`); + } } module.exports = autoresponseCommand; \ No newline at end of file diff --git a/commands/admin/ban.js b/commands/admin/ban.js index a6823a8..0eadb57 100644 --- a/commands/admin/ban.js +++ b/commands/admin/ban.js @@ -1,46 +1,46 @@ const { Command } = require('discord-akairo'); class BanCommand extends Command { - constructor() { - super('ban', { - aliases: ['ban'], - category: 'admin', - split: 'quote', - args: [ - { - id: 'member', - type: 'member' - }, - { - id: 'reasons', - type: 'string' - } - ], - clientPermissions: ['BAN_MEMBERS'], - userPermissions: ['BAN_MEMBERS'], - channelRestriction: 'guild', - description: { - content: 'Ban user', - usage: '[@user]', - examples: ['@user big dumb dumb'] - } - }); - } + constructor() { + super('ban', { + aliases: ['ban'], + category: 'admin', + split: 'quote', + args: [ + { + id: 'member', + type: 'member' + }, + { + id: 'reasons', + type: 'string' + } + ], + clientPermissions: ['BAN_MEMBERS'], + userPermissions: ['BAN_MEMBERS'], + channelRestriction: 'guild', + description: { + content: 'Ban user', + usage: '[@user]', + examples: ['@user big dumb dumb'] + } + }); + } - async exec(message, args) { - let member = args.member; - let reasons = args.reasons; + async exec(message, args) { + let member = args.member; + let reasons = args.reasons; - if(member == this.client) - return message.channel.send('Cant ban me fool') - if(!reasons) - reasons = 'Nothing have been specified' - if(member.id === message.author.id) - return message.channel.send("Why would you ban yourself ?") + if(member == this.client) + return message.channel.send('Cant ban me fool'); + if(!reasons) + reasons = 'Nothing have been specified'; + if(member.id === message.author.id) + return message.channel.send('Why would you ban yourself ?'); - member.ban(`Banned by : ${message.author.username} for the following reasons : ${reasons}`) - .then(() => message.reply(`${member.user.username} was succesfully banned with the following reasons "${reasons}".`)) - } + member.ban(`Banned by : ${message.author.username} for the following reasons : ${reasons}`) + .then(() => message.reply(`${member.user.username} was succesfully banned with the following reasons "${reasons}".`)); + } } module.exports = BanCommand; \ No newline at end of file diff --git a/commands/admin/kick.js b/commands/admin/kick.js index b7467e5..a0d940a 100644 --- a/commands/admin/kick.js +++ b/commands/admin/kick.js @@ -1,47 +1,47 @@ const { Command } = require('discord-akairo'); class KickCommand extends Command { - constructor() { - super('kick', { - aliases: ['kick'], - category: 'admin', - split: 'quoted', - args: [ - { - id: 'member', - type: 'member' - }, - { - id: 'reasons', - type: 'string' - } - ], - clientPermissions: ['KICK_MEMBERS'], - userPermissions: ['KICK_MEMBERS'], - channelRestriction: 'guild', - description: { - content: 'Kick user', - usage: '[@user]', - examples: ['@user big dumb dumb'] - } - }); - } + constructor() { + super('kick', { + aliases: ['kick'], + category: 'admin', + split: 'quoted', + args: [ + { + id: 'member', + type: 'member' + }, + { + id: 'reasons', + type: 'string' + } + ], + clientPermissions: ['KICK_MEMBERS'], + userPermissions: ['KICK_MEMBERS'], + channelRestriction: 'guild', + description: { + content: 'Kick user', + usage: '[@user]', + examples: ['@user big dumb dumb'] + } + }); + } - async exec(message, args) { - let member = args.member; - let reasons = args.reasons; + async exec(message, args) { + let member = args.member; + let reasons = args.reasons; - if(member === this.client.user) - return message.channel.say('Cant kick me fool'); - if(member.id === message.author.id) - return message.channel.say("Why would you kick yourself ?"); - if(!reasons) - reasons = 'Nothing have been specified.'; + if(member === this.client.user) + return message.channel.say('Cant kick me fool'); + if(member.id === message.author.id) + return message.channel.say('Why would you kick yourself ?'); + if(!reasons) + reasons = 'Nothing have been specified.'; - await member.kick(`Kicked by : ${message.author.username} for the following reasons : ${reasons}`) - .then(() => message.reply(`${member.user.username} was succesfully kicked with the following reasons "${reasons}".`)) - .catch(err => console.error(err)) - } + await member.kick(`Kicked by : ${message.author.username} for the following reasons : ${reasons}`) + .then(() => message.reply(`${member.user.username} was succesfully kicked with the following reasons "${reasons}".`)) + .catch(err => console.error(err)); + } } module.exports = KickCommand; \ No newline at end of file diff --git a/commands/admin/prune.js b/commands/admin/prune.js index 7ffe7a7..86d3548 100644 --- a/commands/admin/prune.js +++ b/commands/admin/prune.js @@ -1,31 +1,31 @@ const { Command } = require('discord-akairo'); class PruneCommand extends Command { - constructor() { - super('Prune', { - aliases: ['Prune', 'clean', 'purge'], - category: 'admin', - args: [ - { - id: "amount", - type: "integer" - } - ], - clientPermissions: ['MANAGE_MESSAGES'], - userPermissions: ['MANAGE_MESSAGES'], - channelRestriction: 'guild', - description: { - content: 'Bulk delete messages', - usage: '[amount]', - examples: ['50'] - } - }); - } + constructor() { + super('Prune', { + aliases: ['Prune', 'clean', 'purge'], + category: 'admin', + args: [ + { + id: 'amount', + type: 'integer' + } + ], + clientPermissions: ['MANAGE_MESSAGES'], + userPermissions: ['MANAGE_MESSAGES'], + channelRestriction: 'guild', + description: { + content: 'Bulk delete messages', + usage: '[amount]', + examples: ['50'] + } + }); + } - async exec(message,args) { - if (args.amount >= 100) return; - message.channel.bulkDelete(args.amount + 1, true); - } + async exec(message,args) { + if (args.amount >= 100) return; + message.channel.bulkDelete(args.amount + 1, true); + } } module.exports = PruneCommand; \ No newline at end of file diff --git a/commands/admin/shameboard.js b/commands/admin/shameboard.js index b43240a..406dd51 100644 --- a/commands/admin/shameboard.js +++ b/commands/admin/shameboard.js @@ -2,47 +2,47 @@ const { Command } = require('discord-akairo'); const fs = require('fs'); class shameboardCommand extends Command { - constructor() { - super('shameboard', { - aliases: ['shameboard'], - category: 'admin', - channelRestriction: 'guild', - userPermissions: ['ADMINISTRATOR'], - description: { - content: 'Set shameboard', - usage: '[]', - examples: [''] - } - }); - } + constructor() { + super('shameboard', { + aliases: ['shameboard'], + category: 'admin', + channelRestriction: 'guild', + userPermissions: ['ADMINISTRATOR'], + description: { + content: 'Set shameboard', + usage: '[]', + examples: [''] + } + }); + } - async exec(message) { - let shameboardChannel = message.channel.id; + async exec(message) { + let shameboardChannel = message.channel.id; - fs.readFile(`./starboard/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) { - if (err) { - fs.writeFile(`./starboard/${message.guild.id}.json`, `{"shameboard": "${shameboardChannel}"}`, function (err) { - if (err) { - console.log(err); - } - fs.close(); - return message.channel.send(`This channel have been set as the shameboard`); - }) - } else { - let shameboard = JSON.parse(data); //now it an object - shameboard['shameboard'] = shameboardChannel; - var json = JSON.stringify(shameboard); //convert it back to json - fs.writeFile(`./starboard/${message.guild.id}.json`, json, 'utf8', function (err) { - if (err) { - fs.close(); - return console.log(err); - } - }) - } - }); - fs.close(); - return message.channel.send(`This channel have been set as the shameboard`); - } + fs.readFile(`./starboard/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) { + if (err) { + fs.writeFile(`./starboard/${message.guild.id}.json`, `{"shameboard": "${shameboardChannel}"}`, function (err) { + if (err) { + console.log(err); + } + fs.close(); + return message.channel.send('This channel have been set as the shameboard'); + }); + } else { + let shameboard = JSON.parse(data); //now it an object + shameboard['shameboard'] = shameboardChannel; + var json = JSON.stringify(shameboard); //convert it back to json + fs.writeFile(`./starboard/${message.guild.id}.json`, json, 'utf8', function (err) { + if (err) { + fs.close(); + return console.log(err); + } + }); + } + }); + fs.close(); + return message.channel.send('This channel have been set as the shameboard'); + } } module.exports = shameboardCommand; \ No newline at end of file diff --git a/commands/admin/slowmode.js b/commands/admin/slowmode.js index 858e77a..b1ebf55 100644 --- a/commands/admin/slowmode.js +++ b/commands/admin/slowmode.js @@ -1,54 +1,54 @@ const { Command } = require('discord-akairo'); class PruneCommand extends Command { - constructor() { - super('Slowmode', { - aliases: ['slowmode', 'slow'], - category: 'admin', - args: [ - { - id: "slowmodeNumber", - type: "integer" - }, - { - id: "realtime", - type: "integer", - optional: true, - } - ], - clientPermissions: ['MANAGE_CHANNELS'], - userPermissions: ['MANAGE_CHANNELS'], - channelRestriction: 'guild', - description: { - content: 'Put a channel in slowmode', - usage: '[1-120 slowmode] [time it stays on]', - examples: ['267065637183029248'] - } - }); - } + constructor() { + super('Slowmode', { + aliases: ['slowmode', 'slow'], + category: 'admin', + args: [ + { + id: 'slowmodeNumber', + type: 'integer' + }, + { + id: 'realtime', + type: 'integer', + optional: true, + } + ], + clientPermissions: ['MANAGE_CHANNELS'], + userPermissions: ['MANAGE_CHANNELS'], + channelRestriction: 'guild', + description: { + content: 'Put a channel in slowmode', + usage: '[1-120 slowmode] [time it stays on]', + examples: ['267065637183029248'] + } + }); + } - async exec(message,args) { - let slowmodeNumber = args.slowmodeNumber; - let realtime = args.realtime; + async exec(message,args) { + let slowmodeNumber = args.slowmodeNumber; + let realtime = args.realtime; - if (slowmodeNumber > 120) - return message.channel.send("Slowmode can only be set to 120 seconds or lower!"); + if (slowmodeNumber > 120) + return message.channel.send('Slowmode can only be set to 120 seconds or lower!'); - message.channel.setRateLimitPerUser(slowmodeNumber); + message.channel.setRateLimitPerUser(slowmodeNumber); - if (realtime) { - let time = 60000 * realtime; - message.channel.send(`Slowmode have been set to ${slowmodeNumber} seconds and will end in ${realtime} minutes!`); - setTimeout (function (){ - message.channel.setRateLimitPerUser(0); - return message.channel.send("Slowmode is now disabled!") - }, time); - } else { - if (slowmodeNumber == 0) - return message.channel.send("Slowmode have been disabled!") - return message.channel.send(`Slowmode have been set to ${slowmodeNumber} seconds!`); - } - } + if (realtime) { + let time = 60000 * realtime; + message.channel.send(`Slowmode have been set to ${slowmodeNumber} seconds and will end in ${realtime} minutes!`); + setTimeout (function (){ + message.channel.setRateLimitPerUser(0); + return message.channel.send('Slowmode is now disabled!'); + }, time); + } else { + if (slowmodeNumber == 0) + return message.channel.send('Slowmode have been disabled!'); + return message.channel.send(`Slowmode have been set to ${slowmodeNumber} seconds!`); + } + } } module.exports = PruneCommand; \ No newline at end of file diff --git a/commands/admin/starboard.js b/commands/admin/starboard.js index 9249859..f4cdf8b 100644 --- a/commands/admin/starboard.js +++ b/commands/admin/starboard.js @@ -2,47 +2,47 @@ const { Command } = require('discord-akairo'); const fs = require('fs'); class StarBoardCommand extends Command { - constructor() { - super('starboard', { - aliases: ['starboard'], - category: 'admin', - channelRestriction: 'guild', - userPermissions: ['ADMINISTRATOR'], - description: { - content: 'Set starboard', - usage: '[]', - examples: [''] - } - }); - } + constructor() { + super('starboard', { + aliases: ['starboard'], + category: 'admin', + channelRestriction: 'guild', + userPermissions: ['ADMINISTRATOR'], + description: { + content: 'Set starboard', + usage: '[]', + examples: [''] + } + }); + } - async exec(message) { - let starboardChannel = message.channel.id; + async exec(message) { + let starboardChannel = message.channel.id; - fs.readFile(`./starboard/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) { - if (err) { - fs.writeFile(`./starboard/${message.guild.id}.json`, `{"starboard": "${starboardChannel}"}`, function (err) { - if (err) { - console.log(err); - } - fs.close(); - return message.channel.send(`This channel have been set as the starboard`); - }) - } else { - let starboard = JSON.parse(data); //now it an object - starboard['starboard'] = starboardChannel; - var json = JSON.stringify(starboard); //convert it back to json - fs.writeFile(`./starboard/${message.guild.id}.json`, json, 'utf8', function (err) { - if (err) { - fs.close(); - return console.log(err); - } - }) - } - }); - fs.close(); - return message.channel.send(`This channel have been set as the starboard`); - } + fs.readFile(`./starboard/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) { + if (err) { + fs.writeFile(`./starboard/${message.guild.id}.json`, `{"starboard": "${starboardChannel}"}`, function (err) { + if (err) { + console.log(err); + } + fs.close(); + return message.channel.send('This channel have been set as the starboard'); + }); + } else { + let starboard = JSON.parse(data); //now it an object + starboard['starboard'] = starboardChannel; + var json = JSON.stringify(starboard); //convert it back to json + fs.writeFile(`./starboard/${message.guild.id}.json`, json, 'utf8', function (err) { + if (err) { + fs.close(); + return console.log(err); + } + }); + } + }); + fs.close(); + return message.channel.send('This channel have been set as the starboard'); + } } module.exports = StarBoardCommand; \ No newline at end of file diff --git a/commands/admin/tag.js b/commands/admin/tag.js index e7bcd61..5bc207e 100644 --- a/commands/admin/tag.js +++ b/commands/admin/tag.js @@ -2,66 +2,63 @@ const { Command } = require('discord-akairo'); const fs = require('fs'); class TagCommand extends Command { - constructor() { - super('tag', { - aliases: ['tag'], - category: 'admin', - split: 'quoted', - args: [ - { - id: "trigger", - type: "string" - }, - { - id: "response", - type: "string" - } - ], - channelRestriction: 'guild', - description: { - content: 'Create custom autoresponse', - usage: '[trigger] [response]', - examples: ['"do you know da wea" "Fuck off dead meme"'] - } - }); - } + constructor() { + super('tag', { + aliases: ['tag'], + category: 'admin', + split: 'quoted', + args: [ + { + id: 'trigger', + type: 'string' + }, + { + id: 'response', + type: 'string' + } + ], + channelRestriction: 'guild', + description: { + content: 'Create custom autoresponse', + usage: '[trigger] [response]', + examples: ['do you know da wea', 'Fuck off dead meme'] + } + }); + } - async exec(message, args) { - let trigger = args.trigger; - let response = args.response; + async exec(message, args) { + let trigger = args.trigger; + let response = args.response; - trigger = trigger.toLowerCase(); - do { - trigger = trigger.replace('--', ' '); - } while (trigger.includes('--')) + trigger = trigger.toLowerCase(); - let customresponse = {}; - let json = JSON.stringify(customresponse); + let customresponse = {}; + let json = JSON.stringify(customresponse); - fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) { - if (err) { - fs.writeFile(`./tag/${message.guild.id}.json`, `{"${trigger}":"${response}"}`, function (err) { - if (err) { - fs.close(); - console.log(err); - } - }) - } else { - customresponse = JSON.parse(data); //now it an object - customresponse[trigger] = response - json = JSON.stringify(customresponse); //convert it back to json - fs.writeFile(`./tag/${message.guild.id}.json`, json, 'utf8', function (err) { - if (err) { - fs.close(); - return console.log(err); - } - }) - } - }); + fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) { + if (err) { + fs.writeFile(`./tag/${message.guild.id}.json`, `{'${trigger}':'${response}'}`, function (err) { + if (err) { + fs.close(); + console.log(err); + } + }); + } else { + customresponse = JSON.parse(data); //now it an object + customresponse[trigger] = response; + json = JSON.stringify(customresponse); //convert it back to json + fs.writeFile(`./tag/${message.guild.id}.json`, json, 'utf8', function (err) { + if (err) { + fs.close(); + return console.log(err); + } + }); + } + }); - fs.close(); - return message.channel.send(`autoresponse have been set to ${trigger} : ${response}`); - } + fs.close(); + return message.channel.send(`autoresponse have been set to ${trigger} : ${response}`); + } } module.exports = TagCommand; \ No newline at end of file diff --git a/commands/admin/unban.js b/commands/admin/unban.js index c0de360..4b209dd 100644 --- a/commands/admin/unban.js +++ b/commands/admin/unban.js @@ -1,31 +1,31 @@ const { Command } = require('discord-akairo'); class UnbanCommand extends Command { - constructor() { - super('unban', { - aliases: ['unban'], - category: 'admin', - args: [ - { - id: 'member', - type: 'user' - } - ], - clientPermissions: ['BAN_MEMBERS'], - userPermissions: ['BAN_MEMBERS'], - channelRestriction: 'guild', - description: { - content: 'unban users', - usage: '[user id]', - examples: ['267065637183029248'] - } - }); - } + constructor() { + super('unban', { + aliases: ['unban'], + category: 'admin', + args: [ + { + id: 'member', + type: 'user' + } + ], + clientPermissions: ['BAN_MEMBERS'], + userPermissions: ['BAN_MEMBERS'], + channelRestriction: 'guild', + description: { + content: 'unban users', + usage: '[user id]', + examples: ['267065637183029248'] + } + }); + } - async exec(message, args) { - message.guild.unban(args.member) - .then(() => message.reply(`user was succesfully unbanned.`)); - } + async exec(message, args) { + message.guild.unban(args.member) + .then(() => message.reply('user was succesfully unbanned.')); + } } module.exports = UnbanCommand; \ No newline at end of file diff --git a/commands/admin/untag.js b/commands/admin/untag.js index 0a7ee19..c41e1db 100644 --- a/commands/admin/untag.js +++ b/commands/admin/untag.js @@ -2,55 +2,55 @@ const { Command } = require('discord-akairo'); const fs = require('fs'); class UnTagCommand extends Command { - constructor() { - super('untag', { - aliases: ['untag'], - category: 'admin', - split: 'none', - args: [ - { - id: "trigger", - type: "string" - } - ], - channelRestriction: 'guild', - description: { - content: 'Remove created custom autoresponse', - usage: '[trigger]', - examples: ['"do you know da wea"'] - } - }); - } - - async exec(message, args) { - let trigger = args.trigger; - - trigger = trigger.toLowerCase(); - - let customresponse = {} - let json = JSON.stringify(customresponse) - - - fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) { - if (err) { - console.log(err); - } else { - customresponse = JSON.parse(data); //now it an object - delete customresponse[trigger] - json = JSON.stringify(customresponse); //convert it back to json - fs.writeFile(`./tag/${message.guild.id}.json`, json, 'utf8', function (err) { - if (err) { - fs.close(); - return console.log(err); - } - }) - } - }); - - fs.close(); - return message.channel.send(`The following autoresponse have been deleted: ${trigger}`); - - } + constructor() { + super('untag', { + aliases: ['untag'], + category: 'admin', + split: 'none', + args: [ + { + id: 'trigger', + type: 'string' + } + ], + channelRestriction: 'guild', + description: { + content: 'Remove created custom autoresponse', + usage: '[trigger]', + examples: ['do you know da wea'] + } + }); + } + + async exec(message, args) { + let trigger = args.trigger; + + trigger = trigger.toLowerCase(); + + let customresponse = {}; + let json = JSON.stringify(customresponse); + + + fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) { + if (err) { + console.log(err); + } else { + customresponse = JSON.parse(data); //now it an object + delete customresponse[trigger]; + json = JSON.stringify(customresponse); //convert it back to json + fs.writeFile(`./tag/${message.guild.id}.json`, json, 'utf8', function (err) { + if (err) { + fs.close(); + return console.log(err); + } + }); + } + }); + + fs.close(); + return message.channel.send(`The following autoresponse have been deleted: ${trigger}`); + + } } module.exports = UnTagCommand; \ No newline at end of file diff --git a/commands/general/advice.js b/commands/general/advice.js index 76fae74..8a07d5a 100644 --- a/commands/general/advice.js +++ b/commands/general/advice.js @@ -3,31 +3,31 @@ const Discord = require('discord.js'); const fetch = require('node-fetch'); class AdviceCommand extends Command { - constructor() { - super('advice', { - aliases: ['advice'], - category: 'general', - description: { + constructor() { + super('advice', { + aliases: ['advice'], + category: 'general', + description: { content: 'Send some random advices', usage: '', examples: [''] } - }); - } + }); + } - async exec(message) { - fetch("http://api.adviceslip.com/advice").then((response) => { - return response.json(); - }).then((response) => { - const adviceEmbed = new Discord.RichEmbed() - .setColor("#ff9900") - .setTitle(response.slip.slip_id) - .setDescription(response.slip.advice) + async exec(message) { + fetch('http://api.adviceslip.com/advice').then((response) => { + return response.json(); + }).then((response) => { + const adviceEmbed = new Discord.RichEmbed() + .setColor('#ff9900') + .setTitle(response.slip.slip_id) + .setDescription(response.slip.advice); - message.channel.send(adviceEmbed); - - })} - + message.channel.send(adviceEmbed); + + }); + } } module.exports = AdviceCommand; \ No newline at end of file diff --git a/commands/general/badmeme.js b/commands/general/badmeme.js index ed8e5a3..7b6d28b 100644 --- a/commands/general/badmeme.js +++ b/commands/general/badmeme.js @@ -1,33 +1,33 @@ const { Command } = require('discord-akairo'); -const fetch = require('node-fetch') +const fetch = require('node-fetch'); class ImgurCommand extends Command { - constructor() { - super('imgur', { - aliases: ['badmeme', 'imgur'], - category: 'general', - description: { + constructor() { + super('imgur', { + aliases: ['badmeme', 'imgur'], + category: 'general', + description: { content: 'Send some random images from imgur', usage: '', examples: [''] } - }); - } + }); + } - async exec(message) { - fetch("https://api.imgur.com/3/gallery/hot/day?showViral=true&mature=false&perPage=100&album_previews=true", { - headers: { "Authorization": "Client-ID e4cb6948f80f295" }, - }).then((response) => { - return response.json(); -}).then((response) => { - if (response.success == 'false') - return message.channel.send('An error has occured') + async exec(message) { + fetch('https://api.imgur.com/3/gallery/hot/day?showViral=true&mature=false&perPage=100&album_previews=true', { + headers: { 'Authorization': 'Client-ID e4cb6948f80f295' }, + }).then((response) => { + return response.json(); + }).then((response) => { + if (response.success == 'false') + return message.channel.send('An error has occured'); - const i = Math.floor((Math.random() * response.data.length)); + const i = Math.floor((Math.random() * response.data.length)); - message.channel.send(`**${response.data[i].title}**\n${response.data[i].link}`); - }); - } + message.channel.send(`**${response.data[i].title}**\n${response.data[i].link}`); + }); + } } module.exports = ImgurCommand; \ No newline at end of file diff --git a/commands/general/clap.js b/commands/general/clap.js index 0ab5e4c..732d80c 100644 --- a/commands/general/clap.js +++ b/commands/general/clap.js @@ -1,30 +1,30 @@ const { Command } = require('discord-akairo'); class ClapCommand extends Command { - constructor() { - super('clap', { - aliases: ['clap'], - category: 'general', - split: 'none', - args: [ - { - id: "text", - type: "string" - } - ], - description: { + constructor() { + super('clap', { + aliases: ['clap'], + category: 'general', + split: 'none', + args: [ + { + id: 'text', + type: 'string' + } + ], + description: { content: 'replace šŸ‘ the šŸ‘ spaces šŸ‘ with šŸ‘ clap šŸ‘', usage: '[text]', examples: ['replace the spaces with clap'] } - }); - } + }); + } - async exec(message, args) { - let clap = args.text.replace(/ /g, ' šŸ‘ '); - message.delete(); - message.channel.send(`${clap} šŸ‘`); - } + async exec(message, args) { + let clap = args.text.replace(/ /g, ' šŸ‘ '); + message.delete(); + message.channel.send(`${clap} šŸ‘`); + } } module.exports = ClapCommand; \ No newline at end of file diff --git a/commands/general/emotesay.js b/commands/general/emotesay.js index 6d73162..b90295d 100644 --- a/commands/general/emotesay.js +++ b/commands/general/emotesay.js @@ -2,34 +2,34 @@ const { Command } = require('discord-akairo'); const emojiCharacters = require('../../emojiCharacters'); class EmotesayCommand extends Command { - constructor() { - super('emotesay', { - aliases: ['emotesay', 'esay'], - category: 'general', - split: 'none', - args: [ - { - id: "text", - type: "string" - } - ], - description: { + constructor() { + super('emotesay', { + aliases: ['emotesay', 'esay'], + category: 'general', + split: 'none', + args: [ + { + id: 'text', + type: 'string' + } + ], + description: { content: 'Replace the text you send with dancing letters', usage: '[text]', examples: ['Hello'] } - }); - } + }); + } - async exec(message, args) { - let text = args.text; - - message.delete(); - let emojiArray = []; - for (let i = 0; i < text.length; i++) - emojiArray[i] = emojiCharacters[text.toLowerCase().split('')[i]]; - message.channel.send(emojiArray.join("")) - } + async exec(message, args) { + let text = args.text; + + message.delete(); + let emojiArray = []; + for (let i = 0; i < text.length; i++) + emojiArray[i] = emojiCharacters[text.toLowerCase().split('')[i]]; + message.channel.send(emojiArray.join('')); + } } module.exports = EmotesayCommand; \ No newline at end of file diff --git a/commands/general/ib.js b/commands/general/ib.js index d21a127..82f3150 100644 --- a/commands/general/ib.js +++ b/commands/general/ib.js @@ -2,22 +2,22 @@ const { Command } = require('discord-akairo'); const fetch = require('node-fetch'); class InspiroBotCommand extends Command { - constructor() { - super('InspiroBot', { - aliases: ['inspirobot', 'ib'], - category: 'general', - description: { + constructor() { + super('InspiroBot', { + aliases: ['inspirobot', 'ib'], + category: 'general', + description: { content: 'Send images from Inspirobot', usage: '', examples: [''] } - }); - } + }); + } - async exec(message) { - fetch('http://inspirobot.me/api?generate=true') - .then(res => res.text()) - .then(body => message.channel.send({files: [body]})) - } + async exec(message) { + fetch('http://inspirobot.me/api?generate=true') + .then(res => res.text()) + .then(body => message.channel.send({files: [body]})); + } } module.exports = InspiroBotCommand; \ No newline at end of file diff --git a/commands/general/reddit.js b/commands/general/reddit.js index 80975a9..de27f31 100644 --- a/commands/general/reddit.js +++ b/commands/general/reddit.js @@ -1,52 +1,53 @@ const { Command } = require('discord-akairo'); +const Discord = require('discord.js'); const fetch = require('node-fetch'); class RedditCommand extends Command { - constructor() { - super('reddit', { - aliases: ['reddit'], - category: 'general', - split: 'none', - args: [ - { - id: 'sub', - type: 'string' - } - ], - description: { + constructor() { + super('reddit', { + aliases: ['reddit'], + category: 'general', + split: 'none', + args: [ + { + id: 'sub', + type: 'string' + } + ], + description: { content: 'Send random images from the subreddit you choose', usage: '[subreddit]', examples: ['2meirl4meirl'] } - }); - } + }); + } - async exec(message, args) { - let sub = args.sub; - - fetch('https://www.reddit.com/r/' + sub + '.json?limit=100').then((response) => { - return response.json(); - }).then((response) => { - if (!response.data) - return message.channel.send('Not a valid subreddit') - while (response.data.children[i].data.post_hint !== 'image') { - i = Math.floor((Math.random() * response.data.children.length)); - - a++ - if (a == 5) - return message.channel.send("Could not find any images") - } - if (response.data.children[i].data.over_18 == true) - return message.channel.send(`No nsfw ( if you want a nsfw version of this commands use the feedback commands "${prefix} feedback ")`) - const redditEmbed = new Discord.RichEmbed() - .setColor("#ff9900") - .setTitle(response.data.children[i].data.title) - .setImage(response.data.children[i].data.url) - .setURL('https://reddit.com' + response.data.children[i].data.permalink) - .setFooter(`ā¬† ${response.data.children[i].data.ups} šŸ’¬ ${response.data.children[i].data.num_comments}`) - - message.channel.send(redditEmbed); - }) - } + async exec(message, args) { + let sub = args.sub; + let i, a; + + fetch('https://www.reddit.com/r/' + sub + '.json?limit=100').then((response) => { + return response.json(); + }).then((response) => { + if (!response.data) + return message.channel.send('Not a valid subreddit'); + while (response.data.children[i].data.post_hint !== 'image') { + i = Math.floor((Math.random() * response.data.children.length)); + a++; + if (a == 5) + return message.channel.send('Could not find any images'); + } + if (response.data.children[i].data.over_18 == true) + return message.channel.send('No nsfw'); + const redditEmbed = new Discord.RichEmbed() + .setColor('#ff9900') + .setTitle(response.data.children[i].data.title) + .setImage(response.data.children[i].data.url) + .setURL('https://reddit.com' + response.data.children[i].data.permalink) + .setFooter(`ā¬† ${response.data.children[i].data.ups} šŸ’¬ ${response.data.children[i].data.num_comments}`); + + message.channel.send(redditEmbed); + }); + } } module.exports = RedditCommand; \ No newline at end of file diff --git a/commands/general/say.js b/commands/general/say.js index 0c3039e..71ee8f4 100644 --- a/commands/general/say.js +++ b/commands/general/say.js @@ -1,79 +1,79 @@ const { Command } = require('discord-akairo'); class SayCommand extends Command { - constructor() { - super('say', { - aliases: ['say'], - category: 'general', - split: 'none', - args: [ - { - id: 'text', - type: 'string', - } - ], - description: { - content: 'Repeat what you say but can also replace ', - usage: '[text]', - examples: ['[member] is a big [adverbs] [verb]'] - } - }); - } + constructor() { + super('say', { + aliases: ['say'], + category: 'general', + split: 'none', + args: [ + { + id: 'text', + type: 'string', + } + ], + description: { + content: 'Repeat what you say but can also replace ', + usage: '[text]', + examples: ['[member] is a big [adverbs] [verb]'] + } + }); + } - async exec(message, args) { - let text = args.text; + async exec(message, args) { + let text = args.text; - // Load all the different files - const verb = require('../../dictionary/verbs.json') - const noun = require('../../dictionary/noun.json') - const adjective = require('../../dictionary/adjectives.json') - const adverbs = require('../../dictionary/adverbs.json') - const activities = require('../../dictionary/activities.json') - const celebreties = require('../../dictionary/celebreties.json') - const countries = require('../../dictionary/countries.json') - const diseases = require('../../dictionary/diseases.json') - const elements = require('../../dictionary/elements.json') - const hobbies = require('../../dictionary/hobbies.json') - const music = require('../../dictionary/music.json') - const prefixes = require('../../dictionary/prefixes.json') - const pronouns = require('../../dictionary/pronouns.json') - const states = require('../../dictionary/states.json') - const titles = require('../../dictionary/titles.json') - const units = require('../../dictionary/units.json') + // Load all the different files + const verb = require('../../dictionary/verbs.json'); + const noun = require('../../dictionary/noun.json'); + const adjective = require('../../dictionary/adjectives.json'); + const adverbs = require('../../dictionary/adverbs.json'); + const activities = require('../../dictionary/activities.json'); + const celebreties = require('../../dictionary/celebreties.json'); + const countries = require('../../dictionary/countries.json'); + const diseases = require('../../dictionary/diseases.json'); + const elements = require('../../dictionary/elements.json'); + const hobbies = require('../../dictionary/hobbies.json'); + const music = require('../../dictionary/music.json'); + const prefixes = require('../../dictionary/prefixes.json'); + const pronouns = require('../../dictionary/pronouns.json'); + const states = require('../../dictionary/states.json'); + const titles = require('../../dictionary/titles.json'); + const units = require('../../dictionary/units.json'); - + -// Generate a random number - function randNumber(file) { - let Rand = Math.floor((Math.random() * file.length) + 1); - return Rand; - } -// Replace with a random word from the json - do { - text = text.replace(/\[verb\]/, verb[randNumber(verb)]) - text = text.replace(/\[adverb\]/, adverbs[randNumber(adverbs)]) - text = text.replace(/\[noun\]/, noun[randNumber(noun)]) - text = text.replace(/\[adjective\]/, adjective[randNumber(adjective)]) - text = text.replace(/\[activity\]/, activities[randNumber(activities)]) - text = text.replace(/\[celebrity\]/, celebreties[randNumber(celebreties)]) - text = text.replace(/\[country\]/, countries[randNumber(countries)]) - text = text.replace(/\[diseases\]/, diseases[randNumber(diseases)]) - text = text.replace(/\[elements\]/, elements[randNumber(elements)]) - text = text.replace(/\[hobbies\]/, hobbies[randNumber(hobbies)]) - text = text.replace(/\[music\]/, music[randNumber(music)]) - text = text.replace(/\[prefixes\]/, prefixes[randNumber(prefixes)]) - text = text.replace(/\[pronoun\]/, pronouns[randNumber(pronouns)]) - text = text.replace(/\[state\]/, states[randNumber(states)]) - text = text.replace(/\[title\]/, titles[randNumber(titles)]) - text = text.replace(/\[unit\]/, units[randNumber(units)]) - text = text.replace(/\[member\]/, message.guild.members.random().user.username) - text = text.replace(/\[number\]/, Math.floor((Math.random() * 9) + 1)) -// Verify if it replaced everything - } while( text.includes('[verb]') || text.includes('[adverbs]') || text.includes('[noun]') || text.includes('[adjective]') || text.includes('[member]') || text.includes('[number]') || text.includes('[activities]') || text.includes('[celebrities]') || text.includes('[countries]') || text.includes('[diseases]') || text.includes('[elements]') || text.includes('[hobbies]') || text.includes('[music]') || text.includes('[prefixes]') || text.includes('[pronoun]') || text.includes('[state]') || text.includes('[title]') || text.includes('[unit]')) + // Generate a random number + function randNumber(file) { + let Rand = Math.floor((Math.random() * file.length) + 1); + return Rand; + } + // Replace with a random word from the json + do { + text = text.replace(/\[verb\]/, verb[randNumber(verb)]); + text = text.replace(/\[adverb\]/, adverbs[randNumber(adverbs)]); + text = text.replace(/\[noun\]/, noun[randNumber(noun)]); + text = text.replace(/\[adjective\]/, adjective[randNumber(adjective)]); + text = text.replace(/\[activity\]/, activities[randNumber(activities)]); + text = text.replace(/\[celebrity\]/, celebreties[randNumber(celebreties)]); + text = text.replace(/\[country\]/, countries[randNumber(countries)]); + text = text.replace(/\[diseases\]/, diseases[randNumber(diseases)]); + text = text.replace(/\[elements\]/, elements[randNumber(elements)]); + text = text.replace(/\[hobbies\]/, hobbies[randNumber(hobbies)]); + text = text.replace(/\[music\]/, music[randNumber(music)]); + text = text.replace(/\[prefixes\]/, prefixes[randNumber(prefixes)]); + text = text.replace(/\[pronoun\]/, pronouns[randNumber(pronouns)]); + text = text.replace(/\[state\]/, states[randNumber(states)]); + text = text.replace(/\[title\]/, titles[randNumber(titles)]); + text = text.replace(/\[unit\]/, units[randNumber(units)]); + text = text.replace(/\[member\]/, message.guild.members.random().user.username); + text = text.replace(/\[number\]/, Math.floor((Math.random() * 9) + 1)); + // Verify if it replaced everything + } while( text.includes('[verb]') || text.includes('[adverbs]') || text.includes('[noun]') || text.includes('[adjective]') || text.includes('[member]') || text.includes('[number]') || text.includes('[activities]') || text.includes('[celebrities]') || text.includes('[countries]') || text.includes('[diseases]') || text.includes('[elements]') || text.includes('[hobbies]') || text.includes('[music]') || text.includes('[prefixes]') || text.includes('[pronoun]') || text.includes('[state]') || text.includes('[title]') || text.includes('[unit]')); -// Send the final text - return message.channel.send(text); - } + // Send the final text + return message.channel.send(text); + } } module.exports = SayCommand; \ No newline at end of file diff --git a/commands/general/sayd.js b/commands/general/sayd.js index 612f24e..6a360e4 100644 --- a/commands/general/sayd.js +++ b/commands/general/sayd.js @@ -1,81 +1,81 @@ const { Command } = require('discord-akairo'); -class SayCommand extends Command { - constructor() { - super('sayd', { - aliases: ['sayd'], - category: 'general', - split: 'none', - clientPermissions: 'MANAGE_MESSAGES', - args: [ - { - id: 'text', - type: 'string' - } - ], - description: { - content: 'Repeat what you say but delete the text you sent', - usage: '[text]', - examples: ['[member] is a big [adverbs] [verb]'] - } - }); - } +class SaydCommand extends Command { + constructor() { + super('sayd', { + aliases: ['sayd'], + category: 'general', + split: 'none', + clientPermissions: 'MANAGE_MESSAGES', + args: [ + { + id: 'text', + type: 'string' + } + ], + description: { + content: 'Repeat what you say but delete the text you sent', + usage: '[text]', + examples: ['[member] is a big [adverbs] [verb]'] + } + }); + } - async exec(message, args) { - let text = args.text; + async exec(message, args) { + let text = args.text; - // Load all the different files - const verb = require('../../dictionary/verbs.json') - const noun = require('../../dictionary/noun.json') - const adjective = require('../../dictionary/adjectives.json') - const adverbs = require('../../dictionary/adverbs.json') - const activities = require('../../dictionary/activities.json') - const celebreties = require('../../dictionary/celebreties.json') - const countries = require('../../dictionary/countries.json') - const diseases = require('../../dictionary/diseases.json') - const elements = require('../../dictionary/elements.json') - const hobbies = require('../../dictionary/hobbies.json') - const music = require('../../dictionary/music.json') - const prefixes = require('../../dictionary/prefixes.json') - const pronouns = require('../../dictionary/pronouns.json') - const states = require('../../dictionary/states.json') - const titles = require('../../dictionary/titles.json') - const units = require('../../dictionary/units.json') + // Load all the different files + const verb = require('../../dictionary/verbs.json'); + const noun = require('../../dictionary/noun.json'); + const adjective = require('../../dictionary/adjectives.json'); + const adverbs = require('../../dictionary/adverbs.json'); + const activities = require('../../dictionary/activities.json'); + const celebreties = require('../../dictionary/celebreties.json'); + const countries = require('../../dictionary/countries.json'); + const diseases = require('../../dictionary/diseases.json'); + const elements = require('../../dictionary/elements.json'); + const hobbies = require('../../dictionary/hobbies.json'); + const music = require('../../dictionary/music.json'); + const prefixes = require('../../dictionary/prefixes.json'); + const pronouns = require('../../dictionary/pronouns.json'); + const states = require('../../dictionary/states.json'); + const titles = require('../../dictionary/titles.json'); + const units = require('../../dictionary/units.json'); - + -// Generate a random number - function randNumber(file) { - let Rand = Math.floor((Math.random() * file.length) + 1); - return Rand; - } -// Replace with a random word from the json - do { - text = text.replace(/\[verb\]/, verb[randNumber(verb)]) - text = text.replace(/\[adverb\]/, adverbs[randNumber(adverbs)]) - text = text.replace(/\[noun\]/, noun[randNumber(noun)]) - text = text.replace(/\[adjective\]/, adjective[randNumber(adjective)]) - text = text.replace(/\[activity\]/, activities[randNumber(activities)]) - text = text.replace(/\[celebrity\]/, celebreties[randNumber(celebreties)]) - text = text.replace(/\[country\]/, countries[randNumber(countries)]) - text = text.replace(/\[diseases\]/, diseases[randNumber(diseases)]) - text = text.replace(/\[elements\]/, elements[randNumber(elements)]) - text = text.replace(/\[hobbies\]/, hobbies[randNumber(hobbies)]) - text = text.replace(/\[music\]/, music[randNumber(music)]) - text = text.replace(/\[prefixes\]/, prefixes[randNumber(prefixes)]) - text = text.replace(/\[pronoun\]/, pronouns[randNumber(pronouns)]) - text = text.replace(/\[state\]/, states[randNumber(states)]) - text = text.replace(/\[title\]/, titles[randNumber(titles)]) - text = text.replace(/\[unit\]/, units[randNumber(units)]) - text = text.replace(/\[member\]/, message.guild.members.random().user.username) - text = text.replace(/\[number\]/, Math.floor((Math.random() * 9) + 1)) -// Verify if it replaced everything - } while( text.includes('[verb]') || text.includes('[adverbs]') || text.includes('[noun]') || text.includes('[adjective]') || text.includes('[member]') || text.includes('[number]') || text.includes('[activities]') || text.includes('[celebrities]') || text.includes('[countries]') || text.includes('[diseases]') || text.includes('[elements]') || text.includes('[hobbies]') || text.includes('[music]') || text.includes('[prefixes]') || text.includes('[pronoun]') || text.includes('[state]') || text.includes('[title]') || text.includes('[unit]')) + // Generate a random number + function randNumber(file) { + let Rand = Math.floor((Math.random() * file.length) + 1); + return Rand; + } + // Replace with a random word from the json + do { + text = text.replace(/\[verb\]/, verb[randNumber(verb)]); + text = text.replace(/\[adverb\]/, adverbs[randNumber(adverbs)]); + text = text.replace(/\[noun\]/, noun[randNumber(noun)]); + text = text.replace(/\[adjective\]/, adjective[randNumber(adjective)]); + text = text.replace(/\[activity\]/, activities[randNumber(activities)]); + text = text.replace(/\[celebrity\]/, celebreties[randNumber(celebreties)]); + text = text.replace(/\[country\]/, countries[randNumber(countries)]); + text = text.replace(/\[diseases\]/, diseases[randNumber(diseases)]); + text = text.replace(/\[elements\]/, elements[randNumber(elements)]); + text = text.replace(/\[hobbies\]/, hobbies[randNumber(hobbies)]); + text = text.replace(/\[music\]/, music[randNumber(music)]); + text = text.replace(/\[prefixes\]/, prefixes[randNumber(prefixes)]); + text = text.replace(/\[pronoun\]/, pronouns[randNumber(pronouns)]); + text = text.replace(/\[state\]/, states[randNumber(states)]); + text = text.replace(/\[title\]/, titles[randNumber(titles)]); + text = text.replace(/\[unit\]/, units[randNumber(units)]); + text = text.replace(/\[member\]/, message.guild.members.random().user.username); + text = text.replace(/\[number\]/, Math.floor((Math.random() * 9) + 1)); + // Verify if it replaced everything + } while( text.includes('[verb]') || text.includes('[adverbs]') || text.includes('[noun]') || text.includes('[adjective]') || text.includes('[member]') || text.includes('[number]') || text.includes('[activities]') || text.includes('[celebrities]') || text.includes('[countries]') || text.includes('[diseases]') || text.includes('[elements]') || text.includes('[hobbies]') || text.includes('[music]') || text.includes('[prefixes]') || text.includes('[pronoun]') || text.includes('[state]') || text.includes('[title]') || text.includes('[unit]')); -// Send the final text - message.delete(); - return message.channel.send(text); - } + // Send the final text + message.delete(); + return message.channel.send(text); + } } -module.exports = SayCommand; \ No newline at end of file +module.exports = SaydCommand; \ No newline at end of file diff --git a/commands/general/token.js b/commands/general/token.js index 6b0b11b..3b8d0ab 100644 --- a/commands/general/token.js +++ b/commands/general/token.js @@ -1,22 +1,22 @@ const { Command } = require('discord-akairo'); class tokenCommand extends Command { - constructor() { - super('token', { - aliases: ['token'], - category: 'general', - description: { + constructor() { + super('token', { + aliases: ['token'], + category: 'general', + description: { content: 'Send the token of the bot', usage: '', examples: [''] } - }); - } + }); + } - async exec(message) { - let trollMessage = ["Sick you thought <:youngtroll:488559163832795136>", "OWNED EPIC STYLE <:youngtroll:488559163832795136>", "NDg3MzQyOD__NOPE__pkz5_ck", "Did you think i was that dumb?"]; - trollMessage = trollMessage[Math.floor( Math.random() * trollMessage.length )]; - message.channel.send(trollMessage); - } + async exec(message) { + let trollMessage = ['Sick you thought <:youngtroll:488559163832795136>', 'OWNED EPIC STYLE <:youngtroll:488559163832795136>', 'NDg3MzQyOD__NOPE__pkz5_ck', 'Did you think i was that dumb?']; + trollMessage = trollMessage[Math.floor( Math.random() * trollMessage.length )]; + message.channel.send(trollMessage); + } } module.exports = tokenCommand; \ No newline at end of file diff --git a/commands/general/tts.js b/commands/general/tts.js index 171833b..82bdf92 100644 --- a/commands/general/tts.js +++ b/commands/general/tts.js @@ -4,58 +4,58 @@ const gclient = new textToSpeech.TextToSpeechClient(); const fs = require('fs'); class TtsCommand extends Command { - constructor() { - super('tts', { - aliases: ['tts'], - category: 'general', - split: 'none', - args: [ - { - id: 'text', - type: 'string' - } - ], - description: { - content: 'Send a mp3 of what you wrote in tts', - usage: '[text]', - examples: ['hello'] - } - }); - } + constructor() { + super('tts', { + aliases: ['tts'], + category: 'general', + split: 'none', + args: [ + { + id: 'text', + type: 'string' + } + ], + description: { + content: 'Send a mp3 of what you wrote in tts', + usage: '[text]', + examples: ['hello'] + } + }); + } - async exec(message, args) { - let text = args.text; + async exec(message, args) { + let text = args.text; - // Construct the request - const request = { - input: { text: text }, - // Select the language and SSML Voice Gender (optional) - voice: { languageCode: 'en-US', ssmlGender: 'NEUTRAL' }, - // Select the type of audio encoding - audioConfig: { audioEncoding: 'MP3' }, - }; + // Construct the request + const request = { + input: { text: text }, + // Select the language and SSML Voice Gender (optional) + voice: { languageCode: 'en-US', ssmlGender: 'NEUTRAL' }, + // Select the type of audio encoding + audioConfig: { audioEncoding: 'MP3' }, + }; - // Performs the Text-to-Speech request - gclient.synthesizeSpeech(request, (err, response) => { - if (err) { - fs.close(); - console.error('ERROR:', err); - return; - } + // Performs the Text-to-Speech request + gclient.synthesizeSpeech(request, (err, response) => { + if (err) { + fs.close(); + console.error('ERROR:', err); + return; + } - // Write the binary audio content to a local file - fs.writeFile('tts.mp3', response.audioContent, 'binary', err => { - if (err) { - console.error('ERROR:', err); - message.channel.send('An error has occured, the message is probably too long'); - fs.close(); - return; - } - console.log('Audio content written to file: tts.mp3'); - message.channel.send({ files: ['./tts.mp3'] }) - }); - fs.close(); - }); - } + // Write the binary audio content to a local file + fs.writeFile('tts.mp3', response.audioContent, 'binary', err => { + if (err) { + console.error('ERROR:', err); + message.channel.send('An error has occured, the message is probably too long'); + fs.close(); + return; + } + console.log('Audio content written to file: tts.mp3'); + message.channel.send({ files: ['./tts.mp3'] }); + }); + fs.close(); + }); + } } module.exports = TtsCommand; \ No newline at end of file diff --git a/commands/general/ttsvc.js b/commands/general/ttsvc.js index 4b76241..53dfc7e 100644 --- a/commands/general/ttsvc.js +++ b/commands/general/ttsvc.js @@ -4,78 +4,78 @@ const gclient = new textToSpeech.TextToSpeechClient(); const fs = require('fs'); class TtsvcCommand extends Command { - constructor() { - super('ttsvc', { - aliases: ['ttsvc'], - category: 'general', - split: 'none', - args: [ - { - id: 'text', - type: 'string' - } - ], - description: { - content: 'Say what you wrote in voice channel', - usage: '[text]', - examples: ['hello'] - } - }); - } + constructor() { + super('ttsvc', { + aliases: ['ttsvc'], + category: 'general', + split: 'none', + args: [ + { + id: 'text', + type: 'string' + } + ], + description: { + content: 'Say what you wrote in voice channel', + usage: '[text]', + examples: ['hello'] + } + }); + } - async exec(message, args) { - let text = args.text; + async exec(message, args) { + let text = args.text; - const { voiceChannel } = message.member; + const { voiceChannel } = message.member; - // Construct the request - const request = { - input: { text: text }, - // Select the language and SSML Voice Gender (optional) - voice: { languageCode: 'en-US', ssmlGender: 'NEUTRAL' }, - // Select the type of audio encoding - audioConfig: { audioEncoding: 'MP3' }, - }; + // Construct the request + const request = { + input: { text: text }, + // Select the language and SSML Voice Gender (optional) + voice: { languageCode: 'en-US', ssmlGender: 'NEUTRAL' }, + // Select the type of audio encoding + audioConfig: { audioEncoding: 'MP3' }, + }; - // Performs the Text-to-Speech request - gclient.synthesizeSpeech(request, (err, response) => { - if (err) { - console.error('ERROR:', err); - return; - } + // Performs the Text-to-Speech request + gclient.synthesizeSpeech(request, (err, response) => { + if (err) { + console.error('ERROR:', err); + return; + } - // Write the binary audio content to a local file - fs.writeFile('ttsvc.mp3', response.audioContent, 'binary', err => { - if (err) { - console.error('ERROR:', err); - message.channel.send('An error has occured, the message is probably too long'); - fs.close(); - return; - } - console.log('Audio content written to file: ttsvc.mp3'); + // Write the binary audio content to a local file + fs.writeFile('ttsvc.mp3', response.audioContent, 'binary', err => { + if (err) { + console.error('ERROR:', err); + message.channel.send('An error has occured, the message is probably too long'); + fs.close(); + return; + } + console.log('Audio content written to file: ttsvc.mp3'); - // If not in voice channel ask user to join - if (!voiceChannel) { - return message.reply('please join a voice channel first!'); + // If not in voice channel ask user to join + if (!voiceChannel) { + return message.reply('please join a voice channel first!'); - } else { // you should be careful in what is included in your scopes, you didn't use the {} - // If user say "stop" make the bot leave voice channel - if (text == 'stop') { - voiceChannel.leave(); - message.channel.send('I leaved the channel'); - } else { // you should be careful in what is included in your scopes, you didn't use the {} - voiceChannel.join().then(connection => { - const dispatcher = connection.playStream('./ttsvc.mp3'); - // End at then end of the audio stream - dispatcher.on('end', () => setTimeout(function () { - voiceChannel.leave(); - }, 2000)); - }); - } - } - }); - }); - } + } else { // you should be careful in what is included in your scopes, you didn't use the {} + // If user say "stop" make the bot leave voice channel + if (text == 'stop') { + voiceChannel.leave(); + message.channel.send('I leaved the channel'); + } else { // you should be careful in what is included in your scopes, you didn't use the {} + voiceChannel.join().then(connection => { + const dispatcher = connection.playStream('./ttsvc.mp3'); + // End at then end of the audio stream + dispatcher.on('end', () => setTimeout(function () { + voiceChannel.leave(); + }, 2000)); + }); + } + } + }); + }); + } } module.exports = TtsvcCommand; \ No newline at end of file diff --git a/commands/images/fetish.js b/commands/images/fetish.js index c9e4fdd..d0b4a5b 100644 --- a/commands/images/fetish.js +++ b/commands/images/fetish.js @@ -1,52 +1,52 @@ const { Command } = require('discord-akairo'); const Discord = require('discord.js'); -const { createCanvas, loadImage, getContext } = require('canvas'); +const { createCanvas, loadImage } = require('canvas'); const superagent = require('superagent'); class FetishCommand extends Command { - constructor() { - super('fetish', { - aliases: ['fetish'], - category: 'images', - args: [ - { - id: 'image', - type: 'string' - } - ] - }); - } + constructor() { + super('fetish', { + aliases: ['fetish'], + category: 'images', + args: [ + { + id: 'image', + type: 'string' + } + ] + }); + } - async exec(message, args) { - let Attachment = (message.attachments).array(); - let image = args.image; - if (!Attachment[0] && !image) - image = message.author.displayAvatarURL - else if(Attachment[0] && Attachment[0].url.endsWith('gif')) - return message.channel.send('Gif dosent work, sorry') - else if (!image) - image = Attachment[0].url - - message.channel.send('Processing ') - .then(loadingmsg => loadingmsg.delete(1000)) + async exec(message, args) { + let Attachment = (message.attachments).array(); + let image = args.image; + if (!Attachment[0] && !image) + image = message.author.displayAvatarURL; + else if(Attachment[0] && Attachment[0].url.endsWith('gif')) + return message.channel.send('Gif dosent work, sorry'); + else if (!image) + image = Attachment[0].url; + + message.channel.send('Processing ') + .then(loadingmsg => loadingmsg.delete(1000)); - const canvas = createCanvas(528, 559) - const ctx = canvas.getContext('2d') - const background = await loadImage('https://image.noelshack.com/fichiers/2018/42/2/1539644291-my-fetish-5910119d988512.png').catch(error => { - return message.channel.send('An error as occured, please try again') - }) - ctx.drawImage(background, 0, 0, canvas.width, canvas.height); - const { body: buffer } = await superagent.get(image); - const bg = await loadImage(buffer); - ctx.drawImage(bg, 50, 50, 450, 450); - - const attachment = new Discord.Attachment(canvas.toBuffer(), 'myfetish.png'); + const canvas = createCanvas(528, 559); + const ctx = canvas.getContext('2d'); + const background = await loadImage('https://image.noelshack.com/fichiers/2018/42/2/1539644291-my-fetish-5910119d988512.png').catch(() => { + return message.channel.send('An error as occured, please try again'); + }); + ctx.drawImage(background, 0, 0, canvas.width, canvas.height); + const { body: buffer } = await superagent.get(image); + const bg = await loadImage(buffer); + ctx.drawImage(bg, 50, 50, 450, 450); + + const attachment = new Discord.Attachment(canvas.toBuffer(), 'myfetish.png'); - message.channel.send(attachment).catch(() => { - message.channel.send('an error as occured. Check the bot/channel permissions') - }) - } + message.channel.send(attachment).catch(() => { + message.channel.send('an error as occured. Check the bot/channel permissions'); + }); + } } module.exports = FetishCommand; \ No newline at end of file diff --git a/commands/images/god.js b/commands/images/god.js index 9daca44..3f9f295 100644 --- a/commands/images/god.js +++ b/commands/images/god.js @@ -1,54 +1,54 @@ const { Command } = require('discord-akairo'); const Discord = require('discord.js'); -const { createCanvas, loadImage, getContext } = require('canvas'); +const { createCanvas, loadImage } = require('canvas'); const superagent = require('superagent'); class GodCommand extends Command { - constructor() { - super('god', { - aliases: ['god'], - category: 'images', - args: [ - { - id: 'image', - type: 'string' - } - ] - }); - } + constructor() { + super('god', { + aliases: ['god'], + category: 'images', + args: [ + { + id: 'image', + type: 'string' + } + ] + }); + } - async exec(message, args) { - let Attachment = (message.attachments).array(); - let image = args.image; - if (!Attachment[0] && !image) - image = message.author.displayAvatarURL - else if(Attachment[0] && Attachment[0].url.endsWith('gif')) - return message.channel.send('Gif dosent work, sorry') - else if (!image) - image = Attachment[0].url + async exec(message, args) { + let Attachment = (message.attachments).array(); + let image = args.image; + if (!Attachment[0] && !image) + image = message.author.displayAvatarURL; + else if (Attachment[0] && Attachment[0].url.endsWith('gif')) + return message.channel.send('Gif dosent work, sorry'); + else if (!image) + image = Attachment[0].url; - message.channel.send('Processing ') - .then(loadingmsg => loadingmsg.delete(1000)) + message.channel.send('Processing ') + .then(loadingmsg => loadingmsg.delete(1000)); - const canvas = createCanvas(310, 400) - const ctx = canvas.getContext('2d') - const background = await loadImage(image); - ctx.drawImage(background, 20, 80, 275, 250); - const { body: buffer } = await superagent.get('https://image.noelshack.com/fichiers/2018/42/1/1539555260-untitled.png').catch(() => { - return message.channel.send('An error as occured, please try again') - }) - const bg = await loadImage(buffer); - ctx.drawImage(bg, 0, 0, canvas.width, canvas.height); - - const attachment = new Discord.Attachment(canvas.toBuffer(), 'god.png'); + const canvas = createCanvas(310, 400); + const ctx = canvas.getContext('2d'); + const background = await loadImage(image); + ctx.drawImage(background, 20, 80, 275, 250); + const { body: buffer } = await superagent.get('https://image.noelshack.com/fichiers/2018/42/1/1539555260-untitled.png').catch(() => { + return message.channel.send('An error as occured, please try again'); + }); + const bg = await loadImage(buffer); + ctx.drawImage(bg, 0, 0, canvas.width, canvas.height); + + const attachment = new Discord.Attachment(canvas.toBuffer(), 'god.png'); - message.delete(); - message.channel.send(attachment) - .catch(() => { - message.channel.send('an error as occured. Check the bot/channel permissions') - }) - } + message.delete(); + message.channel.send(attachment) + .catch(() => { + message.channel.send('an error as occured. Check the bot/channel permissions'); + }); + } } module.exports = GodCommand; \ No newline at end of file diff --git a/commands/images/idubbbz.js b/commands/images/idubbbz.js index 7fea85e..9c8569a 100644 --- a/commands/images/idubbbz.js +++ b/commands/images/idubbbz.js @@ -1,76 +1,75 @@ const { Command } = require('discord-akairo'); const Discord = require('discord.js'); -const { createCanvas, loadImage, getContext } = require('canvas'); +const { createCanvas, loadImage } = require('canvas'); const superagent = require('superagent'); class IdubbbzCommand extends Command { - constructor() { - super('idubbbz', { - aliases: ['idubbbz', 'edups'], - category: 'images', - split: 'quoted', - args: [ - { - id: 'text', - type: 'string' - }, - { - id: 'image', - type: 'string' - } - ] - }); - } + constructor() { + super('idubbbz', { + aliases: ['idubbbz', 'edups'], + category: 'images', + split: 'quoted', + args: [ + { + id: 'text', + type: 'string' + }, + { + id: 'image', + type: 'string' + } + ] + }); + } - async exec(message, args) { - let text = args.text; - let Attachment = (message.attachments).array(); - let image = args.image; - if (!Attachment[0] && !image) - image = message.author.displayAvatarURL - else if (Attachment[0] && Attachment[0].url.endsWith('gif')) - return message.channel.send('Gif dosent work, sorry') - else if (!image) { // you should be careful in what is included in your scopes, you didn't use the {} - image = Attachment[0].url; + async exec(message, args) { + let text = args.text; + let Attachment = (message.attachments).array(); + let image = args.image; + if (!Attachment[0] && !image) + image = message.author.displayAvatarURL; + else if (Attachment[0] && Attachment[0].url.endsWith('gif')) + return message.channel.send('Gif dosent work, sorry'); + else if (!image) + image = Attachment[0].url; - message.channel.send('Processing ') - .then(loadingmsg => loadingmsg.delete(2000)) + message.channel.send('Processing ') + .then(loadingmsg => loadingmsg.delete(2000)); - const canvas = createCanvas(1281, 627) - const applyText = (canvas, text) => { - const ctx = canvas.getContext('2d'); + const canvas = createCanvas(1281, 627); + const applyText = (canvas, text) => { + const ctx = canvas.getContext('2d'); - // Declare a base size of the font - let fontSize = 50; + // Declare a base size of the font + let fontSize = 50; - do { - // Assign the font to the context and decrement it so it can be measured again - ctx.font = `${fontSize -= 10}px ubuntu`; - } while (ctx.measureText(text).width > 700 - 300); + do { + // Assign the font to the context and decrement it so it can be measured again + ctx.font = `${fontSize -= 10}px ubuntu`; + } while (ctx.measureText(text).width > 700 - 300); - // Return the result to use in the actual canvas - return ctx.font; - }; - } + // Return the result to use in the actual canvas + return ctx.font; + }; - const ctx = canvas.getContext('2d') - const background = await loadImage(image); - ctx.drawImage(background, 620, 100, 200, 200); - const { body: buffer } = await superagent.get('https://image.noelshack.com/fichiers/2018/41/7/1539510207-untitled.png').catch(error => { - return message.channel.send('An error as occured, please try again') - }) - const bg = await loadImage(buffer); - ctx.drawImage(bg, 0, 0, canvas.width, canvas.height); - ctx.font = applyText(canvas, text) - ctx.fillStyle = '#000000'; - ctx.fillText(text, canvas.width / 2.1, canvas.height / 1.5); + const ctx = canvas.getContext('2d'); + const background = await loadImage(image); + ctx.drawImage(background, 620, 100, 200, 200); + const { body: buffer } = await superagent.get('https://image.noelshack.com/fichiers/2018/41/7/1539510207-untitled.png').catch(() => { + return message.channel.send('An error as occured, please try again'); + }); + const bg = await loadImage(buffer); + ctx.drawImage(bg, 0, 0, canvas.width, canvas.height); + ctx.font = applyText(canvas, text); + ctx.fillStyle = '#000000'; + ctx.fillText(text, canvas.width / 2.1, canvas.height / 1.5); - const attachment = new Discord.Attachment(canvas.toBuffer(), 'edups.png'); + const attachment = new Discord.Attachment(canvas.toBuffer(), 'edups.png'); - message.channel.send(attachment).catch(error => { - message.channel.send('an error as occured. Check the bot/channel permissions') - }) - } + message.channel.send(attachment).catch(() => { + message.channel.send('an error as occured. Check the bot/channel permissions'); + }); + } } module.exports = IdubbbzCommand; \ No newline at end of file diff --git a/commands/images/idubbbzpaint.js b/commands/images/idubbbzpaint.js index 1115e64..e2cd914 100644 --- a/commands/images/idubbbzpaint.js +++ b/commands/images/idubbbzpaint.js @@ -1,75 +1,74 @@ const { Command } = require('discord-akairo'); const Discord = require('discord.js'); -const { createCanvas, loadImage, getContext } = require('canvas'); +const { createCanvas, loadImage } = require('canvas'); const superagent = require('superagent'); class IdubbbzPaintCommand extends Command { - constructor() { - super('idubbbzpaint', { - aliases: ['idubbbzpaint', 'edupspaint'], - category: 'images', - args: [ - { - id: 'text', - type: 'string' - }, - { - id: 'image', - type: 'string' - } - ] - }); - } + constructor() { + super('idubbbzpaint', { + aliases: ['idubbbzpaint', 'edupspaint'], + category: 'images', + args: [ + { + id: 'text', + type: 'string' + }, + { + id: 'image', + type: 'string' + } + ] + }); + } - async exec(message, args) { - let text = args.text; - let Attachment = (message.attachments).array(); - let image = args.image; - if (!Attachment[0] && !image) - image = message.author.displayAvatarURL - else if (Attachment[0] && Attachment[0].url.endsWith('gif')) - return message.channel.send('Gif dosent work, sorry') - else if (!image) { // // you should be careful in what is included in your scopes, you didn't use the {} - image = Attachment[0].url; + async exec(message, args) { + let text = args.text; + let Attachment = (message.attachments).array(); + let image = args.image; + if (!Attachment[0] && !image) + image = message.author.displayAvatarURL; + else if (Attachment[0] && Attachment[0].url.endsWith('gif')) + return message.channel.send('Gif dosent work, sorry'); + else if (!image) + image = Attachment[0].url; - message.channel.send('Processing ') - .then(loadingmsg => loadingmsg.delete(2000)) + message.channel.send('Processing ') + .then(loadingmsg => loadingmsg.delete(2000)); - const canvas = createCanvas(1024, 544) - const applyText = (canvas, text) => { - const ctx = canvas.getContext('2d'); + const canvas = createCanvas(1024, 544); + const applyText = (canvas, text) => { + const ctx = canvas.getContext('2d'); - // Declare a base size of the font - let fontSize = 100; + // Declare a base size of the font + let fontSize = 100; - do { - // Assign the font to the context and decrement it so it can be measured again - ctx.font = `${fontSize -= 10}px ubuntu`; - } while (ctx.measureText(text).width > 800 - 300); + do { + // Assign the font to the context and decrement it so it can be measured again + ctx.font = `${fontSize -= 10}px ubuntu`; + } while (ctx.measureText(text).width > 800 - 300); - // Return the result to use in the actual canvas - return ctx.font; - }; - } + // Return the result to use in the actual canvas + return ctx.font; + }; - const ctx = canvas.getContext('2d') - const background = await loadImage(image); - ctx.drawImage(background, 140, 40, 400, 340); - const { body: buffer } = await superagent.get('https://image.noelshack.com/fichiers/2018/41/7/1539533685-untitled.png').catch(error => { - return message.channel.send('An error as occured, please try again') - }) - const bg = await loadImage(buffer); - ctx.drawImage(bg, 0, 0, canvas.width, canvas.height); - ctx.font = applyText(canvas, text) - ctx.fillStyle = '#ffffff'; - ctx.fillText(text, canvas.width / 3, canvas.height / 1.1); + const ctx = canvas.getContext('2d'); + const background = await loadImage(image); + ctx.drawImage(background, 140, 40, 400, 340); + const { body: buffer } = await superagent.get('https://image.noelshack.com/fichiers/2018/41/7/1539533685-untitled.png').catch(() => { + return message.channel.send('An error as occured, please try again'); + }); + const bg = await loadImage(buffer); + ctx.drawImage(bg, 0, 0, canvas.width, canvas.height); + ctx.font = applyText(canvas, text); + ctx.fillStyle = '#ffffff'; + ctx.fillText(text, canvas.width / 3, canvas.height / 1.1); - const attachment = new Discord.Attachment(canvas.toBuffer(), 'edupspaint.png'); + const attachment = new Discord.Attachment(canvas.toBuffer(), 'edupspaint.png'); - message.channel.send(attachment).catch(error => { - message.channel.send('an error as occured. Check the bot/channel permissions') - }) - } + message.channel.send(attachment).catch(() => { + message.channel.send('an error as occured. Check the bot/channel permissions'); + }); + } } module.exports = IdubbbzPaintCommand; \ No newline at end of file diff --git a/commands/images/like.js b/commands/images/like.js index e26496b..f2c60ff 100644 --- a/commands/images/like.js +++ b/commands/images/like.js @@ -1,52 +1,52 @@ const { Command } = require('discord-akairo'); const Discord = require('discord.js'); -const { createCanvas, loadImage, getContext } = require('canvas'); +const { createCanvas, loadImage } = require('canvas'); const superagent = require('superagent'); class LikeCommand extends Command { - constructor() { - super('like', { - aliases: ['like'], - category: 'images', - args: [ - { - id: 'image', - type: 'string' - } - ] - }); - } + constructor() { + super('like', { + aliases: ['like'], + category: 'images', + args: [ + { + id: 'image', + type: 'string' + } + ] + }); + } - async exec(message, args) { - let Attachment = (message.attachments).array(); - let image = args.image; - if (!Attachment[0] && !image) - image = message.author.displayAvatarURL - else if (Attachment[0] && Attachment[0].url.endsWith('gif')) - return message.channel.send('Gif dosent work, sorry') - else if (!image) { // you should be careful in what is included in your scopes, you didn't use the {} - image = Attachment[0].url; + async exec(message, args) { + let Attachment = (message.attachments).array(); + let image = args.image; + if (!Attachment[0] && !image) + image = message.author.displayAvatarURL; + else if (Attachment[0] && Attachment[0].url.endsWith('gif')) + return message.channel.send('Gif dosent work, sorry'); + else if (!image) + image = Attachment[0].url; - message.channel.send('Processing ') - .then(loadingmsg => loadingmsg.delete(1000)); - } + message.channel.send('Processing ') + .then(loadingmsg => loadingmsg.delete(1000)); + - const canvas = createCanvas(386, 399) - const ctx = canvas.getContext('2d') - const background = await loadImage(image); - ctx.drawImage(background, 40, 0, 300, 255); - const { body: buffer } = await superagent.get('https://image.noelshack.com/fichiers/2018/41/7/1539547403-untitled.png').catch(error => { - return message.channel.send('An error as occured, please try again') - }) - const bg = await loadImage(buffer); - ctx.drawImage(bg, 0, 0, canvas.width, canvas.height); + const canvas = createCanvas(386, 399); + const ctx = canvas.getContext('2d'); + const background = await loadImage(image); + ctx.drawImage(background, 40, 0, 300, 255); + const { body: buffer } = await superagent.get('https://image.noelshack.com/fichiers/2018/41/7/1539547403-untitled.png').catch(() => { + return message.channel.send('An error as occured, please try again'); + }); + const bg = await loadImage(buffer); + ctx.drawImage(bg, 0, 0, canvas.width, canvas.height); - const attachment = new Discord.Attachment(canvas.toBuffer(), 'like.png'); + const attachment = new Discord.Attachment(canvas.toBuffer(), 'like.png'); - message.channel.send(attachment).catch(error => { - message.channel.send('an error as occured. Check the bot/channel permissions') - }) - } + message.channel.send(attachment).catch(() => { + message.channel.send('an error as occured. Check the bot/channel permissions'); + }); + } } module.exports = LikeCommand; \ No newline at end of file diff --git a/commands/images/ugly.js b/commands/images/ugly.js index 0792b98..6983f07 100644 --- a/commands/images/ugly.js +++ b/commands/images/ugly.js @@ -1,52 +1,52 @@ const { Command } = require('discord-akairo'); const Discord = require('discord.js'); -const { createCanvas, loadImage, getContext } = require('canvas'); +const { createCanvas, loadImage } = require('canvas'); const superagent = require('superagent'); class UglyCommand extends Command { - constructor() { - super('ugly', { - aliases: ['ugly'], - category: 'images', - args: [ - { - id: 'image', - type: 'string', - } - ] - }); - } - - async exec(message, args) { - let Attachment = (message.attachments).array(); - let image = args.image; - if (!Attachment[0] && !image) - image = message.author.displayAvatarURL - else if (Attachment[0] && Attachment[0].url.endsWith('gif')) - return message.channel.send('Gif dosent work, sorry') - else if (!image) { // you should be careful in what is included in your scopes, you didn't use the {} - image = Attachment[0].url; - - message.channel.send('Processing ') - .then(loadingmsg => loadingmsg.delete(1000)); - } - - const canvas = createCanvas(323, 400) - const ctx = canvas.getContext('2d') - const background = await loadImage('https://image.noelshack.com/fichiers/2018/42/1/1539598678-untitled.png').catch(error => { - return message.channel.send('An error as occured, please try again') - }) - ctx.drawImage(background, 0, 0, canvas.width, canvas.height); - const { body: buffer } = await superagent.get(image); - const bg = await loadImage(buffer); - ctx.drawImage(bg, 40, 100, 250, 250); - - const attachment = new Discord.Attachment(canvas.toBuffer(), 'ugly.png'); - - message.channel.send(attachment).catch(error => { - message.channel.send('an error as occured. Check the bot/channel permissions') - }) - } + constructor() { + super('ugly', { + aliases: ['ugly'], + category: 'images', + args: [ + { + id: 'image', + type: 'string', + } + ] + }); + } + + async exec(message, args) { + let Attachment = (message.attachments).array(); + let image = args.image; + if (!Attachment[0] && !image) + image = message.author.displayAvatarURL; + else if (Attachment[0] && Attachment[0].url.endsWith('gif')) + return message.channel.send('Gif dosent work, sorry'); + else if (!image) + image = Attachment[0].url; + + message.channel.send('Processing ') + .then(loadingmsg => loadingmsg.delete(1000)); + + + const canvas = createCanvas(323, 400); + const ctx = canvas.getContext('2d'); + const background = await loadImage('https://image.noelshack.com/fichiers/2018/42/1/1539598678-untitled.png').catch(() => { + return message.channel.send('An error as occured, please try again'); + }); + ctx.drawImage(background, 0, 0, canvas.width, canvas.height); + const { body: buffer } = await superagent.get(image); + const bg = await loadImage(buffer); + ctx.drawImage(bg, 40, 100, 250, 250); + + const attachment = new Discord.Attachment(canvas.toBuffer(), 'ugly.png'); + + message.channel.send(attachment).catch(() => { + message.channel.send('an error as occured. Check the bot/channel permissions'); + }); + } } module.exports = UglyCommand; \ No newline at end of file diff --git a/commands/owner/botAvatar.js b/commands/owner/botAvatar.js index c151cb1..6549c73 100644 --- a/commands/owner/botAvatar.js +++ b/commands/owner/botAvatar.js @@ -1,40 +1,41 @@ const { Command } = require('discord-akairo'); class BotAvatarCommand extends Command { - constructor() { - super('botavatar', { - aliases: ['botavatar', 'bavatar'], - split: 'none', - category: 'owner', - ownerOnly: 'true', - args: [ - { - id: 'image', - type:'string', - optional: true - } - ], - description: { + constructor() { + super('botavatar', { + aliases: ['botavatar', 'bavatar'], + split: 'none', + category: 'owner', + ownerOnly: 'true', + args: [ + { + id: 'image', + type:'string', + optional: true + } + ], + description: { content: 'Change bot profil picture', usage: '[image attachment/or link]', examples: ['image file'] } - }); - } + }); + } - async exec(message, args) { - let Attachment = (message.attachments).array(); - let image = args.image; - if (!Attachment[0] && !image) - return message.say('You didint provide any images') - else - image = Attachment[0].url - this.client.user.setAvatar(image) - .catch(() => message.channel.send("The link you provided dosen't work... is it a picture?")); - message.channel.send('The avatar have been changed succesfully'); + async exec(message, args) { + let Attachment = (message.attachments).array(); + let image = args.image; + if (!Attachment[0] && !image) + return message.say('You didint provide any images'); + else + image = Attachment[0].url; + + this.client.user.setAvatar(image) + .catch(() => message.channel.send('The link you provided dosen\'t work... is it a picture?')); + message.channel.send('The avatar have been changed succesfully'); - } + } } module.exports = BotAvatarCommand; \ No newline at end of file diff --git a/commands/owner/dm.js b/commands/owner/dm.js index 289e1b8..69f3b46 100644 --- a/commands/owner/dm.js +++ b/commands/owner/dm.js @@ -1,45 +1,45 @@ const { Command } = require('discord-akairo'); class EvalCommand extends Command { - constructor() { - super('dm', { - aliases: ['dm', 'pm'], - split: 'none', - category: 'owner', - args: [ - { - id: 'user', - type: 'user' - }, - { - id: 'message', - type: 'string' - } - ], - ownerOnly: 'true', - description: { + constructor() { + super('dm', { + aliases: ['dm', 'pm'], + split: 'none', + category: 'owner', + args: [ + { + id: 'user', + type: 'user' + }, + { + id: 'text', + type: 'string' + } + ], + ownerOnly: 'true', + description: { content: 'DM users', usage: '[user id] [message]', examples: ['267065637183029248 hello i recived your feedback and...'] } - }); - } + }); + } - async exec(message, args) { - let user = args.user; - let message = args.message; + async exec(message, args) { + let user = args.user; + let text = args.text; - let Attachment = (message.attachments).array(); - if (Attachment[0]) { - user.send(`**Message from the dev:**\n${message}\n${Attachment[0].url}`) - message.channel.send(`DM sent to ${user.username}`) - } - else { - user.send(`**Message from the dev:**\n${message}`) - message.channel.send(`DM sent to ${user.username}`) - } + let Attachment = (message.attachments).array(); + if (Attachment[0]) { + user.send(`**Message from the dev:**\n${text}\n${Attachment[0].url}`); + message.channel.send(`DM sent to ${user.username}`); + } + else { + user.send(`**Message from the dev:**\n${text}`); + message.channel.send(`DM sent to ${user.username}`); + } - } + } } module.exports = EvalCommand; \ No newline at end of file diff --git a/commands/owner/emit.js b/commands/owner/emit.js index 87d8b40..16ab68e 100644 --- a/commands/owner/emit.js +++ b/commands/owner/emit.js @@ -1,31 +1,31 @@ const { Command } = require('discord-akairo'); class emitCommand extends Command { - constructor() { - super('emit', { - aliases: ['emit'], - split: 'none', - category: 'owner', - ownerOnly: 'true', - args: [ - { - id: 'event', - prompt: 'Wich event should i trigger?', - type: 'string' - } - ], - description: { + constructor() { + super('emit', { + aliases: ['emit'], + split: 'none', + category: 'owner', + ownerOnly: 'true', + args: [ + { + id: 'event', + prompt: 'Wich event should i trigger?', + type: 'string' + } + ], + description: { content: 'Trigger an event', usage: '[event]', examples: ['ready'] } - }); - } + }); + } - async exec(message, args) { - this.client.emit(`${args.event}`); - return message.channel.send(`${args.event} has been emited!`) - } + async exec(message, args) { + this.client.emit(`${args.event}`); + return message.channel.send(`${args.event} has been emited!`); + } } module.exports = emitCommand; \ No newline at end of file diff --git a/commands/owner/eval.js b/commands/owner/eval.js index 53d4d08..1e8a6a2 100644 --- a/commands/owner/eval.js +++ b/commands/owner/eval.js @@ -1,46 +1,46 @@ const { Command } = require('discord-akairo'); class EvalCommand extends Command { - constructor() { - super('eval', { - aliases: ['eval'], - split: 'none', - category: 'owner', - args: [ - { - id: 'eval', - type: 'string' - } - ], - ownerOnly: 'true', - description: { + constructor() { + super('eval', { + aliases: ['eval'], + split: 'none', + category: 'owner', + args: [ + { + id: 'eval', + type: 'string' + } + ], + ownerOnly: 'true', + description: { content: 'Execute javascript', usage: '[code]', examples: ['message.channel.send(\'Hi\')'] } - }); - } + }); + } - async exec(message, args) { - const clean = text => { - if (typeof(text) === "string") - return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203)); - else - return text; - } + async exec(message, args) { + const clean = text => { + if (typeof(text) === 'string') + return text.replace(/`/g, '`' + String.fromCharCode(8203)).replace(/@/g, '@' + String.fromCharCode(8203)); + else + return text; + }; - try { - const code = args.eval - let evaled = eval(code); - - if (typeof evaled !== "string") - evaled = require("util").inspect(evaled); - - message.channel.send(clean(evaled), {code:"xl"}); - } catch (err) { - message.channel.send(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``); - } - } + try { + const code = args.eval; + let evaled = eval(code); + + if (typeof evaled !== 'string') + evaled = require('util').inspect(evaled); + + message.channel.send(clean(evaled), {code:'xl'}); + } catch (err) { + message.channel.send(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``); + } + } } module.exports = EvalCommand; \ No newline at end of file diff --git a/commands/owner/reboot.js b/commands/owner/reboot.js index 46add0f..359ade8 100644 --- a/commands/owner/reboot.js +++ b/commands/owner/reboot.js @@ -1,25 +1,25 @@ const { Command } = require('discord-akairo'); class RebootCommand extends Command { - constructor() { - super('reboot', { - aliases: ['ded', 'reboot', 'restart'], - split: 'none', - category: 'owner', - ownerOnly: 'true', - description: { + constructor() { + super('reboot', { + aliases: ['ded', 'reboot', 'restart'], + split: 'none', + category: 'owner', + ownerOnly: 'true', + description: { content: 'Restart the bot', usage: '[]', examples: [''] } - }); - } + }); + } - async exec(message) { - await message.channel.send('k bye thx\nhttps://i.redd.it/lw8hrvr0l4f11.jpg'); - process.exit(); + async exec(message) { + await message.channel.send('k bye thx\nhttps://i.redd.it/lw8hrvr0l4f11.jpg'); + process.exit(); - } + } } module.exports = RebootCommand; \ No newline at end of file diff --git a/commands/owner/status.js b/commands/owner/status.js index d21a3c3..087d08f 100644 --- a/commands/owner/status.js +++ b/commands/owner/status.js @@ -1,31 +1,31 @@ const { Command } = require('discord-akairo'); class StatusCommand extends Command { - constructor() { - super('status', { - aliases: ['status'], - split: 'none', - category: 'owner', - ownerOnly: 'true', - args: [ - { - id: 'status', - prompt: 'Wich status should i have?', - type: 'string' - } - ], - description: { + constructor() { + super('status', { + aliases: ['status'], + split: 'none', + category: 'owner', + ownerOnly: 'true', + args: [ + { + id: 'status', + prompt: 'Wich status should i have?', + type: 'string' + } + ], + description: { content: 'Change the status of the bot', usage: '[status]', examples: ['Hello world!'] } - }); - } + }); + } - async exec(message, args) { - this.client.user.setActivity(args.status); - message.channel.send(`Status have been set to ${args.status}`); - } + async exec(message, args) { + this.client.user.setActivity(args.status); + message.channel.send(`Status have been set to ${args.status}`); + } } module.exports = StatusCommand; \ No newline at end of file diff --git a/commands/owner/username.js b/commands/owner/username.js index f8982de..2738bb4 100644 --- a/commands/owner/username.js +++ b/commands/owner/username.js @@ -1,31 +1,31 @@ const { Command } = require('discord-akairo'); class usernameCommand extends Command { - constructor() { - super('username', { - aliases: ['username'], - split: 'none', - category: 'owner', - ownerOnly: 'true', - args: [ - { - id: 'username', - prompt: 'Wich username should i have?', - type: 'string' - } - ], - description: { + constructor() { + super('username', { + aliases: ['username'], + split: 'none', + category: 'owner', + ownerOnly: 'true', + args: [ + { + id: 'username', + prompt: 'Wich username should i have?', + type: 'string' + } + ], + description: { content: 'Change the username of the bot', usage: '[username]', examples: ['haha no'] } - }); - } + }); + } - async exec(message, args) { - this.client.user.setUsername(args.username); - message.channel.send(`The username have been changed sucessfully to ${args.username}`); - } + async exec(message, args) { + this.client.user.setUsername(args.username); + message.channel.send(`The username have been changed sucessfully to ${args.username}`); + } } module.exports = usernameCommand; \ No newline at end of file diff --git a/commands/reserved/bsespam.js b/commands/reserved/bsespam.js index b486e4e..29d74a4 100644 --- a/commands/reserved/bsespam.js +++ b/commands/reserved/bsespam.js @@ -1,41 +1,41 @@ const { Command } = require('discord-akairo'); class bsespamCommand extends Command { - constructor() { - super('bsespam', { - aliases: ['bsespam'] , //Required - category: 'reserved', //recommended - channelRestriction: 'guild', //needed if you want to restrict where we can launch the command - args: [ //if need args - { - id: 'number', - type: 'interger', - }, - { - id: 'text', - type: 'string' - } - ], - description: { //recommended - content: 'ONLY FOR BIG SNOW ENERGY\nSpam the text you send', - usage: '[args]', - examples: [''] - } - }); - } + constructor() { + super('bsespam', { + aliases: ['bsespam'] , //Required + category: 'reserved', //recommended + channelRestriction: 'guild', //needed if you want to restrict where we can launch the command + args: [ //if need args + { + id: 'number', + type: 'interger', + }, + { + id: 'text', + type: 'string' + } + ], + description: { //recommended + content: 'ONLY FOR BIG SNOW ENERGY\nSpam the text you send', + usage: '[args]', + examples: [''] + } + }); + } - async exec(message, args) { - if (message.author.id != "428387534842626048") - return message.say('Command only available to **Big Snow Energy**') - if (args.number <= 10) { - for(let i = 0; i < args.number; i++) { - message.channel.send(args.text); - } - return message.channel.send('Finished :)'); - } else { - return message.channel.send('No more than 10!') - } - } + async exec(message, args) { + if (message.author.id != '428387534842626048') + return message.say('Command only available to **Big Snow Energy**'); + if (args.number <= 10) { + for(let i = 0; i < args.number; i++) { + message.channel.send(args.text); + } + return message.channel.send('Finished :)'); + } else { + return message.channel.send('No more than 10!'); + } + } } module.exports = bsespamCommand; \ No newline at end of file diff --git a/commands/utility/avatar.js b/commands/utility/avatar.js index 012a5e3..39de925 100644 --- a/commands/utility/avatar.js +++ b/commands/utility/avatar.js @@ -1,30 +1,30 @@ const { Command } = require('discord-akairo'); class AvatarCommand extends Command { - constructor() { - super('avatar', { - aliases: ['avatar', 'avy'], - category: 'utility', - args: [ - { - id: 'user', - type: 'user' - } - ], - description: { + constructor() { + super('avatar', { + aliases: ['avatar', 'avy'], + category: 'utility', + args: [ + { + id: 'user', + type: 'user' + } + ], + description: { content: 'Show avatar of the mentioned user or you', usage: '(optional) [@user]', examples: ['', '@user'] } - }); - } + }); + } - async exec(message, args) { - if (!args.user) // While these kind of statments work you really should use {} - return message.channel.send(`Your avatar:\n${message.author.displayAvatarURL}`); - else - return message.channel.send(`${args.user.username}'s avatar:\n${args.user.displayAvatarURL}`); - } + async exec(message, args) { + if (!args.user) // While these kind of statments work you really should use {} + return message.channel.send(`Your avatar:\n${message.author.displayAvatarURL}`); + else + return message.channel.send(`${args.user.username}'s avatar:\n${args.user.displayAvatarURL}`); + } } module.exports = AvatarCommand; \ No newline at end of file diff --git a/commands/utility/download.js b/commands/utility/download.js index a0d409d..f24d93a 100644 --- a/commands/utility/download.js +++ b/commands/utility/download.js @@ -4,52 +4,52 @@ const youtubedl = require('youtube-dl'); const { fbuser, fbpasswd } = require('../../config.json'); class DownloadCommand extends Command { - constructor() { - super('download', { - aliases: ['download', 'dl'], - category: 'utility', - args: [ - { - id: "link", - type: "string", - default: "https://www.youtube.com/watch?v=6n3pFFPSlW4" - } - ], - clientPermissions: ['ATTACH_FILES'], - description: { - content: 'Download videos from different website from the link you provided', - usage: '[link]', - examples: ['https://www.youtube.com/watch?v=6n3pFFPSlW4'] - } - }); - } + constructor() { + super('download', { + aliases: ['download', 'dl'], + category: 'utility', + args: [ + { + id: 'link', + type: 'string', + default: 'https://www.youtube.com/watch?v=6n3pFFPSlW4' + } + ], + clientPermissions: ['ATTACH_FILES'], + description: { + content: 'Download videos from different website from the link you provided', + usage: '[link]', + examples: ['https://www.youtube.com/watch?v=6n3pFFPSlW4'] + } + }); + } - async exec(message, args) { - let link = args.link; + async exec(message, args) { + let link = args.link; - if (link.includes("http") || link.includes("www")) { - message.channel.send('Downloading ').then(msg => { - video.on('end', function () { - msg.delete() - }); - }); - let video = youtubedl(link, [`--username=${fbuser}`, `--password=${fbpasswd}`]) - video.pipe(fs.createWriteStream('./video.mp4')); - video.on('error', function error(err) { - console.log('error 2:', err); - message.channel.send("An error has occured, I can't download from the link you provided.") - }); - video.on('end', function () { - message.delete(); - message.channel.send(`Downloaded by ${message.author.username}`, { files: ["./video.mp4"] }) - .catch(() => message.channel.send('File too big')); - fs.close(); - }); - } else { - fs.close(); - message.channel.send("You need to input a valid link"); - } - } + if (link.includes('http') || link.includes('www')) { + message.channel.send('Downloading ').then(msg => { + video.on('end', function () { + msg.delete(); + }); + }); + let video = youtubedl(link, [`--username=${fbuser}`, `--password=${fbpasswd}`]); + video.pipe(fs.createWriteStream('./video.mp4')); + video.on('error', function error(err) { + console.log('error 2:', err); + message.channel.send('An error has occured, I can\'t download from the link you provided.'); + }); + video.on('end', function () { + message.delete(); + message.channel.send(`Downloaded by ${message.author.username}`, { files: ['./video.mp4'] }) + .catch(() => message.channel.send('File too big')); + fs.close(); + }); + } else { + fs.close(); + message.channel.send('You need to input a valid link'); + } + } } module.exports = DownloadCommand; \ No newline at end of file diff --git a/commands/utility/feedback.js b/commands/utility/feedback.js index e024fdf..ea55650 100644 --- a/commands/utility/feedback.js +++ b/commands/utility/feedback.js @@ -2,32 +2,32 @@ const { Command } = require('discord-akairo'); const { feedbackChannel } = require('../../config.json'); class FeedbackCommand extends Command { - constructor() { - super('feedback', { - aliases: ['feedback'], - category: 'utility', - split: 'none', - args: [ - { - id: "text", - type: "string" - } - ], - description: { + constructor() { + super('feedback', { + aliases: ['feedback'], + category: 'utility', + split: 'none', + args: [ + { + id: 'text', + type: 'string' + } + ], + description: { content: 'Send feedback to the bot owner', usage: '[What do you want to say]', examples: ['Hello, i just wanted to say hi!'] } - }); - } + }); + } - async exec(message,args) { - let text = args.text; + async exec(message,args) { + let text = args.text; - const channel = this.client.channels.get(feedbackChannel); - channel.send(`from ${message.author.username} (${message.author.id}) : ${text}`); - message.channel.send('Your feedback has been sent!'); - } + const channel = this.client.channels.get(feedbackChannel); + channel.send(`from ${message.author.username} (${message.author.id}) : ${text}`); + message.channel.send('Your feedback has been sent!'); + } } module.exports = FeedbackCommand; \ No newline at end of file diff --git a/commands/utility/invite.js b/commands/utility/invite.js index a6e1ede..79a94ae 100644 --- a/commands/utility/invite.js +++ b/commands/utility/invite.js @@ -2,22 +2,22 @@ const { Command } = require('discord-akairo'); const { supportServer } = require('../../config.json'); class InviteCommand extends Command { - constructor() { - super('invite', { - aliases: ['invite'], - category: 'utility', - description: { + constructor() { + super('invite', { + aliases: ['invite'], + category: 'utility', + description: { content: 'Send invite link for the bot and support server', usage: '', examples: [''] } - }); - } + }); + } - async exec(message) { - message.channel.send('Check your dm') - return message.author.send(`You can add me from here: https://discordapp.com/oauth2/authorize?client_id=${this.client.user.id}&scope=bot&permissions=0\nYou can also join my support server over here: ${supportServer} come and say hi :)`); - } + async exec(message) { + message.channel.send('Check your dm') + return message.author.send(`You can add me from here: https://discordapp.com/oauth2/authorize?client_id=${this.client.user.id}&scope=bot&permissions=0\nYou can also join my support server over here: ${supportServer} come and say hi :)`); + } } module.exports = InviteCommand; \ No newline at end of file diff --git a/commands/utility/ping.js b/commands/utility/ping.js index f1516b0..f46743e 100644 --- a/commands/utility/ping.js +++ b/commands/utility/ping.js @@ -1,25 +1,25 @@ const { Command } = require('discord-akairo'); class PingCommand extends Command { - constructor() { - super('ping', { - aliases: ['ping', 'hello'], - category: 'utility', - description: { + constructor() { + super('ping', { + aliases: ['ping', 'hello'], + category: 'utility', + description: { content: 'Ping the bot', usage: '', examples: [''] } - }); - } + }); + } - async exec(message) { - return message.util.reply('Pong!').then(sent => { - const timeDiff = (sent.editedAt || sent.createdAt) - (message.editedAt || message.createdAt); - const text = `šŸ”‚\u2000**RTT**: ${timeDiff} ms\nšŸ’Ÿ\u2000**Heartbeat**: ${Math.round(this.client.ping)} ms`; - return message.util.reply(`Pong!\n${text}`); - }); - } + async exec(message) { + return message.util.reply('Pong!').then(sent => { + const timeDiff = (sent.editedAt || sent.createdAt) - (message.editedAt || message.createdAt); + const text = `šŸ”‚\u2000**RTT**: ${timeDiff} ms\nšŸ’Ÿ\u2000**Heartbeat**: ${Math.round(this.client.ping)} ms`; + return message.util.reply(`Pong!\n${text}`); + }); + } } module.exports = PingCommand; \ No newline at end of file diff --git a/commands/utility/server.js b/commands/utility/server.js index bca5dd1..1de95cc 100644 --- a/commands/utility/server.js +++ b/commands/utility/server.js @@ -1,39 +1,36 @@ const { Command } = require('discord-akairo'); class ServerCommand extends Command { - constructor() { - super('server', { - aliases: ['server', 'serverinfo'], - category: 'utility', - channelRestriction: 'guild', - description: { + constructor() { + super('server', { + aliases: ['server', 'serverinfo'], + category: 'utility', + channelRestriction: 'guild', + description: { content: 'Show info about the server', usage: '', examples: [''] } - }); - } + }); + } - async exec(message) { - try { - const customresponse = require(`../tag/${message.guild.id}.json`); - var count = Object.keys(customresponse).length - } catch { - var count = 'None' - } - - - const addEmbed = { - color: 0x0099ff, - title: 'Stats of the server', - thumbnail: { - url: `${message.guild.iconURL}`, - }, - description: `Member: **${message.guild.memberCount}** \nChannel number: **${message.guild.channels.size}**\nGuild created at **${message.guild.createdAt}**\nOwner: **${message.guild.owner}**\nTag number: **${count}**`, - }; - - message.channel.send({ embed: addEmbed }); - } + async exec(message) { + const customresponse = require(`../tag/${message.guild.id}.json`); + var count = Object.keys(customresponse).length; + + + + const addEmbed = { + color: 0x0099ff, + title: 'Stats of the server', + thumbnail: { + url: `${message.guild.iconURL}`, + }, + description: `Member: **${message.guild.memberCount}** \nChannel number: **${message.guild.channels.size}**\nGuild created at **${message.guild.createdAt}**\nOwner: **${message.guild.owner}**\nTag number: **${count}**`, + }; + + message.channel.send({ embed: addEmbed }); + } } module.exports = ServerCommand; \ No newline at end of file diff --git a/commands/utility/stats.js b/commands/utility/stats.js index dc8faf9..9113caf 100644 --- a/commands/utility/stats.js +++ b/commands/utility/stats.js @@ -1,28 +1,28 @@ const { Command } = require('discord-akairo'); class StatsCommand extends Command { - constructor() { - super('stats', { - aliases: ['stats'], - category: 'utility', - description: { + constructor() { + super('stats', { + aliases: ['stats'], + category: 'utility', + description: { content: 'Show some stats about the bot', usage: '', examples: [''] } - }); - } + }); + } - async exec(message) { - let totalSeconds = (this.client.uptime / 1000); - let days = Math.floor(totalSeconds / 86400); - let hours = Math.floor(totalSeconds / 3600); - totalSeconds %= 3600; - let minutes = Math.floor(totalSeconds / 60); - let seconds = totalSeconds.toFixed(0) % 60; - let uptime = `${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds`; - return message.channel.send(`Servers: \`${this.client.guilds.size}\`\nChannels: \`${this.client.channels.size}\`\nUsers: \`${this.client.users.size}\`\nBot uptime: \`${uptime}\``); - } + async exec(message) { + let totalSeconds = (this.client.uptime / 1000); + let days = Math.floor(totalSeconds / 86400); + let hours = Math.floor(totalSeconds / 3600); + totalSeconds %= 3600; + let minutes = Math.floor(totalSeconds / 60); + let seconds = totalSeconds.toFixed(0) % 60; + let uptime = `${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds`; + return message.channel.send(`Servers: \`${this.client.guilds.size}\`\nChannels: \`${this.client.channels.size}\`\nUsers: \`${this.client.users.size}\`\nBot uptime: \`${uptime}\``); + } } module.exports = StatsCommand; \ No newline at end of file diff --git a/commands/utility/taglist.js b/commands/utility/taglist.js index 1ce914a..0927a7d 100644 --- a/commands/utility/taglist.js +++ b/commands/utility/taglist.js @@ -4,50 +4,44 @@ const reload = require('auto-reload'); const fs = require('fs'); class taglistCommand extends Command { - constructor() { - super('taglist', { - aliases: ['taglist'], - category: 'utility', - channelRestriction: 'guild', - description: { - content: 'Show the list of tag for this server.', - usage: '', - examples: [''] - } - }); - } + constructor() { + super('taglist', { + aliases: ['taglist'], + category: 'utility', + channelRestriction: 'guild', + description: { + content: 'Show the list of tag for this server.', + usage: '', + examples: [''] + } + }); + } - async exec(message) { - try { - let customresponse = reload(`../../tag/${message.guild.id}.json`); - let count = Object.keys(customresponse).length + async exec(message) { + let customresponse = reload(`../../tag/${message.guild.id}.json`); + let count = Object.keys(customresponse).length; - await fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) { - if (err) { - console.log(err); - /* do you need it to end here on error? if so uncomment the following code: - fs.close(); - return; - */ - } - let json = JSON.stringify(data) - json = json.replace(/[{}"\\]+/g, '') - json = json.replace(/,+/g, '\n') - const tagEmbed = new Discord.RichEmbed() - .setColor("#ff9900") - .setTitle('Tags list') - .setDescription(`Trigger:Response\n\n${json}`) - .setFooter(`You have ${count} tags on this server`) + await fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) { + if (err) { + console.log(err); + fs.close(); + return; + } + let json = JSON.stringify(data); + json = json.replace(/[{}'\\]+/g, ''); + json = json.replace(/,+/g, '\n'); + const tagEmbed = new Discord.RichEmbed() + .setColor('#ff9900') + .setTitle('Tags list') + .setDescription(`Trigger:Response\n\n${json}`) + .setFooter(`You have ${count} tags on this server`); - message.channel.send(tagEmbed); - }); - fs.close(); - } catch { - fs.close(); - message.channel.send('An error has occured, do you have any tags on the server?'); - } - } + message.channel.send(tagEmbed); + }); + fs.close(); + message.channel.send('An error has occured, do you have any tags on the server?'); + } } module.exports = taglistCommand; \ No newline at end of file diff --git a/commands/utility/translate.js b/commands/utility/translate.js index 34c584b..d1142c0 100644 --- a/commands/utility/translate.js +++ b/commands/utility/translate.js @@ -4,59 +4,58 @@ const fetch = require('node-fetch'); const { yandexAPI } = require('../../config.json'); class TranslationCommand extends Command { - constructor() { - super('translation', { - aliases: ['translation', 'trn'], - category: 'utility', - split: 'sticky', - description: 'Translate the text you send into the lanuguage you selected', - args: [ - { - id: 'language', - type: 'string', - default: 'en' - }, - { - id: 'text', - type: 'string', - } - ], - description: { - content: 'Translate what you send in your desired language. You can find the language code here: https://tech.yandex.com/translate/doc/dg/concepts/api-overview-docpage/', - usage: '[language code] [Text to translate]', - examples: ['fr What are we doing today?', 'en Que faisons-nous aujourd\'hui?'] - } - }); - } + constructor() { + super('translation', { + aliases: ['translation', 'trn'], + category: 'utility', + split: 'sticky', + args: [ + { + id: 'language', + type: 'string', + default: 'en' + }, + { + id: 'text', + type: 'string', + } + ], + description: { + content: 'Translate what you send in your desired language. You can find the language code here: https://tech.yandex.com/translate/doc/dg/concepts/api-overview-docpage/', + usage: '[language code] [Text to translate]', + examples: ['fr What are we doing today?', 'en Que faisons-nous aujourd\'hui?'] + } + }); + } - async exec(message, args) { - let language = args.language; - let text = args.text; + async exec(message, args) { + let language = args.language; + let text = args.text; - let textURI = encodeURI(text) - fetch(`https://translate.yandex.net/api/v1.5/tr.json/translate?key=${yandexAPI}&text=${textURI}&lang=${language}&options=1`, { - }).then((response) => { - return response.json(); - }).then((response) => { - if (response.code == '502') - return message.channel.send(`${response.message}, you probably didin't input the correct language code, you can check them here! https://tech.yandex.com/translate/doc/dg/concepts/api-overview-docpage/`) - else if (response.code != '200') - return message.channel.send('An error has occured') + let textURI = encodeURI(text); + fetch(`https://translate.yandex.net/api/v1.5/tr.json/translate?key=${yandexAPI}&text=${textURI}&lang=${language}&options=1`, { + }).then((response) => { + return response.json(); + }).then((response) => { + if (response.code == '502') + return message.channel.send(`${response.message}, you probably didin't input the correct language code, you can check them here! https://tech.yandex.com/translate/doc/dg/concepts/api-overview-docpage/`); + else if (response.code != '200') + return message.channel.send('An error has occured'); - const translationEmbed = new Discord.RichEmbed() - .setColor('#0099ff') - .setTitle('Asked for the following translation:') - .setAuthor(message.author.username) - .setDescription(response.text[0]) - .addField('Original text', text) - .addField('Translated from', response.detected.lang) - .setTimestamp() - .setFooter('Powered by Yandex.Translate '); + const translationEmbed = new Discord.RichEmbed() + .setColor('#0099ff') + .setTitle('Asked for the following translation:') + .setAuthor(message.author.username) + .setDescription(response.text[0]) + .addField('Original text', text) + .addField('Translated from', response.detected.lang) + .setTimestamp() + .setFooter('Powered by Yandex.Translate '); - message.channel.send(translationEmbed) - }); - } + message.channel.send(translationEmbed); + }); + } } module.exports = TranslationCommand; \ No newline at end of file diff --git a/commands/utility/updoot.js b/commands/utility/updoot.js index 8ec2902..6a739c2 100644 --- a/commands/utility/updoot.js +++ b/commands/utility/updoot.js @@ -1,34 +1,34 @@ const { Command } = require('discord-akairo'); class UpdootCommand extends Command { - constructor() { - super('updoot', { - aliases: ['updoot', 'upvote', 'vote'], - category: 'utility', - channelRestriction: 'guild', - description: { + constructor() { + super('updoot', { + aliases: ['updoot', 'upvote', 'vote'], + category: 'utility', + channelRestriction: 'guild', + description: { content: 'Send a link to vote for my bot', usage: '', examples: [''] } - }); - } + }); + } - async exec(message) { - const upDoot = { - color: 0x93C54B, - title: 'Vote for my bot', - url: 'https://discordbots.org/bot/377563711927484418/vote', - description: 'You can vote for my bot if you think the bot is awesome!', - timestamp: new Date(), - footer: { - text: 'Thanks for the updoots', - icon_url: 'https://cdn.discordapp.com/avatars/377563711927484418/1335d202aa466dbeaa4ed2e4b616484a.png?size=2048', - }, - }; - - message.channel.send({ embed: upDoot }); - } + async exec(message) { + const upDoot = { + color: 0x93C54B, + title: 'Vote for my bot', + url: 'https://discordbots.org/bot/377563711927484418/vote', + description: 'You can vote for my bot if you think the bot is awesome!', + timestamp: new Date(), + footer: { + text: 'Thanks for the updoots', + icon_url: 'https://cdn.discordapp.com/avatars/377563711927484418/1335d202aa466dbeaa4ed2e4b616484a.png?size=2048', + }, + }; + + message.channel.send({ embed: upDoot }); + } } module.exports = UpdootCommand; \ No newline at end of file diff --git a/emojiCharacters.js b/emojiCharacters.js index 85e03ad..dd68f97 100644 --- a/emojiCharacters.js +++ b/emojiCharacters.js @@ -1,12 +1,12 @@ module.exports = { - a: '', b: '', c: '', d: '', - e: '', f: '', g: '', h: '', - i: '', j: '', k: '', l: '', - m: '', n: '', o: '', p: '', - q: '', r: '', s: '', t: '', - u: '', v: '', w: '', x: '', - y: '', z: '', 1: '', 2: '', - 3: '', 4: '', 5: '', 6: '', - 7: '', 8: '', 9: '', 0: '', - ' ': ' ', '?': '', '!': '' + a: '', b: '', c: '', d: '', + e: '', f: '', g: '', h: '', + i: '', j: '', k: '', l: '', + m: '', n: '', o: '', p: '', + q: '', r: '', s: '', t: '', + u: '', v: '', w: '', x: '', + y: '', z: '', 1: '', 2: '', + 3: '', 4: '', 5: '', 6: '', + 7: '', 8: '', 9: '', 0: '', + ' ': ' ', '?': '', '!': '' }; \ No newline at end of file diff --git a/index.js b/index.js index c4c4e9a..f21e4a5 100644 --- a/index.js +++ b/index.js @@ -2,33 +2,32 @@ const { AkairoClient } = require('discord-akairo'); const { token, prefix, ownerID, statsChannel } = require('./config.json'); const client = new AkairoClient({ - ownerID: ownerID, - prefix: prefix, - allowMention: true, - handleEdits: true, - emitters: { - process - }, - handleEdits: true, - commandUtil: true, - commandUtilLifetime: 600000, - commandDirectory: './commands/', - inhibitorDirectory: './inhibitors/', - listenerDirectory: './listeners/' + ownerID: ownerID, + prefix: prefix, + allowMention: true, + handleEdits: true, + emitters: { + process + }, + commandUtil: true, + commandUtilLifetime: 600000, + commandDirectory: './commands/', + inhibitorDirectory: './inhibitors/', + listenerDirectory: './listeners/' }, { - disableEveryone: true + disableEveryone: true }); // Ready messages dosent work on the listeners event for some reasons client.on('ready', async () => { - // Send stats to the console - console.log(`\x1b[32mLogged in as \x1b[34m${client.user.tag}\x1b[0m! (\x1b[33m${client.user.id}\x1b[0m)`); - console.log(`Ready to serve in \x1b[33m${client.channels.size}\x1b[0m channels on \x1b[33m${client.guilds.size}\x1b[0m servers, for a total of \x1b[33m${client.users.size}\x1b[0m users. \x1b${client.readyAt}\x1b[0m`); - // Send stats to the "stats" channel in the support server if its not the test bot - if (client.user.id == 377563711927484418) { - const channel = client.channels.get(statsChannel); - channel.send(`Ready to serve in ${client.channels.size} channels on ${client.guilds.size} servers, for a total of ${client.users.size} users. ${client.readyAt}`); - client.user.setActivity(`${prefix} feedback to tell me what you think of the bot! | ${prefix} help`); } - }); + // Send stats to the console + console.log(`\x1b[32mLogged in as \x1b[34m${client.user.tag}\x1b[0m! (\x1b[33m${client.user.id}\x1b[0m)`); + console.log(`Ready to serve in \x1b[33m${client.channels.size}\x1b[0m channels on \x1b[33m${client.guilds.size}\x1b[0m servers, for a total of \x1b[33m${client.users.size}\x1b[0m users. \x1b${client.readyAt}\x1b[0m`); + // Send stats to the 'stats' channel in the support server if its not the test bot + if (client.user.id == 377563711927484418) { + const channel = client.channels.get(statsChannel); + channel.send(`Ready to serve in ${client.channels.size} channels on ${client.guilds.size} servers, for a total of ${client.users.size} users. ${client.readyAt}`); + client.user.setActivity(`${prefix} feedback to tell me what you think of the bot! | ${prefix} help`); } +}); client.login(token); \ No newline at end of file diff --git a/inhibitors/blacklist.js b/inhibitors/blacklist.js index 751ef87..46e76e4 100644 --- a/inhibitors/blacklist.js +++ b/inhibitors/blacklist.js @@ -1,16 +1,16 @@ const { Inhibitor } = require('discord-akairo'); class BlacklistInhibitor extends Inhibitor { - constructor() { - super('blacklist', { - reason: 'blacklist' - }) - } + constructor() { + super('blacklist', { + reason: 'blacklist' + }); + } - exec(message) { - const blacklist = ['501856229123948545', '497730155691638784']; - return blacklist.includes(message.author.id); - } + exec(message) { + const blacklist = ['501856229123948545', '497730155691638784']; + return blacklist.includes(message.author.id); + } } module.exports = BlacklistInhibitor; \ No newline at end of file diff --git a/listeners/UnhandledRejection.js b/listeners/UnhandledRejection.js index 116cdb3..e141f3d 100644 --- a/listeners/UnhandledRejection.js +++ b/listeners/UnhandledRejection.js @@ -1,16 +1,16 @@ const { Listener } = require('discord-akairo'); class UnhandledRejectionListener extends Listener { - constructor() { - super('unhandledRejection', { - eventName: 'unhandledRejection', - emitter: 'process' - }); - } + constructor() { + super('unhandledRejection', { + eventName: 'unhandledRejection', + emitter: 'process' + }); + } - exec(error) { - console.error(error); - } + exec(error) { + console.error(error); + } } module.exports = UnhandledRejectionListener; \ No newline at end of file diff --git a/listeners/commandblocked.js b/listeners/commandblocked.js index 96f92f7..fc92a05 100644 --- a/listeners/commandblocked.js +++ b/listeners/commandblocked.js @@ -1,33 +1,34 @@ const { Listener } = require('discord-akairo'); class CommandBlockedListener extends Listener { - constructor() { - super('commandBlocked', { - emitter: 'commandHandler', - eventName: 'commandBlocked' - }); - } + constructor() { + super('commandBlocked', { + emitter: 'commandHandler', + eventName: 'commandBlocked' + }); + } - exec(message, command, reason) { - console.log(`${message.author.username} was blocked from using ${command.id} because of ${reason}!`); - switch(reason) { - case "Owner": - let ownerMessage = ["Nice try but you aren't the owner ", "LOADING SUPER SECRET COMMAND Wait a minute... you aren't the owner!", "uhm, how about no"]; - let ownerMessage = ownerMessage[Math.floor( Math.random() * ownerMessage.length )]; - message.reply(ownerMessage); - break; - case "clientPermissions": - message.reply('Im missing the required permissions for this command!'); - break; - case "userPermissions": - message.reply('You are missing some permissions to use this command!'); - break; - case "blacklist": - message.reply('You can\'t use this command because you have been blacklisted!'); - break; - - } - } + exec(message, command, reason) { + console.log(`${message.author.username} was blocked from using ${command.id} because of ${reason}!`); + let ownerMessage; + switch(reason) { + case 'Owner': + ownerMessage = ['Nice try but you aren\'t the owner ', 'LOADING SUPER SECRET COMMAND Wait a minute... you aren\'t the owner!', 'uhm, how about no']; + ownerMessage = ownerMessage[Math.floor( Math.random() * ownerMessage.length )]; + message.reply(ownerMessage); + break; + case 'clientPermissions': + message.reply('Im missing the required permissions for this command!'); + break; + case 'userPermissions': + message.reply('You are missing some permissions to use this command!'); + break; + case 'blacklist': + message.reply('You can\'t use this command because you have been blacklisted!'); + break; + + } + } } module.exports = CommandBlockedListener; \ No newline at end of file diff --git a/listeners/guildCreate.js b/listeners/guildCreate.js index eb4f00f..4b33e68 100644 --- a/listeners/guildCreate.js +++ b/listeners/guildCreate.js @@ -4,25 +4,25 @@ const { statsChannel } = require('../config.json'); class guildCreateListener extends Listener { - constructor() { - super('guildCreate', { - emitter: 'client', - eventName: 'guildCreate' - }); - } + constructor() { + super('guildCreate', { + emitter: 'client', + eventName: 'guildCreate' + }); + } - async exec(guild, client) { - console.log(`${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}`); - const channel = this.client.channels.get(statsChannel); - const addEmbed = new Discord.RichEmbed() - .setColor("#52e80d") - .setTitle('Someone added me ! YAY :D') - .setURL('https://www.youtube.com/watch?v=6n3pFFPSlW4') - .setThumbnail(guild.iconURL) - .setDescription(`${guild.name}\n${guild.id}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\n(${guild.owner.id})`) - .setTimestamp() - - channel.send({ embed: addEmbed }); - } + async exec(guild) { + console.log(`${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}`); + const channel = this.client.channels.get(statsChannel); + const addEmbed = new Discord.RichEmbed() + .setColor('#52e80d') + .setTitle('Someone added me ! YAY :D') + .setURL('https://www.youtube.com/watch?v=6n3pFFPSlW4') + .setThumbnail(guild.iconURL) + .setDescription(`${guild.name}\n${guild.id}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\n(${guild.owner.id})`) + .setTimestamp(); + + channel.send({ embed: addEmbed }); + } } module.exports = guildCreateListener; \ No newline at end of file diff --git a/listeners/guildDelete.js b/listeners/guildDelete.js index 4ebd87d..d2e884d 100644 --- a/listeners/guildDelete.js +++ b/listeners/guildDelete.js @@ -4,28 +4,28 @@ const { statsChannel } = require('../config.json'); class guildCreateListener extends Listener { - constructor() { - super('guildDelete', { - emitter: 'client', - eventName: 'guildDelete' - }); - } + constructor() { + super('guildDelete', { + emitter: 'client', + eventName: 'guildDelete' + }); + } - async exec(guild, client) { - console.log(`***BOT KICKED***\n${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}\n***BOT KICKED***`); - const channel = this.client.channels.get(statsChannel); + async exec(guild) { + console.log(`***BOT KICKED***\n${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}\n***BOT KICKED***`); + const channel = this.client.channels.get(statsChannel); - const kickEmbed = new Discord.RichEmbed() - .setColor("#FF0000") - .setTitle('They kicked me out :(') - .setURL('https://www.youtube.com/watch?v=6n3pFFPSlW4') - .setThumbnail(guild.iconURL) - .setDescription(`${guild.name}\n${guild.id}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\n(${guild.owner.id})`) - .setTimestamp() + const kickEmbed = new Discord.RichEmbed() + .setColor('#FF0000') + .setTitle('They kicked me out :(') + .setURL('https://www.youtube.com/watch?v=6n3pFFPSlW4') + .setThumbnail(guild.iconURL) + .setDescription(`${guild.name}\n${guild.id}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\n(${guild.owner.id})`) + .setTimestamp(); - channel.send({ embed: kickEmbed }); - console.log('***BOT KICKED***') - } + channel.send({ embed: kickEmbed }); + console.log('***BOT KICKED***'); + } } module.exports = guildCreateListener; \ No newline at end of file diff --git a/listeners/message.js b/listeners/message.js index b9f3d38..c64718d 100644 --- a/listeners/message.js +++ b/listeners/message.js @@ -5,48 +5,48 @@ const imgResponseObject = require("../json/imgreply.json"); const reload = require('auto-reload'); class MessageListener extends Listener { - constructor() { - super('message', { - emitter: 'client', - eventName: 'message' - }); - } + constructor() { + super('message', { + emitter: 'client', + eventName: 'message' + }); + } - async exec(message) { - let autoresponse = reload('../json/autoresponse.json'); - let message_content = message.content.toLowerCase(); + async exec(message) { + let autoresponse = reload('../json/autoresponse.json'); + let message_content = message.content.toLowerCase(); - if (message.author.bot) return; { + if (message.author.bot) return; { - // If autoresponse is enable send the response - if(autoresponse[message.channel.id] == 'enable') { - // Reply with images as attachement - if(imgResponseObject[message_content]) { - message.channel.send({files: [imgResponseObject[message_content]]}); - } - // React only to the messages - else if(reactObject[message_content]) { - message.react(reactObject[message_content]); - } - // auto respond to messages - else if(responseObject[message_content]) { - message.channel.send(responseObject[message_content]); - // If it contain "like if" react with šŸ‘ - } else if (message_content.includes("like if")) { - message.react("\u{1F44D}") - // If it contain "jeff" react with a jeff emote - } else if (message_content.includes("jeff")) { - message.react("496028845967802378") - } - } - let customresponse = reload(`../tag/${message.guild.id}.json`); - // User autoresponse - if(customresponse[message_content]) { - message.channel.send(customresponse[message_content]) - } + // If autoresponse is enable send the response + if(autoresponse[message.channel.id] == 'enable') { + // Reply with images as attachement + if(imgResponseObject[message_content]) { + message.channel.send({files: [imgResponseObject[message_content]]}); + } + // React only to the messages + else if(reactObject[message_content]) { + message.react(reactObject[message_content]); + } + // auto respond to messages + else if(responseObject[message_content]) { + message.channel.send(responseObject[message_content]); + // If it contain "like if" react with šŸ‘ + } else if (message_content.includes("like if")) { + message.react("\u{1F44D}") + // If it contain "jeff" react with a jeff emote + } else if (message_content.includes("jeff")) { + message.react("496028845967802378") + } + } + let customresponse = reload(`../tag/${message.guild.id}.json`); + // User autoresponse + if(customresponse[message_content]) { + message.channel.send(customresponse[message_content]) + } - } - } + } + } } module.exports = MessageListener; \ No newline at end of file diff --git a/listeners/messageReactionAdd.js b/listeners/messageReactionAdd.js index a87f6fd..2709582 100644 --- a/listeners/messageReactionAdd.js +++ b/listeners/messageReactionAdd.js @@ -3,49 +3,49 @@ const Discord = require('discord.js'); const reload = require('auto-reload'); class MessageReactionAddListener extends Listener { - constructor() { - super('messagereactionadd', { - emitter: 'client', - eventName: 'messageReactionAdd' - }); - } - - async exec(reaction, message, client) { - let messageContent = reaction.message.content; - let messageAttachments = reaction.message.attachments.map(u=> `${u.url}`); - - if (reaction.emoji.name === 'šŸŒŸ' && reaction.count === 4) { - let starboardChannel = reload(`../starboard/${reaction.message.guild.id}.json`); - const channel = this.client.channels.get(starboardChannel['starboard']); - - const starEmbed = new Discord.RichEmbed() - .setColor() - .setDescription(messageContent) - .setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL) - .setTimestamp() - - channel.send({ embed: starEmbed}); - return channel.send(`From: ${reaction.message.channel}\n${messageAttachments}`); - } - if (reaction.emoji.name === 'āœ”' && reaction.count === 4) { - let shameboardChannel = reload(`../starboard/${message.guild.id}.json`); - const channel = client.channels.get(shameboardChannel['shameboard']); - - const starEmbed = new Discord.RichEmbed() - .setColor() - .setDescription(messageContent) - .setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL) - .setTimestamp() - - try { - channel.send({ embed: starEmbed}); - await channel.send(messageAttachments); - } catch(err) { - console.error('There is no shameboard'); - } - } - - } + constructor() { + super('messagereactionadd', { + emitter: 'client', + eventName: 'messageReactionAdd' + }); + } + + async exec(reaction, message, client) { + let messageContent = reaction.message.content; + let messageAttachments = reaction.message.attachments.map(u=> `${u.url}`); + + if (reaction.emoji.name === 'šŸŒŸ' && reaction.count === 4) { + let starboardChannel = reload(`../starboard/${reaction.message.guild.id}.json`); + const channel = this.client.channels.get(starboardChannel['starboard']); + + const starEmbed = new Discord.RichEmbed() + .setColor() + .setDescription(messageContent) + .setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL) + .setTimestamp() + + channel.send({ embed: starEmbed}); + return channel.send(`From: ${reaction.message.channel}\n${messageAttachments}`); + } + if (reaction.emoji.name === 'āœ”' && reaction.count === 4) { + let shameboardChannel = reload(`../starboard/${message.guild.id}.json`); + const channel = client.channels.get(shameboardChannel['shameboard']); + + const starEmbed = new Discord.RichEmbed() + .setColor() + .setDescription(messageContent) + .setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL) + .setTimestamp() + + try { + channel.send({ embed: starEmbed}); + await channel.send(messageAttachments); + } catch(err) { + console.error('There is no shameboard'); + } + } + + } } module.exports = MessageReactionAddListener; \ No newline at end of file