diff --git a/.gitignore b/.gitignore index 00cbbdf..c853c35 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,5 @@ typings/ # dotenv environment variables file .env + +secret\.json diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..ae9615c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "7" +install: npm install +cache: + directories: + - node_modules diff --git a/app.js b/app.js new file mode 100644 index 0000000..7a27fd6 --- /dev/null +++ b/app.js @@ -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); \ No newline at end of file diff --git a/commands/ass.js b/commands/ass.js new file mode 100644 index 0000000..6a392f8 --- /dev/null +++ b/commands/ass.js @@ -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' +}; \ No newline at end of file diff --git a/commands/boobs.js b/commands/boobs.js new file mode 100644 index 0000000..2cb2ba4 --- /dev/null +++ b/commands/boobs.js @@ -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' +}; \ No newline at end of file diff --git a/commands/cat.js b/commands/cat.js new file mode 100644 index 0000000..fc562c1 --- /dev/null +++ b/commands/cat.js @@ -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' +}; \ No newline at end of file diff --git a/commands/deafen.js b/commands/deafen.js new file mode 100644 index 0000000..c5daf88 --- /dev/null +++ b/commands/deafen.js @@ -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 ' +}; \ No newline at end of file diff --git a/commands/dog.js b/commands/dog.js new file mode 100644 index 0000000..34435e3 --- /dev/null +++ b/commands/dog.js @@ -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' +}; \ No newline at end of file diff --git a/commands/help.js b/commands/help.js new file mode 100644 index 0000000..c922069 --- /dev/null +++ b/commands/help.js @@ -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} ' 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]' +}; \ No newline at end of file diff --git a/commands/kick.js b/commands/kick.js new file mode 100644 index 0000000..bef0ce4 --- /dev/null +++ b/commands/kick.js @@ -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 ' +}; \ No newline at end of file diff --git a/commands/mute.js b/commands/mute.js new file mode 100644 index 0000000..75c04ff --- /dev/null +++ b/commands/mute.js @@ -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 ' +}; \ No newline at end of file diff --git a/commands/poll.js b/commands/poll.js new file mode 100644 index 0000000..3c04a7f --- /dev/null +++ b/commands/poll.js @@ -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 [] ()' +}; \ No newline at end of file diff --git a/commands/purge.js b/commands/purge.js new file mode 100644 index 0000000..7941a53 --- /dev/null +++ b/commands/purge.js @@ -0,0 +1,22 @@ +const settings = require('../settings.json'); + +exports.run = (client, message, args) => { + const messageCount = parseInt(args) || 50; + const logs = message.guild.channels.find('name', settings.logs); + const channel = message.channel; + channel.fetchMessages({ limit: messageCount }).then(messages => messages.deleteAll()); +}; + +exports.conf = { + enabled: true, + guildOnly: true, + aliases: ['clear'], + permLevel: 5, + nsfw: false +}; + +exports.help = { + name: 'purge', + description: 'Purges a channel', + usage: 'purge ' +}; \ No newline at end of file diff --git a/commands/roll.js b/commands/roll.js new file mode 100644 index 0000000..43986ce --- /dev/null +++ b/commands/roll.js @@ -0,0 +1,37 @@ +exports.run = (client, message, args) => { + const rolls = {}; + let str = args.replace(/(\d*)d(\d+)/gi, (match, $1, $2) => { + $1 = $1 || 1; + const val = []; + for (let i = 0 ; i < $1 ; ++i) { + val.push(Math.floor((Math.random() * $2) + 1)); + } + return `(${val.join(' + ')})`; + }); + if (/[^\(\)\d\s\=\-\+\\\*]/.test(str)) { + return message.reply('je sais pas ce que tu essayes de faire ...') + } + + let val; + try { + val = new Function(`return ${str}`)(); + } catch(err) { + console.error(err); + return message.reply('je sais pas ce que tu essayes de faire ...') + } + message.reply(`${val}. Détail : ${str}`).catch(console.error); +}; + +exports.conf = { + enabled: true, + guildOnly: false, + aliases: [], + permLevel: 2, + nsfw: false +}; + +exports.help = { + name: 'roll', + description: 'Rolls some dice', + usage: 'roll ' +}; \ No newline at end of file diff --git a/commands/undeafen.js b/commands/undeafen.js new file mode 100644 index 0000000..62689ff --- /dev/null +++ b/commands/undeafen.js @@ -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 undeafen').catch(console.error); + } + if (!message.guild.member(client.user).hasPermission('DEAFEN_MEMBERS')) { + return message.reply('Je peux pas.').catch(console.error); + } + + const undeafenMember = (member) => { + if (!member || !member.voiceChannel) return; + if (!member.serverDeaf) return message.channel.send(`${member} n'est pas deaf`); + member.setDeaf(false).catch(console.error); + }; + + message.mentions.users.forEach(user => { undeafenMember(message.guild.member(user)); }); + message.mentions.roles.forEach(role => { role.members.forEach(member => { undeafenMember(member); }); }); +}; + +exports.conf = { + enabled: true, + guildOnly: true, + aliases: ['-d'], + permLevel: 5, + nsfw: false +}; + +exports.help = { + name: 'undeafen', + description: 'Undeafens a member or a group', + usage: 'undeafen ' +}; \ No newline at end of file diff --git a/commands/unmute.js b/commands/unmute.js new file mode 100644 index 0000000..26b3244 --- /dev/null +++ b/commands/unmute.js @@ -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 unmute').catch(console.error); + } + if (!message.guild.member(client.user).hasPermission('MUTE_MEMBERS')) { + return message.reply('je peux pas.').catch(console.error); + } + + const unmuteMember = (member) => { + if (!member || !member.voiceChannel) return; + if (!member.serverMute) return message.channel.send(`${member} n'est pas mute`); + member.setMute(false).catch(console.error); + }; + + message.mentions.users.forEach(user => { unmuteMember(message.guild.member(user)); }); + message.mentions.roles.forEach(role => { role.members.forEach(member => { unmuteMember(member); }); }); +}; + +exports.conf = { + enabled: true, + guildOnly: true, + aliases: ['-m'], + permLevel: 5, + nsfw: false +}; + +exports.help = { + name: 'unmute', + description: 'Unmutes a member or a group', + usage: 'unmute ' +}; \ No newline at end of file diff --git a/events/guildBanAdd.js b/events/guildBanAdd.js new file mode 100644 index 0000000..28c4321 --- /dev/null +++ b/events/guildBanAdd.js @@ -0,0 +1,12 @@ +const settings = require('../settings.json'); +const Emoji = require("discord-emoji"); + +exports.run = (client, member) => { + member.guild.defaultChannel.send(`${member} est maintenant banni !`).then(message => { + message.react(Emoji.people.smiling_imp); + }); + + const channel = member.guild.channels.find('name', settings.logs); + if (!channel) return; + channel.send(`banned member : ${member}`); +}; \ No newline at end of file diff --git a/events/guildBanRemove.js b/events/guildBanRemove.js new file mode 100644 index 0000000..1c5201b --- /dev/null +++ b/events/guildBanRemove.js @@ -0,0 +1,12 @@ +const settings = require('../settings.json'); +const Emoji = require("discord-emoji"); + +exports.run = (client, member) => { + member.guild.defaultChannel.send(`${member} n'est plus banni !`).then(message => { + message.react(Emoji.people.innocent); + }); + + const channel = member.guild.channels.find('name', settings.logs); + if (!channel) return; + channel.send(`unbanned member : ${member}`); +}; \ No newline at end of file diff --git a/events/guildMemberAdd.js b/events/guildMemberAdd.js new file mode 100644 index 0000000..97ccc87 --- /dev/null +++ b/events/guildMemberAdd.js @@ -0,0 +1,11 @@ +const settings = require('../settings.json'); + +exports.run = (client, member) => { + member.guild.defaultChannel.send(`${member} nous a rejoint !`).then(message => { + message.react('😊'); + }); + + const channel = member.guild.channels.find('name', settings.logs); + if (!channel) return; + channel.send(`added member : ${member}`); +}; \ No newline at end of file diff --git a/events/guildMemberRemove.js b/events/guildMemberRemove.js new file mode 100644 index 0000000..57b08c4 --- /dev/null +++ b/events/guildMemberRemove.js @@ -0,0 +1,11 @@ +const settings = require('../settings.json'); + +exports.run = (client, member) => { + member.guild.defaultChannel.send(`${member} nous a quitté !`).then(message => { + message.react('😭'); + }); + + const channel = member.guild.channels.find('name', settings.logs); + if (!channel) return; + channel.send(`removed member : ${member}`); +}; \ No newline at end of file diff --git a/events/guildMemberUpdate.js b/events/guildMemberUpdate.js new file mode 100644 index 0000000..4e1a2e6 --- /dev/null +++ b/events/guildMemberUpdate.js @@ -0,0 +1,37 @@ +const settings = require('../settings.json'); +const ddiff = require('deep-diff').diff; + +exports.run = (client, oldMember, newMember) => { + const channel = newMember.guild.channels.find('name', settings.logs); + if (!channel) return; + + const differences = ddiff(oldMember, newMember); + const getData = (el, obj, data) => { + if (el.path[0] === '_roles') { + data = obj.guild.roles.get(data); + } + return data; + }; + const translateDiff = (el) => { + const name = el.path && el.path.join('.') || ''; + switch (el.kind) { + case 'N': + return `added : ${name} (${getData(el, newMember, el.rhs)})`; + case 'D': + return `removed : ${name} (${getData(el, oldMember, el.lhs)})`; + case 'E': + return `edited : ${name} (${getData(el, oldMember, el.lhs)} => ${getData(el, newMember, el.rhs)})`; + case 'A': + el = Object.assign({}, el, el.item); + el.path.push(el.index); + return translateDiff(el); + } + }; + + let message = `${oldMember} changed :`; + for (let d of differences) { + message += `\n - ${translateDiff(d)}`; + } + + channel.send(message); +}; \ No newline at end of file diff --git a/events/message.js b/events/message.js new file mode 100644 index 0000000..507e46c --- /dev/null +++ b/events/message.js @@ -0,0 +1,117 @@ +const sql = require('sqlite'); +const Emoji = require("discord-emoji"); +const settings = require('../settings.json'); + +sql.open('./db.sqlite'); + +const updateUserXP = (points, userId) => { + sql.get(`SELECT xp, level FROM users WHERE id = '${userId}'`).then(row => { + if (!row) { + sql.run('INSERT INTO users (id, xp, level) VALUES (?, ?, ?)', [userId, 1, 0]); + } else { + sql.run(`UPDATE users SET xp = ${row.xp + points} WHERE id = ${userId}`) + } + }).catch(() => { + console.error; + sql.run('CREATE TABLE IF NOT EXISTS users (id TEXT, xp INTEGER, level INTEGER)').then(() => { + sql.run('INSERT INTO users (id, xp, level) VALUES (?, ?, ?)', [userId, 1, 0]); + }); + }); +}; + +exports.run = (client, message) => { + let matches; + + if (message.channel.type === 'text') { + updateUserXP(1, message.author.id); + } + + if (/^ping$/i.test(message.content) /*&& !/^(?:236198969019990018|220333308569976834)$/.test(message.author.id)*/ ) { + message.channel.send('pong', { tts: true }); + } + if (/my avatar/i.test(message.content)) { + message.reply(message.author.avatarURL); + } + if (/(?:^| )ch?ats?(?: |$)/i.test(message.content)) { + message.react(Emoji.nature.cat); + } + if (/(?:^| )(?:chien|dog)s?(?: |$)/i.test(message.content)) { + message.react(Emoji.nature.dog); + } + if (/\(\╯\°\□\°\)\╯\︵\ \┻\━\┻/.test(message.content)) { + message.reply('PUT. THE. TABLE. BACK.'); + } + if ((matches = message.content.match(/^([a-zA-Z])$/))) { + let c = message.content.charCodeAt(0); + switch (c) { + case 'Z': + c = 'A'; + case 'z': + c = 'a'; + default: + c = String.fromCharCode(++c); + } + message.reply(c); + } + if ((matches = message.content.match(/^([0-9]{1,15})$/))) { + message.reply(Number(matches[1]) + 1); + } + + if (message.content.startsWith(settings.prefix)) { + const command = message.content.slice(settings.prefix.length).split(' ')[0]; + const args = message.content.slice(settings.prefix.length + command.length + 1); + let cmd; + + if (client.commands.has(command)) { + cmd = client.commands.get(command); + } else if (client.aliases.has(command)) { + cmd = client.commands.get(client.aliases.get(command)); + } + + if (cmd) { + if (cmd.conf.guildOnly && !message.guild) { + message.markAsError(); + return message.reply('you have to be in a guild channel.').catch(console.error); + } + if (client.elevation(message) < cmd.conf.permLevel) { + message.markAsError(); + return message.reply('you are not allowed to do that.').catch(console.error); + } + if (cmd.conf.nsfw && !message.channel.nsfw) { + message.markAsError(); + return message.reply('you are way too pervert for this channel !').catch(console.error); + } + try { + cmd.run(client, message, args); + } catch (err) { + console.error(err); + } + } + } + + /*const keys = Object.keys(settings.commands); + for (let key of keys) { + const commandGroup = settings.commands[key]; + if (message.content.startsWith(commandGroup.prefix)) { + if (!message.member.roles.some(role => settings.commands[key].roles.includes(role.name))) { + message.reply('tu n\'es pas autorisée à faire ça, bitch'); + } else { + const command = message.content.split(' ')[0].slice(commandGroup.prefix.length); + const args = message.content.slice(commandGroup.prefix.length + command.length + 1); + + if (/\.\./.test(command)) { + message.reply('Tu y as vraiment cru ?'); + break; + } + + try { + const commandFile = require(`../commands/${key}/${command}.js`); + commandFile.run(client, message, args); + } catch (err) { + console.error(err); + } + } + break; + } + }*/ +}; \ No newline at end of file diff --git a/events/ready.js b/events/ready.js new file mode 100644 index 0000000..cac6bdb --- /dev/null +++ b/events/ready.js @@ -0,0 +1,3 @@ +exports.run = (client) => { + console.log(`Ready to server in ${client.channels.size} channels on ${client.guilds.size} servers, for a total of ${client.users.size} users.`); +}; \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..97945a9 --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ +{ + "name": "noobeater", + "version": "0.0.1", + "description": "Bot for Glaucus Pocus Discord", + "main": "app.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Pandraghon", + "license": "MIT", + "dependencies": { + "deep-diff": "^0.3.8", + "discord-emoji": "^1.1.1", + "discord.js": "^11.1.0", + "moment": "^2.18.1", + "node-opus": "^0.2.6", + "request": "^2.81.0", + "sqlite": "^2.7.0" + } +} diff --git a/settings.json b/settings.json new file mode 100644 index 0000000..4986cf7 --- /dev/null +++ b/settings.json @@ -0,0 +1,19 @@ +{ + "logs": "logs", + "ownerid": "235515918879293440", + "prefix": "hal ", + "commands": { + "base": { + "prefix": "!", + "roles": ["girl", "boy", "bot"] + }, + "admin": { + "prefix": "a!", + "roles": ["admin", "superadmin"] + }, + "user": { + "prefix": "u!", + "roles": ["girl", "boy", "bot"] + } + } +} \ No newline at end of file diff --git a/utils/log.js b/utils/log.js new file mode 100644 index 0000000..307e153 --- /dev/null +++ b/utils/log.js @@ -0,0 +1,14 @@ +const moment = require('moment'); + +exports.log = (msg) => { + console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] `, msg); +}; +exports.warn = (msg) => { + console.warn(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] `, msg); +}; +exports.error = (msg) => { + console.error(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] `, msg); +}; +exports.info = (msg) => { + console.info(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] `, msg); +}; \ No newline at end of file