Switched to discord akairo
This commit is contained in:
parent
2fa0b76baf
commit
2fb624e265
73 changed files with 1212 additions and 1858 deletions
0
TODO
0
TODO
|
@ -1,4 +0,0 @@
|
|||
module.exports = function blacklist(reasons, message){
|
||||
return message.channel.send(`You have been blacklisted for the following reasons: **${reasons}**`)
|
||||
}
|
||||
|
|
@ -1,46 +1,46 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const fs = require('fs');
|
||||
const { prefix } = require('../../config.json')
|
||||
module.exports = class AutoresponseCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'autoresponse',
|
||||
group: 'admin',
|
||||
memberName: 'autoresponse',
|
||||
userPermissions: ['ADMINISTRATOR'],
|
||||
description: `Can disable autoresponse in the channel (you can add "ALL" like this "${prefix} enable/disable all" to enable/disable in every channel (EXPERIMENTAL))`,
|
||||
const { Command } = require('discord-akairo');
|
||||
|
||||
class autoresponseCommand extends Command {
|
||||
constructor() {
|
||||
super('autoresponse', {
|
||||
aliases: ['autoresponse'],
|
||||
category: 'admin',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'Disable or enable?',
|
||||
type: 'string',
|
||||
oneOf: ['disable', 'enable','disable all', 'enable all'],
|
||||
id: 'text',
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
key: 'all',
|
||||
prompt: 'Disable or enable in every channel? (EXPERIMENTAL)',
|
||||
type: 'string',
|
||||
oneOf: ['all', ''],
|
||||
default: ''
|
||||
id: 'all',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
],
|
||||
userPermissions: ['ADMINISTRATOR'],
|
||||
channelRestriction: 'guild',
|
||||
description: {
|
||||
content: 'enable/disable autoresponse',
|
||||
usage: '[enable/disable] (optional) [all]',
|
||||
examples: ['enable all']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { text, all }) {
|
||||
if(blacklist[message.author.id])
|
||||
return message.channel.send("You are blacklisted")
|
||||
async exec(message, args) {
|
||||
let text = args.text;
|
||||
let all = args.all;
|
||||
|
||||
let autoresponse = {}
|
||||
let json = JSON.stringify(autoresponse)
|
||||
|
||||
if (all == 'all') {
|
||||
const guild = this.client.guilds.get(message.guild.id);
|
||||
|
||||
fs.readFile('./json/autoresponse.json', 'utf8', function readFileCallback(err, data){
|
||||
if (err){
|
||||
console.log(err);
|
||||
} else {
|
||||
|
||||
autoresponse = JSON.parse(data); //now it an object
|
||||
guild.channels.forEach(channel => autoresponse [channel] = text)
|
||||
json = JSON.stringify(autoresponse); //convert it back to json
|
||||
|
@ -51,22 +51,22 @@ module.exports = class AutoresponseCommand extends Command {
|
|||
}
|
||||
})}});
|
||||
|
||||
return message.say('Auto response have been disable/enable on every channel')
|
||||
} else if(text == 'disable' || 'enable') {
|
||||
fs.readFile('./json/autoresponse.json', 'utf8', function readFileCallback(err, data){
|
||||
if (err){
|
||||
console.log(err);
|
||||
} else {
|
||||
autoresponse = JSON.parse(data); //now it an object
|
||||
autoresponse [message.channel.id] = text
|
||||
json = JSON.stringify(autoresponse); //convert it back to json
|
||||
fs.writeFile('./json/autoresponse.json', json, 'utf8', function(err) {
|
||||
if(err) {
|
||||
return console.log(err);
|
||||
}
|
||||
})}});
|
||||
return message.channel.send('Auto response have been disable/enable on every channel')
|
||||
|
||||
} else if (text == 'disable' || 'enable') {
|
||||
fs.readFile('./json/autoresponse.json', 'utf8', function readFileCallback(err, data){
|
||||
if (err){
|
||||
console.log(err);
|
||||
} else {
|
||||
autoresponse = JSON.parse(data); //now it an object
|
||||
autoresponse [message.channel.id] = text
|
||||
json = JSON.stringify(autoresponse); //convert it back to json
|
||||
fs.writeFile('./json/autoresponse.json', json, 'utf8', function(err) {
|
||||
if(err) {
|
||||
return console.log(err);
|
||||
}
|
||||
})}})};
|
||||
|
||||
return message.say(`Autoresponse have been ${text}d`);
|
||||
}
|
||||
}
|
||||
};
|
||||
return message.channel.send(`Autoresponse have been ${text}d`);
|
||||
}}
|
||||
module.exports = autoresponseCommand;
|
|
@ -1,48 +1,45 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { Command } = require('discord-akairo');
|
||||
|
||||
module.exports = class BanCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'ban',
|
||||
group: 'admin',
|
||||
memberName: 'ban',
|
||||
description: 'ban the mentionned user',
|
||||
guildOnly: true,
|
||||
clientPermissions: ['BAN_MEMBERS'],
|
||||
userPermissions: ['BAN_MEMBERS'],
|
||||
args: [
|
||||
{
|
||||
key: 'member',
|
||||
prompt: 'Wich member would you like to ban?',
|
||||
type: 'member',
|
||||
},
|
||||
{
|
||||
key: 'reasons',
|
||||
prompt: 'What is the reasons of the kick',
|
||||
type: 'string',
|
||||
default: ''
|
||||
}
|
||||
]
|
||||
class BanCommand extends Command {
|
||||
constructor() {
|
||||
super('ban', {
|
||||
aliases: ['ban'],
|
||||
category: 'admin',
|
||||
args: [
|
||||
{
|
||||
id: 'member',
|
||||
type: 'member'
|
||||
},
|
||||
{
|
||||
id: 'reasons',
|
||||
type: 'string'
|
||||
}
|
||||
],
|
||||
clientPermissions: ['BAN_MEMBERS'],
|
||||
userPermissions: ['BAN_MEMBERS'],
|
||||
channelRestriction: 'guild',
|
||||
description: {
|
||||
content: 'Ban user',
|
||||
usage: '[@user]',
|
||||
examples: ['@user big dumb dumb']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { member, reasons }) {
|
||||
async exec(message, args) {
|
||||
let member = args.member;
|
||||
let reasons = args.reasons;
|
||||
|
||||
if(member == this.client)
|
||||
return message.say('Cant kick me fool')
|
||||
return message.channel.send('Cant ban me fool')
|
||||
if(!reasons)
|
||||
reasons = 'Nothing have been specified'
|
||||
if(member.id === message.author.id)
|
||||
return message.say("Why would you ban yourself ?")
|
||||
|
||||
try {
|
||||
await member.send(`https://youtu.be/55-mHgUjZfY\nYou have been banned for the following reasons: "${reasons}"`)
|
||||
} catch(err) {
|
||||
console.error(`Could not dm the user, probably disabled\n${err}`)
|
||||
}
|
||||
return message.channel.send("Why would you ban yourself ?")
|
||||
|
||||
member.ban(`Banned by : ${message.author.username} for the following reasons : ${reasons}`)
|
||||
.then(() => message.reply(`${member.user.username} was succesfully banned with the following reasons "${reasons}".`))
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
module.exports = BanCommand;
|
|
@ -1,20 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
module.exports = class cbCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'cb',
|
||||
group: 'admin',
|
||||
memberName: 'cb',
|
||||
description: 'spam a bunch of dot to quickly make something disspear',
|
||||
userPermissions: ['MANAGE_MESSAGES'],
|
||||
guildOnly: true,
|
||||
});
|
||||
}
|
||||
|
||||
run(message) {
|
||||
message.say('.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.')
|
||||
}
|
||||
};
|
||||
|
|
@ -1,42 +1,47 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { Command } = require('discord-akairo');
|
||||
|
||||
module.exports = class KickCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'kick',
|
||||
group: 'admin',
|
||||
memberName: 'kick',
|
||||
description: 'Kick the mentionned user',
|
||||
guildOnly: true,
|
||||
clientPermissions: ['KICK_MEMBERS'],
|
||||
userPermissions: ['KICK_MEMBERS'],
|
||||
args: [
|
||||
{
|
||||
key: 'member',
|
||||
prompt: 'Wich member would you like to kick?',
|
||||
type: 'member',
|
||||
},
|
||||
{
|
||||
key: 'reasons',
|
||||
prompt: 'What is the reasons of the kick',
|
||||
type: 'string',
|
||||
default: ''
|
||||
}
|
||||
]
|
||||
class KickCommand extends Command {
|
||||
constructor() {
|
||||
super('kick', {
|
||||
aliases: ['kick'],
|
||||
category: 'admin',
|
||||
strip: 'none',
|
||||
args: [
|
||||
{
|
||||
id: 'member',
|
||||
type: 'member'
|
||||
},
|
||||
{
|
||||
id: 'reasons',
|
||||
type: 'string'
|
||||
}
|
||||
],
|
||||
clientPermissions: ['KICK_MEMBERS'],
|
||||
userPermissions: ['KICK_MEMBERS'],
|
||||
channelRestriction: 'guild',
|
||||
description: {
|
||||
content: 'Kick user',
|
||||
usage: '[@user]',
|
||||
examples: ['@user big dumb dumb']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { member, reasons }) {
|
||||
if(member == this.client)
|
||||
message.say('Cant kick me fool')
|
||||
if(!reasons)
|
||||
reasons = 'Nothing have been specified.'
|
||||
async exec(message, args) {
|
||||
let member = args.member;
|
||||
let reasons = args.reasons;
|
||||
|
||||
if(member === this.client.user)
|
||||
return message.channel.say('Cant kick me fool');
|
||||
if(member.id === message.author.id)
|
||||
return message.say("Why would you kick yourself ?")
|
||||
await member.send(`You have been kicked for the following reasons: "${reasons}"`)
|
||||
.error(err => console.error(`Could not dm the user, probably disabled\n${err}`))
|
||||
member.kick(`Kicked by : ${message.author.username} for the following reasons : ${reasons}`)
|
||||
return message.channel.say("Why would you kick yourself ?");
|
||||
if(!reasons)
|
||||
reasons = 'Nothing have been specified.';
|
||||
|
||||
await member.kick(`Kicked by : ${message.author.username} for the following reasons : ${reasons}`)
|
||||
.then(() => message.reply(`${member.user.username} was succesfully kicked with the following reasons "${reasons}".`))
|
||||
};
|
||||
};
|
||||
.catch(err => console.error(err))
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = KickCommand;
|
|
@ -1,32 +1,31 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { Command } = require('discord-akairo');
|
||||
|
||||
module.exports = class PruneCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'prune',
|
||||
aliases: ['purge', 'clear', 'clean'],
|
||||
group: 'admin',
|
||||
memberName: 'prune',
|
||||
description: 'Bulk delete messages.',
|
||||
clientPermissions: ['READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'],
|
||||
userPermissions: ['MANAGE_MESSAGES'],
|
||||
guildOnly: true,
|
||||
class PruneCommand extends Command {
|
||||
constructor() {
|
||||
super('Prune', {
|
||||
aliases: ['Prune'],
|
||||
category: 'admin',
|
||||
args: [
|
||||
{
|
||||
key: 'amount',
|
||||
prompt: 'How many messages would you like to delete? ( choose a number between 1 & 99 )',
|
||||
type: 'integer',
|
||||
min: '1',
|
||||
max: '99'
|
||||
id: "amount",
|
||||
type: "string"
|
||||
}
|
||||
]
|
||||
],
|
||||
clientPermissions: ['MANAGE_MESSAGES'],
|
||||
userPermissions: ['MANAGE_MESSAGES'],
|
||||
channelRestriction: 'guild',
|
||||
description: {
|
||||
content: 'Bulk delete messages',
|
||||
usage: '[amount]',
|
||||
examples: ['50']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
run(message, { amount }) {
|
||||
amount = amount+1
|
||||
message.channel.bulkDelete(amount, true);
|
||||
async exec(message,args) {
|
||||
if (args.amount > 99) return;
|
||||
message.channel.bulkDelete(args.amount + 1, true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = PruneCommand;
|
|
@ -1,51 +1,54 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const { Command } = require('discord-akairo');
|
||||
|
||||
module.exports = class CustomResponseCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'slowmode',
|
||||
aliases: ['slow'],
|
||||
group: 'admin',
|
||||
memberName: 'slowmode',
|
||||
description: `Custom auto response`,
|
||||
userPermissions: ['MANAGE_CHANNELS'],
|
||||
clientPermissions: ['MANAGE_CHANNELS'],
|
||||
class PruneCommand extends Command {
|
||||
constructor() {
|
||||
super('Slowmode', {
|
||||
aliases: ['slowmode', 'slow'],
|
||||
category: 'admin',
|
||||
args: [
|
||||
{
|
||||
key: 'slowmodeNumber',
|
||||
prompt: 'How many seconds should the slowmode be? ( 0 to remove it )',
|
||||
type: 'integer',
|
||||
id: "slowmodeNumber",
|
||||
type: "integer"
|
||||
},
|
||||
{
|
||||
key: 'realtime',
|
||||
prompt: 'How long shoud it remain',
|
||||
default: '',
|
||||
type: 'integer',
|
||||
id: "realtime",
|
||||
type: "integer",
|
||||
optional: true,
|
||||
}
|
||||
]
|
||||
],
|
||||
clientPermissions: ['MANAGE_CHANNELS'],
|
||||
userPermissions: ['MANAGE_CHANNELS'],
|
||||
channelRestriction: 'guild',
|
||||
description: {
|
||||
content: 'Put a channel in slowmode',
|
||||
usage: '[1-120 slowmode] [time it stays on]',
|
||||
examples: ['267065637183029248']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { slowmodeNumber, realtime }) {
|
||||
async exec(message,args) {
|
||||
let slowmodeNumber = args.slowmodeNumber;
|
||||
let realtime = args.realtime;
|
||||
|
||||
if (slowmodeNumber > 120)
|
||||
return message.say("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);
|
||||
|
||||
if (realtime) {
|
||||
let time = 60000 * realtime;
|
||||
message.say(`Slowmode have been set to ${slowmodeNumber} seconds and will end in ${realtime} minutes!`);
|
||||
setTimeout (function (){
|
||||
message.channel.setRateLimitPerUser(0);
|
||||
return message.say("Slowmode is now disabled!")
|
||||
}, time);
|
||||
let time = 60000 * realtime;
|
||||
message.channel.send(`Slowmode have been set to ${slowmodeNumber} seconds and will end in ${realtime} minutes!`);
|
||||
setTimeout (function (){
|
||||
message.channel.setRateLimitPerUser(0);
|
||||
return message.channel.send("Slowmode is now disabled!")
|
||||
}, time);
|
||||
} else {
|
||||
if (slowmodeNumber == 0)
|
||||
return message.say("Slowmode have been disabled!")
|
||||
return message.say(`Slowmode have been set to ${slowmodeNumber} seconds!`);
|
||||
if (slowmodeNumber == 0)
|
||||
return message.channel.send("Slowmode have been disabled!")
|
||||
return message.channel.send(`Slowmode have been set to ${slowmodeNumber} seconds!`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
module.exports = PruneCommand;
|
|
@ -1,36 +1,36 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { Command } = require('discord-akairo');
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = class CustomResponseCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'tag',
|
||||
aliases: ['customresponse'],
|
||||
group: 'admin',
|
||||
memberName: 'tag',
|
||||
description: `Custom auto response`,
|
||||
userPermissions: ['MANAGE_MESSAGES'],
|
||||
class TagCommand extends Command {
|
||||
constructor() {
|
||||
super('tag', {
|
||||
aliases: ['tag'],
|
||||
category: 'admin',
|
||||
split: 'quoted',
|
||||
args: [
|
||||
{
|
||||
key: 'trigger',
|
||||
prompt: 'The word that will trigger the autoresponse (use "--" instead of spaces)',
|
||||
type: 'string',
|
||||
id: "trigger",
|
||||
type: "string"
|
||||
},
|
||||
{
|
||||
key: 'response',
|
||||
prompt: 'The response to the word ( you can use spaces here )',
|
||||
type: 'string',
|
||||
id: "response",
|
||||
type: "string"
|
||||
}
|
||||
]
|
||||
],
|
||||
channelRestriction: 'guild',
|
||||
description: {
|
||||
content: 'Create custom autoresponse',
|
||||
usage: '[trigger] [response]',
|
||||
examples: ['"do you know da wea" "Fuck off dead meme"']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { trigger, response }) {
|
||||
if(blacklist[message.author.id])
|
||||
return message.channel.send("You are blacklisted")
|
||||
async exec(message, args) {
|
||||
let trigger = args.trigger;
|
||||
let response = args.response;
|
||||
|
||||
trigger = trigger.toLowerCase();
|
||||
trigger = trigger.toLowerCase();
|
||||
do {
|
||||
trigger = trigger.replace('--', ' ')
|
||||
} while (trigger.includes('--'))
|
||||
|
@ -58,6 +58,8 @@ module.exports = class CustomResponseCommand extends Command {
|
|||
}
|
||||
})}});
|
||||
|
||||
return message.say(`autoresponse have been set to ${trigger} : ${response}`);
|
||||
}
|
||||
};
|
||||
return message.channel.send(`autoresponse have been set to ${trigger} : ${response}`);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TagCommand;
|
|
@ -1,28 +1,31 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { Command } = require('discord-akairo');
|
||||
|
||||
module.exports = class UnbanCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'unban',
|
||||
group: 'admin',
|
||||
memberName: 'unban',
|
||||
description: 'unban the provided id',
|
||||
guildOnly: true,
|
||||
clientPermissions: ['BAN_MEMBERS'],
|
||||
userPermissions: ['BAN_MEMBERS'],
|
||||
args: [
|
||||
{
|
||||
key: 'member',
|
||||
prompt: 'Wich member would you like to unban?',
|
||||
type: 'user',
|
||||
}
|
||||
]
|
||||
class UnbanCommand extends Command {
|
||||
constructor() {
|
||||
super('unban', {
|
||||
aliases: ['unban'],
|
||||
category: 'admin',
|
||||
args: [
|
||||
{
|
||||
id: 'member',
|
||||
type: 'user'
|
||||
}
|
||||
],
|
||||
clientPermissions: ['BAN_MEMBERS'],
|
||||
userPermissions: ['BAN_MEMBERS'],
|
||||
channelRestriction: 'guild',
|
||||
description: {
|
||||
content: 'unban users',
|
||||
usage: '[user id]',
|
||||
examples: ['267065637183029248']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { member }) {
|
||||
message.guild.unban(member)
|
||||
.then(() => message.reply(`user was succesfully unbanned.`));
|
||||
};
|
||||
};
|
||||
async exec(message, args) {
|
||||
message.guild.unban(args.member)
|
||||
.then(() => message.reply(`user was succesfully unbanned.`));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = UnbanCommand;
|
|
@ -1,48 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const fs = require('fs');
|
||||
module.exports = class CustomResponseCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'untag',
|
||||
aliases: ['rmcustomresponse'],
|
||||
group: 'admin',
|
||||
memberName: 'untag',
|
||||
description: `remove custom autoresponse`,
|
||||
userPermissions: ['MANAGE_MESSAGES'],
|
||||
args: [
|
||||
{
|
||||
key: 'trigger',
|
||||
prompt: 'What is the word to remove',
|
||||
type: 'string',
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { trigger }) {
|
||||
if(blacklist[message.author.id])
|
||||
return message.channel.send("You are blacklisted")
|
||||
|
||||
trigger = trigger.toLowerCase();
|
||||
|
||||
let customresponse = {}
|
||||
let json = JSON.stringify(customresponse)
|
||||
|
||||
|
||||
fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data){
|
||||
if (err){
|
||||
console.log(err);
|
||||
} else {
|
||||
customresponse = JSON.parse(data); //now it an object
|
||||
delete customresponse[trigger]
|
||||
json = JSON.stringify(customresponse); //convert it back to json
|
||||
fs.writeFile(`./tag/${message.guild.id}.json`, json, 'utf8', function(err) {
|
||||
if(err) {
|
||||
return console.log(err);
|
||||
}
|
||||
})}});
|
||||
|
||||
return message.say(`The following autoresponse have been deleted: ${trigger}`);
|
||||
}
|
||||
};
|
|
@ -1,34 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const Discord = require('discord.js');
|
||||
const fetch = require('node-fetch')
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
|
||||
module.exports = class AdviceCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'advice',
|
||||
group: 'fun',
|
||||
memberName: 'advice',
|
||||
description: `Show some random advice`,
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
fetch("http://api.adviceslip.com/advice").then((response) => {
|
||||
return response.json();
|
||||
}).then((response) => {
|
||||
const adviceEmbed = new Discord.RichEmbed()
|
||||
.setColor("#ff9900")
|
||||
.setTitle(response.slip.slip_id)
|
||||
.setDescription(response.slip.advice)
|
||||
|
||||
|
||||
message.say(adviceEmbed);
|
||||
});
|
||||
}};
|
|
@ -1,35 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const fetch = require('node-fetch')
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
|
||||
module.exports = class BadMemeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'badmeme',
|
||||
group: 'fun',
|
||||
memberName: 'badmeme',
|
||||
description: `Take random images from imgur`,
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
fetch("https://api.imgur.com/3/gallery/hot/day?showViral=true&mature=false&perPage=100&album_previews=true", {
|
||||
headers: { "Authorization": "Client-ID e4cb6948f80f295" },
|
||||
}).then((response) => {
|
||||
return response.json();
|
||||
}).then((response) => {
|
||||
if (response.success == 'false')
|
||||
return message.say('An error has occured')
|
||||
|
||||
const i = Math.floor((Math.random() * response.data.length));
|
||||
|
||||
message.say(`**${response.data[i].title}**`)
|
||||
message.say(response.data[i].link);
|
||||
});
|
||||
}};
|
|
@ -1,30 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
module.exports = class clapCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'clap',
|
||||
group: 'fun',
|
||||
memberName: 'clap',
|
||||
description: `Repeat the text you send with clap`,
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What do you want me to say',
|
||||
type: 'string',
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { text }) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
let clap = text.replace(/ /g, ' 👏 ');
|
||||
message.delete();
|
||||
message.say(`${clap} 👏`);
|
||||
}};
|
|
@ -1,25 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const responseObject = require("../../json/randVid.json");
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
module.exports = class dankCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'dank',
|
||||
group: 'fun',
|
||||
memberName: 'dank',
|
||||
description: `send some random dank vid (yea sorry for that name). There is currently **${Object.keys(responseObject).length}** vid`,
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
const number = Object.keys(responseObject).length;
|
||||
const vidNumber = Math.floor (Math.random() * (number - 1 + 1)) + 1;
|
||||
message.channel.send(`${vidNumber}: ${responseObject[vidNumber]}`);
|
||||
}
|
||||
};
|
|
@ -1,59 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const responseObject = require("../../json/despacito.json");
|
||||
const { createCanvas, loadImage, getContext } = require('canvas')
|
||||
const superagent = require('superagent')
|
||||
const Discord = require('discord.js');
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
module.exports = class DespacitoCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'despacito',
|
||||
group: 'fun',
|
||||
memberName: 'despacito',
|
||||
description: `despacito`,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'What do you want me to say',
|
||||
type: 'user',
|
||||
default: ''
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { user }) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
if (!user) {
|
||||
const number = Object.keys(responseObject).length;
|
||||
const despacitoNumber = Math.floor (Math.random() * (number - 1 + 1)) + 1;
|
||||
return message.channel.send({files: [responseObject[despacitoNumber]]}).catch(error => {
|
||||
message.say('an error as occured')
|
||||
})
|
||||
|
||||
} else if (user.id === this.client.user.id) {
|
||||
return message.say('Nice try but you wont get me :^)');
|
||||
} else {
|
||||
const canvas = createCanvas(660, 660);
|
||||
const ctx = canvas.getContext('2d');
|
||||
const background = await loadImage(user.avatarURL);
|
||||
ctx.drawImage(background, 5, 12, canvas.width, canvas.height);
|
||||
const { body: buffer } = await superagent.get('https://image.noelshack.com/fichiers/2018/41/6/1539381851-untitled.png');
|
||||
const bg = await loadImage(buffer);
|
||||
ctx.drawImage(bg, 0, 0, canvas.width, canvas.height);
|
||||
const attachment = new Discord.Attachment(canvas.toBuffer(), 'despacito.png');
|
||||
|
||||
message.delete();
|
||||
message.say(`${user.username}, you have been despacito'd`, attachment).catch(error => {
|
||||
message.say('an error as occured')
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
};
|
|
@ -1,36 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const emojiCharacters = require('../../emojiCharacters');
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
module.exports = class emoteSayCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'emotesay',
|
||||
group: 'fun',
|
||||
memberName: 'emotesay',
|
||||
description: `repeat the text in dancing letters`,
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What do you want me to say',
|
||||
type: 'string',
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { text }) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
message.delete();
|
||||
let emojiArray = [];
|
||||
for (let i = 0; i < text.length; i++)
|
||||
emojiArray[i] = emojiCharacters[text.toLowerCase().split('')[i]];
|
||||
message.say(emojiArray.join(""))
|
||||
|
||||
|
||||
}
|
||||
};
|
|
@ -1,25 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const responseObject = require("../../json/funfact.json");
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
module.exports = class FunFactCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'funfact',
|
||||
group: 'fun',
|
||||
memberName: 'funfact',
|
||||
description: `Send some fun fact. If you would like to see some of yours fun fact you can send them to @Supositware | Baguette#8211. There is currently **${Object.keys(responseObject).length}** fun fact.`,
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
const number = Object.keys(responseObject).length;
|
||||
const funFactNumber = Math.floor (Math.random() * (number - 1 + 1)) + 1;
|
||||
message.channel.send(`Fun fact: ${responseObject[funFactNumber]}`);
|
||||
}
|
||||
};
|
|
@ -1,26 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const fetch = require('node-fetch')
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
|
||||
module.exports = class BadMemeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'ib',
|
||||
aliases: ['inspirobot'],
|
||||
group: 'fun',
|
||||
memberName: 'ib',
|
||||
description: `Return a random inspiration from inspirobot`,
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
fetch('http://inspirobot.me/api?generate=true')
|
||||
.then(res => res.text())
|
||||
.then(body => message.channel.send({files: [body]}))
|
||||
}}
|
|
@ -1,45 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const printer = require('printer');
|
||||
const { printChannel } = require('../../config.json');
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
module.exports = class printCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'print',
|
||||
aliases: ['dundermifflin', 'wastedevinkandmoney'],
|
||||
group: 'fun',
|
||||
memberName: 'print',
|
||||
description: 'print whatever you want using the dev printer ! ( yea really, send a feedback requesting the image and i\'il send it to you. )',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 86400,
|
||||
},
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What do you want to print? ( text only )',
|
||||
type: 'string',
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { text }) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
const channel = this.client.channels.get(printChannel);
|
||||
printer.printDirect({data:`Printed by: ${message.author.username}\n\n${text}`
|
||||
, type: 'TEXT' // type: RAW, TEXT, PDF, JPEG, .. depends on platform
|
||||
, success:function(jobID){
|
||||
console.log("sent to printer with ID: "+jobID);
|
||||
message.say("Printing now! ( You will receive your print shortly ( if the dev isint sleeping that is ))");
|
||||
channel.send(`${message.author.username} (${message.author.id}) Asked for a print with the following text: ${text}`);
|
||||
}
|
||||
, error:function(err){console.log(err); message.say("An error has occured, the printer is most likely disconnected, try again later")}
|
||||
});
|
||||
}
|
||||
};
|
|
@ -1,56 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const Discord = require('discord.js');
|
||||
const fetch = require('node-fetch');
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const { prefix } = require('../../config.json')
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
module.exports = class redditCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'reddit',
|
||||
group: 'fun',
|
||||
memberName: 'reddit',
|
||||
description: `Show a random images from the subreddit you choose`,
|
||||
args: [
|
||||
{
|
||||
key: 'sub',
|
||||
prompt: 'Wich subreddit would you like to see?',
|
||||
type: 'string',
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { sub }) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
let /* the bodies hit the */ i = Math.floor((Math.random() * 10) + 1);
|
||||
let a = 0
|
||||
fetch('https://www.reddit.com/r/' + sub + '.json?limit=100').then((response) => {
|
||||
return response.json();
|
||||
}).then((response) => {
|
||||
if (!response.data)
|
||||
return message.say('Not a valid subreddit')
|
||||
while (response.data.children[i].data.post_hint !== 'image') {
|
||||
i = Math.floor((Math.random() * response.data.children.length));
|
||||
|
||||
a++
|
||||
if (a == 5)
|
||||
return message.say("Could not find any images")
|
||||
}
|
||||
if (response.data.children[i].data.over_18 == true)
|
||||
return message.say(`No nsfw ( if you want a nsfw version of this commands use the feedback commands "${prefix} feedback <your feedback>")`)
|
||||
const redditEmbed = new Discord.RichEmbed()
|
||||
.setColor("#ff9900")
|
||||
.setTitle(response.data.children[i].data.title)
|
||||
.setImage(response.data.children[i].data.url)
|
||||
.setURL('https://reddit.com' + response.data.children[i].data.permalink)
|
||||
.setFooter(`⬆ ${response.data.children[i].data.ups} 💬 ${response.data.children[i].data.num_comments}`)
|
||||
|
||||
message.say(redditEmbed);
|
||||
}
|
||||
|
||||
)}}
|
|
@ -1,58 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const textToSpeech = require('@google-cloud/text-to-speech');
|
||||
const gclient = new textToSpeech.TextToSpeechClient();
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const fs = require('fs');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
|
||||
module.exports = class BadMemeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'tts',
|
||||
group: 'fun',
|
||||
memberName: 'tts',
|
||||
description: `Return what you type in a tts file`,
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What do you want to be said',
|
||||
type: 'string',
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { text }) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
// Construct the request
|
||||
const request = {
|
||||
input: {text: text},
|
||||
// Select the language and SSML Voice Gender (optional)
|
||||
voice: {languageCode: 'en-US', ssmlGender: 'NEUTRAL'},
|
||||
// Select the type of audio encoding
|
||||
audioConfig: {audioEncoding: 'MP3'},
|
||||
};
|
||||
|
||||
// Performs the Text-to-Speech request
|
||||
gclient.synthesizeSpeech(request, (err, response) => {
|
||||
if (err) {
|
||||
console.error('ERROR:', err);
|
||||
return;
|
||||
}
|
||||
|
||||
// Write the binary audio content to a local file
|
||||
fs.writeFile('tts.mp3', response.audioContent, 'binary', err => {
|
||||
if (err) {
|
||||
console.error('ERROR:', err);
|
||||
message.say('An error has occured, the message is probably too long')
|
||||
return;
|
||||
}
|
||||
console.log('Audio content written to file: tts.mp3');
|
||||
message.say({files: ['./tts.mp3']})
|
||||
});
|
||||
});
|
||||
}}
|
33
commands/general/advice.js
Normal file
33
commands/general/advice.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
const { Command } = require('discord-akairo');
|
||||
const Discord = require('discord.js');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
class AdviceCommand extends Command {
|
||||
constructor() {
|
||||
super('advice', {
|
||||
aliases: ['advice'],
|
||||
category: 'general',
|
||||
description: {
|
||||
content: 'Send some random advices',
|
||||
usage: '',
|
||||
examples: ['']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async exec(message) {
|
||||
fetch("http://api.adviceslip.com/advice").then((response) => {
|
||||
return response.json();
|
||||
}).then((response) => {
|
||||
const adviceEmbed = new Discord.RichEmbed()
|
||||
.setColor("#ff9900")
|
||||
.setTitle(response.slip.slip_id)
|
||||
.setDescription(response.slip.advice)
|
||||
|
||||
|
||||
message.channel.send(adviceEmbed);
|
||||
|
||||
})}
|
||||
|
||||
}
|
||||
module.exports = AdviceCommand;
|
33
commands/general/badmeme.js
Normal file
33
commands/general/badmeme.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
const { Command } = require('discord-akairo');
|
||||
const fetch = require('node-fetch')
|
||||
|
||||
class ImgurCommand extends Command {
|
||||
constructor() {
|
||||
super('imgur', {
|
||||
aliases: ['badmeme', 'imgur'],
|
||||
category: 'general',
|
||||
description: {
|
||||
content: 'Send some random images from imgur',
|
||||
usage: '',
|
||||
examples: ['']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async exec(message) {
|
||||
fetch("https://api.imgur.com/3/gallery/hot/day?showViral=true&mature=false&perPage=100&album_previews=true", {
|
||||
headers: { "Authorization": "Client-ID e4cb6948f80f295" },
|
||||
}).then((response) => {
|
||||
return response.json();
|
||||
}).then((response) => {
|
||||
if (response.success == 'false')
|
||||
return message.channel.send('An error has occured')
|
||||
|
||||
const i = Math.floor((Math.random() * response.data.length));
|
||||
|
||||
message.channel.send(`**${response.data[i].title}**\n${response.data[i].link}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ImgurCommand;
|
30
commands/general/clap.js
Normal file
30
commands/general/clap.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
const { Command } = require('discord-akairo');
|
||||
|
||||
class ClapCommand extends Command {
|
||||
constructor() {
|
||||
super('clap', {
|
||||
aliases: ['clap'],
|
||||
category: 'general',
|
||||
split: 'none',
|
||||
args: [
|
||||
{
|
||||
id: "text",
|
||||
type: "string"
|
||||
}
|
||||
],
|
||||
description: {
|
||||
content: 'replace 👏 the 👏 spaces 👏 with 👏 clap 👏',
|
||||
usage: '[text]',
|
||||
examples: ['replace the spaces with clap']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async exec(message, args) {
|
||||
let clap = args.text.replace(/ /g, ' 👏 ');
|
||||
message.delete();
|
||||
message.channel.send(`${clap} 👏`);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ClapCommand;
|
35
commands/general/emotesay.js
Normal file
35
commands/general/emotesay.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
const { Command } = require('discord-akairo');
|
||||
const emojiCharacters = require('../../emojiCharacters');
|
||||
|
||||
class EmotesayCommand extends Command {
|
||||
constructor() {
|
||||
super('emotesay', {
|
||||
aliases: ['emotesay', 'esay'],
|
||||
category: 'general',
|
||||
split: 'none',
|
||||
args: [
|
||||
{
|
||||
id: "text",
|
||||
type: "string"
|
||||
}
|
||||
],
|
||||
description: {
|
||||
content: 'Replace the text you send with dancing letters',
|
||||
usage: '[text]',
|
||||
examples: ['Hello']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async exec(message, args) {
|
||||
let text = args.text;
|
||||
|
||||
message.delete();
|
||||
let emojiArray = [];
|
||||
for (let i = 0; i < text.length; i++)
|
||||
emojiArray[i] = emojiCharacters[text.toLowerCase().split('')[i]];
|
||||
message.channel.send(emojiArray.join(""))
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = EmotesayCommand;
|
23
commands/general/ib.js
Normal file
23
commands/general/ib.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
const { Command } = require('discord-akairo');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
class InspiroBotCommand extends Command {
|
||||
constructor() {
|
||||
super('InspiroBot', {
|
||||
aliases: ['inspirobot', 'ib'],
|
||||
category: 'general',
|
||||
description: {
|
||||
content: 'Send images from Inspirobot',
|
||||
usage: '',
|
||||
examples: ['']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async exec(message) {
|
||||
fetch('http://inspirobot.me/api?generate=true')
|
||||
.then(res => res.text())
|
||||
.then(body => message.channel.send({files: [body]}))
|
||||
}
|
||||
}
|
||||
module.exports = InspiroBotCommand;
|
52
commands/general/reddit.js
Normal file
52
commands/general/reddit.js
Normal file
|
@ -0,0 +1,52 @@
|
|||
const { Command } = require('discord-akairo');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
class RedditCommand extends Command {
|
||||
constructor() {
|
||||
super('reddit', {
|
||||
aliases: ['reddit'],
|
||||
category: 'general',
|
||||
split: 'none',
|
||||
args: [
|
||||
{
|
||||
id: 'sub',
|
||||
type: 'string'
|
||||
}
|
||||
],
|
||||
description: {
|
||||
content: 'Send random images from the subreddit you choose',
|
||||
usage: '[subreddit]',
|
||||
examples: ['2meirl4meirl']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async exec(message, args) {
|
||||
let sub = args.sub;
|
||||
|
||||
fetch('https://www.reddit.com/r/' + sub + '.json?limit=100').then((response) => {
|
||||
return response.json();
|
||||
}).then((response) => {
|
||||
if (!response.data)
|
||||
return message.channel.send('Not a valid subreddit')
|
||||
while (response.data.children[i].data.post_hint !== 'image') {
|
||||
i = Math.floor((Math.random() * response.data.children.length));
|
||||
|
||||
a++
|
||||
if (a == 5)
|
||||
return message.channel.send("Could not find any images")
|
||||
}
|
||||
if (response.data.children[i].data.over_18 == true)
|
||||
return message.channel.send(`No nsfw ( if you want a nsfw version of this commands use the feedback commands "${prefix} feedback <your feedback>")`)
|
||||
const redditEmbed = new Discord.RichEmbed()
|
||||
.setColor("#ff9900")
|
||||
.setTitle(response.data.children[i].data.title)
|
||||
.setImage(response.data.children[i].data.url)
|
||||
.setURL('https://reddit.com' + response.data.children[i].data.permalink)
|
||||
.setFooter(`⬆ ${response.data.children[i].data.ups} 💬 ${response.data.children[i].data.num_comments}`)
|
||||
|
||||
message.channel.send(redditEmbed);
|
||||
})
|
||||
}
|
||||
}
|
||||
module.exports = RedditCommand;
|
|
@ -1,32 +1,31 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { Command } = require('discord-akairo');
|
||||
|
||||
module.exports = class sayCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'say',
|
||||
aliases: ['repeat'],
|
||||
group: 'fun',
|
||||
memberName: 'say',
|
||||
description: `Repeat the text you send ( can also use [verb] [noun] [adverbs] [adjective] [activities] [celebrities] [countries] [diseases] [elements] [hobbies] [music] [prefixes] [pronoun] [state] [title] [unit] [member] [number] to replace it with something else )`,
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What do you want me to say',
|
||||
type: 'string',
|
||||
}
|
||||
]
|
||||
class SayCommand extends Command {
|
||||
constructor() {
|
||||
super('say', {
|
||||
aliases: ['say'],
|
||||
category: 'general',
|
||||
split: 'none',
|
||||
args: [
|
||||
{
|
||||
id: 'text',
|
||||
type: 'string',
|
||||
}
|
||||
],
|
||||
description: {
|
||||
content: 'Repeat what you say but can also replace ',
|
||||
usage: '[text]',
|
||||
examples: ['[member] is a big [adverbs] [verb]']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { text }) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
async exec(message, args) {
|
||||
let text = args.text;
|
||||
|
||||
if (!text) return;
|
||||
|
||||
// Load all the different files
|
||||
// Load all the different files
|
||||
const verb = require('../../dictionary/verbs.json')
|
||||
const noun = require('../../dictionary/noun.json')
|
||||
const adverbs = require('../../dictionary/adjectives.json')
|
||||
|
@ -75,6 +74,8 @@ module.exports = class sayCommand extends Command {
|
|||
} while( text.includes('[verb]') || text.includes('[adverbs]') || text.includes('[noun]') || text.includes('[adjective]') || text.includes('[member]') || text.includes('[number]') || text.includes('[activities]') || text.includes('[celebrities]') || text.includes('[countries]') || text.includes('[diseases]') || text.includes('[elements]') || text.includes('[hobbies]') || text.includes('[music]') || text.includes('[prefixes]') || text.includes('[pronoun]') || text.includes('[state]') || text.includes('[title]') || text.includes('[unit]'))
|
||||
|
||||
// Send the final text
|
||||
message.say(text);
|
||||
}
|
||||
};
|
||||
return message.channel.send(text);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SayCommand;
|
|
@ -1,32 +1,30 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { Command } = require('discord-akairo');
|
||||
|
||||
module.exports = class saydCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'sayd',
|
||||
aliases: ['repeatd'],
|
||||
group: 'fun',
|
||||
memberName: 'sayd',
|
||||
description: `Repeat the text you send and delete it after ward( can also use [verb] [noun] [adverbs] [adjective] [activities] [celebrities] [countries] [diseases] [elements] [hobbies] [music] [prefixes] [pronoun] [state] [title] [unit] [member] [number] to replace it with something else )`,
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What do you want me to say',
|
||||
type: 'string',
|
||||
}
|
||||
]
|
||||
class SayCommand extends Command {
|
||||
constructor() {
|
||||
super('sayd', {
|
||||
aliases: ['sayd'],
|
||||
category: 'general',
|
||||
split: 'none',
|
||||
clientPermissions: 'MANAGE_MESSAGES',
|
||||
args: [
|
||||
{
|
||||
id: 'text',
|
||||
type: 'string'
|
||||
}
|
||||
],
|
||||
description: {
|
||||
content: 'Repeat what you say but delete the text you sent',
|
||||
usage: '[text]',
|
||||
examples: ['[member] is a big [adverbs] [verb]']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { text }) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
async exec(message, args) {
|
||||
let text = args.text;
|
||||
|
||||
|
||||
// Load all the different files
|
||||
// Load all the different files
|
||||
const verb = require('../../dictionary/verbs.json')
|
||||
const noun = require('../../dictionary/noun.json')
|
||||
const adverbs = require('../../dictionary/adjectives.json')
|
||||
|
@ -74,9 +72,10 @@ module.exports = class saydCommand extends Command {
|
|||
// Verify if it replaced everything
|
||||
} while( text.includes('[verb]') || text.includes('[adverbs]') || text.includes('[noun]') || text.includes('[adjective]') || text.includes('[member]') || text.includes('[number]') || text.includes('[activities]') || text.includes('[celebrities]') || text.includes('[countries]') || text.includes('[diseases]') || text.includes('[elements]') || text.includes('[hobbies]') || text.includes('[music]') || text.includes('[prefixes]') || text.includes('[pronoun]') || text.includes('[state]') || text.includes('[title]') || text.includes('[unit]'))
|
||||
|
||||
|
||||
// Send the final text
|
||||
message.delete();
|
||||
message.say(text);
|
||||
}
|
||||
};
|
||||
return message.channel.send(text);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SayCommand;
|
56
commands/general/tts.js
Normal file
56
commands/general/tts.js
Normal file
|
@ -0,0 +1,56 @@
|
|||
const { Command } = require('discord-akairo');
|
||||
const textToSpeech = require('@google-cloud/text-to-speech');
|
||||
const gclient = new textToSpeech.TextToSpeechClient();
|
||||
|
||||
class TtsCommand extends Command {
|
||||
constructor() {
|
||||
super('tts', {
|
||||
aliases: ['tts'],
|
||||
category: 'general',
|
||||
split: 'none',
|
||||
args: [
|
||||
{
|
||||
id: 'text',
|
||||
type: 'string'
|
||||
}
|
||||
],
|
||||
description: {
|
||||
content: 'Send a mp3 of what you wrote in tts',
|
||||
usage: '[text]',
|
||||
examples: ['hello']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async exec(message, args) {
|
||||
|
||||
// Construct the request
|
||||
const request = {
|
||||
input: {text: text},
|
||||
// Select the language and SSML Voice Gender (optional)
|
||||
voice: {languageCode: 'en-US', ssmlGender: 'NEUTRAL'},
|
||||
// Select the type of audio encoding
|
||||
audioConfig: {audioEncoding: 'MP3'},
|
||||
};
|
||||
|
||||
// Performs the Text-to-Speech request
|
||||
gclient.synthesizeSpeech(request, (err, response) => {
|
||||
if (err) {
|
||||
console.error('ERROR:', err);
|
||||
return;
|
||||
}
|
||||
|
||||
// Write the binary audio content to a local file
|
||||
fs.writeFile('tts.mp3', response.audioContent, 'binary', err => {
|
||||
if (err) {
|
||||
console.error('ERROR:', err);
|
||||
message.channel.send('An error has occured, the message is probably too long')
|
||||
return;
|
||||
}
|
||||
console.log('Audio content written to file: tts.mp3');
|
||||
message.channel.send({files: ['./tts.mp3']})
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = TtsCommand;
|
|
@ -1,33 +1,28 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const { Command } = require('discord-akairo');
|
||||
const textToSpeech = require('@google-cloud/text-to-speech');
|
||||
const gclient = new textToSpeech.TextToSpeechClient();
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const fs = require('fs');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
|
||||
module.exports = class ttsvcCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'ttsvc',
|
||||
group: 'fun',
|
||||
memberName: 'ttsvc',
|
||||
description: `Play what you write in tts in vc`,
|
||||
class TtsvcCommand extends Command {
|
||||
constructor() {
|
||||
super('ttsvc', {
|
||||
aliases: ['ttsvc'],
|
||||
category: 'general',
|
||||
split: 'none',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What do you want to be said',
|
||||
type: 'string',
|
||||
id: 'text',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
],
|
||||
description: {
|
||||
content: 'Say what you wrote in voice channel',
|
||||
usage: '[text]',
|
||||
examples: ['hello']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { text }) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
async exec(message, args) {
|
||||
// Construct the request
|
||||
const request = {
|
||||
input: {text: text},
|
||||
|
@ -73,4 +68,6 @@ module.exports = class ttsvcCommand extends Command {
|
|||
});
|
||||
});
|
||||
});
|
||||
}}
|
||||
}
|
||||
}
|
||||
module.exports = TtsvcCommand;
|
|
@ -1,41 +1,36 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const { Command } = require('discord-akairo');
|
||||
const Discord = require('discord.js');
|
||||
const { createCanvas, loadImage, getContext } = require('canvas')
|
||||
const superagent = require('superagent')
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { createCanvas, loadImage, getContext } = require('canvas');
|
||||
const superagent = require('superagent');
|
||||
|
||||
|
||||
|
||||
|
||||
module.exports = class fetishCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'fetish',
|
||||
group: 'images',
|
||||
memberName: 'fetish',
|
||||
description: `My fetish`,
|
||||
class FetishCommand extends Command {
|
||||
constructor() {
|
||||
super('fetish', {
|
||||
aliases: ['fetish'],
|
||||
category: 'images',
|
||||
args: [
|
||||
{
|
||||
id: 'image',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
async exec(message,args) {
|
||||
let Attachment = (message.attachments).array();
|
||||
let image = null
|
||||
if (!Attachment[0])
|
||||
let image = args.image;
|
||||
if (!Attachment[0] && !image)
|
||||
image = message.author.displayAvatarURL
|
||||
else if(Attachment[0] && Attachment[0].url.endsWith('gif'))
|
||||
return message.say('Gif dosent work, sorry')
|
||||
else
|
||||
image = Attachment[0].url
|
||||
return message.channel.send('Gif dosent work, sorry')
|
||||
else if (!image)
|
||||
image = Attachment[0].url
|
||||
|
||||
const canvas = createCanvas(528, 559)
|
||||
const ctx = canvas.getContext('2d')
|
||||
const background = await loadImage('https://image.noelshack.com/fichiers/2018/42/2/1539644291-my-fetish-5910119d988512.png').catch(error => {
|
||||
return message.say('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);
|
||||
const { body: buffer } = await superagent.get(image);
|
||||
|
@ -44,9 +39,11 @@ module.exports = class fetishCommand extends Command {
|
|||
|
||||
const attachment = new Discord.Attachment(canvas.toBuffer(), 'myfetish.png');
|
||||
|
||||
message.say(attachment).catch(error => {
|
||||
message.say('an error as occured. Check the bot/channel permissions')
|
||||
})
|
||||
|
||||
}
|
||||
};
|
||||
message.channel.send(attachment).catch(() => {
|
||||
message.channel.send('an error as occured. Check the bot/channel permissions')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = FetishCommand;
|
|
@ -1,52 +1,46 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const { Command } = require('discord-akairo');
|
||||
const Discord = require('discord.js');
|
||||
const { createCanvas, loadImage, getContext } = require('canvas')
|
||||
const superagent = require('superagent')
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { createCanvas, loadImage, getContext } = require('canvas');
|
||||
const superagent = require('superagent');
|
||||
|
||||
|
||||
|
||||
|
||||
module.exports = class godCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'god',
|
||||
group: 'images',
|
||||
memberName: 'god',
|
||||
description: `Retweet if you aren't afraid to have a picture of god on your timeline`,
|
||||
class GodCommand extends Command {
|
||||
constructor() {
|
||||
super('god', {
|
||||
aliases: ['god'],
|
||||
category: 'images',
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
async exec(message) {
|
||||
let Attachment = (message.attachments).array();
|
||||
let image = null
|
||||
if (!Attachment[0])
|
||||
let image = args.image;
|
||||
if (!Attachment[0] && !image)
|
||||
image = message.author.displayAvatarURL
|
||||
else if(Attachment[0] && Attachment[0].url.endsWith('gif'))
|
||||
return message.say('Gif dosent work, sorry')
|
||||
else
|
||||
image = Attachment[0].url
|
||||
return message.channel.send('Gif dosent work, sorry')
|
||||
else if (!image)
|
||||
image = Attachment[0].url
|
||||
|
||||
|
||||
const canvas = createCanvas(310, 400)
|
||||
const ctx = canvas.getContext('2d')
|
||||
const background = await loadImage(image);
|
||||
ctx.drawImage(background, 20, 80, 275, 250);
|
||||
const { body: buffer } = await superagent.get('https://image.noelshack.com/fichiers/2018/42/1/1539555260-untitled.png').catch(error => {
|
||||
return message.say('An error as occured, please try again')
|
||||
const { body: buffer } = await superagent.get('https://image.noelshack.com/fichiers/2018/42/1/1539555260-untitled.png').catch(() => {
|
||||
return message.channel.send('An error as occured, please try again')
|
||||
})
|
||||
const bg = await loadImage(buffer);
|
||||
ctx.drawImage(bg, 0, 0, canvas.width, canvas.height);
|
||||
|
||||
const attachment = new Discord.Attachment(canvas.toBuffer(), 'god.png');
|
||||
|
||||
message.say(attachment).catch(error => {
|
||||
message.say('an error as occured. Check the bot/channel permissions')
|
||||
message.delete();
|
||||
message.channel.send(attachment)
|
||||
.catch(() => {
|
||||
message.channel.send('an error as occured. Check the bot/channel permissions')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
module.exports = GodCommand;
|
|
@ -1,52 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const Discord = require('discord.js');
|
||||
const { createCanvas, loadImage, getContext } = require('canvas')
|
||||
const superagent = require('superagent')
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
|
||||
|
||||
|
||||
module.exports = class humanCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'human',
|
||||
group: 'images',
|
||||
memberName: 'human',
|
||||
description: `HUMAN ?! YOU DARE CALL THAT THING HUMAN?!?!`,
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
let Attachment = (message.attachments).array();
|
||||
let image = null
|
||||
if (!Attachment[0])
|
||||
image = message.author.displayAvatarURL
|
||||
else if(Attachment[0] && Attachment[0].url.endsWith('gif'))
|
||||
return message.say('Gif dosent work, sorry')
|
||||
else
|
||||
image = Attachment[0].url
|
||||
|
||||
const canvas = createCanvas(578, 400)
|
||||
const ctx = canvas.getContext('2d')
|
||||
const background = await loadImage('https://image.noelshack.com/fichiers/2018/42/1/1539594726-untitled.png').catch(error => {
|
||||
return message.say('An error as occured, please try again')
|
||||
})
|
||||
ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
|
||||
const { body: buffer } = await superagent.get(image);
|
||||
const bg = await loadImage(buffer);
|
||||
ctx.drawImage(bg, 420, 120, 150, 150);
|
||||
|
||||
const attachment = new Discord.Attachment(canvas.toBuffer(), 'human.png');
|
||||
|
||||
message.say(attachment).catch(error => {
|
||||
message.say('an error as occured. Check the bot/channel permissions')
|
||||
})
|
||||
|
||||
}
|
||||
};
|
|
@ -1,45 +1,26 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const { Command } = require('discord-akairo');
|
||||
const Discord = require('discord.js');
|
||||
const { createCanvas, loadImage, getContext } = require('canvas')
|
||||
const superagent = require('superagent')
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { createCanvas, loadImage, getContext } = require('canvas');
|
||||
const superagent = require('superagent');
|
||||
|
||||
|
||||
|
||||
|
||||
module.exports = class idubbbzCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'idubbbz',
|
||||
aliases: ['idubbz', 'edups'],
|
||||
group: 'images',
|
||||
memberName: 'idubbbz',
|
||||
description: `Put the text you send in idubbbz piece of paper`,
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What do you the paper to say?',
|
||||
type: 'string',
|
||||
default: 'Nigger Faggot'
|
||||
}
|
||||
]
|
||||
class IdubbbzCommand extends Command {
|
||||
constructor() {
|
||||
super('idubbbz', {
|
||||
aliases: ['idubbbz', 'edups'],
|
||||
category: 'images',
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { text }) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
async exec(message) {
|
||||
let Attachment = (message.attachments).array();
|
||||
let image = null
|
||||
if (!Attachment[0])
|
||||
image = message.author.displayAvatarURL
|
||||
else if(Attachment[0] && Attachment[0].url.endsWith('gif'))
|
||||
return message.say('Gif dosent work, sorry')
|
||||
else
|
||||
image = Attachment[0].url
|
||||
let image = args.image;
|
||||
if (!Attachment[0] && !image)
|
||||
image = message.author.displayAvatarURL
|
||||
else if(Attachment[0] && Attachment[0].url.endsWith('gif'))
|
||||
return message.channel.send('Gif dosent work, sorry')
|
||||
else if (!image)
|
||||
image = Attachment[0].url
|
||||
|
||||
|
||||
const canvas = createCanvas(1281, 627)
|
||||
const applyText = (canvas, text) => {
|
||||
|
@ -61,7 +42,7 @@ module.exports = class idubbbzCommand extends Command {
|
|||
const background = await loadImage(image);
|
||||
ctx.drawImage(background, 620, 100, 200, 200);
|
||||
const { body: buffer } = await superagent.get('https://image.noelshack.com/fichiers/2018/41/7/1539510207-untitled.png').catch(error => {
|
||||
return message.say('An error as occured, please try again')
|
||||
return message.channel.send('An error as occured, please try again')
|
||||
})
|
||||
const bg = await loadImage(buffer);
|
||||
ctx.drawImage(bg, 0, 0, canvas.width, canvas.height);
|
||||
|
@ -71,9 +52,10 @@ module.exports = class idubbbzCommand extends Command {
|
|||
|
||||
const attachment = new Discord.Attachment(canvas.toBuffer(), 'edups.png');
|
||||
|
||||
message.say(attachment).catch(error => {
|
||||
message.say('an error as occured. Check the bot/channel permissions')
|
||||
message.channel.send(attachment).catch(error => {
|
||||
message.channel.send('an error as occured. Check the bot/channel permissions')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
module.exports = IdubbbzCommand;
|
|
@ -1,45 +1,25 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const { Command } = require('discord-akairo');
|
||||
const Discord = require('discord.js');
|
||||
const { createCanvas, loadImage, getContext } = require('canvas')
|
||||
const superagent = require('superagent')
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { createCanvas, loadImage, getContext } = require('canvas');
|
||||
const superagent = require('superagent');
|
||||
|
||||
|
||||
|
||||
|
||||
module.exports = class idubbbzpaintCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'idubbbzpaint',
|
||||
aliases: ['idubbzpaint', 'edupspaint'],
|
||||
group: 'images',
|
||||
memberName: 'painting',
|
||||
description: `Put the image you send or you in idubbbz painting`,
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What do you the paper to say?',
|
||||
type: 'string',
|
||||
default: 'Perfection'
|
||||
}
|
||||
]
|
||||
class IdubbbzPaintCommand extends Command {
|
||||
constructor() {
|
||||
super('idubbbzpaint', {
|
||||
aliases: ['idubbbzpaint', 'edupspaint'],
|
||||
category: 'images',
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { text }) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
async exec(message) {
|
||||
let Attachment = (message.attachments).array();
|
||||
let image = null
|
||||
if (!Attachment[0])
|
||||
let image = args.image;
|
||||
if (!Attachment[0] && !image)
|
||||
image = message.author.displayAvatarURL
|
||||
else if(Attachment[0] && Attachment[0].url.endsWith('gif'))
|
||||
return message.say('Gif dosent work, sorry')
|
||||
else
|
||||
image = Attachment[0].url
|
||||
return message.channel.send('Gif dosent work, sorry')
|
||||
else if (!image)
|
||||
image = Attachment[0].url
|
||||
|
||||
const canvas = createCanvas(1024, 544)
|
||||
const applyText = (canvas, text) => {
|
||||
|
@ -61,7 +41,7 @@ module.exports = class idubbbzpaintCommand extends Command {
|
|||
const background = await loadImage(image);
|
||||
ctx.drawImage(background, 140, 40, 400, 340);
|
||||
const { body: buffer } = await superagent.get('https://image.noelshack.com/fichiers/2018/41/7/1539533685-untitled.png').catch(error => {
|
||||
return message.say('An error as occured, please try again')
|
||||
return message.channel.send('An error as occured, please try again')
|
||||
})
|
||||
const bg = await loadImage(buffer);
|
||||
ctx.drawImage(bg, 0, 0, canvas.width, canvas.height);
|
||||
|
@ -71,9 +51,10 @@ module.exports = class idubbbzpaintCommand extends Command {
|
|||
|
||||
const attachment = new Discord.Attachment(canvas.toBuffer(), 'edupspaint.png');
|
||||
|
||||
message.say(attachment).catch(error => {
|
||||
message.say('an error as occured. Check the bot/channel permissions')
|
||||
message.channel.send(attachment).catch(error => {
|
||||
message.channel.send('an error as occured. Check the bot/channel permissions')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
module.exports = IdubbbzPaintCommand;
|
|
@ -1,51 +1,48 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const { Command } = require('discord-akairo');
|
||||
const Discord = require('discord.js');
|
||||
const { createCanvas, loadImage, getContext } = require('canvas')
|
||||
const superagent = require('superagent')
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { createCanvas, loadImage, getContext } = require('canvas');
|
||||
const superagent = require('superagent');
|
||||
|
||||
|
||||
|
||||
module.exports = class likeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'like',
|
||||
group: 'images',
|
||||
memberName: 'like',
|
||||
description: `What the hell is this and why did my grandsone like it`,
|
||||
class LikeCommand extends Command {
|
||||
constructor() {
|
||||
super('like', {
|
||||
aliases: ['like'],
|
||||
category: 'images',
|
||||
args: [
|
||||
{
|
||||
id: 'image',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
async exec(message,args) {
|
||||
let Attachment = (message.attachments).array();
|
||||
let image = null
|
||||
if (!Attachment[0])
|
||||
let image = args.image;
|
||||
if (!Attachment[0] && !image)
|
||||
image = message.author.displayAvatarURL
|
||||
else if(Attachment[0] && Attachment[0].url.endsWith('gif'))
|
||||
return message.say('Gif dosent work, sorry')
|
||||
else
|
||||
image = Attachment[0].url
|
||||
return message.channel.send('Gif dosent work, sorry')
|
||||
else if (!image)
|
||||
image = Attachment[0].url
|
||||
|
||||
const canvas = createCanvas(386, 399)
|
||||
const ctx = canvas.getContext('2d')
|
||||
const background = await loadImage(image);
|
||||
ctx.drawImage(background, 40, 0, 300, 255);
|
||||
const { body: buffer } = await superagent.get('https://image.noelshack.com/fichiers/2018/41/7/1539547403-untitled.png').catch(error => {
|
||||
return message.say('An error as occured, please try again')
|
||||
return message.channel.send('An error as occured, please try again')
|
||||
})
|
||||
const bg = await loadImage(buffer);
|
||||
ctx.drawImage(bg, 0, 0, canvas.width, canvas.height);
|
||||
|
||||
const attachment = new Discord.Attachment(canvas.toBuffer(), 'like.png');
|
||||
|
||||
message.say(attachment).catch(error => {
|
||||
message.say('an error as occured. Check the bot/channel permissions')
|
||||
message.channel.send(attachment).catch(error => {
|
||||
message.channel.send('an error as occured. Check the bot/channel permissions')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
module.exports = LikeCommand;
|
|
@ -1,40 +1,37 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const { Command } = require('discord-akairo');
|
||||
const Discord = require('discord.js');
|
||||
const { createCanvas, loadImage, getContext } = require('canvas')
|
||||
const superagent = require('superagent')
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { createCanvas, loadImage, getContext } = require('canvas');
|
||||
const superagent = require('superagent');
|
||||
|
||||
|
||||
|
||||
module.exports = class uglyCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'ugly',
|
||||
group: 'images',
|
||||
memberName: 'ugly',
|
||||
description: `You are very ugly!`,
|
||||
class UglyCommand extends Command {
|
||||
constructor() {
|
||||
super('ugly', {
|
||||
aliases: ['ugly'],
|
||||
category: 'images',
|
||||
args: [
|
||||
{
|
||||
id: 'image',
|
||||
type: 'string',
|
||||
optional: true,
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
async exec(message,args) {
|
||||
let Attachment = (message.attachments).array();
|
||||
let image = null
|
||||
if (!Attachment[0])
|
||||
let image = args.image;
|
||||
if (!Attachment[0] && !image)
|
||||
image = message.author.displayAvatarURL
|
||||
else if(Attachment[0] && Attachment[0].url.endsWith('gif'))
|
||||
return message.say('Gif dosent work, sorry')
|
||||
else
|
||||
image = Attachment[0].url
|
||||
return message.channel.send('Gif dosent work, sorry')
|
||||
else if (!image)
|
||||
image = Attachment[0].url
|
||||
|
||||
const canvas = createCanvas(323, 400)
|
||||
const ctx = canvas.getContext('2d')
|
||||
const background = await loadImage('https://image.noelshack.com/fichiers/2018/42/1/1539598678-untitled.png').catch(error => {
|
||||
return message.say('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);
|
||||
const { body: buffer } = await superagent.get(image);
|
||||
|
@ -43,9 +40,10 @@ module.exports = class uglyCommand extends Command {
|
|||
|
||||
const attachment = new Discord.Attachment(canvas.toBuffer(), 'ugly.png');
|
||||
|
||||
message.say(attachment).catch(error => {
|
||||
message.say('an error as occured. Check the bot/channel permissions')
|
||||
message.channel.send(attachment).catch(error => {
|
||||
message.channel.send('an error as occured. Check the bot/channel permissions')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
module.exports = UglyCommand;
|
|
@ -1,50 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const fs = require('fs');
|
||||
module.exports = class BlacklistCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'blacklist',
|
||||
aliases: ['niggerlist'],
|
||||
group: 'owner',
|
||||
memberName: 'blacklist',
|
||||
description: `To blacklist a user from the bot`,
|
||||
ownerOnly: true,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Who do you want to blacklist',
|
||||
type: 'user',
|
||||
},
|
||||
{
|
||||
key: 'reasons',
|
||||
prompt: 'Who do you want to blacklist',
|
||||
type: 'string',
|
||||
default: 'Didin\'t provide any reasons'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { user, reasons }) {
|
||||
let blacklist = {}
|
||||
let json = JSON.stringify(blacklist)
|
||||
|
||||
if(user) {
|
||||
fs.readFile('json/blacklist.json', 'utf8', function readFileCallback(err, data){
|
||||
if (err){
|
||||
console.log(err);
|
||||
} else {
|
||||
blacklist = JSON.parse(data); //now it an object
|
||||
blacklist [user] = reasons
|
||||
json = JSON.stringify(blacklist); //convert it back to json
|
||||
json = json.replace(/[<@!>]/g, '')
|
||||
fs.writeFile('json/blacklist.json', json, 'utf8', function(err) {
|
||||
if(err) {
|
||||
return console.log(err);
|
||||
}
|
||||
})}});
|
||||
|
||||
return message.say(`User ${user} have been blacklisted`);
|
||||
}
|
||||
}
|
||||
};
|
|
@ -1,31 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
module.exports = class BotavatarCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'botavatar',
|
||||
group: 'owner',
|
||||
memberName: 'botavatar',
|
||||
description: 'Change the avatar of the bot',
|
||||
ownerOnly: true,
|
||||
args: [
|
||||
{
|
||||
key: 'pic',
|
||||
prompt: 'Wich avatar should i have?',
|
||||
type: 'string',
|
||||
default: ''
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { pic }) {
|
||||
let Attachment = (message.attachments).array();
|
||||
let image = null
|
||||
if (!Attachment[0])
|
||||
return message.say('You didint provide any images')
|
||||
else
|
||||
image = Attachment[0].url
|
||||
this.client.user.setAvatar(image);
|
||||
message.say('The avatar have been changed succesfully');
|
||||
}
|
||||
};
|
|
@ -1,17 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
module.exports = class DedCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'ded',
|
||||
aliases: ['shutdown', 'dead', 'restart', 'reboot'],
|
||||
group: 'owner',
|
||||
memberName: 'ded',
|
||||
description: 'Reboot the bot',
|
||||
ownerOnly: true,
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
await message.say('k bye thx\nhttps://i.redd.it/lw8hrvr0l4f11.jpg');
|
||||
process.exit();
|
||||
}}
|
|
@ -1,37 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
module.exports = class dmCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'dm',
|
||||
group: 'owner',
|
||||
memberName: 'dm',
|
||||
aliases: ['pm'],
|
||||
description: 'Dm the user id',
|
||||
ownerOnly: true,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Wich user would you like to dm?',
|
||||
type: 'user',
|
||||
},
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What do you want to say to the user',
|
||||
type: 'string',
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { user, text }) {
|
||||
let Attachment = (message.attachments).array();
|
||||
if (Attachment[0]) {
|
||||
user.send(`**Message from the dev:**\n${text}\n${Attachment[0].url}`)
|
||||
message.say(`DM sent to ${user.username}`)
|
||||
}
|
||||
else {
|
||||
user.send(`**Message from the dev:**\n${text}`)
|
||||
message.say(`DM sent to ${user.username}`)
|
||||
}
|
||||
}
|
||||
};
|
|
@ -1,24 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
module.exports = class dmCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'emit',
|
||||
group: 'owner',
|
||||
memberName: 'emit',
|
||||
aliases: ['event', 'emitevent'],
|
||||
description: 'Trigger an event',
|
||||
ownerOnly: true,
|
||||
args: [
|
||||
{
|
||||
key: 'event',
|
||||
prompt: 'Wich event do you want to trigger?',
|
||||
type: 'string',
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { event }) {
|
||||
this.client.emit(`${event}`);
|
||||
}
|
||||
};
|
46
commands/owner/eval.js
Normal file
46
commands/owner/eval.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
const { Command } = require('discord-akairo');
|
||||
|
||||
class EvalCommand extends Command {
|
||||
constructor() {
|
||||
super('eval', {
|
||||
aliases: ['eval'],
|
||||
split: 'none',
|
||||
category: 'owner',
|
||||
args: [
|
||||
{
|
||||
id: 'eval',
|
||||
type: 'string'
|
||||
}
|
||||
],
|
||||
ownerOnly: 'true',
|
||||
description: {
|
||||
content: 'Execute javascript',
|
||||
usage: '[code]',
|
||||
examples: ['message.channel.send(\'Hi\')']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async exec(message, args) {
|
||||
const clean = text => {
|
||||
if (typeof(text) === "string")
|
||||
return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203));
|
||||
else
|
||||
return text;
|
||||
}
|
||||
|
||||
try {
|
||||
const code = args.eval
|
||||
let evaled = eval(code);
|
||||
|
||||
if (typeof evaled !== "string")
|
||||
evaled = require("util").inspect(evaled);
|
||||
|
||||
message.channel.send(clean(evaled), {code:"xl"});
|
||||
} catch (err) {
|
||||
message.channel.send(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = EvalCommand;
|
|
@ -1,24 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
module.exports = class StatusCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'status',
|
||||
group: 'owner',
|
||||
memberName: 'status',
|
||||
description: 'Change the status of the bot',
|
||||
ownerOnly: true,
|
||||
args: [
|
||||
{
|
||||
key: 'status',
|
||||
prompt: 'Wich status should i have?',
|
||||
type: 'string',
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { status }) {
|
||||
this.client.user.setActivity(status);
|
||||
message.say(`Status have been set to ${status}`);
|
||||
}
|
||||
};
|
|
@ -1,25 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
module.exports = class UsernameCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'username',
|
||||
group: 'owner',
|
||||
memberName: 'username',
|
||||
description: 'Change the username of the bot',
|
||||
ownerOnly: true,
|
||||
args: [
|
||||
{
|
||||
key: 'username',
|
||||
prompt: 'Wich status should i have?',
|
||||
type: 'string',
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { username }) {
|
||||
this.client.user.setUsername(username);
|
||||
message.say(`The username have been changed sucessfully to ${username}`);
|
||||
|
||||
}
|
||||
};
|
|
@ -1,40 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
|
||||
module.exports = class BSEspamCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'bsespam',
|
||||
group: 'reserved',
|
||||
memberName: 'bsespam',
|
||||
description: `FOR Big Snow Energy only\nSpam the text you send`,
|
||||
throttling: {
|
||||
usages: 2,
|
||||
duration: 3600,
|
||||
},
|
||||
args: [
|
||||
{
|
||||
key: 'number',
|
||||
prompt: 'How many times do you want to repeat it?',
|
||||
type: 'integer',
|
||||
validate: number => number < 11,
|
||||
default: '1'
|
||||
},
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What do you want me to say',
|
||||
type: 'string',
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { number, text }) {
|
||||
if (message.author.id != "428387534842626048")
|
||||
return message.say('Command only available to **Big Snow Energy**')
|
||||
|
||||
for(let i = 0; i < number; i++) {
|
||||
message.say(text);
|
||||
}
|
||||
message.say('Finished :)');
|
||||
}
|
||||
};
|
|
@ -1,34 +1,30 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { Command } = require('discord-akairo');
|
||||
|
||||
|
||||
module.exports = class AvatarCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'avatar',
|
||||
group: 'utility',
|
||||
memberName: 'avatar',
|
||||
description: 'Send the avatar of the mentionned user.',
|
||||
class AvatarCommand extends Command {
|
||||
constructor() {
|
||||
super('avatar', {
|
||||
aliases: ['avatar', 'avy'],
|
||||
category: 'utility',
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'What do you want me to say',
|
||||
type: 'user',
|
||||
default: ''
|
||||
id: 'user',
|
||||
type: 'user'
|
||||
}
|
||||
]
|
||||
],
|
||||
description: {
|
||||
content: 'Show avatar of the mentioned user or you',
|
||||
usage: '(optional) [@user]',
|
||||
examples: ['', '@user']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { user }) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
if (!user)
|
||||
return message.say(`Your avatar:\n${message.author.displayAvatarURL}`);
|
||||
async exec(message, args) {
|
||||
if (!args.user)
|
||||
return message.channel.send(`Your avatar:\n${message.author.displayAvatarURL}`);
|
||||
else
|
||||
return message.say(`${user.username}'s avatar:\n${user.displayAvatarURL}`);
|
||||
return message.channel.send(`${args.user.username}'s avatar:\n${args.user.displayAvatarURL}`);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = AvatarCommand;
|
|
@ -1,36 +1,34 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const { Command } = require('discord-akairo');
|
||||
const fs = require('fs');
|
||||
const youtubedl = require('youtube-dl');
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const { fbuser, fbpasswd } = require('../../config.json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
|
||||
module.exports = class downloadCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'download',
|
||||
group: 'utility',
|
||||
memberName: 'download',
|
||||
description: `Download any video from the link you provided.`,
|
||||
class DownloadCommand extends Command {
|
||||
constructor() {
|
||||
super('download', {
|
||||
aliases: ['download', 'dl'],
|
||||
category: 'utility',
|
||||
args: [
|
||||
{
|
||||
key: 'link',
|
||||
prompt: 'Wich video would you like to download?',
|
||||
type: 'string',
|
||||
default: 'https://www.youtube.com/watch?v=6n3pFFPSlW4'
|
||||
id: "link",
|
||||
type: "string",
|
||||
default: "https://www.youtube.com/watch?v=6n3pFFPSlW4"
|
||||
}
|
||||
]
|
||||
],
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
description: {
|
||||
content: 'Download videos from different website from the link you provided',
|
||||
usage: '[link]',
|
||||
examples: ['https://www.youtube.com/watch?v=6n3pFFPSlW4']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { link }) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
async exec(message,args) {
|
||||
let link = args.link;
|
||||
|
||||
if(link.includes("http") || link.includes("www")) {
|
||||
message.say('Downloading...').then(msg => {
|
||||
message.channel.send('Downloading <a:loadingmin:527579785212329984>').then(msg => {
|
||||
video.on('end', function() {
|
||||
msg.delete()
|
||||
})
|
||||
|
@ -39,15 +37,16 @@ module.exports = class downloadCommand extends Command {
|
|||
video.pipe(fs.createWriteStream('./video.mp4'))
|
||||
video.on('error', function error(err) {
|
||||
console.log('error 2:', err);
|
||||
message.say("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() {
|
||||
message.delete();
|
||||
message.channel.send(`Downloaded by ${message.author.username}`, {files: ["./video.mp4"]})
|
||||
.catch(error => message.say('File too big'))
|
||||
.catch(() => message.channel.send('File too big'))
|
||||
})
|
||||
} else
|
||||
message.say("You need to input a valid link")
|
||||
message.channel.send("You need to input a valid link")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
module.exports = DownloadCommand;
|
|
@ -1,38 +1,33 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const { Command } = require('discord-akairo');
|
||||
const { feedbackChannel } = require('../../config.json');
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
|
||||
const fs = require('fs');
|
||||
module.exports = class feedbackCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'feedback',
|
||||
group: 'utility',
|
||||
memberName: 'feedback',
|
||||
description: `Send feedback ( if you abuse you will get blacklisted )`,
|
||||
throttling: {
|
||||
usages: 2,
|
||||
duration: 60,
|
||||
},
|
||||
class FeedbackCommand extends Command {
|
||||
constructor() {
|
||||
super('feedback', {
|
||||
aliases: ['feedback'],
|
||||
category: 'utility',
|
||||
split: 'none',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What would you want to send as feedback?',
|
||||
type: 'string',
|
||||
id: "text",
|
||||
type: "string"
|
||||
}
|
||||
]
|
||||
],
|
||||
description: {
|
||||
content: 'Send feedback to the bot owner',
|
||||
usage: '[What do you want to say]',
|
||||
examples: ['Hello, i just wanted to say hi!']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { text }) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
async exec(message,args) {
|
||||
let text = args.text;
|
||||
|
||||
const channel = this.client.channels.get(feedbackChannel);
|
||||
channel.send(`from ${message.author.username} (${message.author.id}) : ${text}`);
|
||||
message.say('Your feedback has been sent!');
|
||||
message.channel.send('Your feedback has been sent!');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = FeedbackCommand;
|
94
commands/utility/help.js
Normal file
94
commands/utility/help.js
Normal file
|
@ -0,0 +1,94 @@
|
|||
const { Command } = require('discord-akairo');
|
||||
const { prefix } = require('../../config.json');
|
||||
|
||||
class HelpCommand extends Command {
|
||||
constructor() {
|
||||
super('help', {
|
||||
aliases: ['help', 'halp', 'h'],
|
||||
category: 'utility',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
quoted: false,
|
||||
args: [
|
||||
{
|
||||
id: 'command',
|
||||
type: 'commandAlias',
|
||||
prompt: {
|
||||
start: 'Which command do you need help with?',
|
||||
retry: 'Please provide a valid command.',
|
||||
optional: true
|
||||
}
|
||||
}
|
||||
],
|
||||
description: {
|
||||
content: 'Displays a list of commands or information about a command.',
|
||||
usage: '[command]',
|
||||
examples: ['', 'star', 'remove-rep']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
exec(message, { command }) {
|
||||
if (!command) return this.execCommandList(message);
|
||||
|
||||
const prefix = this.handler.prefix(message);
|
||||
const description = Object.assign({
|
||||
content: 'No description available.',
|
||||
usage: '',
|
||||
examples: [],
|
||||
fields: []
|
||||
}, command.description);
|
||||
|
||||
const embed = this.client.util.embed()
|
||||
.setColor(0xFFAC33)
|
||||
.setTitle(`\`${prefix}${command.aliases[0]} ${description.usage}\``)
|
||||
.addField('Description', description.content);
|
||||
|
||||
for (const field of description.fields) embed.addField(field.name, field.value);
|
||||
|
||||
if (description.examples.length) {
|
||||
const text = `${prefix}${command.aliases[0]}`;
|
||||
embed.addField('Examples', `\`${text} ${description.examples.join(`\`\n\`${text} `)}\``, true);
|
||||
}
|
||||
|
||||
if (command.aliases.length > 1) {
|
||||
embed.addField('Aliases', `\`${command.aliases.join('` `')}\``, true);
|
||||
}
|
||||
|
||||
return message.util.send({ embed });
|
||||
}
|
||||
|
||||
async execCommandList(message) {
|
||||
const embed = this.client.util.embed()
|
||||
.setColor(0xFFAC33)
|
||||
.addField('Command List',
|
||||
[
|
||||
'This is a list of commands.',
|
||||
`To view details for a command, do \`${prefix}help <command>\`.`
|
||||
]);
|
||||
|
||||
for (const category of this.handler.categories.values()) {
|
||||
const title = {
|
||||
general: '📝\u2000General',
|
||||
images: '💕\u2000Images',
|
||||
utility: '⭐\u2000Utility',
|
||||
admin: '😎\u2000Admin',
|
||||
owner: '⚡\u2000Owner'
|
||||
}[category.id];
|
||||
|
||||
if (title) embed.addField(title, `\`${category.map(cmd => cmd.aliases[0]).join('` `')}\``);
|
||||
}
|
||||
|
||||
const shouldReply = message.guild && message.channel.permissionsFor(this.client.user).has('SEND_MESSAGES');
|
||||
|
||||
try {
|
||||
await message.author.send({ embed });
|
||||
if (shouldReply) return message.util.reply('I\'ve sent you a DM with the command list.');
|
||||
} catch (err) {
|
||||
if (shouldReply) return message.util.reply('I could not send you the command list in DMs.');
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = HelpCommand;
|
|
@ -1,47 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const Discord = require('discord.js');
|
||||
const fetch = require('node-fetch')
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
|
||||
module.exports = class InfoCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'info',
|
||||
group: 'fun',
|
||||
memberName: 'info',
|
||||
description: `Search DuckDuckGo for answer`,
|
||||
args: [
|
||||
{
|
||||
key: 'search',
|
||||
prompt: 'What do you want me to search',
|
||||
type: 'string',
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { search }) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
let searchURL = encodeURI(search)
|
||||
fetch("https://api.duckduckgo.com/?q=" + searchURL + "&format=json").then((response) => {
|
||||
return response.json();
|
||||
}).then((response) => {
|
||||
if (response.unsafe == 1)
|
||||
return message.say("No nsfw sorry...")
|
||||
const ddgEmbed = new Discord.RichEmbed()
|
||||
.setColor("#ff9900")
|
||||
.setTitle(response.Heading)
|
||||
.setURL(response.AbstractURL)
|
||||
.setDescription(response.Abstract)
|
||||
.addField("Topic", response.meta.topic)
|
||||
.setImage(response.Image)
|
||||
.setTimestamp()
|
||||
|
||||
message.say(ddgEmbed);
|
||||
});
|
||||
}};
|
|
@ -1,25 +1,24 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const { Command } = require('discord-akairo');
|
||||
const { supportServer } = require('../../config.json');
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
|
||||
module.exports = class InviteCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'invite',
|
||||
group: 'utility',
|
||||
memberName: 'invite',
|
||||
description: 'Send invite to add the bot',
|
||||
class InviteCommand extends Command {
|
||||
constructor() {
|
||||
super('invite', {
|
||||
aliases: ['invite'],
|
||||
category: 'utility',
|
||||
channelRestriction: 'guild',
|
||||
description: {
|
||||
content: 'Send invite link for the bot and support server',
|
||||
usage: '',
|
||||
examples: ['']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
message.say('Check your dm')
|
||||
async exec(message) {
|
||||
message.channel.send('Check your dm')
|
||||
return message.author.send(`You can add me from here: https://discordapp.com/oauth2/authorize?client_id=${this.client.user.id}&scope=bot&permissions=0\nYou can also join my support server over here: ${supportServer} come and say hi :)`);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = InviteCommand;
|
|
@ -1,41 +1,25 @@
|
|||
const { oneLine } = require('common-tags');
|
||||
const { Command } = require('discord.js-commando');
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { Command } = require('discord-akairo');
|
||||
|
||||
|
||||
module.exports = class PingCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'ping',
|
||||
group: 'util',
|
||||
memberName: 'ping',
|
||||
description: 'Checks the bot\'s ping to the Discord server.',
|
||||
throttling: {
|
||||
usages: 5,
|
||||
duration: 10
|
||||
class PingCommand extends Command {
|
||||
constructor() {
|
||||
super('ping', {
|
||||
aliases: ['ping', 'hello'],
|
||||
category: 'utility',
|
||||
description: {
|
||||
content: 'Ping the bot',
|
||||
usage: '',
|
||||
examples: ['']
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
if(!message.editable) {
|
||||
const pingMsg = await message.say('Pinging...');
|
||||
return pingMsg.edit(oneLine`
|
||||
${message.channel.type !== 'dm' ? `${message.author},` : ''}
|
||||
<:ping:499226870047571978> Pong! The message round-trip took **${pingMsg.createdTimestamp - message.createdTimestamp}**ms.
|
||||
${this.client.ping ? `The heartbeat ping is **${Math.round(this.client.ping)}**ms.` : ''}
|
||||
`);
|
||||
} else {
|
||||
await message.edit('Pinging...');
|
||||
return message.edit(oneLine`
|
||||
Pong! The message round-trip took **${message.editedTimestamp - message.createdTimestamp}**ms.
|
||||
${this.client.ping ? `The heartbeat ping is **${Math.round(this.client.ping)}**ms.` : ''}
|
||||
`);
|
||||
}
|
||||
}
|
||||
};
|
||||
async exec(message) {
|
||||
return message.util.reply('Pong!').then(sent => {
|
||||
const timeDiff = (sent.editedAt || sent.createdAt) - (message.editedAt || message.createdAt);
|
||||
const text = `🔂\u2000**RTT**: ${timeDiff} ms\n💟\u2000**Heartbeat**: ${Math.round(this.client.ping)} ms`;
|
||||
return message.util.reply(`Pong!\n${text}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = PingCommand;
|
|
@ -1,42 +1,39 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { Command } = require('discord-akairo');
|
||||
|
||||
|
||||
module.exports = class ServerCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'server',
|
||||
group: 'utility',
|
||||
guildOnly: 'true',
|
||||
memberName: 'server',
|
||||
description: 'Show some stats about the server',
|
||||
guildOnly: true,
|
||||
class ServerCommand extends Command {
|
||||
constructor() {
|
||||
super('server', {
|
||||
aliases: ['server', 'serverinfo'],
|
||||
category: 'utility',
|
||||
channelRestriction: 'guild',
|
||||
description: {
|
||||
content: 'Show info about the server',
|
||||
usage: '',
|
||||
examples: ['']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
async exec(message) {
|
||||
try {
|
||||
let customresponse = new SelfReloadJSON(`./tag/${message.guild.id}.json`);
|
||||
const customresponse = require(`../tag/${message.guild.id}.json`);
|
||||
var count = Object.keys(customresponse).length
|
||||
} catch {
|
||||
var count = 'None'
|
||||
}
|
||||
|
||||
|
||||
const addEmbed = {
|
||||
|
||||
const addEmbed = {
|
||||
color: 0x0099ff,
|
||||
title: 'Stats of the server',
|
||||
thumbnail: {
|
||||
url: `${message.guild.iconURL}`,
|
||||
},
|
||||
},
|
||||
description: `Member: **${message.guild.memberCount}** \nChannel number: **${message.guild.channels.size}**\nGuild created at **${message.guild.createdAt}**\nOwner: **${message.guild.owner}**\nTag number: **${count}**`,
|
||||
};
|
||||
|
||||
message.say({ embed: addEmbed });
|
||||
};
|
||||
|
||||
message.channel.send({ embed: addEmbed });
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = ServerCommand;
|
|
@ -1,23 +1,19 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { Command } = require('discord-akairo');
|
||||
|
||||
|
||||
module.exports = class statsCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'stats',
|
||||
group: 'utility',
|
||||
memberName: 'stats',
|
||||
description: 'Show bot stats.',
|
||||
class StatsCommand extends Command {
|
||||
constructor() {
|
||||
super('stats', {
|
||||
aliases: ['stats'],
|
||||
category: 'utility',
|
||||
description: {
|
||||
content: 'Show some stats about the bot',
|
||||
usage: '',
|
||||
examples: ['']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
async exec(message) {
|
||||
let totalSeconds = (this.client.uptime / 1000);
|
||||
let days = Math.floor(totalSeconds / 86400);
|
||||
let hours = Math.floor(totalSeconds / 3600);
|
||||
|
@ -27,4 +23,6 @@ module.exports = class statsCommand extends Command {
|
|||
let uptime = `${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds`;
|
||||
return message.channel.send(`Servers: \`${this.client.guilds.size}\`\nChannels: \`${this.client.channels.size}\`\nUsers: \`${this.client.users.size}\`\nBot uptime: \`${uptime}\``);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = StatsCommand;
|
|
@ -1,23 +0,0 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
|
||||
|
||||
module.exports = class supportMeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'supportme',
|
||||
group: 'utility',
|
||||
memberName: 'supportme',
|
||||
description: `Support me and my bot`,
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { text }) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
message.say('If you want to support me and my bot you can donate here\nhttps://donatebot.io/checkout/487640086859743232\nor here on patreon: https://patreon.com/user?u=15330358&utm_medium=social&utm_source=twitter&utm_campaign=creatorshare\n(This is totally optional dont feel forced to do it)');
|
||||
}
|
||||
};
|
|
@ -1,27 +1,25 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const Discord = require('discord.js');
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const fs = require('fs');
|
||||
module.exports = class taglistCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'taglist',
|
||||
group: 'utility',
|
||||
memberName: 'taglist',
|
||||
description: `List all the tag`
|
||||
const { Command } = require('discord-akairo');
|
||||
|
||||
class taglistCommand extends Command {
|
||||
constructor() {
|
||||
super('taglist', {
|
||||
aliases: ['taglist'],
|
||||
category: 'utility',
|
||||
channelRestriction: 'guild',
|
||||
description: {
|
||||
content: 'Show the list of tag for this server.',
|
||||
usage: '',
|
||||
examples: ['']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(blacklist[message.author.id])
|
||||
return message.channel.send("You are blacklisted")
|
||||
|
||||
async exec(message) {
|
||||
try {
|
||||
let customresponse = new SelfReloadJSON(`./tag/${message.guild.id}.json`);
|
||||
let count = Object.keys(customresponse).length
|
||||
|
||||
|
||||
|
||||
fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data){
|
||||
if (err) {
|
||||
console.log(err);
|
||||
|
@ -35,14 +33,12 @@ module.exports = class taglistCommand extends Command {
|
|||
.setDescription(`Trigger:Response\n\n${json}`)
|
||||
.setFooter(`You have ${count} tags on this server`)
|
||||
|
||||
message.say(tagEmbed);
|
||||
message.channel.send(tagEmbed);
|
||||
});
|
||||
} catch {
|
||||
message.say('An error has occured, do you have any tags on the server?')
|
||||
message.channel.send('An error has occured, do you have any tags on the server?')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
module.exports = taglistCommand;
|
|
@ -1,59 +1,63 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const fetch = require('node-fetch')
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { Command } = require('discord-akairo');
|
||||
const Discord = require('discord.js');
|
||||
const fetch = require('node-fetch');
|
||||
const { yandexAPI } = require('../../config.json');
|
||||
|
||||
module.exports = class translationCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'translation',
|
||||
aliases: ['trn', 'translate'],
|
||||
group: 'utility',
|
||||
memberName: 'translation',
|
||||
description: `Translate what you say in english`,
|
||||
class TranslationCommand extends Command {
|
||||
constructor() {
|
||||
super('translation', {
|
||||
aliases: ['translation', 'trn'],
|
||||
category: 'utility',
|
||||
description: 'Translate the text you send into the lanuguage you selected',
|
||||
split: 'none',
|
||||
args: [
|
||||
{
|
||||
key: 'language',
|
||||
prompt: 'In what language do you want me to translate to? ( You can get the list here https://tech.yandex.com/translate/doc/dg/concepts/api-overview-docpage/)',
|
||||
id: 'language',
|
||||
type: 'string',
|
||||
default: 'en',
|
||||
oneOf: ["az","ml","sq","mt","am","mk","en","mi","ar","mr","hy","mhr","af","mn","eu","de","ba","ne","be","no","bn","pa","my","pap","bg","fa","bs","pl","cy","pt","hu","ro","vi","ru","ht","ceb","gl","sr","nl","si","mrj","sk","el","sl","ka","sw","gu","su","da","tg","he","th","yi","tl","id","ta","ga","tt","it","te","is","tr","es","udm","kk","uz","kn","uk","ca","ur","ky","fi","zh","fr","ko","hi","xh","hr","km","cs","lo","sv","la","gd","lv","et","lt","eo","lb","jv","mg","ja","ms"]
|
||||
default: 'en'
|
||||
},
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What do you want me to translate',
|
||||
id: 'text',
|
||||
type: 'string',
|
||||
}
|
||||
]
|
||||
],
|
||||
description: {
|
||||
content: 'Translate what you send in your desired language. You can find the language code here: https://tech.yandex.com/translate/doc/dg/concepts/api-overview-docpage/',
|
||||
usage: '[language code] [Text to translate]',
|
||||
examples: ['fr What are we doing today?', 'en Que faisons-nous aujourd\'hui?']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, { text, language }) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
async exec(message, args) {
|
||||
console.log(args.language , args.text)
|
||||
let language = args.language;
|
||||
let text = args.text;
|
||||
|
||||
let textURI = encodeURI(text)
|
||||
fetch(`https://translate.yandex.net/api/v1.5/tr.json/translate?key=${yandexAPI}&text=${textURI}&lang=${language}&options=1`,{
|
||||
}).then((response) => {
|
||||
return response.json();
|
||||
}).then((response) => {
|
||||
if (response.code != '200')
|
||||
return message.say('An error has occured')
|
||||
|
||||
|
||||
return response.json();
|
||||
}).then((response) => {
|
||||
if (response.code == '502')
|
||||
return message.channel.send(`${response.message}, you probably didin't input the correct language code, you can check them here! https://tech.yandex.com/translate/doc/dg/concepts/api-overview-docpage/`)
|
||||
else if (response.code != '200')
|
||||
return message.channel.send('An error has occured')
|
||||
|
||||
|
||||
const translationEmbed = new Discord.RichEmbed()
|
||||
.setColor('#0099ff')
|
||||
.setTitle('Asked for the following translation:')
|
||||
.setAuthor(message.author.username)
|
||||
.setDescription(response.text[0])
|
||||
.addField('Original text', text)
|
||||
.addField('Translated from', response.detected.lang)
|
||||
.setTimestamp()
|
||||
.setFooter('Powered by Yandex.Translate ');
|
||||
|
||||
message.say(translationEmbed)
|
||||
.setColor('#0099ff')
|
||||
.setTitle('Asked for the following translation:')
|
||||
.setAuthor(message.author.username)
|
||||
.setDescription(response.text[0])
|
||||
.addField('Original text', text)
|
||||
.addField('Translated from', response.detected.lang)
|
||||
.setTimestamp()
|
||||
.setFooter('Powered by Yandex.Translate ');
|
||||
|
||||
message.channel.send(translationEmbed)
|
||||
});
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TranslationCommand;
|
|
@ -1,24 +1,20 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
const blacklist = require('../../json/blacklist.json');
|
||||
const { Command } = require('discord-akairo');
|
||||
|
||||
|
||||
module.exports = class UpDootCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'updoot',
|
||||
aliases: ['vote'],
|
||||
group: 'utility',
|
||||
memberName: 'updoot',
|
||||
description: 'Send link to updoot my bot :D.',
|
||||
class UpdootCommand extends Command {
|
||||
constructor() {
|
||||
super('updoot', {
|
||||
aliases: ['updoot', 'upvote', 'vote'],
|
||||
category: 'utility',
|
||||
channelRestriction: 'guild',
|
||||
description: {
|
||||
content: 'Send a link to vote for my bot',
|
||||
usage: '',
|
||||
examples: ['']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
|
||||
if(blacklistJson[message.author.id])
|
||||
return blacklist(blacklistJson[message.author.id] , message)
|
||||
|
||||
async exec(message) {
|
||||
const upDoot = {
|
||||
color: 0x93C54B,
|
||||
title: 'Vote for my bot',
|
||||
|
@ -33,4 +29,6 @@ module.exports = class UpDootCommand extends Command {
|
|||
|
||||
message.channel.send({ embed: upDoot });
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = UpdootCommand;
|
169
index.js
169
index.js
|
@ -1,147 +1,32 @@
|
|||
const { CommandoClient } = require('discord.js-commando');
|
||||
const Discord = require('discord.js');
|
||||
const path = require('path');
|
||||
const { token, prefix, statsChannel, ownerID, supportServer } = require('./config.json');
|
||||
const responseObject = require("./json/reply.json");
|
||||
const reactObject = require("./json/react.json");
|
||||
const imgResponseObject = require("./json/imgreply.json");
|
||||
const SelfReloadJSON = require('self-reload-json');
|
||||
// Prefix and ownerID and invite to support server
|
||||
const client = new CommandoClient({
|
||||
commandPrefix: prefix,
|
||||
owner: ownerID,
|
||||
invite: supportServer,
|
||||
unknownCommandResponse: false,
|
||||
disableEveryone: true,
|
||||
});
|
||||
// Command groups
|
||||
client.registry
|
||||
.registerDefaultTypes()
|
||||
.registerGroups([
|
||||
['fun', 'Fun'],
|
||||
['images', 'Images'],
|
||||
['utility', 'Utility'],
|
||||
['reserved', 'Reserved'],
|
||||
['admin', 'Admins'],
|
||||
['owner', 'Owner'],
|
||||
const { AkairoClient } = require('discord-akairo');
|
||||
const { token, prefix, ownerID } = require('./config.json');
|
||||
|
||||
])
|
||||
.registerDefaultGroups()
|
||||
.registerDefaultCommands({
|
||||
ping: false
|
||||
})
|
||||
.registerCommandsIn(path.join(__dirname, 'commands'));
|
||||
// Ready messages
|
||||
client.on('ready', async () => {
|
||||
// Send stats to the console
|
||||
console.log(`\x1b[32mLogged in as \x1b[34m${client.user.tag}\x1b[0m! (\x1b[33m${client.user.id}\x1b[0m)`);
|
||||
console.log(`Ready to serve in \x1b[33m${client.channels.size}\x1b[0m channels on \x1b[33m${client.guilds.size}\x1b[0m servers, for a total of \x1b[33m${client.users.size}\x1b[0m users. \x1b${client.readyAt}\x1b[0m`);
|
||||
// Send stats to the "stats" channel in the support server if its not the test bot
|
||||
if (client.user.id == 377563711927484418) {
|
||||
const channel = client.channels.get(statsChannel);
|
||||
channel.send(`Ready to serve in ${client.channels.size} channels on ${client.guilds.size} servers, for a total of ${client.users.size} users. ${client.readyAt}`);
|
||||
client.user.setActivity(`${prefix} feedback <feedback> to tell me what you think of the bot! | ${prefix} help`); }
|
||||
const client = new AkairoClient({
|
||||
ownerID: ownerID,
|
||||
prefix: prefix,
|
||||
emitters: {
|
||||
process
|
||||
},
|
||||
handleEdits: true,
|
||||
commandUtil: true,
|
||||
commandUtilLifetime: 600000,
|
||||
commandDirectory: './commands/',
|
||||
inhibitorDirectory: './inhibitors/',
|
||||
listenerDirectory: './listeners/'
|
||||
}, {
|
||||
disableEveryone: true
|
||||
});
|
||||
|
||||
// When bot join a guild send embeds with details about it.
|
||||
client.on("guildCreate", async guild => {
|
||||
console.log(`${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}`);
|
||||
const channel = client.channels.get(statsChannel);
|
||||
const addEmbed = new Discord.RichEmbed()
|
||||
.setColor("#52e80d")
|
||||
.setTitle('Someone added me ! YAY :D')
|
||||
.setURL('https://www.youtube.com/watch?v=6n3pFFPSlW4')
|
||||
.setThumbnail(guild.iconURL)
|
||||
.setDescription(`${guild.name}\n${guild.id}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\n(${guild.owner.id})`)
|
||||
.setTimestamp()
|
||||
|
||||
channel.send({ embed: addEmbed });
|
||||
});
|
||||
|
||||
// When bot get kicked from a guild send embeds with details about it.
|
||||
client.on("guildDelete", async guild => {
|
||||
console.log(`***BOT KICKED***\n${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}\n***BOT KICKED***`);
|
||||
const channel = client.channels.get(statsChannel);
|
||||
|
||||
const kickEmbed = new Discord.RichEmbed()
|
||||
.setColor("#FF0000")
|
||||
.setTitle('They kicked me out :(')
|
||||
.setURL('https://www.youtube.com/watch?v=6n3pFFPSlW4')
|
||||
.setThumbnail(guild.iconURL)
|
||||
.setDescription(`${guild.name}\n${guild.id}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\n(${guild.owner.id})`)
|
||||
.setTimestamp()
|
||||
|
||||
channel.send({ embed: kickEmbed });
|
||||
console.log('***BOT KICKED***')
|
||||
// Ready messages dosent work on the listeners event for some reasons
|
||||
client.on('ready', async () => {
|
||||
// Send stats to the console
|
||||
console.log(`\x1b[32mLogged in as \x1b[34m${client.user.tag}\x1b[0m! (\x1b[33m${client.user.id}\x1b[0m)`);
|
||||
console.log(`Ready to serve in \x1b[33m${client.channels.size}\x1b[0m channels on \x1b[33m${client.guilds.size}\x1b[0m servers, for a total of \x1b[33m${client.users.size}\x1b[0m users. \x1b${client.readyAt}\x1b[0m`);
|
||||
// Send stats to the "stats" channel in the support server if its not the test bot
|
||||
if (client.user.id == 377563711927484418) {
|
||||
const channel = client.channels.get(statsChannel);
|
||||
channel.send(`Ready to serve in ${client.channels.size} channels on ${client.guilds.size} servers, for a total of ${client.users.size} users. ${client.readyAt}`);
|
||||
client.user.setActivity(`${prefix} feedback <feedback> to tell me what you think of the bot! | ${prefix} help`); }
|
||||
});
|
||||
|
||||
|
||||
client.on("message", async (message) => {
|
||||
var customresponse = new SelfReloadJSON(`./tag/${message.guild.id}.json`);
|
||||
customresponse.on('error', function(err) { console.log('test') })
|
||||
var autoresponse = new SelfReloadJSON('./json/autoresponse.json');
|
||||
|
||||
let message_content = message.content.toLowerCase();
|
||||
|
||||
// fix a stupid bug that happen for idk wich reasons pls why tf it happen
|
||||
if (message_content == ('stop')) return;
|
||||
if (message_content == ('is')) return;
|
||||
if (message_content == ('on')) return;
|
||||
if (message_content == ('once')) return;
|
||||
if (message_content == ('save')) return;
|
||||
|
||||
if (message.author.bot) return; {
|
||||
|
||||
// User autoresponse
|
||||
if(customresponse[message_content]) {
|
||||
message.channel.send(customresponse[message_content])
|
||||
}
|
||||
// If autoresponse is enable send the response
|
||||
if(autoresponse[message.channel.id] == 'enable') {
|
||||
// Reply with images as attachement
|
||||
if(imgResponseObject[message_content]) {
|
||||
message.channel.send({files: [imgResponseObject[message_content]]});
|
||||
}
|
||||
// React only to the messages
|
||||
else if(reactObject[message_content]) {
|
||||
message.react(reactObject[message_content]);
|
||||
}
|
||||
// auto respond to messages
|
||||
else if(responseObject[message_content]) {
|
||||
message.channel.send(responseObject[message_content]);
|
||||
// If it contain "like if" react with 👍
|
||||
} else if (message_content.includes("like if")) {
|
||||
message.react("\u{1F44D}")
|
||||
// If it contain "jeff" react with a jeff emote
|
||||
} else if (message_content.includes("jeff")) {
|
||||
message.react("496028845967802378")
|
||||
}
|
||||
}}
|
||||
})
|
||||
|
||||
// Very basic starboard
|
||||
client.on('messageReactionAdd', async (reaction, message) => {
|
||||
let messageContent = reaction.message.content;
|
||||
let messageAttachments = reaction.message.attachments.map(u=> `${u.url}`);
|
||||
let messageAuthor = reaction.message.author.username;
|
||||
let messageChannel = reaction.message.channel.name;
|
||||
|
||||
if (reaction.emoji.name === '🌟' && reaction.count === 4) {
|
||||
const channel = client.channels.find(channel => channel.name === "starboard");
|
||||
channel.send(`From the channel: **${messageChannel}**\n${messageAuthor}\n${messageContent}\n${messageAttachments}`)
|
||||
.catch
|
||||
console.error('There is no starboard')
|
||||
}
|
||||
|
||||
if (reaction.emoji.name === '✡' && reaction.count === 4) {
|
||||
const channel = client.channels.find(channel => channel.name === "shameboard");
|
||||
channel.send(`From the channel: **${messageChannel}**\n${messageAuthor}\n${messageContent}\n${messageAttachments}`)
|
||||
.catch
|
||||
console.error('There is no shameboard')
|
||||
}
|
||||
})
|
||||
|
||||
client.on('error', console.error);
|
||||
process.on('unhandledRejection', error => console.error('Uncaught Promise Rejection', error));
|
||||
|
||||
client.login(token);
|
||||
client.login(token);
|
16
inhibitors/blacklist.js
Normal file
16
inhibitors/blacklist.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
const { Inhibitor } = require('discord-akairo');
|
||||
|
||||
class BlacklistInhibitor extends Inhibitor {
|
||||
constructor() {
|
||||
super('blacklist', {
|
||||
reason: 'blacklist'
|
||||
})
|
||||
}
|
||||
|
||||
exec(message) {
|
||||
const blacklist = ['501856229123948545', '497730155691638784'];
|
||||
return blacklist.includes(message.author.id);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = BlacklistInhibitor;
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"501856229123948545": "Fuck off wierd userbot",
|
||||
"497730155691638784": "Fuck off wierd userbot",
|
||||
"503501944694767626": "User with invite username are not welcome."
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"1": "https://cdn.discordapp.com/attachments/475999813587173406/498088708210425866/image-50.jpg",
|
||||
"2": "https://cdn.discordapp.com/attachments/475999813587173406/498088708872994818/image-29.png",
|
||||
"3": "https://cdn.discordapp.com/attachments/475999813587173406/498088708872994821/magik-2.png",
|
||||
"4": "https://cdn.discordapp.com/attachments/475999813587173406/498088709443289088/image-26.png",
|
||||
"5": "https://cdn.discordapp.com/attachments/475999813587173406/498088709443289089/image-301.jpg",
|
||||
"6": "https://cdn.discordapp.com/attachments/475999813587173406/498088709883953162/458da9a.jpg",
|
||||
"7": "https://cdn.discordapp.com/attachments/349122704995254275/498086713026150400/despacito-eS6Lm.jpg",
|
||||
"8": "https://cdn.discordapp.com/attachments/240843640375607296/498096605661102090/38026328_1287563578041482_711316145507926016_n.png",
|
||||
"9": "https://cdn.discordapp.com/attachments/348937971858145293/500357748043677706/7Kva2utdL.png"
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"1": "When i first did the badmeme command the bot used to stock the pic locally lole good thing i fixed after that.",
|
||||
"2": "You can put your own fun fact if you want you can dm @Supositware | Baguette#82110.",
|
||||
"3": "feline dicks have little barbs",
|
||||
"4": "This bot is running on a raspberry pi !",
|
||||
"5": "Male nipples can lactate"
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"1": "https://twitter.com/i/status/1037932315727618048",
|
||||
"2": "https://www.youtube.com/watch?v=W3GrSMYbkBE",
|
||||
"3": "https://www.youtube.com/watch?v=OuzRcfWyurE",
|
||||
"4": "https://www.youtube.com/watch?v=IejjQzExNM4",
|
||||
"5": "https://www.youtube.com/watch?v=zUAtDlAoaac",
|
||||
"6": "https://cdn.discordapp.com/attachments/435167348652245002/486334823808630784/video.mov",
|
||||
"7": "https://cdn.discordapp.com/attachments/453648629303869440/485557714970345494/DASH_4_8_M_1.mp4",
|
||||
"8": "https://youtu.be/Gl6ekgobG2k",
|
||||
"9": "https://www.youtube.com/watch?v=hzyMs_8k58Y",
|
||||
"10": "https://www.youtube.com/watch?v=e6mfgX9TdCg",
|
||||
"11": "https://twitter.com/i/status/1038774986855604225",
|
||||
"12": "https://twitter.com/i/status/1038015132545282048",
|
||||
"13": "https://twitter.com/i/status/1042002164728639490",
|
||||
"14": "https://twitter.com/i/status/1043840216530866176"
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
{}
|
16
listeners/UnhandledRejection.js
Normal file
16
listeners/UnhandledRejection.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
const { Listener } = require('discord-akairo');
|
||||
|
||||
class UnhandledRejectionListener extends Listener {
|
||||
constructor() {
|
||||
super('unhandledRejection', {
|
||||
eventName: 'unhandledRejection',
|
||||
emitter: 'process'
|
||||
});
|
||||
}
|
||||
|
||||
exec(error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = UnhandledRejectionListener;
|
16
listeners/commandblocked.js
Normal file
16
listeners/commandblocked.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
const { Listener } = require('discord-akairo');
|
||||
|
||||
class CommandBlockedListener extends Listener {
|
||||
constructor() {
|
||||
super('commandBlocked', {
|
||||
emitter: 'commandHandler',
|
||||
eventName: 'commandBlocked'
|
||||
});
|
||||
}
|
||||
|
||||
exec(message, command, reason) {
|
||||
console.log(`${message.author.username} was blocked from using ${command.id} because of ${reason}!`);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CommandBlockedListener;
|
52
listeners/message.js
Normal file
52
listeners/message.js
Normal file
|
@ -0,0 +1,52 @@
|
|||
const { Listener } = require('discord-akairo');
|
||||
const responseObject = require("../json/reply.json");
|
||||
const reactObject = require("../json/react.json");
|
||||
const imgResponseObject = require("../json/imgreply.json");
|
||||
|
||||
class MessageListener extends Listener {
|
||||
constructor() {
|
||||
super('message', {
|
||||
emitter: 'client',
|
||||
eventName: 'message'
|
||||
});
|
||||
}
|
||||
|
||||
async exec(message) {
|
||||
const autoresponse = require("../json/autoresponse.json");
|
||||
|
||||
let message_content = message.content.toLowerCase();
|
||||
|
||||
if (message.author.bot) return; {
|
||||
|
||||
// If autoresponse is enable send the response
|
||||
if(autoresponse[message.channel.id] == 'enable') {
|
||||
// Reply with images as attachement
|
||||
if(imgResponseObject[message_content]) {
|
||||
message.channel.send({files: [imgResponseObject[message_content]]});
|
||||
}
|
||||
// React only to the messages
|
||||
else if(reactObject[message_content]) {
|
||||
message.react(reactObject[message_content]);
|
||||
}
|
||||
// auto respond to messages
|
||||
else if(responseObject[message_content]) {
|
||||
message.channel.send(responseObject[message_content]);
|
||||
// If it contain "like if" react with 👍
|
||||
} else if (message_content.includes("like if")) {
|
||||
message.react("\u{1F44D}")
|
||||
// If it contain "jeff" react with a jeff emote
|
||||
} else if (message_content.includes("jeff")) {
|
||||
message.react("496028845967802378")
|
||||
}
|
||||
}
|
||||
const customresponse = require(`../tag/${message.guild.id}.json`);
|
||||
// User autoresponse
|
||||
if(customresponse[message_content]) {
|
||||
message.channel.send(customresponse[message_content])
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MessageListener;
|
26
package.json
26
package.json
|
@ -1,33 +1,23 @@
|
|||
{
|
||||
"name": "discordbot",
|
||||
"name": "djs12",
|
||||
"version": "1.0.0",
|
||||
"description": "A simple discord bot made with discord.js and commando",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://gitlab.com/loicbersier/discordbot.git"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://gitlab.com/loicbersier/discordbot/issues"
|
||||
},
|
||||
"homepage": "https://gitlab.com/loicbersier/discordbot#readme",
|
||||
"dependencies": {
|
||||
"@google-cloud/text-to-speech": "^0.4.0",
|
||||
"canvas": "^2.0.1",
|
||||
"discord.js": "file:../discord.js-11.4-dev",
|
||||
"discord.js-commando": "^0.10.0",
|
||||
"node-fetch": "^2.2.0",
|
||||
"node-gyp": "^3.8.0",
|
||||
"node-opus": "^0.3.1",
|
||||
"printer": "^0.2.2",
|
||||
"canvas": "^2.2.0",
|
||||
"discord-akairo": "^7.5.5",
|
||||
"discord.js": "^11.4.2",
|
||||
"node-fetch": "^2.3.0",
|
||||
"reload-json": "^0.3.1",
|
||||
"self-reload-json": "^0.4.0",
|
||||
"superagent": "^4.0.0-beta.5",
|
||||
"superagent": "^4.1.0",
|
||||
"youtube-dl": "^1.12.2"
|
||||
}
|
||||
}
|
||||
|
|
33
readme.md
33
readme.md
|
@ -1,33 +0,0 @@
|
|||
# A simple discord bot
|
||||
|
||||
A simple discord bot made with discord.js and commando
|
||||
|
||||
## Feature
|
||||
|
||||
- Kick and ban user, you can provid a reasons and the user will know
|
||||
- Faceapp
|
||||
- put images into other images ( i dont know how to explain so here a picture of it: <img src="https://cdn.discordapp.com/attachments/488094005071183913/514869492615086113/edupspaint.png">)
|
||||
- take images from reddit & imgur
|
||||
- can make the bot write thing in emote or just repeat what the user say
|
||||
- Print thing from the printer dev ( yes really, to disable simple delete print.js or disable with "${prefix} unload print")
|
||||
- autoresponse ( that can be disable with a simple command "${prefix} autoresponse disable ("all" for server wide))
|
||||
- and more !
|
||||
|
||||
### Installing
|
||||
|
||||
To install you need the dependency for [**node-canvas**](https://github.com/Automattic/node-canvas) and for [**node-printer ( for ubuntu )**](https://github.com/tojocky/node-printer)
|
||||
|
||||
then for the bot do the following commands
|
||||
|
||||
```
|
||||
git clone https://gitlab.com/loicbersier/discordbot
|
||||
npm install
|
||||
```
|
||||
|
||||
##### Special thanks to
|
||||
|
||||
discord.js (https://github.com/discordjs) for providing discord.js, commando and the discord.js guide<br>
|
||||
All the people who made all the node modules<br>
|
||||
[TG/LW] Tina the Cyclops#5861 for inspiring me to make this bot
|
||||
|
||||
[You can also support me on patreon](https://patreon.com/user?u=15330358&utm_medium=social&utm_source=twitter&utm_campaign=creatorshare)
|
Loading…
Reference in a new issue