-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
747 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,3 +57,5 @@ typings/ | |
# dotenv environment variables file | ||
.env | ||
|
||
|
||
secret\.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
language: node_js | ||
node_js: | ||
- "7" | ||
install: npm install | ||
cache: | ||
directories: | ||
- node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
const Discord = require('discord.js'); | ||
const Emoji = require("discord-emoji"); | ||
const client = new Discord.Client(); | ||
const fs = require('fs'); | ||
const settings = require('./settings.json'); | ||
const token = require('./secret.json').token; | ||
const Log = require('./utils/log.js'); | ||
|
||
Discord.Message.prototype.markAsDone = function() { | ||
this.react(Emoji.symbols.o).catch(Log.error); | ||
}; | ||
|
||
Discord.Message.prototype.markAsError = function() { | ||
this.react(Emoji.symbols.x).catch(Log.error); | ||
}; | ||
|
||
Discord.Message.prototype.markAsQuestion = function() { | ||
this.react(Emoji.symbols.question).catch(Log.error); | ||
}; | ||
|
||
client.commands = new Discord.Collection(); | ||
client.aliases = new Discord.Collection(); | ||
|
||
fs.readdir('./commands/', (err, files) => { | ||
if (err) return Log.error(err); | ||
Log.info(`Loading a total of ${files.length} commands.`); | ||
files.forEach(file => { | ||
const props = require(`./commands/${file}`); | ||
Log.info(`Loading command: ${props.help.name}.`); | ||
client.commands.set(props.help.name, props); | ||
props.conf.aliases.forEach(alias => { | ||
client.aliases.set(alias, props.help.name); | ||
}); | ||
}); | ||
}); | ||
|
||
fs.readdir('./events/', (err, files) => { | ||
if (err) return Log.error(err); | ||
files.forEach(file => { | ||
const eventFunction = require(`./events/${file}`); | ||
const eventName = file.split('.')[0]; | ||
client.on(eventName, (...args) => eventFunction.run(client, ...args)); | ||
}); | ||
}); | ||
|
||
client.elevation = (message) => { | ||
let level; | ||
const role = message.member.highestRole; | ||
switch (role.name) { | ||
case 'superadmin': level = 10; break; | ||
case 'admin': level = 5; break; | ||
case 'bot': case 'dev': level = 3; break; | ||
case 'boy': case 'girl': level = 2; break; | ||
default: level = 0; | ||
} | ||
if (message.author.id === settings.ownerid) level = 90; | ||
return level; | ||
}; | ||
|
||
client.login(token); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const request = require('request'); | ||
const RichEmbed = require('discord.js').RichEmbed; | ||
const Log = require('../utils/log.js'); | ||
|
||
exports.run = (client, message, args) => { | ||
request('http://api.obutts.ru/butts/0/1/random', (err, resp, body) => { | ||
if (err) return Log.error(err); | ||
if (resp.statusCode === 200) { | ||
message.channel.send({embed: new RichEmbed() | ||
.setColor('DARK_RED') | ||
.setImage(`http://media.obutts.ru/${JSON.parse(body)[0].preview}`) | ||
}).catch(console.error); | ||
} | ||
}) | ||
}; | ||
|
||
exports.conf = { | ||
enabled: true, | ||
guildOnly: true, | ||
aliases: ['butt'], | ||
permLevel: 2, | ||
nsfw: true | ||
}; | ||
|
||
exports.help = { | ||
name: 'ass', | ||
description: 'Writes some poem.', | ||
usage: 'ass' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const request = require('request'); | ||
const RichEmbed = require('discord.js').RichEmbed; | ||
const Log = require('../utils/log.js'); | ||
|
||
exports.run = (client, message, args) => { | ||
request('http://api.oboobs.ru/boobs/0/1/random', (err, resp, body) => { | ||
if (err) return Log.error(err); | ||
if (resp.statusCode === 200) { | ||
message.channel.send({embed: new RichEmbed() | ||
.setColor('DARK_RED') | ||
.setImage(`http://media.oboobs.ru/${JSON.parse(body)[0].preview}`) | ||
}).catch(console.error); | ||
} | ||
}) | ||
}; | ||
|
||
exports.conf = { | ||
enabled: true, | ||
guildOnly: true, | ||
aliases: ['boobies'], | ||
permLevel: 2, | ||
nsfw: true | ||
}; | ||
|
||
exports.help = { | ||
name: 'boobs', | ||
description: 'Writes some poem.', | ||
usage: 'boobs' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const request = require('request'); | ||
const RichEmbed = require('discord.js').RichEmbed; | ||
const Log = require('../utils/log.js'); | ||
|
||
exports.run = (client, message, args) => { | ||
request('http://random.cat/meow', (err, resp, body) => { | ||
if (err) return Log.error(err); | ||
if (resp.statusCode === 200) { | ||
message.channel.send({embed: new RichEmbed() | ||
.setColor('DARK_RED') | ||
.setImage(JSON.parse(body).file) | ||
}).catch(console.error); | ||
} | ||
}) | ||
}; | ||
|
||
exports.conf = { | ||
enabled: true, | ||
guildOnly: true, | ||
aliases: ['pussy', 'moew'], | ||
permLevel: 2, | ||
nsfw: false | ||
}; | ||
|
||
exports.help = { | ||
name: 'cat', | ||
description: 'Moew.', | ||
usage: 'cat' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
exports.run = (client, message, args) => { | ||
if (message.mentions.users.size === 0 && message.mentions.roles.size === 0) { | ||
return message.reply('T\'as pas dit qui qu\'tu veux deafen').catch(console.error); | ||
} | ||
if (!message.guild.member(client.user).hasPermission('DEAFEN_MEMBERS')) { | ||
return message.reply('Je peux pas.').catch(console.error); | ||
} | ||
|
||
const deafenMember = (member) => { | ||
if (!member || !member.voiceChannel) return; | ||
if (member.serverDeaf) return message.channel.send(`${member} est déjà deaf`); | ||
member.setDeaf(true).catch(console.error); | ||
}; | ||
|
||
message.mentions.users.forEach(user => { deafenMember(message.guild.member(user)); }); | ||
message.mentions.roles.forEach(role => { role.members.forEach(member => { deafenMember(member); }); }); | ||
}; | ||
|
||
exports.conf = { | ||
enabled: true, | ||
guildOnly: true, | ||
aliases: ['+d'], | ||
permLevel: 5, | ||
nsfw: false | ||
}; | ||
|
||
exports.help = { | ||
name: 'deafen', | ||
description: 'Deafens a member or a group', | ||
usage: 'deafen <members> <roles>' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const request = require('request'); | ||
const RichEmbed = require('discord.js').RichEmbed; | ||
const Log = require('../utils/log.js'); | ||
|
||
exports.run = (client, message, args) => { | ||
request('https://random.dog/woof.json', (err, resp, body) => { | ||
if (err) return Log.error(err); | ||
if (resp.statusCode === 200) { | ||
message.channel.send({embed: new RichEmbed() | ||
.setColor('DARK_RED') | ||
.setImage(JSON.parse(body).url) | ||
}).catch(console.error); | ||
} | ||
}) | ||
}; | ||
|
||
exports.conf = { | ||
enabled: true, | ||
guildOnly: true, | ||
aliases: ['bitch', 'woof'], | ||
permLevel: 2, | ||
nsfw: false | ||
}; | ||
|
||
exports.help = { | ||
name: 'dog', | ||
description: 'Woof.', | ||
usage: 'dog' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const settings = require('../settings.json'); | ||
|
||
exports.run = (client, message, args) => { | ||
if (!args) { | ||
let commands = client.commands; | ||
const perms = client.elevation(message); | ||
commands = commands.filter(cmd => perms >= cmd.conf.permLevel); | ||
if (!message.channel.nsfw) commands = commands.filter(cmd => !cmd.conf.nsfw); | ||
const commandNames = Array.from(commands.keys()); | ||
const longest = commandNames.reduce((long, str) => Math.max(long, str.length), 0); | ||
let msg = `Command List\n\n[Use '${settings.prefix}${exports.help.name} <command>' for details]\n\n`; | ||
msg += commands.map(cmd => `${settings.prefix}${cmd.help.name}${' '.repeat(longest - cmd.help.name.length)} > ${cmd.help.description}`).join('\n'); | ||
message.channel.send(msg, {code: 'asciidoc'}); | ||
} else { | ||
if (client.commands.has(args)) { | ||
const command = client.commands.get(args); | ||
const msg = `${command.help.name}\n${command.help.description}\nusage: ${command.help.usage}`; | ||
message.channel.send(msg, {code: 'asciidoc'}); | ||
} | ||
} | ||
}; | ||
|
||
exports.conf = { | ||
enabled: true, | ||
guildOnly: true, | ||
aliases: ['h'], | ||
permLevel: 0, | ||
nsfw: false | ||
}; | ||
|
||
exports.help = { | ||
name: 'help', | ||
description: 'Displays all available commands for your permission level.', | ||
usage: 'help [command]' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
exports.run = (client, message, args) => { | ||
if (message.mentions.users.size === 0) { | ||
return message.reply('T\'as pas dit qui qu\'tu veux kick').catch(console.error); | ||
} | ||
const kickMember = message.guild.member(message.mentions.users.first()); | ||
if (!kickMember) { | ||
return message.reply('Hum, c\'est qui ? Connais pas.'); | ||
} | ||
if (!message.guild.member(client.user).hasPermission('KICK_MEMBERS')) { | ||
return message.reply('Je peux pas.').catch(console.error); | ||
} | ||
kickMember.kick().then(member => { | ||
message.reply(`${member.user.username} a dégagé.`).catch(console.error); | ||
}).catch(console.error) | ||
}; | ||
|
||
exports.conf = { | ||
enabled: true, | ||
guildOnly: true, | ||
aliases: [], | ||
permLevel: 5, | ||
nsfw: false | ||
}; | ||
|
||
exports.help = { | ||
name: 'kick', | ||
description: 'Kicks a member', | ||
usage: 'kick <member>' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
exports.run = (client, message, args) => { | ||
if (message.mentions.users.size === 0 && message.mentions.roles.size === 0) { | ||
return message.reply('t\'as pas dit qui qu\'tu veux mute').catch(console.error); | ||
} | ||
if (!message.guild.member(client.user).hasPermission('MUTE_MEMBERS')) { | ||
return message.reply('je peux pas.').catch(console.error); | ||
} | ||
|
||
const muteMember = (member) => { | ||
if (!member || !member.voiceChannel) return; | ||
if (member.serverMute) return message.channel.send(`${member} est déjà mute`); | ||
member.setMute(true).catch(console.error); | ||
}; | ||
|
||
message.mentions.users.forEach(user => { muteMember(message.guild.member(user)); }); | ||
message.mentions.roles.forEach(role => { role.members.forEach(member => { muteMember(member); }); }); | ||
}; | ||
|
||
exports.conf = { | ||
enabled: true, | ||
guildOnly: true, | ||
aliases: ['+m'], | ||
permLevel: 5, | ||
nsfw: false | ||
}; | ||
|
||
exports.help = { | ||
name: 'mute', | ||
description: 'Mutes a member or a group', | ||
usage: 'mute <members> <roles>' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
const settings = require('../settings.json'); | ||
const Emoji = require("discord-emoji"); | ||
|
||
exports.run = (client, message, args) => { | ||
let matches; | ||
if ((matches = args.match(/^\[(.*)\] ?(?:\((.*)\))?/))) { | ||
const title = matches[1]; | ||
const options = matches[2] ? matches[2].split(' ;; ') : []; | ||
let msg = `**${title}**`; | ||
for (let option in options) { | ||
msg += `\n **${Number(option) + 1}**. \`${options[option]}\``; | ||
} | ||
message.channel.send(msg) | ||
.then(msg => { | ||
const emojiList = { | ||
1: 'one', | ||
2: 'two', | ||
3: 'three', | ||
4: 'four', | ||
5: 'five', | ||
6: 'six', | ||
7: 'seven', | ||
8: 'eight', | ||
9: 'nine' | ||
}; | ||
if (options.length > 0) { | ||
let promise = false; | ||
for (let option in options) { | ||
if (promise) { | ||
promise = promise.then(react => react.message.react(Emoji.symbols[emojiList[Number(option) + 1]])); | ||
} else { | ||
promise = msg.react(Emoji.symbols[emojiList[1]]); | ||
} | ||
} | ||
} | ||
}) | ||
.catch(error => { | ||
const channel = message.guild.channels.find('name', settings.logs); | ||
if (!channel) return; | ||
channel.send(`Error while creating poll in ${message.channel} : \`${error}\`\nCommand : \`${message.content}\``); | ||
}); | ||
} else { | ||
message.channel.send('Pas comme ça qu\'ça s\'écrit !'); | ||
} | ||
}; | ||
|
||
exports.conf = { | ||
enabled: true, | ||
guildOnly: true, | ||
aliases: ['p?'], | ||
permLevel: 2, | ||
nsfw: false | ||
}; | ||
|
||
exports.help = { | ||
name: 'poll', | ||
description: 'Creates a poll', | ||
usage: 'poll [<question>] (<choices separated with ;; >)' | ||
}; |
Oops, something went wrong.