Changed indent

merge-requests/2/head
Supositware 5 years ago
parent e8ce566c4b
commit a64c0a2cc8

@ -2,82 +2,82 @@ const fs = require('fs');
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class autoresponseCommand extends Command { class autoresponseCommand extends Command {
constructor() { constructor() {
super('autoresponse', { super('autoresponse', {
aliases: ['autoresponse'], aliases: ['autoresponse'],
category: 'admin', category: 'admin',
args: [ args: [
{ {
id: 'text', id: 'text',
type: 'string' type: 'string'
}, },
{ {
id: 'all', id: 'all',
type: 'string' type: 'string'
} }
], ],
userPermissions: ['ADMINISTRATOR'], userPermissions: ['ADMINISTRATOR'],
channelRestriction: 'guild', channelRestriction: 'guild',
description: { description: {
content: 'enable/disable autoresponse', content: 'enable/disable autoresponse',
usage: '[enable/disable] (optional) [all]', usage: '[enable/disable] (optional) [all]',
examples: ['enable all'] examples: ['enable all']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
let text = args.text; let text = args.text;
let all = args.all; let all = args.all;
let autoresponse = {}; let autoresponse = {};
let json = JSON.stringify(autoresponse); let json = JSON.stringify(autoresponse);
if (all == 'all') { if (all == 'all') {
const guild = this.client.guilds.get(message.guild.id); const guild = this.client.guilds.get(message.guild.id);
fs.readFile('./json/autoresponse.json', 'utf8', function readFileCallback(err, data) { fs.readFile('./json/autoresponse.json', 'utf8', function readFileCallback(err, data) {
if (err) { if (err) {
fs.close(); fs.close();
console.log(err); console.log(err);
} else { } else {
autoresponse = JSON.parse(data); //now it an object autoresponse = JSON.parse(data); //now it an object
guild.channels.forEach(channel => autoresponse[channel] = text); guild.channels.forEach(channel => autoresponse[channel] = text);
json = JSON.stringify(autoresponse); //convert it back to json json = JSON.stringify(autoresponse); //convert it back to json
json = json.replace(/[<#>]/g, ''); json = json.replace(/[<#>]/g, '');
fs.writeFile('./json/autoresponse.json', json, 'utf8', function (err) { fs.writeFile('./json/autoresponse.json', json, 'utf8', function (err) {
if (err) { if (err) {
fs.close(); fs.close();
return console.log(err); return console.log(err);
} }
}) });
} }
}); });
fs.close(); fs.close();
return message.channel.send('Auto response have been disable/enable on every channel'); return message.channel.send('Auto response have been disable/enable on every channel');
} else if (text == 'disable' || 'enable') { } else if (text == 'disable' || 'enable') {
fs.readFile('./json/autoresponse.json', 'utf8', function readFileCallback(err, data) { fs.readFile('./json/autoresponse.json', 'utf8', function readFileCallback(err, data) {
if (err) { if (err) {
console.log(err); console.log(err);
} else { } else {
autoresponse = JSON.parse(data); //now it an object autoresponse = JSON.parse(data); //now it an object
autoresponse[message.channel.id] = text; autoresponse[message.channel.id] = text;
json = JSON.stringify(autoresponse); //convert it back to json json = JSON.stringify(autoresponse); //convert it back to json
fs.writeFile('./json/autoresponse.json', json, 'utf8', function (err) { fs.writeFile('./json/autoresponse.json', json, 'utf8', function (err) {
if (err) { if (err) {
fs.close(); fs.close();
return console.log(err); return console.log(err);
} }
}) });
} }
}) });
}; }
fs.close(); fs.close();
return message.channel.send(`Autoresponse have been ${text}d`); return message.channel.send(`Autoresponse have been ${text}d`);
} }
} }
module.exports = autoresponseCommand; module.exports = autoresponseCommand;

@ -1,46 +1,46 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class BanCommand extends Command { class BanCommand extends Command {
constructor() { constructor() {
super('ban', { super('ban', {
aliases: ['ban'], aliases: ['ban'],
category: 'admin', category: 'admin',
split: 'quote', split: 'quote',
args: [ args: [
{ {
id: 'member', id: 'member',
type: 'member' type: 'member'
}, },
{ {
id: 'reasons', id: 'reasons',
type: 'string' type: 'string'
} }
], ],
clientPermissions: ['BAN_MEMBERS'], clientPermissions: ['BAN_MEMBERS'],
userPermissions: ['BAN_MEMBERS'], userPermissions: ['BAN_MEMBERS'],
channelRestriction: 'guild', channelRestriction: 'guild',
description: { description: {
content: 'Ban user', content: 'Ban user',
usage: '[@user]', usage: '[@user]',
examples: ['@user big dumb dumb'] examples: ['@user big dumb dumb']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
let member = args.member; let member = args.member;
let reasons = args.reasons; let reasons = args.reasons;
if(member == this.client) if(member == this.client)
return message.channel.send('Cant ban me fool') return message.channel.send('Cant ban me fool');
if(!reasons) if(!reasons)
reasons = 'Nothing have been specified' reasons = 'Nothing have been specified';
if(member.id === message.author.id) if(member.id === message.author.id)
return message.channel.send("Why would you ban yourself ?") return message.channel.send('Why would you ban yourself ?');
member.ban(`Banned by : ${message.author.username} for 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}".`)) .then(() => message.reply(`${member.user.username} was succesfully banned with the following reasons "${reasons}".`));
} }
} }
module.exports = BanCommand; module.exports = BanCommand;

@ -1,47 +1,47 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class KickCommand extends Command { class KickCommand extends Command {
constructor() { constructor() {
super('kick', { super('kick', {
aliases: ['kick'], aliases: ['kick'],
category: 'admin', category: 'admin',
split: 'quoted', split: 'quoted',
args: [ args: [
{ {
id: 'member', id: 'member',
type: 'member' type: 'member'
}, },
{ {
id: 'reasons', id: 'reasons',
type: 'string' type: 'string'
} }
], ],
clientPermissions: ['KICK_MEMBERS'], clientPermissions: ['KICK_MEMBERS'],
userPermissions: ['KICK_MEMBERS'], userPermissions: ['KICK_MEMBERS'],
channelRestriction: 'guild', channelRestriction: 'guild',
description: { description: {
content: 'Kick user', content: 'Kick user',
usage: '[@user]', usage: '[@user]',
examples: ['@user big dumb dumb'] examples: ['@user big dumb dumb']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
let member = args.member; let member = args.member;
let reasons = args.reasons; let reasons = args.reasons;
if(member === this.client.user) if(member === this.client.user)
return message.channel.say('Cant kick me fool'); return message.channel.say('Cant kick me fool');
if(member.id === message.author.id) if(member.id === message.author.id)
return message.channel.say("Why would you kick yourself ?"); return message.channel.say('Why would you kick yourself ?');
if(!reasons) if(!reasons)
reasons = 'Nothing have been specified.'; reasons = 'Nothing have been specified.';
await member.kick(`Kicked by : ${message.author.username} for the following reasons : ${reasons}`) 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}".`)) .then(() => message.reply(`${member.user.username} was succesfully kicked with the following reasons "${reasons}".`))
.catch(err => console.error(err)) .catch(err => console.error(err));
} }
} }
module.exports = KickCommand; module.exports = KickCommand;

@ -1,31 +1,31 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class PruneCommand extends Command { class PruneCommand extends Command {
constructor() { constructor() {
super('Prune', { super('Prune', {
aliases: ['Prune', 'clean', 'purge'], aliases: ['Prune', 'clean', 'purge'],
category: 'admin', category: 'admin',
args: [ args: [
{ {
id: "amount", id: 'amount',
type: "integer" type: 'integer'
} }
], ],
clientPermissions: ['MANAGE_MESSAGES'], clientPermissions: ['MANAGE_MESSAGES'],
userPermissions: ['MANAGE_MESSAGES'], userPermissions: ['MANAGE_MESSAGES'],
channelRestriction: 'guild', channelRestriction: 'guild',
description: { description: {
content: 'Bulk delete messages', content: 'Bulk delete messages',
usage: '[amount]', usage: '[amount]',
examples: ['50'] examples: ['50']
} }
}); });
} }
async exec(message,args) { async exec(message,args) {
if (args.amount >= 100) return; if (args.amount >= 100) return;
message.channel.bulkDelete(args.amount + 1, true); message.channel.bulkDelete(args.amount + 1, true);
} }
} }
module.exports = PruneCommand; module.exports = PruneCommand;

@ -2,47 +2,47 @@ const { Command } = require('discord-akairo');
const fs = require('fs'); const fs = require('fs');
class shameboardCommand extends Command { class shameboardCommand extends Command {
constructor() { constructor() {
super('shameboard', { super('shameboard', {
aliases: ['shameboard'], aliases: ['shameboard'],
category: 'admin', category: 'admin',
channelRestriction: 'guild', channelRestriction: 'guild',
userPermissions: ['ADMINISTRATOR'], userPermissions: ['ADMINISTRATOR'],
description: { description: {
content: 'Set shameboard', content: 'Set shameboard',
usage: '[]', usage: '[]',
examples: [''] examples: ['']
} }
}); });
} }
async exec(message) { async exec(message) {
let shameboardChannel = message.channel.id; let shameboardChannel = message.channel.id;
fs.readFile(`./starboard/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) { fs.readFile(`./starboard/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) {
if (err) { if (err) {
fs.writeFile(`./starboard/${message.guild.id}.json`, `{"shameboard": "${shameboardChannel}"}`, function (err) { fs.writeFile(`./starboard/${message.guild.id}.json`, `{"shameboard": "${shameboardChannel}"}`, function (err) {
if (err) { if (err) {
console.log(err); console.log(err);
} }
fs.close(); fs.close();
return message.channel.send(`This channel have been set as the shameboard`); return message.channel.send('This channel have been set as the shameboard');
}) });
} else { } else {
let shameboard = JSON.parse(data); //now it an object let shameboard = JSON.parse(data); //now it an object
shameboard['shameboard'] = shameboardChannel; shameboard['shameboard'] = shameboardChannel;
var json = JSON.stringify(shameboard); //convert it back to json var json = JSON.stringify(shameboard); //convert it back to json
fs.writeFile(`./starboard/${message.guild.id}.json`, json, 'utf8', function (err) { fs.writeFile(`./starboard/${message.guild.id}.json`, json, 'utf8', function (err) {
if (err) { if (err) {
fs.close(); fs.close();
return console.log(err); return console.log(err);
} }
}) });
} }
}); });
fs.close(); fs.close();
return message.channel.send(`This channel have been set as the shameboard`); return message.channel.send('This channel have been set as the shameboard');
} }
} }
module.exports = shameboardCommand; module.exports = shameboardCommand;

@ -1,54 +1,54 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class PruneCommand extends Command { class PruneCommand extends Command {
constructor() { constructor() {
super('Slowmode', { super('Slowmode', {
aliases: ['slowmode', 'slow'], aliases: ['slowmode', 'slow'],
category: 'admin', category: 'admin',
args: [ args: [
{ {
id: "slowmodeNumber", id: 'slowmodeNumber',
type: "integer" type: 'integer'
}, },
{ {
id: "realtime", id: 'realtime',
type: "integer", type: 'integer',
optional: true, optional: true,
} }
], ],
clientPermissions: ['MANAGE_CHANNELS'], clientPermissions: ['MANAGE_CHANNELS'],
userPermissions: ['MANAGE_CHANNELS'], userPermissions: ['MANAGE_CHANNELS'],
channelRestriction: 'guild', channelRestriction: 'guild',
description: { description: {
content: 'Put a channel in slowmode', content: 'Put a channel in slowmode',
usage: '[1-120 slowmode] [time it stays on]', usage: '[1-120 slowmode] [time it stays on]',
examples: ['267065637183029248'] examples: ['267065637183029248']
} }
}); });
} }
async exec(message,args) { async exec(message,args) {
let slowmodeNumber = args.slowmodeNumber; let slowmodeNumber = args.slowmodeNumber;
let realtime = args.realtime; let realtime = args.realtime;
if (slowmodeNumber > 120) if (slowmodeNumber > 120)
return message.channel.send("Slowmode can only be set to 120 seconds or lower!"); return message.channel.send('Slowmode can only be set to 120 seconds or lower!');
message.channel.setRateLimitPerUser(slowmodeNumber); message.channel.setRateLimitPerUser(slowmodeNumber);
if (realtime) { if (realtime) {
let time = 60000 * realtime; let time = 60000 * realtime;
message.channel.send(`Slowmode have been set to ${slowmodeNumber} seconds and will end in ${realtime} minutes!`); message.channel.send(`Slowmode have been set to ${slowmodeNumber} seconds and will end in ${realtime} minutes!`);
setTimeout (function (){ setTimeout (function (){
message.channel.setRateLimitPerUser(0); message.channel.setRateLimitPerUser(0);
return message.channel.send("Slowmode is now disabled!") return message.channel.send('Slowmode is now disabled!');
}, time); }, time);
} else { } else {
if (slowmodeNumber == 0) if (slowmodeNumber == 0)
return message.channel.send("Slowmode have been disabled!") return message.channel.send('Slowmode have been disabled!');
return message.channel.send(`Slowmode have been set to ${slowmodeNumber} seconds!`); return message.channel.send(`Slowmode have been set to ${slowmodeNumber} seconds!`);
} }
} }
} }
module.exports = PruneCommand; module.exports = PruneCommand;

@ -2,47 +2,47 @@ const { Command } = require('discord-akairo');
const fs = require('fs'); const fs = require('fs');
class StarBoardCommand extends Command { class StarBoardCommand extends Command {
constructor() { constructor() {
super('starboard', { super('starboard', {
aliases: ['starboard'], aliases: ['starboard'],
category: 'admin', category: 'admin',
channelRestriction: 'guild', channelRestriction: 'guild',
userPermissions: ['ADMINISTRATOR'], userPermissions: ['ADMINISTRATOR'],
description: { description: {
content: 'Set starboard', content: 'Set starboard',
usage: '[]', usage: '[]',
examples: [''] examples: ['']
} }
}); });
} }
async exec(message) { async exec(message) {
let starboardChannel = message.channel.id; let starboardChannel = message.channel.id;
fs.readFile(`./starboard/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) { fs.readFile(`./starboard/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) {
if (err) { if (err) {
fs.writeFile(`./starboard/${message.guild.id}.json`, `{"starboard": "${starboardChannel}"}`, function (err) { fs.writeFile(`./starboard/${message.guild.id}.json`, `{"starboard": "${starboardChannel}"}`, function (err) {
if (err) { if (err) {
console.log(err); console.log(err);
} }
fs.close(); fs.close();
return message.channel.send(`This channel have been set as the starboard`); return message.channel.send('This channel have been set as the starboard');
}) });
} else { } else {
let starboard = JSON.parse(data); //now it an object let starboard = JSON.parse(data); //now it an object
starboard['starboard'] = starboardChannel; starboard['starboard'] = starboardChannel;
var json = JSON.stringify(starboard); //convert it back to json var json = JSON.stringify(starboard); //convert it back to json
fs.writeFile(`./starboard/${message.guild.id}.json`, json, 'utf8', function (err) { fs.writeFile(`./starboard/${message.guild.id}.json`, json, 'utf8', function (err) {
if (err) { if (err) {
fs.close(); fs.close();
return console.log(err); return console.log(err);
} }
}) });
} }
}); });
fs.close(); fs.close();
return message.channel.send(`This channel have been set as the starboard`); return message.channel.send('This channel have been set as the starboard');
} }
} }
module.exports = StarBoardCommand; module.exports = StarBoardCommand;

@ -2,66 +2,63 @@ const { Command } = require('discord-akairo');
const fs = require('fs'); const fs = require('fs');
class TagCommand extends Command { class TagCommand extends Command {
constructor() { constructor() {
super('tag', { super('tag', {
aliases: ['tag'], aliases: ['tag'],
category: 'admin', category: 'admin',
split: 'quoted', split: 'quoted',
args: [ args: [
{ {
id: "trigger", id: 'trigger',
type: "string" type: 'string'
}, },
{ {
id: "response", id: 'response',
type: "string" type: 'string'
} }
], ],
channelRestriction: 'guild', channelRestriction: 'guild',
description: { description: {
content: 'Create custom autoresponse', content: 'Create custom autoresponse',
usage: '[trigger] [response]', usage: '[trigger] [response]',
examples: ['"do you know da wea" "Fuck off dead meme"'] examples: ['do you know da wea', 'Fuck off dead meme']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
let trigger = args.trigger; let trigger = args.trigger;
let response = args.response; let response = args.response;
trigger = trigger.toLowerCase(); trigger = trigger.toLowerCase();
do {
trigger = trigger.replace('--', ' ');
} while (trigger.includes('--'))
let customresponse = {}; let customresponse = {};
let json = JSON.stringify(customresponse); let json = JSON.stringify(customresponse);
fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) { fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) {
if (err) { if (err) {
fs.writeFile(`./tag/${message.guild.id}.json`, `{"${trigger}":"${response}"}`, function (err) { fs.writeFile(`./tag/${message.guild.id}.json`, `{'${trigger}':'${response}'}`, function (err) {
if (err) { if (err) {
fs.close(); fs.close();
console.log(err); console.log(err);
} }
}) });
} else { } else {
customresponse = JSON.parse(data); //now it an object customresponse = JSON.parse(data); //now it an object
customresponse[trigger] = response customresponse[trigger] = response;
json = JSON.stringify(customresponse); //convert it back to json json = JSON.stringify(customresponse); //convert it back to json
fs.writeFile(`./tag/${message.guild.id}.json`, json, 'utf8', function (err) { fs.writeFile(`./tag/${message.guild.id}.json`, json, 'utf8', function (err) {
if (err) { if (err) {
fs.close(); fs.close();
return console.log(err); return console.log(err);
} }
}) });
} }
}); });
fs.close(); fs.close();
return message.channel.send(`autoresponse have been set to ${trigger} : ${response}`); return message.channel.send(`autoresponse have been set to ${trigger} : ${response}`);
} }
} }
module.exports = TagCommand; module.exports = TagCommand;

@ -1,31 +1,31 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class UnbanCommand extends Command { class UnbanCommand extends Command {
constructor() { constructor() {
super('unban', { super('unban', {
aliases: ['unban'], aliases: ['unban'],
category: 'admin', category: 'admin',
args: [ args: [
{ {
id: 'member', id: 'member',
type: 'user' type: 'user'
} }
], ],
clientPermissions: ['BAN_MEMBERS'], clientPermissions: ['BAN_MEMBERS'],
userPermissions: ['BAN_MEMBERS'], userPermissions: ['BAN_MEMBERS'],
channelRestriction: 'guild', channelRestriction: 'guild',
description: { description: {
content: 'unban users', content: 'unban users',
usage: '[user id]', usage: '[user id]',
examples: ['267065637183029248'] examples: ['267065637183029248']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
message.guild.unban(args.member) message.guild.unban(args.member)
.then(() => message.reply(`user was succesfully unbanned.`)); .then(() => message.reply('user was succesfully unbanned.'));
} }
} }
module.exports = UnbanCommand; module.exports = UnbanCommand;

@ -2,55 +2,55 @@ const { Command } = require('discord-akairo');
const fs = require('fs'); const fs = require('fs');
class UnTagCommand extends Command { class UnTagCommand extends Command {
constructor() { constructor() {
super('untag', { super('untag', {
aliases: ['untag'], aliases: ['untag'],
category: 'admin', category: 'admin',
split: 'none', split: 'none',
args: [ args: [
{ {
id: "trigger", id: 'trigger',
type: "string" type: 'string'
} }
], ],
channelRestriction: 'guild', channelRestriction: 'guild',
description: { description: {
content: 'Remove created custom autoresponse', content: 'Remove created custom autoresponse',
usage: '[trigger]', usage: '[trigger]',
examples: ['"do you know da wea"'] examples: ['do you know da wea']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
let trigger = args.trigger; let trigger = args.trigger;
trigger = trigger.toLowerCase(); trigger = trigger.toLowerCase();
let customresponse = {} let customresponse = {};
let json = JSON.stringify(customresponse) let json = JSON.stringify(customresponse);
fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) { fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) {
if (err) { if (err) {
console.log(err); console.log(err);
} else { } else {
customresponse = JSON.parse(data); //now it an object customresponse = JSON.parse(data); //now it an object
delete customresponse[trigger] delete customresponse[trigger];
json = JSON.stringify(customresponse); //convert it back to json json = JSON.stringify(customresponse); //convert it back to json
fs.writeFile(`./tag/${message.guild.id}.json`, json, 'utf8', function (err) { fs.writeFile(`./tag/${message.guild.id}.json`, json, 'utf8', function (err) {
if (err) { if (err) {
fs.close(); fs.close();
return console.log(err); return console.log(err);
} }
}) });
} }
}); });
fs.close(); fs.close();
return message.channel.send(`The following autoresponse have been deleted: ${trigger}`); return message.channel.send(`The following autoresponse have been deleted: ${trigger}`);
} }
} }
module.exports = UnTagCommand; module.exports = UnTagCommand;

@ -3,31 +3,31 @@ const Discord = require('discord.js');
const fetch = require('node-fetch'); const fetch = require('node-fetch');
class AdviceCommand extends Command { class AdviceCommand extends Command {
constructor() { constructor() {
super('advice', { super('advice', {
aliases: ['advice'], aliases: ['advice'],
category: 'general', category: 'general',
description: { description: {
content: 'Send some random advices', content: 'Send some random advices',
usage: '', usage: '',
examples: [''] examples: ['']
} }
}); });
} }
async exec(message) { async exec(message) {
fetch("http://api.adviceslip.com/advice").then((response) => { fetch('http://api.adviceslip.com/advice').then((response) => {
return response.json(); return response.json();
}).then((response) => { }).then((response) => {
const adviceEmbed = new Discord.RichEmbed() const adviceEmbed = new Discord.RichEmbed()
.setColor("#ff9900") .setColor('#ff9900')
.setTitle(response.slip.slip_id) .setTitle(response.slip.slip_id)
.setDescription(response.slip.advice) .setDescription(response.slip.advice);
message.channel.send(adviceEmbed); message.channel.send(adviceEmbed);
})} });
}
} }
module.exports = AdviceCommand; module.exports = AdviceCommand;

@ -1,33 +1,33 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
const fetch = require('node-fetch') const fetch = require('node-fetch');
class ImgurCommand extends Command { class ImgurCommand extends Command {
constructor() { constructor() {
super('imgur', { super('imgur', {
aliases: ['badmeme', 'imgur'], aliases: ['badmeme', 'imgur'],
category: 'general', category: 'general',
description: { description: {
content: 'Send some random images from imgur', content: 'Send some random images from imgur',
usage: '', usage: '',
examples: [''] examples: ['']
} }
}); });
} }
async exec(message) { async exec(message) {
fetch("https://api.imgur.com/3/gallery/hot/day?showViral=true&mature=false&perPage=100&album_previews=true", { fetch('https://api.imgur.com/3/gallery/hot/day?showViral=true&mature=false&perPage=100&album_previews=true', {
headers: { "Authorization": "Client-ID e4cb6948f80f295" }, headers: { 'Authorization': 'Client-ID e4cb6948f80f295' },
}).then((response) => { }).then((response) => {
return response.json(); return response.json();
}).then((response) => { }).then((response) => {
if (response.success == 'false') if (response.success == 'false')
return message.channel.send('An error has occured') 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; module.exports = ImgurCommand;

@ -1,30 +1,30 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class ClapCommand extends Command { class ClapCommand extends Command {
constructor() { constructor() {
super('clap', { super('clap', {
aliases: ['clap'], aliases: ['clap'],
category: 'general', category: 'general',
split: 'none', split: 'none',
args: [ args: [
{ {
id: "text", id: 'text',
type: "string" type: 'string'
} }
], ],
description: { description: {
content: 'replace 👏 the 👏 spaces 👏 with 👏 clap 👏', content: 'replace 👏 the 👏 spaces 👏 with 👏 clap 👏',
usage: '[text]', usage: '[text]',
examples: ['replace the spaces with clap'] examples: ['replace the spaces with clap']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
let clap = args.text.replace(/ /g, ' 👏 '); let clap = args.text.replace(/ /g, ' 👏 ');
message.delete(); message.delete();
message.channel.send(`${clap} 👏`); message.channel.send(`${clap} 👏`);
} }
} }
module.exports = ClapCommand; module.exports = ClapCommand;

@ -2,34 +2,34 @@ const { Command } = require('discord-akairo');
const emojiCharacters = require('../../emojiCharacters'); const emojiCharacters = require('../../emojiCharacters');
class EmotesayCommand extends Command { class EmotesayCommand extends Command {
constructor() { constructor() {
super('emotesay', { super('emotesay', {
aliases: ['emotesay', 'esay'], aliases: ['emotesay', 'esay'],
category: 'general', category: 'general',
split: 'none', split: 'none',
args: [ args: [
{ {
id: "text", id: 'text',
type: "string" type: 'string'
} }
], ],
description: { description: {
content: 'Replace the text you send with dancing letters', content: 'Replace the text you send with dancing letters',
usage: '[text]', usage: '[text]',
examples: ['Hello'] examples: ['Hello']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
let text = args.text; let text = args.text;
message.delete(); message.delete();
let emojiArray = []; let emojiArray = [];
for (let i = 0; i < text.length; i++) for (let i = 0; i < text.length; i++)
emojiArray[i] = emojiCharacters[text.toLowerCase().split('')[i]]; emojiArray[i] = emojiCharacters[text.toLowerCase().split('')[i]];
message.channel.send(emojiArray.join("")) message.channel.send(emojiArray.join(''));
} }
} }
module.exports = EmotesayCommand; module.exports = EmotesayCommand;

@ -2,22 +2,22 @@ const { Command } = require('discord-akairo');
const fetch = require('node-fetch'); const fetch = require('node-fetch');
class InspiroBotCommand extends Command { class InspiroBotCommand extends Command {
constructor() { constructor() {
super('InspiroBot', { super('InspiroBot', {
aliases: ['inspirobot', 'ib'], aliases: ['inspirobot', 'ib'],
category: 'general', category: 'general',
description: { description: {
content: 'Send images from Inspirobot', content: 'Send images from Inspirobot',
usage: '', usage: '',
examples: [''] examples: ['']
} }
}); });
} }
async exec(message) { async exec(message) {
fetch('http://inspirobot.me/api?generate=true') fetch('http://inspirobot.me/api?generate=true')
.then(res => res.text()) .then(res => res.text())
.then(body => message.channel.send({files: [body]})) .then(body => message.channel.send({files: [body]}));
} }
} }
module.exports = InspiroBotCommand; module.exports = InspiroBotCommand;

@ -1,52 +1,53 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
const Discord = require('discord.js');
const fetch = require('node-fetch'); const fetch = require('node-fetch');
class RedditCommand extends Command { class RedditCommand extends Command {
constructor() { constructor() {
super('reddit', { super('reddit', {
aliases: ['reddit'], aliases: ['reddit'],
category: 'general', category: 'general',
split: 'none', split: 'none',
args: [ args: [
{ {
id: 'sub', id: 'sub',
type: 'string' type: 'string'
} }
], ],
description: { description: {
content: 'Send random images from the subreddit you choose', content: 'Send random images from the subreddit you choose',
usage: '[subreddit]', usage: '[subreddit]',
examples: ['2meirl4meirl'] examples: ['2meirl4meirl']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
let sub = args.sub; let sub = args.sub;
let i, a;
fetch('https://www.reddit.com/r/' + sub + '.json?limit=100').then((response) => {
return response.json(); fetch('https://www.reddit.com/r/' + sub + '.json?limit=100').then((response) => {
}).then((response) => { return response.json();
if (!response.data) }).then((response) => {
return message.channel.send('Not a valid subreddit') if (!response.data)
while (response.data.children[i].data.post_hint !== 'image') { return message.channel.send('Not a valid subreddit');
i = Math.floor((Math.random() * response.data.children.length)); while (response.data.children[i].data.post_hint !== 'image') {
i = Math.floor((Math.random() * response.data.children.length));
a++ a++;
if (a == 5) if (a == 5)
return message.channel.send("Could not find any images") return message.channel.send('Could not find any images');
} }
if (response.data.children[i].data.over_18 == true) 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 <your feedback>")`) return message.channel.send('No nsfw');
const redditEmbed = new Discord.RichEmbed() const redditEmbed = new Discord.RichEmbed()
.setColor("#ff9900") .setColor('#ff9900')
.setTitle(response.data.children[i].data.title) .setTitle(response.data.children[i].data.title)
.setImage(response.data.children[i].data.url) .setImage(response.data.children[i].data.url)
.setURL('https://reddit.com' + response.data.children[i].data.permalink) .setURL('https://reddit.com' + response.data.children[i].data.permalink)
.setFooter(`${response.data.children[i].data.ups} 💬 ${response.data.children[i].data.num_comments}`) .setFooter(`${response.data.children[i].data.ups} 💬 ${response.data.children[i].data.num_comments}`);
message.channel.send(redditEmbed); message.channel.send(redditEmbed);
}) });
} }
} }
module.exports = RedditCommand; module.exports = RedditCommand;

@ -1,79 +1,79 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class SayCommand extends Command { class SayCommand extends Command {
constructor() { constructor() {
super('say', { super('say', {
aliases: ['say'], aliases: ['say'],
category: 'general', category: 'general',
split: 'none', split: 'none',
args: [ args: [
{ {
id: 'text', id: 'text',
type: 'string', type: 'string',
} }
], ],
description: { description: {
content: 'Repeat what you say but can also replace ', content: 'Repeat what you say but can also replace ',
usage: '[text]', usage: '[text]',
examples: ['[member] is a big [adverbs] [verb]'] examples: ['[member] is a big [adverbs] [verb]']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
let text = args.text; let text = args.text;
// Load all the different files // Load all the different files
const verb = require('../../dictionary/verbs.json') const verb = require('../../dictionary/verbs.json');
const noun = require('../../dictionary/noun.json') const noun = require('../../dictionary/noun.json');
const adjective = require('../../dictionary/adjectives.json') const adjective = require('../../dictionary/adjectives.json');
const adverbs = require('../../dictionary/adverbs.json') const adverbs = require('../../dictionary/adverbs.json');
const activities = require('../../dictionary/activities.json') const activities = require('../../dictionary/activities.json');
const celebreties = require('../../dictionary/celebreties.json') const celebreties = require('../../dictionary/celebreties.json');
const countries = require('../../dictionary/countries.json') const countries = require('../../dictionary/countries.json');
const diseases = require('../../dictionary/diseases.json') const diseases = require('../../dictionary/diseases.json');
const elements = require('../../dictionary/elements.json') const elements = require('../../dictionary/elements.json');
const hobbies = require('../../dictionary/hobbies.json') const hobbies = require('../../dictionary/hobbies.json');
const music = require('../../dictionary/music.json') const music = require('../../dictionary/music.json');
const prefixes = require('../../dictionary/prefixes.json') const prefixes = require('../../dictionary/prefixes.json');
const pronouns = require('../../dictionary/pronouns.json') const pronouns = require('../../dictionary/pronouns.json');
const states = require('../../dictionary/states.json') const states = require('../../dictionary/states.json');
const titles = require('../../dictionary/titles.json') const titles = require('../../dictionary/titles.json');
const units = require('../../dictionary/units.json') const units = require('../../dictionary/units.json');
// Generate a random number // Generate a random number
function randNumber(file) { function randNumber(file) {
let Rand = Math.floor((Math.random() * file.length) + 1); let Rand = Math.floor((Math.random() * file.length) + 1);
return Rand; return Rand;
} }
// Replace with a random word from the json // Replace with a random word from the json
do { do {
text = text.replace(/\[verb\]/, verb[randNumber(verb)]) text = text.replace(/\[verb\]/, verb[randNumber(verb)]);
text = text.replace(/\[adverb\]/, adverbs[randNumber(adverbs)]) text = text.replace(/\[adverb\]/, adverbs[randNumber(adverbs)]);
text = text.replace(/\[noun\]/, noun[randNumber(noun)]) text = text.replace(/\[noun\]/, noun[randNumber(noun)]);
text = text.replace(/\[adjective\]/, adjective[randNumber(adjective)]) text = text.replace(/\[adjective\]/, adjective[randNumber(adjective)]);
text = text.replace(/\[activity\]/, activities[randNumber(activities)]) text = text.replace(/\[activity\]/, activities[randNumber(activities)]);
text = text.replace(/\[celebrity\]/, celebreties[randNumber(celebreties)]) text = text.replace(/\[celebrity\]/, celebreties[randNumber(celebreties)]);
text = text.replace(/\[country\]/, countries[randNumber(countries)]) text = text.replace(/\[country\]/, countries[randNumber(countries)]);
text = text.replace(/\[diseases\]/, diseases[randNumber(diseases)]) text = text.replace(/\[diseases\]/, diseases[randNumber(diseases)]);
text = text.replace(/\[elements\]/, elements[randNumber(elements)]) text = text.replace(/\[elements\]/, elements[randNumber(elements)]);
text = text.replace(/\[hobbies\]/, hobbies[randNumber(hobbies)]) text = text.replace(/\[hobbies\]/, hobbies[randNumber(hobbies)]);
text = text.replace(/\[music\]/, music[randNumber(music)]) text = text.replace(/\[music\]/, music[randNumber(music)]);
text = text.replace(/\[prefixes\]/, prefixes[randNumber(prefixes)]) text = text.replace(/\[prefixes\]/, prefixes[randNumber(prefixes)]);
text = text.replace(/\[pronoun\]/, pronouns[randNumber(pronouns)]) text = text.replace(/\[pronoun\]/, pronouns[randNumber(pronouns)]);
text = text.replace(/\[state\]/, states[randNumber(states)]) text = text.replace(/\[state\]/, states[randNumber(states)]);
text = text.replace(/\[title\]/, titles[randNumber(titles)]) text = text.replace(/\[title\]/, titles[randNumber(titles)]);
text = text.replace(/\[unit\]/, units[randNumber(units)]) text = text.replace(/\[unit\]/, units[randNumber(units)]);
text = text.replace(/\[member\]/, message.guild.members.random().user.username) text = text.replace(/\[member\]/, message.guild.members.random().user.username);
text = text.replace(/\[number\]/, Math.floor((Math.random() * 9) + 1)) text = text.replace(/\[number\]/, Math.floor((Math.random() * 9) + 1));
// Verify if it replaced everything // 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]')) } 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 // Send the final text
return message.channel.send(text); return message.channel.send(text);
} }
} }
module.exports = SayCommand; module.exports = SayCommand;

@ -1,81 +1,81 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class SayCommand extends Command { class SaydCommand extends Command {
constructor() { constructor() {
super('sayd', { super('sayd', {
aliases: ['sayd'], aliases: ['sayd'],
category: 'general', category: 'general',
split: 'none', split: 'none',
clientPermissions: 'MANAGE_MESSAGES', clientPermissions: 'MANAGE_MESSAGES',
args: [ args: [
{ {
id: 'text', id: 'text',
type: 'string' type: 'string'
} }
], ],
description: { description: {
content: 'Repeat what you say but delete the text you sent', content: 'Repeat what you say but delete the text you sent',
usage: '[text]', usage: '[text]',
examples: ['[member] is a big [adverbs] [verb]'] examples: ['[member] is a big [adverbs] [verb]']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
let text = args.text; let text = args.text;
// Load all the different files // Load all the different files
const verb = require('../../dictionary/verbs.json') const verb = require('../../dictionary/verbs.json');
const noun = require('../../dictionary/noun.json') const noun = require('../../dictionary/noun.json');
const adjective = require('../../dictionary/adjectives.json') const adjective = require('../../dictionary/adjectives.json');
const adverbs = require('../../dictionary/adverbs.json') const adverbs = require('../../dictionary/adverbs.json');
const activities = require('../../dictionary/activities.json') const activities = require('../../dictionary/activities.json');
const celebreties = require('../../dictionary/celebreties.json') const celebreties = require('../../dictionary/celebreties.json');
const countries = require('../../dictionary/countries.json') const countries = require('../../dictionary/countries.json');
const diseases = require('../../dictionary/diseases.json') const diseases = require('../../dictionary/diseases.json');
const elements = require('../../dictionary/elements.json') const elements = require('../../dictionary/elements.json');
const hobbies = require('../../dictionary/hobbies.json') const hobbies = require('../../dictionary/hobbies.json');
const music = require('../../dictionary/music.json') const music = require('../../dictionary/music.json');
const prefixes = require('../../dictionary/prefixes.json') const prefixes = require('../../dictionary/prefixes.json');
const pronouns = require('../../dictionary/pronouns.json') const pronouns = require('../../dictionary/pronouns.json');
const states = require('../../dictionary/states.json') const states = require('../../dictionary/states.json');
const titles = require('../../dictionary/titles.json') const titles = require('../../dictionary/titles.json');
const units = require('../../dictionary/units.json') const units = require('../../dictionary/units.json');
// Generate a random number // Generate a random number
function randNumber(file) { function randNumber(file) {
let Rand = Math.floor((Math.random() * file.length) + 1); let Rand = Math.floor((Math.random() * file.length) + 1);
return Rand; return Rand;
} }
// Replace with a random word from the json // Replace with a random word from the json
do { do {
text = text.replace(/\[verb\]/, verb[randNumber(verb)]) text = text.replace(/\[verb\]/, verb[randNumber(verb)]);
text = text.replace(/\[adverb\]/, adverbs[randNumber(adverbs)]) text = text.replace(/\[adverb\]/, adverbs[randNumber(adverbs)]);
text = text.replace(/\[noun\]/, noun[randNumber(noun)]) text = text.replace(/\[noun\]/, noun[randNumber(noun)]);
text = text.replace(/\[adjective\]/, adjective[randNumber(adjective)]) text = text.replace(/\[adjective\]/, adjective[randNumber(adjective)]);
text = text.replace(/\[activity\]/, activities[randNumber(activities)]) text = text.replace(/\[activity\]/, activities[randNumber(activities)]);
text = text.replace(/\[celebrity\]/, celebreties[randNumber(celebreties)]) text = text.replace(/\[celebrity\]/, celebreties[randNumber(celebreties)]);
text = text.replace(/\[country\]/, countries[randNumber(countries)]) text = text.replace(/\[country\]/, countries[randNumber(countries)]);
text = text.replace(/\[diseases\]/, diseases[randNumber(diseases)]) text = text.replace(/\[diseases\]/, diseases[randNumber(diseases)]);
text = text.replace(/\[elements\]/, elements[randNumber(elements)]) text = text.replace(/\[elements\]/, elements[randNumber(elements)]);
text = text.replace(/\[hobbies\]/, hobbies[randNumber(hobbies)]) text = text.replace(/\[hobbies\]/, hobbies[randNumber(hobbies)]);
text = text.replace(/\[music\]/, music[randNumber(music)]) text = text.replace(/\[music\]/, music[randNumber(music)]);
text = text.replace(/\[prefixes\]/, prefixes[randNumber(prefixes)]) text = text.replace(/\[prefixes\]/, prefixes[randNumber(prefixes)]);
text = text.replace(/\[pronoun\]/, pronouns[randNumber(pronouns)]) text = text.replace(/\[pronoun\]/, pronouns[randNumber(pronouns)]);
text = text.replace(/\[state\]/, states[randNumber(states)]) text = text.replace(/\[state\]/, states[randNumber(states)]);
text = text.replace(/\[title\]/, titles[randNumber(titles)]) text = text.replace(/\[title\]/, titles[randNumber(titles)]);
text = text.replace(/\[unit\]/, units[randNumber(units)]) text = text.replace(/\[unit\]/, units[randNumber(units)]);
text = text.replace(/\[member\]/, message.guild.members.random().user.username) text = text.replace(/\[member\]/, message.guild.members.random().user.username);
text = text.replace(/\[number\]/, Math.floor((Math.random() * 9) + 1)) text = text.replace(/\[number\]/, Math.floor((Math.random() * 9) + 1));
// Verify if it replaced everything // 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]')) } 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 // Send the final text
message.delete(); message.delete();
return message.channel.send(text); return message.channel.send(text);
} }
} }
module.exports = SayCommand; module.exports = SaydCommand;

@ -1,22 +1,22 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class tokenCommand extends Command { class tokenCommand extends Command {
constructor() { constructor() {
super('token', { super('token', {
aliases: ['token'], aliases: ['token'],
category: 'general', category: 'general',
description: { description: {
content: 'Send the token of the bot', content: 'Send the token of the bot',
usage: '', usage: '',
examples: [''] examples: ['']
} }
}); });
} }
async exec(message) { 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?"]; 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 )]; trollMessage = trollMessage[Math.floor( Math.random() * trollMessage.length )];
message.channel.send(trollMessage); message.channel.send(trollMessage);
} }
} }
module.exports = tokenCommand; module.exports = tokenCommand;

@ -4,58 +4,58 @@ const gclient = new textToSpeech.TextToSpeechClient();
const fs = require('fs'); const fs = require('fs');
class TtsCommand extends Command { class TtsCommand extends Command {
constructor() { constructor() {
super('tts', { super('tts', {
aliases: ['tts'], aliases: ['tts'],
category: 'general', category: 'general',
split: 'none', split: 'none',
args: [ args: [
{ {
id: 'text', id: 'text',
type: 'string' type: 'string'
} }
], ],
description: { description: {
content: 'Send a mp3 of what you wrote in tts', content: 'Send a mp3 of what you wrote in tts',
usage: '[text]', usage: '[text]',
examples: ['hello'] examples: ['hello']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
let text = args.text; let text = args.text;
// Construct the request // Construct the request
const request = { const request = {
input: { text: text }, input: { text: text },
// Select the language and SSML Voice Gender (optional) // Select the language and SSML Voice Gender (optional)
voice: { languageCode: 'en-US', ssmlGender: 'NEUTRAL' }, voice: { languageCode: 'en-US', ssmlGender: 'NEUTRAL' },
// Select the type of audio encoding // Select the type of audio encoding
audioConfig: { audioEncoding: 'MP3' }, audioConfig: { audioEncoding: 'MP3' },
}; };
// Performs the Text-to-Speech request // Performs the Text-to-Speech request
gclient.synthesizeSpeech(request, (err, response) => { gclient.synthesizeSpeech(request, (err, response) => {
if (err) { if (err) {
fs.close(); fs.close();
console.error('ERROR:', err); console.error('ERROR:', err);
return; return;
} }
// Write the binary audio content to a local file // Write the binary audio content to a local file
fs.writeFile('tts.mp3', response.audioContent, 'binary', err => { fs.writeFile('tts.mp3', response.audioContent, 'binary', err => {
if (err) { if (err) {
console.error('ERROR:', err); console.error('ERROR:', err);
message.channel.send('An error has occured, the message is probably too long'); message.channel.send('An error has occured, the message is probably too long');
fs.close(); fs.close();
return; return;
} }
console.log('Audio content written to file: tts.mp3'); console.log('Audio content written to file: tts.mp3');
message.channel.send({ files: ['./tts.mp3'] }) message.channel.send({ files: ['./tts.mp3'] });
}); });
fs.close(); fs.close();
}); });
} }
} }
module.exports = TtsCommand; module.exports = TtsCommand;

@ -4,78 +4,78 @@ const gclient = new textToSpeech.TextToSpeechClient();
const fs = require('fs'); const fs = require('fs');
class TtsvcCommand extends Command { class TtsvcCommand extends Command {
constructor() { constructor() {
super('ttsvc', { super('ttsvc', {
aliases: ['ttsvc'], aliases: ['ttsvc'],
category: 'general', category: 'general',
split: 'none', split: 'none',
args: [ args: [
{ {
id: 'text', id: 'text',
type: 'string' type: 'string'
} }
], ],
description: { description: {
content: 'Say what you wrote in voice channel', content: 'Say what you wrote in voice channel',
usage: '[text]', usage: '[text]',
examples: ['hello'] examples: ['hello']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
let text = args.text; let text = args.text;
const { voiceChannel } = message.member; const { voiceChannel } = message.member;
// Construct the request // Construct the request
const request = { const request = {
input: { text: text }, input: { text: text },
// Select the language and SSML Voice Gender (optional) // Select the language and SSML Voice Gender (optional)
voice: { languageCode: 'en-US', ssmlGender: 'NEUTRAL' }, voice: { languageCode: 'en-US', ssmlGender: 'NEUTRAL' },
// Select the type of audio encoding // Select the type of audio encoding
audioConfig: { audioEncoding: 'MP3' }, audioConfig: { audioEncoding: 'MP3' },
}; };
// Performs the Text-to-Speech request // Performs the Text-to-Speech request
gclient.synthesizeSpeech(request, (err, response) => { gclient.synthesizeSpeech(request, (err, response) => {
if (err) { if (err) {
console.error('ERROR:', err); console.error('ERROR:', err);
return; return;
} }
// Write the binary audio content to a local file // Write the binary audio content to a local file
fs.writeFile('ttsvc.mp3', response.audioContent, 'binary', err => { fs.writeFile('ttsvc.mp3', response.audioContent, 'binary', err => {
if (err) { if (err) {
console.error('ERROR:', err); console.error('ERROR:', err);
message.channel.send('An error has occured, the message is probably too long'); message.channel.send('An error has occured, the message is probably too long');
fs.close(); fs.close();
return; return;
} }
console.log('Audio content written to file: ttsvc.mp3'); console.log('Audio content written to file: ttsvc.mp3');
// If not in voice channel ask user to join // If not in voice channel ask user to join
if (!voiceChannel) { if (!voiceChannel) {
return message.reply('please join a voice channel first!'); 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 {} } 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 user say "stop" make the bot leave voice channel
if (text == 'stop') { if (text == 'stop') {
voiceChannel.leave(); voiceChannel.leave();
message.channel.send('I leaved the channel'); message.channel.send('I leaved the channel');
} else { // you should be careful in what is included in your scopes, you didn't use the {} } else { // you should be careful in what is included in your scopes, you didn't use the {}
voiceChannel.join().then(connection => { voiceChannel.join().then(connection => {
const dispatcher = connection.playStream('./ttsvc.mp3'); const dispatcher = connection.playStream('./ttsvc.mp3');
// End at then end of the audio stream // End at then end of the audio stream
dispatcher.on('end', () => setTimeout(function () { dispatcher.on('end', () => setTimeout(function () {
voiceChannel.leave(); voiceChannel.leave();
}, 2000)); }, 2000));
}); });
} }
} }
}); });
}); });
} }
} }
module.exports = TtsvcCommand; module.exports = TtsvcCommand;

@ -1,52 +1,52 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
const Discord = require('discord.js'); const Discord = require('discord.js');
const { createCanvas, loadImage, getContext } = require('canvas'); const { createCanvas, loadImage } = require('canvas');
const superagent = require('superagent'); const superagent = require('superagent');
class FetishCommand extends Command { class FetishCommand extends Command {
constructor() { constructor() {
super('fetish', { super('fetish', {
aliases: ['fetish'], aliases: ['fetish'],
category: 'images', category: 'images',
args: [ args: [
{ {
id: 'image', id: 'image',
type: 'string' type: 'string'
} }
] ]
}); });
} }
async exec(message, args) { async exec(message, args) {
let Attachment = (message.attachments).array(); let Attachment = (message.attachments).array();
let image = args.image; let image = args.image;
if (!Attachment[0] && !image) if (!Attachment[0] && !image)
image = message.author.displayAvatarURL image = message.author.displayAvatarURL;
else if(Attachment[0] && Attachment[0].url.endsWith('gif')) else if(Attachment[0] && Attachment[0].url.endsWith('gif'))
return message.channel.send('Gif dosent work, sorry') return message.channel.send('Gif dosent work, sorry');
else if (!image) else if (!image)
image = Attachment[0].url image = Attachment[0].url;
message.channel.send('Processing <a:loadingmin:527579785212329984>') message.channel.send('Processing <a:loadingmin:527579785212329984>')
.then(loadingmsg => loadingmsg.delete(1000)) .then(loadingmsg => loadingmsg.delete(1000));
const canvas = createCanvas(528, 559) const canvas = createCanvas(528, 559);
const ctx = canvas.getContext('2d') const ctx = canvas.getContext('2d');
const background = await loadImage('https://image.noelshack.com/fichiers/2018/42/2/1539644291-my-fetish-5910119d988512.png').catch(error => { 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') return message.channel.send('An error as occured, please try again');
}) });
ctx.drawImage(background, 0, 0, canvas.width, canvas.height); ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
const { body: buffer } = await superagent.get(image); const { body: buffer } = await superagent.get(image);
const bg = await loadImage(buffer); const bg = await loadImage(buffer);
ctx.drawImage(bg, 50, 50, 450, 450); ctx.drawImage(bg, 50, 50, 450, 450);
const attachment = new Discord.Attachment(canvas.toBuffer(), 'myfetish.png'); const attachment = new Discord.Attachment(canvas.toBuffer(), 'myfetish.png');
message.channel.send(attachment).catch(() => { message.channel.send(attachment).catch(() => {
message.channel.send('an error as occured. Check the bot/channel permissions') message.channel.send('an error as occured. Check the bot/channel permissions');
}) });
} }
} }
module.exports = FetishCommand; module.exports = FetishCommand;

@ -1,54 +1,54 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
const Discord = require('discord.js'); const Discord = require('discord.js');
const { createCanvas, loadImage, getContext } = require('canvas'); const { createCanvas, loadImage } = require('canvas');
const superagent = require('superagent'); const superagent = require('superagent');
class GodCommand extends Command { class GodCommand extends Command {
constructor() { constructor() {
super('god', { super('god', {
aliases: ['god'], aliases: ['god'],
category: 'images', category: 'images',
args: [ args: [
{ {
id: 'image', id: 'image',
type: 'string' type: 'string'
} }
] ]
}); });
} }
async exec(message, args) { async exec(message, args) {
let Attachment = (message.attachments).array(); let Attachment = (message.attachments).array();
let image = args.image; let image = args.image;
if (!Attachment[0] && !image) if (!Attachment[0] && !image)
image = message.author.displayAvatarURL image = message.author.displayAvatarURL;
else if(Attachment[0] && Attachment[0].url.endsWith('gif')) else if (Attachment[0] && Attachment[0].url.endsWith('gif'))
return message.channel.send('Gif dosent work, sorry') return message.channel.send('Gif dosent work, sorry');
else if (!image) else if (!image)
image = Attachment[0].url image = Attachment[0].url;
message.channel.send('Processing <a:loadingmin:527579785212329984>') message.channel.send('Processing <a:loadingmin:527579785212329984>')
.then(loadingmsg => loadingmsg.delete(1000)) .then(loadingmsg => loadingmsg.delete(1000));
const canvas = createCanvas(310, 400) const canvas = createCanvas(310, 400);
const ctx = canvas.getContext('2d') const ctx = canvas.getContext('2d');
const background = await loadImage(image); const background = await loadImage(image);
ctx.drawImage(background, 20, 80, 275, 250); 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(() => { 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') return message.channel.send('An error as occured, please try again');
}) });
const bg = await loadImage(buffer); const bg = await loadImage(buffer);
ctx.drawImage(bg, 0, 0, canvas.width, canvas.height); ctx.drawImage(bg, 0, 0, canvas.width, canvas.height);
const attachment = new Discord.Attachment(canvas.toBuffer(), 'god.png'); const attachment = new Discord.Attachment(canvas.toBuffer(), 'god.png');
message.delete(); message.delete();
message.channel.send(attachment) message.channel.send(attachment)
.catch(() => { .catch(() => {
message.channel.send('an error as occured. Check the bot/channel permissions') message.channel.send('an error as occured. Check the bot/channel permissions');
}) });
} }
} }
module.exports = GodCommand; module.exports = GodCommand;

@ -1,76 +1,75 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
const Discord = require('discord.js'); const Discord = require('discord.js');
const { createCanvas, loadImage, getContext } = require('canvas'); const { createCanvas, loadImage } = require('canvas');
const superagent = require('superagent'); const superagent = require('superagent');
class IdubbbzCommand extends Command { class IdubbbzCommand extends Command {
constructor() { constructor() {
super('idubbbz', { super('idubbbz', {
aliases: ['idubbbz', 'edups'], aliases: ['idubbbz', 'edups'],
category: 'images', category: 'images',
split: 'quoted', split: 'quoted',
args: [ args: [
{ {
id: 'text', id: 'text',
type: 'string' type: 'string'
}, },
{ {
id: 'image', id: 'image',
type: 'string' type: 'string'
} }
] ]
}); });
} }
async exec(message, args) { async exec(message, args) {
let text = args.text; let text = args.text;
let Attachment = (message.attachments).array(); let Attachment = (message.attachments).array();
let image = args.image; let image = args.image;
if (!Attachment[0] && !image) if (!Attachment[0] && !image)
image = message.author.displayAvatarURL image = message.author.displayAvatarURL;
else if (Attachment[0] && Attachment[0].url.endsWith('gif')) else if (Attachment[0] && Attachment[0].url.endsWith('gif'))
return message.channel.send('Gif dosent work, sorry') 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 {} else if (!image)
image = Attachment[0].url; image = Attachment[0].url;
message.channel.send('Processing <a:loadingmin:527579785212329984>') message.channel.send('Processing <a:loadingmin:527579785212329984>')
.then(loadingmsg => loadingmsg.delete(2000)) .then(loadingmsg => loadingmsg.delete(2000));
const canvas = createCanvas(1281, 627) const canvas = createCanvas(1281, 627);
const applyText = (canvas, text) => { const applyText = (canvas, text) => {
const ctx = canvas.getContext('2d'); const ctx = canvas.getContext('2d');
// Declare a base size of the font // Declare a base size of the font
let fontSize = 50; let fontSize = 50;
do { do {
// Assign the font to the context and decrement it so it can be measured again // Assign the font to the context and decrement it so it can be measured again
ctx.font = `${fontSize -= 10}px ubuntu`; ctx.font = `${fontSize -= 10}px ubuntu`;
} while (ctx.measureText(text).width > 700 - 300); } while (ctx.measureText(text).width > 700 - 300);
// Return the result to use in the actual canvas // Return the result to use in the actual canvas
return ctx.font; return ctx.font;
}; };
}
const ctx = canvas.getContext('2d') const ctx = canvas.getContext('2d');
const background = await loadImage(image); const background = await loadImage(image);
ctx.drawImage(background, 620, 100, 200, 200); 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 => { 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') return message.channel.send('An error as occured, please try again');
}) });
const bg = await loadImage(buffer); const bg = await loadImage(buffer);
ctx.drawImage(bg, 0, 0, canvas.width, canvas.height); ctx.drawImage(bg, 0, 0, canvas.width, canvas.height);
ctx.font = applyText(canvas, text) ctx.font = applyText(canvas, text);
ctx.fillStyle = '#000000'; ctx.fillStyle = '#000000';
ctx.fillText(text, canvas.width / 2.1, canvas.height / 1.5); 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(attachment).catch(() => {
message.channel.send('an error as occured. Check the bot/channel permissions') message.channel.send('an error as occured. Check the bot/channel permissions');
}) });
} }
} }
module.exports = IdubbbzCommand; module.exports = IdubbbzCommand;

@ -1,75 +1,74 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
const Discord = require('discord.js'); const Discord = require('discord.js');
const { createCanvas, loadImage, getContext } = require('canvas'); const { createCanvas, loadImage } = require('canvas');
const superagent = require('superagent'); const superagent = require('superagent');
class IdubbbzPaintCommand extends Command { class IdubbbzPaintCommand extends Command {
constructor() { constructor() {
super('idubbbzpaint', { super('idubbbzpaint', {
aliases: ['idubbbzpaint', 'edupspaint'], aliases: ['idubbbzpaint', 'edupspaint'],
category: 'images', category: 'images',
args: [ args: [
{ {
id: 'text', id: 'text',
type: 'string' type: 'string'
}, },
{ {
id: 'image', id: 'image',
type: 'string' type: 'string'
} }
] ]
}); });
} }
async exec(message, args) { async exec(message, args) {
let text = args.text; let text = args.text;
let Attachment = (message.attachments).array(); let Attachment = (message.attachments).array();
let image = args.image; let image = args.image;
if (!Attachment[0] && !image) if (!Attachment[0] && !image)
image = message.author.displayAvatarURL image = message.author.displayAvatarURL;
else if (Attachment[0] && Attachment[0].url.endsWith('gif')) else if (Attachment[0] && Attachment[0].url.endsWith('gif'))
return message.channel.send('Gif dosent work, sorry') 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 {} else if (!image)
image = Attachment[0].url; image = Attachment[0].url;
message.channel.send('Processing <a:loadingmin:527579785212329984>') message.channel.send('Processing <a:loadingmin:527579785212329984>')
.then(loadingmsg => loadingmsg.delete(2000)) .then(loadingmsg => loadingmsg.delete(2000));
const canvas = createCanvas(1024, 544) const canvas = createCanvas(1024, 544);
const applyText = (canvas, text) => { const applyText = (canvas, text) => {
const ctx = canvas.getContext('2d'); const ctx = canvas.getContext('2d');
// Declare a base size of the font // Declare a base size of the font
let fontSize = 100; let fontSize = 100;
do { do {
// Assign the font to the context and decrement it so it can be measured again // Assign the font to the context and decrement it so it can be measured again
ctx.font = `${fontSize -= 10}px ubuntu`; ctx.font = `${fontSize -= 10}px ubuntu`;
} while (ctx.measureText(text).width > 800 - 300); } while (ctx.measureText(text).width > 800 - 300);
// Return the result to use in the actual canvas // Return the result to use in the actual canvas
return ctx.font; return ctx.font;
}; };
}
const ctx = canvas.getContext('2d') const ctx = canvas.getContext('2d');
const background = await loadImage(image); const background = await loadImage(image);
ctx.drawImage(background, 140, 40, 400, 340); 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 => { 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') return message.channel.send('An error as occured, please try again');
}) });
const bg = await loadImage(buffer); const bg = await loadImage(buffer);
ctx.drawImage(bg, 0, 0, canvas.width, canvas.height); ctx.drawImage(bg, 0, 0, canvas.width, canvas.height);
ctx.font = applyText(canvas, text) ctx.font = applyText(canvas, text);
ctx.fillStyle = '#ffffff'; ctx.fillStyle = '#ffffff';
ctx.fillText(text, canvas.width / 3, canvas.height / 1.1); 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(attachment).catch(() => {
message.channel.send('an error as occured. Check the bot/channel permissions') message.channel.send('an error as occured. Check the bot/channel permissions');
}) });
} }
} }
module.exports = IdubbbzPaintCommand; module.exports = IdubbbzPaintCommand;

@ -1,52 +1,52 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
const Discord = require('discord.js'); const Discord = require('discord.js');
const { createCanvas, loadImage, getContext } = require('canvas'); const { createCanvas, loadImage } = require('canvas');
const superagent = require('superagent'); const superagent = require('superagent');
class LikeCommand extends Command { class LikeCommand extends Command {
constructor() { constructor() {
super('like', { super('like', {
aliases: ['like'], aliases: ['like'],
category: 'images', category: 'images',
args: [ args: [
{ {
id: 'image', id: 'image',
type: 'string' type: 'string'
} }
] ]
}); });
} }
async exec(message, args) { async exec(message, args) {
let Attachment = (message.attachments).array(); let Attachment = (message.attachments).array();
let image = args.image; let image = args.image;
if (!Attachment[0] && !image) if (!Attachment[0] && !image)
image = message.author.displayAvatarURL image = message.author.displayAvatarURL;
else if (Attachment[0] && Attachment[0].url.endsWith('gif')) else if (Attachment[0] && Attachment[0].url.endsWith('gif'))
return message.channel.send('Gif dosent work, sorry') 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 {} else if (!image)
image = Attachment[0].url; image = Attachment[0].url;
message.channel.send('Processing <a:loadingmin:527579785212329984>') message.channel.send('Processing <a:loadingmin:527579785212329984>')
.then(loadingmsg => loadingmsg.delete(1000)); .then(loadingmsg => loadingmsg.delete(1000));
}
const canvas = createCanvas(386, 399) const canvas = createCanvas(386, 399);
const ctx = canvas.getContext('2d') const ctx = canvas.getContext('2d');
const background = await loadImage(image); const background = await loadImage(image);
ctx.drawImage(background, 40, 0, 300, 255); 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 => { 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') return message.channel.send('An error as occured, please try again');
}) });
const bg = await loadImage(buffer); const bg = await loadImage(buffer);
ctx.drawImage(bg, 0, 0, canvas.width, canvas.height); 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(attachment).catch(() => {
message.channel.send('an error as occured. Check the bot/channel permissions') message.channel.send('an error as occured. Check the bot/channel permissions');
}) });
} }
} }
module.exports = LikeCommand; module.exports = LikeCommand;

@ -1,52 +1,52 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
const Discord = require('discord.js'); const Discord = require('discord.js');
const { createCanvas, loadImage, getContext } = require('canvas'); const { createCanvas, loadImage } = require('canvas');
const superagent = require('superagent'); const superagent = require('superagent');
class UglyCommand extends Command { class UglyCommand extends Command {
constructor() { constructor() {
super('ugly', { super('ugly', {
aliases: ['ugly'], aliases: ['ugly'],
category: 'images', category: 'images',
args: [ args: [
{ {
id: 'image', id: 'image',
type: 'string', type: 'string',
} }
] ]
}); });
} }
async exec(message, args) { async exec(message, args) {
let Attachment = (message.attachments).array(); let Attachment = (message.attachments).array();
let image = args.image; let image = args.image;
if (!Attachment[0] && !image) if (!Attachment[0] && !image)
image = message.author.displayAvatarURL image = message.author.displayAvatarURL;
else if (Attachment[0] && Attachment[0].url.endsWith('gif')) else if (Attachment[0] && Attachment[0].url.endsWith('gif'))
return message.channel.send('Gif dosent work, sorry') 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 {} else if (!image)
image = Attachment[0].url; image = Attachment[0].url;
message.channel.send('Processing <a:loadingmin:527579785212329984>') message.channel.send('Processing <a:loadingmin:527579785212329984>')
.then(loadingmsg => loadingmsg.delete(1000)); .then(loadingmsg => loadingmsg.delete(1000));
}
const canvas = createCanvas(323, 400) const canvas = createCanvas(323, 400);
const ctx = canvas.getContext('2d') const ctx = canvas.getContext('2d');
const background = await loadImage('https://image.noelshack.com/fichiers/2018/42/1/1539598678-untitled.png').catch(error => { 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') return message.channel.send('An error as occured, please try again');
}) });
ctx.drawImage(background, 0, 0, canvas.width, canvas.height); ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
const { body: buffer } = await superagent.get(image); const { body: buffer } = await superagent.get(image);
const bg = await loadImage(buffer); const bg = await loadImage(buffer);
ctx.drawImage(bg, 40, 100, 250, 250); ctx.drawImage(bg, 40, 100, 250, 250);
const attachment = new Discord.Attachment(canvas.toBuffer(), 'ugly.png'); const attachment = new Discord.Attachment(canvas.toBuffer(), 'ugly.png');
message.channel.send(attachment).catch(error => { message.channel.send(attachment).catch(() => {
message.channel.send('an error as occured. Check the bot/channel permissions') message.channel.send('an error as occured. Check the bot/channel permissions');
}) });
} }
} }
module.exports = UglyCommand; module.exports = UglyCommand;

@ -1,40 +1,41 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class BotAvatarCommand extends Command { class BotAvatarCommand extends Command {
constructor() { constructor() {
super('botavatar', { super('botavatar', {
aliases: ['botavatar', 'bavatar'], aliases: ['botavatar', 'bavatar'],
split: 'none', split: 'none',
category: 'owner', category: 'owner',
ownerOnly: 'true', ownerOnly: 'true',
args: [ args: [
{ {
id: 'image', id: 'image',
type:'string', type:'string',
optional: true optional: true
} }
], ],
description: { description: {
content: 'Change bot profil picture', content: 'Change bot profil picture',
usage: '[image attachment/or link]', usage: '[image attachment/or link]',
examples: ['image file'] examples: ['image file']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
let Attachment = (message.attachments).array(); let Attachment = (message.attachments).array();
let image = args.image; let image = args.image;
if (!Attachment[0] && !image) if (!Attachment[0] && !image)
return message.say('You didint provide any images') return message.say('You didint provide any images');
else else
image = Attachment[0].url image = Attachment[0].url;
this.client.user.setAvatar(image)
.catch(() => message.channel.send("The link you provided dosen't work... is it a picture?")); this.client.user.setAvatar(image)
message.channel.send('The avatar have been changed succesfully'); .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; module.exports = BotAvatarCommand;

@ -1,45 +1,45 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class EvalCommand extends Command { class EvalCommand extends Command {
constructor() { constructor() {
super('dm', { super('dm', {
aliases: ['dm', 'pm'], aliases: ['dm', 'pm'],
split: 'none', split: 'none',
category: 'owner', category: 'owner',
args: [ args: [
{ {
id: 'user', id: 'user',
type: 'user' type: 'user'
}, },
{ {
id: 'message', id: 'text',
type: 'string' type: 'string'
} }
], ],
ownerOnly: 'true', ownerOnly: 'true',
description: { description: {
content: 'DM users', content: 'DM users',
usage: '[user id] [message]', usage: '[user id] [message]',
examples: ['267065637183029248 hello i recived your feedback and...'] examples: ['267065637183029248 hello i recived your feedback and...']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
let user = args.user; let user = args.user;
let message = args.message; let text = args.text;
let Attachment = (message.attachments).array(); let Attachment = (message.attachments).array();
if (Attachment[0]) { if (Attachment[0]) {
user.send(`**Message from the dev:**\n${message}\n${Attachment[0].url}`) user.send(`**Message from the dev:**\n${text}\n${Attachment[0].url}`);
message.channel.send(`DM sent to ${user.username}`) message.channel.send(`DM sent to ${user.username}`);
} }
else { else {
user.send(`**Message from the dev:**\n${message}`) user.send(`**Message from the dev:**\n${text}`);
message.channel.send(`DM sent to ${user.username}`) message.channel.send(`DM sent to ${user.username}`);
} }
} }
} }
module.exports = EvalCommand; module.exports = EvalCommand;

@ -1,31 +1,31 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class emitCommand extends Command { class emitCommand extends Command {
constructor() { constructor() {
super('emit', { super('emit', {
aliases: ['emit'], aliases: ['emit'],
split: 'none', split: 'none',
category: 'owner', category: 'owner',
ownerOnly: 'true', ownerOnly: 'true',
args: [ args: [
{ {
id: 'event', id: 'event',
prompt: 'Wich event should i trigger?', prompt: 'Wich event should i trigger?',
type: 'string' type: 'string'
} }
], ],
description: { description: {
content: 'Trigger an event', content: 'Trigger an event',
usage: '[event]', usage: '[event]',
examples: ['ready'] examples: ['ready']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
this.client.emit(`${args.event}`); this.client.emit(`${args.event}`);
return message.channel.send(`${args.event} has been emited!`) return message.channel.send(`${args.event} has been emited!`);
} }
} }
module.exports = emitCommand; module.exports = emitCommand;

@ -1,46 +1,46 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class EvalCommand extends Command { class EvalCommand extends Command {
constructor() { constructor() {
super('eval', { super('eval', {
aliases: ['eval'], aliases: ['eval'],
split: 'none', split: 'none',
category: 'owner', category: 'owner',
args: [ args: [
{ {
id: 'eval', id: 'eval',
type: 'string' type: 'string'
} }
], ],
ownerOnly: 'true', ownerOnly: 'true',
description: { description: {
content: 'Execute javascript', content: 'Execute javascript',
usage: '[code]', usage: '[code]',
examples: ['message.channel.send(\'Hi\')'] examples: ['message.channel.send(\'Hi\')']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
const clean = text => { const clean = text => {
if (typeof(text) === "string") if (typeof(text) === 'string')
return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203)); return text.replace(/`/g, '`' + String.fromCharCode(8203)).replace(/@/g, '@' + String.fromCharCode(8203));
else else
return text; return text;
} };
try { try {
const code = args.eval const code = args.eval;
let evaled = eval(code); let evaled = eval(code);
if (typeof evaled !== "string") if (typeof evaled !== 'string')
evaled = require("util").inspect(evaled); evaled = require('util').inspect(evaled);
message.channel.send(clean(evaled), {code:"xl"}); message.channel.send(clean(evaled), {code:'xl'});
} catch (err) { } catch (err) {
message.channel.send(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``); message.channel.send(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``);
} }
} }
} }
module.exports = EvalCommand; module.exports = EvalCommand;

@ -1,25 +1,25 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class RebootCommand extends Command { class RebootCommand extends Command {
constructor() { constructor() {
super('reboot', { super('reboot', {
aliases: ['ded', 'reboot', 'restart'], aliases: ['ded', 'reboot', 'restart'],
split: 'none', split: 'none',
category: 'owner', category: 'owner',
ownerOnly: 'true', ownerOnly: 'true',
description: { description: {
content: 'Restart the bot', content: 'Restart the bot',
usage: '[]', usage: '[]',
examples: [''] examples: ['']
} }
}); });
} }
async exec(message) { async exec(message) {
await message.channel.send('k bye thx\nhttps://i.redd.it/lw8hrvr0l4f11.jpg'); await message.channel.send('k bye thx\nhttps://i.redd.it/lw8hrvr0l4f11.jpg');
process.exit(); process.exit();
} }
} }
module.exports = RebootCommand; module.exports = RebootCommand;

@ -1,31 +1,31 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class StatusCommand extends Command { class StatusCommand extends Command {
constructor() { constructor() {
super('status', { super('status', {
aliases: ['status'], aliases: ['status'],
split: 'none', split: 'none',
category: 'owner', category: 'owner',
ownerOnly: 'true', ownerOnly: 'true',
args: [ args: [
{ {
id: 'status', id: 'status',
prompt: 'Wich status should i have?', prompt: 'Wich status should i have?',
type: 'string' type: 'string'
} }
], ],
description: { description: {
content: 'Change the status of the bot', content: 'Change the status of the bot',
usage: '[status]', usage: '[status]',
examples: ['Hello world!'] examples: ['Hello world!']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
this.client.user.setActivity(args.status); this.client.user.setActivity(args.status);
message.channel.send(`Status have been set to ${args.status}`); message.channel.send(`Status have been set to ${args.status}`);
} }
} }
module.exports = StatusCommand; module.exports = StatusCommand;

@ -1,31 +1,31 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class usernameCommand extends Command { class usernameCommand extends Command {
constructor() { constructor() {
super('username', { super('username', {
aliases: ['username'], aliases: ['username'],
split: 'none', split: 'none',
category: 'owner', category: 'owner',
ownerOnly: 'true', ownerOnly: 'true',
args: [ args: [
{ {
id: 'username', id: 'username',
prompt: 'Wich username should i have?', prompt: 'Wich username should i have?',
type: 'string' type: 'string'
} }
], ],
description: { description: {
content: 'Change the username of the bot', content: 'Change the username of the bot',
usage: '[username]', usage: '[username]',
examples: ['haha no'] examples: ['haha no']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
this.client.user.setUsername(args.username); this.client.user.setUsername(args.username);
message.channel.send(`The username have been changed sucessfully to ${args.username}`); message.channel.send(`The username have been changed sucessfully to ${args.username}`);
} }
} }
module.exports = usernameCommand; module.exports = usernameCommand;

@ -1,41 +1,41 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class bsespamCommand extends Command { class bsespamCommand extends Command {
constructor() { constructor() {
super('bsespam', { super('bsespam', {
aliases: ['bsespam'] , //Required aliases: ['bsespam'] , //Required
category: 'reserved', //recommended category: 'reserved', //recommended
channelRestriction: 'guild', //needed if you want to restrict where we can launch the command channelRestriction: 'guild', //needed if you want to restrict where we can launch the command
args: [ //if need args args: [ //if need args
{ {
id: 'number', id: 'number',
type: 'interger', type: 'interger',
}, },
{ {
id: 'text', id: 'text',
type: 'string' type: 'string'
} }
], ],
description: { //recommended description: { //recommended
content: 'ONLY FOR BIG SNOW ENERGY\nSpam the text you send', content: 'ONLY FOR BIG SNOW ENERGY\nSpam the text you send',
usage: '[args]', usage: '[args]',
examples: [''] examples: ['']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
if (message.author.id != "428387534842626048") if (message.author.id != '428387534842626048')
return message.say('Command only available to **Big Snow Energy**') return message.say('Command only available to **Big Snow Energy**');
if (args.number <= 10) { if (args.number <= 10) {
for(let i = 0; i < args.number; i++) { for(let i = 0; i < args.number; i++) {
message.channel.send(args.text); message.channel.send(args.text);
} }
return message.channel.send('Finished :)'); return message.channel.send('Finished :)');
} else { } else {
return message.channel.send('No more than 10!') return message.channel.send('No more than 10!');
} }
} }
} }
module.exports = bsespamCommand; module.exports = bsespamCommand;

@ -1,30 +1,30 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class AvatarCommand extends Command { class AvatarCommand extends Command {
constructor() { constructor() {
super('avatar', { super('avatar', {
aliases: ['avatar', 'avy'], aliases: ['avatar', 'avy'],
category: 'utility', category: 'utility',
args: [ args: [
{ {
id: 'user', id: 'user',
type: 'user' type: 'user'
} }
], ],
description: { description: {
content: 'Show avatar of the mentioned user or you', content: 'Show avatar of the mentioned user or you',
usage: '(optional) [@user]', usage: '(optional) [@user]',
examples: ['', '@user'] examples: ['', '@user']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
if (!args.user) // While these kind of statments work you really should use {} if (!args.user) // While these kind of statments work you really should use {}
return message.channel.send(`Your avatar:\n${message.author.displayAvatarURL}`); return message.channel.send(`Your avatar:\n${message.author.displayAvatarURL}`);
else else
return message.channel.send(`${args.user.username}'s avatar:\n${args.user.displayAvatarURL}`); return message.channel.send(`${args.user.username}'s avatar:\n${args.user.displayAvatarURL}`);
} }
} }
module.exports = AvatarCommand; module.exports = AvatarCommand;

@ -4,52 +4,52 @@ const youtubedl = require('youtube-dl');
const { fbuser, fbpasswd } = require('../../config.json'); const { fbuser, fbpasswd } = require('../../config.json');
class DownloadCommand extends Command { class DownloadCommand extends Command {
constructor() { constructor() {
super('download', { super('download', {
aliases: ['download', 'dl'], aliases: ['download', 'dl'],
category: 'utility', category: 'utility',
args: [ args: [
{ {
id: "link", id: 'link',
type: "string", type: 'string',
default: "https://www.youtube.com/watch?v=6n3pFFPSlW4" default: 'https://www.youtube.com/watch?v=6n3pFFPSlW4'
} }
], ],
clientPermissions: ['ATTACH_FILES'], clientPermissions: ['ATTACH_FILES'],
description: { description: {
content: 'Download videos from different website from the link you provided', content: 'Download videos from different website from the link you provided',
usage: '[link]', usage: '[link]',
examples: ['https://www.youtube.com/watch?v=6n3pFFPSlW4'] examples: ['https://www.youtube.com/watch?v=6n3pFFPSlW4']
} }
}); });
} }
async exec(message, args) { async exec(message, args) {
let link = args.link; let link = args.link;
if (link.includes("http") || link.includes("www")) { if (link.includes('http') || link.includes('www')) {
message.channel.send('Downloading <a:loadingmin:527579785212329984>').then(msg => { message.channel.send('Downloading <a:loadingmin:527579785212329984>').then(msg => {
video.on('end', function () { video.on('end', function () {
msg.delete() msg.delete();
}); });
}); });
let video = youtubedl(link, [`--username=${fbuser}`, `--password=${fbpasswd}`]) let video = youtubedl(link, [`--username=${fbuser}`, `--password=${fbpasswd}`]);
video.pipe(fs.createWriteStream('./video.mp4')); video.pipe(fs.createWriteStream('./video.mp4'));
video.on('error', function error(err) { video.on('error', function error(err) {
console.log('error 2:', err); console.log('error 2:', err);
message.channel.send("An error has occured, I can't download from the link you provided.") message.channel.send('An error has occured, I can\'t download from the link you provided.');
}); });
video.on('end', function () { video.on('end', function () {
message.delete(); message.delete();
message.channel.send(`Downloaded by ${message.author.username}`, { files: ["./video.mp4"] }) message.channel.send(`Downloaded by ${message.author.username}`, { files: ['./video.mp4'] })
.catch(() => message.channel.send('File too big')); .catch(() => message.channel.send('File too big'));
fs.close(); fs.close();
}); });
} else { } else {
fs.close(); fs.close();
message.channel.send("You need to input a valid link"); message.channel.send('You need to input a valid link');
} }
} }
} }
module.exports = DownloadCommand; module.exports = DownloadCommand;

@ -2,32 +2,32 @@ const { Command } = require('discord-akairo');
const { feedbackChannel } = require('../../config.json'); const { feedbackChannel } = require('../../config.json');
class FeedbackCommand extends Command { class FeedbackCommand extends Command {
constructor() { constructor() {
super('feedback', { super('feedback', {
aliases: ['feedback'], aliases: ['feedback'],
category: 'utility', category: 'utility',
split: 'none', split: 'none',
args: [ args: [
{ {
id: "text", id: 'text',
type: "string" type: 'string'
} }
], ],
description: { description: {
content: 'Send feedback to the bot owner', content: 'Send feedback to the bot owner',
usage: '[What do you want to say]', usage: '[What do you want to say]',
examples: ['Hello, i just wanted to say hi!'] examples: ['Hello, i just wanted to say hi!']
} }
}); });
} }
async exec(message,args) { async exec(message,args) {
let text = args.text; let text = args.text;
const channel = this.client.channels.get(feedbackChannel); const channel = this.client.channels.get(feedbackChannel);
channel.send(`from ${message.author.username} (${message.author.id}) : ${text}`); channel.send(`from ${message.author.username} (${message.author.id}) : ${text}`);
message.channel.send('Your feedback has been sent!'); message.channel.send('Your feedback has been sent!');
} }
} }
module.exports = FeedbackCommand; module.exports = FeedbackCommand;

@ -2,22 +2,22 @@ const { Command } = require('discord-akairo');
const { supportServer } = require('../../config.json'); const { supportServer } = require('../../config.json');
class InviteCommand extends Command { class InviteCommand extends Command {
constructor() { constructor() {
super('invite', { super('invite', {
aliases: ['invite'], aliases: ['invite'],
category: 'utility', category: 'utility',
description: { description: {
content: 'Send invite link for the bot and support server', content: 'Send invite link for the bot and support server',
usage: '', usage: '',
examples: [''] examples: ['']
} }
}); });
} }
async exec(message) { async exec(message) {
message.channel.send('Check your dm') 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 :)`); 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; module.exports = InviteCommand;

@ -1,25 +1,25 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class PingCommand extends Command { class PingCommand extends Command {
constructor() { constructor() {
super('ping', { super('ping', {
aliases: ['ping', 'hello'], aliases: ['ping', 'hello'],
category: 'utility', category: 'utility',
description: { description: {
content: 'Ping the bot', content: 'Ping the bot',
usage: '', usage: '',
examples: [''] examples: ['']
} }
}); });
} }
async exec(message) { async exec(message) {
return message.util.reply('Pong!').then(sent => { return message.util.reply('Pong!').then(sent => {
const timeDiff = (sent.editedAt || sent.createdAt) - (message.editedAt || message.createdAt); 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`; const text = `🔂\u2000**RTT**: ${timeDiff} ms\n💟\u2000**Heartbeat**: ${Math.round(this.client.ping)} ms`;
return message.util.reply(`Pong!\n${text}`); return message.util.reply(`Pong!\n${text}`);
}); });
} }
} }
module.exports = PingCommand; module.exports = PingCommand;

@ -1,39 +1,36 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class ServerCommand extends Command { class ServerCommand extends Command {
constructor() { constructor() {
super('server', { super('server', {
aliases: ['server', 'serverinfo'], aliases: ['server', 'serverinfo'],
category: 'utility', category: 'utility',
channelRestriction: 'guild', channelRestriction: 'guild',
description: { description: {
content: 'Show info about the server', content: 'Show info about the server',
usage: '', usage: '',
examples: [''] examples: ['']
} }
}); });
} }
async exec(message) { async exec(message) {
try { const customresponse = require(`../tag/${message.guild.id}.json`);
const customresponse = require(`../tag/${message.guild.id}.json`); var count = Object.keys(customresponse).length;
var count = Object.keys(customresponse).length
} catch {
var count = 'None'
} const addEmbed = {
color: 0x0099ff,
title: 'Stats of the server',
const addEmbed = { thumbnail: {
color: 0x0099ff, url: `${message.guild.iconURL}`,
title: 'Stats of the server', },
thumbnail: { description: `Member: **${message.guild.memberCount}** \nChannel number: **${message.guild.channels.size}**\nGuild created at **${message.guild.createdAt}**\nOwner: **${message.guild.owner}**\nTag number: **${count}**`,
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 });
}; }
message.channel.send({ embed: addEmbed });
}
} }
module.exports = ServerCommand; module.exports = ServerCommand;

@ -1,28 +1,28 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class StatsCommand extends Command { class StatsCommand extends Command {
constructor() { constructor() {
super('stats', { super('stats', {
aliases: ['stats'], aliases: ['stats'],
category: 'utility', category: 'utility',
description: { description: {
content: 'Show some stats about the bot', content: 'Show some stats about the bot',
usage: '', usage: '',
examples: [''] examples: ['']
} }
}); });
} }
async exec(message) { async exec(message) {
let totalSeconds = (this.client.uptime / 1000); let totalSeconds = (this.client.uptime / 1000);
let days = Math.floor(totalSeconds / 86400); let days = Math.floor(totalSeconds / 86400);
let hours = Math.floor(totalSeconds / 3600); let hours = Math.floor(totalSeconds / 3600);
totalSeconds %= 3600; totalSeconds %= 3600;
let minutes = Math.floor(totalSeconds / 60); let minutes = Math.floor(totalSeconds / 60);
let seconds = totalSeconds.toFixed(0) % 60; let seconds = totalSeconds.toFixed(0) % 60;
let uptime = `${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds`; 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}\``); 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; module.exports = StatsCommand;

@ -4,50 +4,44 @@ const reload = require('auto-reload');
const fs = require('fs'); const fs = require('fs');
class taglistCommand extends Command { class taglistCommand extends Command {
constructor() { constructor() {
super('taglist', { super('taglist', {
aliases: ['taglist'], aliases: ['taglist'],
category: 'utility', category: 'utility',
channelRestriction: 'guild', channelRestriction: 'guild',
description: { description: {
content: 'Show the list of tag for this server.', content: 'Show the list of tag for this server.',
usage: '', usage: '',
examples: [''] examples: ['']
} }
}); });
} }
async exec(message) { async exec(message) {
try { let customresponse = reload(`../../tag/${message.guild.id}.json`);
let customresponse = reload(`../../tag/${message.guild.id}.json`); let count = Object.keys(customresponse).length;
let count = Object.keys(customresponse).length
await fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) { await fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) {
if (err) { if (err) {
console.log(err); console.log(err);
/* do you need it to end here on error? if so uncomment the following code: fs.close();
fs.close(); return;
return; }
*/ let json = JSON.stringify(data);
} json = json.replace(/[{}'\\]+/g, '');
let json = JSON.stringify(data) json = json.replace(/,+/g, '\n');
json = json.replace(/[{}"\\]+/g, '') const tagEmbed = new Discord.RichEmbed()
json = json.replace(/,+/g, '\n') .setColor('#ff9900')
const tagEmbed = new Discord.RichEmbed() .setTitle('Tags list')
.setColor("#ff9900") .setDescription(`Trigger:Response\n\n${json}`)
.setTitle('Tags list') .setFooter(`You have ${count} tags on this server`);
.setDescription(`Trigger:Response\n\n${json}`)
.setFooter(`You have ${count} tags on this server`)
message.channel.send(tagEmbed); message.channel.send(tagEmbed);
}); });
fs.close(); fs.close();
} catch { message.channel.send('An error has occured, do you have any tags on the server?');
fs.close(); }
message.channel.send('An error has occured, do you have any tags on the server?');
}
}
} }
module.exports = taglistCommand; module.exports = taglistCommand;

@ -4,59 +4,58 @@ const fetch = require('node-fetch');
const { yandexAPI } = require('../../config.json'); const { yandexAPI } = require('../../config.json');
class TranslationCommand extends Command { class TranslationCommand extends Command {
constructor() { constructor() {
super('translation', { super('translation', {
aliases: ['translation', 'trn'], aliases: ['translation', 'trn'],
category: 'utility', category: 'utility',
split: 'sticky', split: 'sticky',
description: 'Translate the text you send into the lanuguage you selected', args: [
args: [ {
{ id: 'language',
id: 'language', type: 'string',
type: 'string', default: 'en'
default: 'en' },
}, {
{ id: 'text',
id: 'text', type: 'string',
type: 'string', }
} ],
], description: {
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/',
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]',
usage: '[language code] [Text to translate]', examples: ['fr What are we doing today?', 'en Que faisons-nous aujourd\'hui?']
examples: ['fr What are we doing today?', 'en Que faisons-nous aujourd\'hui?'] }
} });
}); }
}
async exec(message, args) { async exec(message, args) {
let language = args.language; let language = args.language;
let text = args.text; let text = args.text;
let textURI = encodeURI(text) let textURI = encodeURI(text);
fetch(`https://translate.yandex.net/api/v1.5/tr.json/translate?key=${yandexAPI}&text=${textURI}&lang=${language}&options=1`, { fetch(`https://translate.yandex.net/api/v1.5/tr.json/translate?key=${yandexAPI}&text=${textURI}&lang=${language}&options=1`, {
}).then((response) => { }).then((response) => {
return response.json(); return response.json();
}).then((response) => { }).then((response) => {
if (response.code == '502') 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/`) 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') else if (response.code != '200')
return message.channel.send('An error has occured') return message.channel.send('An error has occured');
const translationEmbed = new Discord.RichEmbed() const translationEmbed = new Discord.RichEmbed()
.setColor('#0099ff') .setColor('#0099ff')
.setTitle('Asked for the following translation:') .setTitle('Asked for the following translation:')
.setAuthor(message.author.username) .setAuthor(message.author.username)
.setDescription(response.text[0]) .setDescription(response.text[0])
.addField('Original text', text) .addField('Original text', text)
.addField('Translated from', response.detected.lang) .addField('Translated from', response.detected.lang)
.setTimestamp() .setTimestamp()
.setFooter('Powered by Yandex.Translate '); .setFooter('Powered by Yandex.Translate ');
message.channel.send(translationEmbed) message.channel.send(translationEmbed);
}); });
} }
} }
module.exports = TranslationCommand; module.exports = TranslationCommand;

@ -1,34 +1,34 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
class UpdootCommand extends Command { class UpdootCommand extends Command {
constructor() { constructor() {
super('updoot', { super('updoot', {
aliases: ['updoot', 'upvote', 'vote'], aliases: ['updoot', 'upvote', 'vote'],
category: 'utility', category: 'utility',
channelRestriction: 'guild', channelRestriction: 'guild',
description: { description: {
content: 'Send a link to vote for my bot', content: 'Send a link to vote for my bot',
usage: '', usage: '',
examples: [''] examples: ['']
} }
}); });
} }
async exec(message) { async exec(message) {
const upDoot = { const upDoot = {
color: 0x93C54B, color: 0x93C54B,
title: 'Vote for my bot', title: 'Vote for my bot',
url: 'https://discordbots.org/bot/377563711927484418/vote', url: 'https://discordbots.org/bot/377563711927484418/vote',
description: 'You can vote for my bot if you think the bot is awesome!', description: 'You can vote for my bot if you think the bot is awesome!',
timestamp: new Date(), timestamp: new Date(),
footer: { footer: {
text: 'Thanks for the updoots', text: 'Thanks for the updoots',
icon_url: 'https://cdn.discordapp.com/avatars/377563711927484418/1335d202aa466dbeaa4ed2e4b616484a.png?size=2048', icon_url: 'https://cdn.discordapp.com/avatars/377563711927484418/1335d202aa466dbeaa4ed2e4b616484a.png?size=2048',
}, },
}; };
message.channel.send({ embed: upDoot }); message.channel.send({ embed: upDoot });
} }
} }
module.exports = UpdootCommand; module.exports = UpdootCommand;

@ -1,12 +1,12 @@
module.exports = { module.exports = {
a: '<a:a:493014525226778624>', b: '<a:b:493014525696802817>', c: '<a:c:493014525457596417>', d: '<a:d:493014526791254026>', a: '<a:a:493014525226778624>', b: '<a:b:493014525696802817>', c: '<a:c:493014525457596417>', d: '<a:d:493014526791254026>',
e: '<a:e:493014525373710339>', f: '<a:f:493014525788946443>', g: '<a:g:493014525151543297>', h: '<a:h:493014525256138763>', e: '<a:e:493014525373710339>', f: '<a:f:493014525788946443>', g: '<a:g:493014525151543297>', h: '<a:h:493014525256138763>',
i: '<a:i:493014525566648321>', j: '<a:j:493014525738614806>', k: '<a:k:493014525336092673>', l: '<a:l:493014525134635039>', i: '<a:i:493014525566648321>', j: '<a:j:493014525738614806>', k: '<a:k:493014525336092673>', l: '<a:l:493014525134635039>',
m: '<a:m:493014525927227392>', n: '<a:n:493014525746872323>', o: '<a:o:493014525847797761>', p: '<a:p:493014525788815371>', m: '<a:m:493014525927227392>', n: '<a:n:493014525746872323>', o: '<a:o:493014525847797761>', p: '<a:p:493014525788815371>',
q: '<a:q:493014525344219137>', r: '<a:r:493014525914775562>', s: '<a:s:493014525335961601>', t: '<a:t:493014525818306560>', q: '<a:q:493014525344219137>', r: '<a:r:493014525914775562>', s: '<a:s:493014525335961601>', t: '<a:t:493014525818306560>',
u: '<a:u:493014525466116097>', v: '<a:v:493014525432561666>', w: '<a:w:493014525885546497>', x: '<a:x:493014525801660426>', u: '<a:u:493014525466116097>', v: '<a:v:493014525432561666>', w: '<a:w:493014525885546497>', x: '<a:x:493014525801660426>',
y: '<a:y:493014525042360329>', z: '<a:z:493014525856055306>', 1: '<a:1:493096650160472065>', 2: '<a:2:493096650160603140>', y: '<a:y:493014525042360329>', z: '<a:z:493014525856055306>', 1: '<a:1:493096650160472065>', 2: '<a:2:493096650160603140>',
3: '<a:3:493096650039099412>', 4: '<a:4:493096650005544960>', 5: '<a:5:493096650395353099>', 6: '<a:6:493096649908944906>', 3: '<a:3:493096650039099412>', 4: '<a:4:493096650005544960>', 5: '<a:5:493096650395353099>', 6: '<a:6:493096649908944906>',
7: '<a:7:493096649833578508>', 8: '<a:8:493096650491822090>', 9: '<a:9:493096649619668993>', 0: '<a:0:493096650202546208>', 7: '<a:7:493096649833578508>', 8: '<a:8:493096650491822090>', 9: '<a:9:493096649619668993>', 0: '<a:0:493096650202546208>',
' ': ' ', '?': '<a:question:493448821020426243>', '!': '<a:exclamation:493448903459471360>' ' ': ' ', '?': '<a:question:493448821020426243>', '!': '<a:exclamation:493448903459471360>'
}; };

@ -2,33 +2,32 @@ const { AkairoClient } = require('discord-akairo');
const { token, prefix, ownerID, statsChannel } = require('./config.json'); const { token, prefix, ownerID, statsChannel } = require('./config.json');
const client = new AkairoClient({ const client = new AkairoClient({
ownerID: ownerID, ownerID: ownerID,
prefix: prefix, prefix: prefix,
allowMention: true, allowMention: true,
handleEdits: true, handleEdits: true,
emitters: { emitters: {
process process
}, },
handleEdits: true, commandUtil: true,
commandUtil: true, commandUtilLifetime: 600000,
commandUtilLifetime: 600000, commandDirectory: './commands/',
commandDirectory: './commands/', inhibitorDirectory: './inhibitors/',
inhibitorDirectory: './inhibitors/', listenerDirectory: './listeners/'
listenerDirectory: './listeners/'
}, { }, {
disableEveryone: true disableEveryone: true
}); });
// Ready messages dosent work on the listeners event for some reasons // Ready messages dosent work on the listeners event for some reasons
client.on('ready', async () => { client.on('ready', async () => {
// Send stats to the console // 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(`\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`); 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 // Send stats to the 'stats' channel in the support server if its not the test bot
if (client.user.id == 377563711927484418) { if (client.user.id == 377563711927484418) {
const channel = client.channels.get(statsChannel); 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}`); 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 <feedback> to tell me what you think of the bot! | ${prefix} help`); } client.user.setActivity(`${prefix} feedback <feedback> to tell me what you think of the bot! | ${prefix} help`); }
}); });
client.login(token); client.login(token);

@ -1,16 +1,16 @@
const { Inhibitor } = require('discord-akairo'); const { Inhibitor } = require('discord-akairo');
class BlacklistInhibitor extends Inhibitor { class BlacklistInhibitor extends Inhibitor {
constructor() { constructor() {
super('blacklist', { super('blacklist', {
reason: 'blacklist' reason: 'blacklist'
}) });
} }
exec(message) { exec(message) {
const blacklist = ['501856229123948545', '497730155691638784']; const blacklist = ['501856229123948545', '497730155691638784'];
return blacklist.includes(message.author.id); return blacklist.includes(message.author.id);
} }
} }
module.exports = BlacklistInhibitor; module.exports = BlacklistInhibitor;

@ -1,16 +1,16 @@
const { Listener } = require('discord-akairo'); const { Listener } = require('discord-akairo');
class UnhandledRejectionListener extends Listener { class UnhandledRejectionListener extends Listener {
constructor() { constructor() {
super('unhandledRejection', { super('unhandledRejection', {
eventName: 'unhandledRejection', eventName: 'unhandledRejection',
emitter: 'process' emitter: 'process'
}); });
} }
exec(error) { exec(error) {
console.error(error); console.error(error);
} }
} }
module.exports = UnhandledRejectionListener; module.exports = UnhandledRejectionListener;

@ -1,33 +1,34 @@
const { Listener } = require('discord-akairo'); const { Listener } = require('discord-akairo');
class CommandBlockedListener extends Listener { class CommandBlockedListener extends Listener {
constructor() { constructor() {
super('commandBlocked', { super('commandBlocked', {
emitter: 'commandHandler', emitter: 'commandHandler',
eventName: 'commandBlocked' eventName: 'commandBlocked'
}); });
} }
exec(message, command, reason) { exec(message, command, reason) {
console.log(`${message.author.username} was blocked from using ${command.id} because of ${reason}!`); console.log(`${message.author.username} was blocked from using ${command.id} because of ${reason}!`);
switch(reason) { let ownerMessage;
case "Owner": switch(reason) {
let ownerMessage = ["Nice try but you aren't the owner <a:memed:433320880135733248>", "LOADING SUPER SECRET COMMAND <a:loadingmin:527579785212329984> Wait a minute... you aren't the owner!", "uhm, how about no"]; case 'Owner':
let ownerMessage = ownerMessage[Math.floor( Math.random() * ownerMessage.length )]; ownerMessage = ['Nice try but you aren\'t the owner <a:memed:433320880135733248>', 'LOADING SUPER SECRET COMMAND <a:loadingmin:527579785212329984> Wait a minute... you aren\'t the owner!', 'uhm, how about no'];
message.reply(ownerMessage); ownerMessage = ownerMessage[Math.floor( Math.random() * ownerMessage.length )];
break; message.reply(ownerMessage);
case "clientPermissions": break;
message.reply('Im missing the required permissions for this command!'); case 'clientPermissions':
break; message.reply('Im missing the required permissions for this command!');
case "userPermissions": break;
message.reply('You are missing some permissions to use this command!'); case 'userPermissions':
break; message.reply('You are missing some permissions to use this command!');
case "blacklist": break;
message.reply('You can\'t use this command because you have been blacklisted!'); case 'blacklist':
break; message.reply('You can\'t use this command because you have been blacklisted!');
break;
}
} }
}
} }
module.exports = CommandBlockedListener; module.exports = CommandBlockedListener;

@ -4,25 +4,25 @@ const { statsChannel } = require('../config.json');
class guildCreateListener extends Listener { class guildCreateListener extends Listener {
constructor() { constructor() {
super('guildCreate', { super('guildCreate', {
emitter: 'client', emitter: 'client',
eventName: 'guildCreate' eventName: 'guildCreate'
}); });
} }
async exec(guild, client) { async exec(guild) {
console.log(`${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}`); 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 channel = this.client.channels.get(statsChannel);
const addEmbed = new Discord.RichEmbed() const addEmbed = new Discord.RichEmbed()
.setColor("#52e80d") .setColor('#52e80d')
.setTitle('Someone added me ! YAY :D') .setTitle('Someone added me ! YAY :D')
.setURL('https://www.youtube.com/watch?v=6n3pFFPSlW4') .setURL('https://www.youtube.com/watch?v=6n3pFFPSlW4')
.setThumbnail(guild.iconURL) .setThumbnail(guild.iconURL)
.setDescription(`${guild.name}\n${guild.id}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\n(${guild.owner.id})`) .setDescription(`${guild.name}\n${guild.id}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\n(${guild.owner.id})`)
.setTimestamp() .setTimestamp();
channel.send({ embed: addEmbed }); channel.send({ embed: addEmbed });
} }
} }
module.exports = guildCreateListener; module.exports = guildCreateListener;

@ -4,28 +4,28 @@ const { statsChannel } = require('../config.json');
class guildCreateListener extends Listener { class guildCreateListener extends Listener {
constructor() { constructor() {
super('guildDelete', { super('guildDelete', {
emitter: 'client', emitter: 'client',
eventName: 'guildDelete' eventName: 'guildDelete'
}); });
} }
async exec(guild, client) { 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***`); 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 channel = this.client.channels.get(statsChannel);
const kickEmbed = new Discord.RichEmbed() const kickEmbed = new Discord.RichEmbed()
.setColor("#FF0000") .setColor('#FF0000')
.setTitle('They kicked me out :(') .setTitle('They kicked me out :(')
.setURL('https://www.youtube.com/watch?v=6n3pFFPSlW4') .setURL('https://www.youtube.com/watch?v=6n3pFFPSlW4')
.setThumbnail(guild.iconURL) .setThumbnail(guild.iconURL)
.setDescription(`${guild.name}\n${guild.id}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\n(${guild.owner.id})`) .setDescription(`${guild.name}\n${guild.id}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\n(${guild.owner.id})`)
.setTimestamp() .setTimestamp();
channel.send({ embed: kickEmbed }); channel.send({ embed: kickEmbed });
console.log('***BOT KICKED***') console.log('***BOT KICKED***');
} }
} }
module.exports = guildCreateListener; module.exports = guildCreateListener;

@ -5,48 +5,48 @@ const imgResponseObject = require("../json/imgreply.json");
const reload = require('auto-reload'); const reload = require('auto-reload');
class MessageListener extends Listener { class MessageListener extends Listener {
constructor() { constructor() {
super('message', { super('message', {
emitter: 'client', emitter: 'client',
eventName: 'message' eventName: 'message'
}); });
} }
async exec(message) { async exec(message) {
let autoresponse = reload('../json/autoresponse.json'); let autoresponse = reload('../json/autoresponse.json');
let message_content = message.content.toLowerCase(); 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 is enable send the response
if(autoresponse[message.channel.id] == 'enable') { if(autoresponse[message.channel.id] == 'enable') {
// Reply with images as attachement // Reply with images as attachement
if(imgResponseObject[message_content]) { if(imgResponseObject[message_content]) {
message.channel.send({files: [imgResponseObject[message_content]]}); message.channel.send({files: [imgResponseObject[message_content]]});
} }
// React only to the messages // React only to the messages
else if(reactObject[message_content]) { else if(reactObject[message_content]) {
message.react(reactObject[message_content]); message.react(reactObject[message_content]);
} }
// auto respond to messages // auto respond to messages
else if(responseObject[message_content]) { else if(responseObject[message_content]) {
message.channel.send(responseObject[message_content]); message.channel.send(responseObject[message_content]);
// If it contain "like if" react with 👍 // If it contain "like if" react with 👍
} else if (message_content.includes("like if")) { } else if (message_content.includes("like if")) {
message.react("\u{1F44D}") message.react("\u{1F44D}")
// If it contain "jeff" react with a jeff emote // If it contain "jeff" react with a jeff emote
} else if (message_content.includes("jeff")) { } else if (message_content.includes("jeff")) {
message.react("496028845967802378") message.react("496028845967802378")
} }
} }
let customresponse = reload(`../tag/${message.guild.id}.json`); let customresponse = reload(`../tag/${message.guild.id}.json`);
// User autoresponse // User autoresponse
if(customresponse[message_content]) { if(customresponse[message_content]) {
message.channel.send(customresponse[message_content]) message.channel.send(customresponse[message_content])
} }
} }
} }
} }
module.exports = MessageListener; module.exports = MessageListener;

@ -3,49 +3,49 @@ const Discord = require('discord.js');
const reload = require('auto-reload'); const reload = require('auto-reload');
class MessageReactionAddListener extends Listener { class MessageReactionAddListener extends Listener {
constructor() { constructor() {
super('messagereactionadd', { super('messagereactionadd', {
emitter: 'client', emitter: 'client',
eventName: 'messageReactionAdd' eventName: 'messageReactionAdd'
}); });
} }
async exec(reaction, message, client) { async exec(reaction, message, client) {
let messageContent = reaction.message.content; let messageContent = reaction.message.content;
let messageAttachments = reaction.message.attachments.map(u=> `${u.url}`); let messageAttachments = reaction.message.attachments.map(u=> `${u.url}`);
if (reaction.emoji.name === '🌟' && reaction.count === 4) { if (reaction.emoji.name === '🌟' && reaction.count === 4) {
let starboardChannel = reload(`../starboard/${reaction.message.guild.id}.json`); let starboardChannel = reload(`../starboard/${reaction.message.guild.id}.json`);
const channel = this.client.channels.get(starboardChannel['starboard']); const channel = this.client.channels.get(starboardChannel['starboard']);
const starEmbed = new Discord.RichEmbed() const starEmbed = new Discord.RichEmbed()
.setColor() .setColor()
.setDescription(messageContent) .setDescription(messageContent)
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL) .setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL)
.setTimestamp() .setTimestamp()
channel.send({ embed: starEmbed}); channel.send({ embed: starEmbed});
return channel.send(`From: ${reaction.message.channel}\n${messageAttachments}`); return channel.send(`From: ${reaction.message.channel}\n${messageAttachments}`);
} }
if (reaction.emoji.name === '✡' && reaction.count === 4) { if (reaction.emoji.name === '✡' && reaction.count === 4) {
let shameboardChannel = reload(`../starboard/${message.guild.id}.json`); let shameboardChannel = reload(`../starboard/${message.guild.id}.json`);
const channel = client.channels.get(shameboardChannel['shameboard']); const channel = client.channels.get(shameboardChannel['shameboard']);
const starEmbed = new Discord.RichEmbed() const starEmbed = new Discord.RichEmbed()
.setColor() .setColor()
.setDescription(messageContent) .setDescription(messageContent)
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL) .setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL)
.setTimestamp() .setTimestamp()
try { try {
channel.send({ embed: starEmbed}); channel.send({ embed: starEmbed});
await channel.send(messageAttachments); await channel.send(messageAttachments);
} catch(err) { } catch(err) {
console.error('There is no shameboard'); console.error('There is no shameboard');
} }
} }
} }
} }
module.exports = MessageReactionAddListener; module.exports = MessageReactionAddListener;
Loading…
Cancel
Save