diff options
| author | Alee14 <Alee14498@gmail.com> | 2017-08-18 13:34:36 -0400 |
|---|---|---|
| committer | Alee14 <Alee14498@gmail.com> | 2017-08-18 13:34:36 -0400 |
| commit | 3c74b0b12bafe942b4ec8a091b559fadc5ec1c5f (patch) | |
| tree | 66b518f20383d909e10b67ca402156975aacde1b | |
| parent | 9742cf16699ad63becd6d84bc31a74b31627a7d0 (diff) | |
| download | AleeBot-3c74b0b12bafe942b4ec8a091b559fadc5ec1c5f.tar.gz AleeBot-3c74b0b12bafe942b4ec8a091b559fadc5ec1c5f.tar.bz2 AleeBot-3c74b0b12bafe942b4ec8a091b559fadc5ec1c5f.zip | |
Added when you start AleeBot it's going to load all the commands
| -rw-r--r-- | aleebot.js | 57 | ||||
| -rw-r--r-- | commands/ask.js | 20 | ||||
| -rw-r--r-- | commands/attack.js | 20 | ||||
| -rw-r--r-- | commands/avatarurl.js | 21 | ||||
| -rw-r--r-- | commands/botinvite.js | 21 | ||||
| -rw-r--r-- | commands/eval.js | 21 | ||||
| -rw-r--r-- | commands/git.js | 20 | ||||
| -rw-r--r-- | commands/help.js | 21 | ||||
| -rw-r--r-- | commands/ping.js | 21 | ||||
| -rw-r--r-- | commands/say.js | 21 | ||||
| -rw-r--r-- | commands/serverinvite.js | 21 | ||||
| -rw-r--r-- | commands/ship.js | 21 | ||||
| -rw-r--r-- | commands/uptime.js | 21 | ||||
| -rw-r--r-- | commands/userinfo.js | 21 | ||||
| -rw-r--r-- | package.json | 1 |
15 files changed, 301 insertions, 27 deletions
@@ -24,48 +24,50 @@ * **************************************/ const Discord = require('discord.js'); +const moment = require('moment'); const blessed = require('blessed'); const fs = require('fs'); const client = new Discord.Client(); const config = require('./absettings.json'); +const log = message => { + + console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${message}`); + +}; var logsChannel = "318874545593384970"; + +client.commands = new Discord.Collection(); + +client.aliases = new Discord.Collection(); + fs.readdir('./commands/', (err, files) => { + if (err) console.error(err); + log(`Loading a total of ${files.length} commands.`); + files.forEach(f => { + let props = require(`./commands/${f}`); + log(`Loading Command: ${props.help.name}. Done!`); + client.commands.set(props.help.name, props); + props.conf.aliases.forEach(alias => { + client.aliases.set(alias, props.help.name); + }); + }); + }); + + client.on('ready', () => { - console.log("[SUCCESS] AleeBot is now ready! Running version "+ config.abversion +"!"); + log("[>] AleeBot is now ready! Running version "+ config.abversion +"!"); client.user.setPresence({ game: { name: 'with version '+ config.abversion +'', type: 0 } }); client.user.setStatus('online') }); - fs.readdir("./events/", (err, files) => { - if (err) return console.error(err); - files.forEach(file => { - let eventFunction = require(`./events/${file}`); - let eventName = file.split(".")[0]; - // super-secret recipe to call events with all their proper arguments *after* the `client` var. - client.on(eventName, (...args) => eventFunction.run(client, ...args)); - }); - }); - - -/* -function wordFilter(content) { - var word = content.search(/\b(fuck|fag|faggot|fuck|fuk|fuc|fucc|ho|phuck|hentai|porn|slut|bitch|succ|fucking|shit|ass|asshole|mofo|motherfucker|fucker|damn|hell|dick|cock|sex|cunt|nigger|nigga)+\b/i); - - if (word != -1) { - return true; - } else { - return false; - } -} */ - client.on("guildCreate", guild => { // This event triggers when the bot joins a guild. - console.log(`New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!`); + log(`New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!`); guild.defaultChannel.sendMessage(":wave: Hello I am AleeBot thanks for inviting me to your server for help type `"+ config.prefix +"help`.") @@ -78,7 +80,7 @@ client.on("guildDelete", guild => { // this event triggers when the bot is removed from a guild. - console.log(`I have been removed from: ${guild.name} (id: ${guild.id})`); + log(`I have been removed from: ${guild.name} (id: ${guild.id})`); }); @@ -96,6 +98,7 @@ client.on("message", function(message){ let commandFile = require(`./commands/${command}.js`); commandFile.run(client, message, args, config); } catch (err) { + message.reply (`:no_entry_sign: Error!\nThe command ${command} isn't found. (Reported to console.)`) console.error(err); } @@ -112,9 +115,9 @@ client.on("message", function(message){ }); process.on('unhandledRejection', function(err, p) { - console.log("[ERROR | UNCAUGHT PROMISE] " + err.stack); + log("[X | UNCAUGHT PROMISE] " + err.stack); }); client.login (config.abtoken).catch(function() { - console.log("[ERROR] Login failed. Please contact Alee14#9928 or email him at alee14498@gmail.com."); + log("[X] Login failed. Please contact Alee14#9928 or email him at alee14498@gmail.com."); }); diff --git a/commands/ask.js b/commands/ask.js index a87cb8a..89ce891 100644 --- a/commands/ask.js +++ b/commands/ask.js @@ -17,3 +17,23 @@ if (args[1]) { message.channel.sendMessage("Sorry, I don't know what your saying.") } } +exports.conf = { + enabled: true, + + guildOnly: false, + + aliases: [], + + permLevel: 0 + +}; + +exports.help = { + + name: 'ask', + + description: 'Go ask AleeBot a question let\'s see what AleeBot\'s response!', + + usage: 'ask [args]' + +}; diff --git a/commands/attack.js b/commands/attack.js index b17d0d9..d0b0ed0 100644 --- a/commands/attack.js +++ b/commands/attack.js @@ -7,3 +7,23 @@ message.channel.send("<@" + message.author.id + "> :right_facing_fist: " + args) commandProcessed = true; } +exports.conf = { + enabled: true, + + guildOnly: false, + + aliases: [], + + permLevel: 0 + +}; + +exports.help = { + + name: 'attack', + + description: 'If your mad at someone if they messed up use this command and mention them.', + + usage: 'attack [args]' + +}; diff --git a/commands/avatarurl.js b/commands/avatarurl.js index 6cc4313..65abc45 100644 --- a/commands/avatarurl.js +++ b/commands/avatarurl.js @@ -2,3 +2,24 @@ const Discord = require('discord.js'); exports.run = (client, message, args, config) => { message.reply(message.author.avatarURL); } + +exports.conf = { + enabled: true, + + guildOnly: false, + + aliases: [], + + permLevel: 0 + +}; + +exports.help = { + + name: 'avatarurl', + + description: 'It displays your avatar url.', + + usage: 'avatarurl' + +}; diff --git a/commands/botinvite.js b/commands/botinvite.js index 32c85ba..e0e43ad 100644 --- a/commands/botinvite.js +++ b/commands/botinvite.js @@ -3,3 +3,24 @@ exports.run = (client, message, args, config) => { message.reply(':arrow_left: Continue in DMs.'); message.author.sendMessage("AleeBot on your server? Great! Here's the link: https://goo.gl/KDQyrp"); } + +exports.conf = { + enabled: true, + + guildOnly: false, + + aliases: [], + + permLevel: 0 + +}; + +exports.help = { + + name: 'botinvite', + + description: 'Now you can invite your bot to your server!', + + usage: 'botinvite' + +}; diff --git a/commands/eval.js b/commands/eval.js index 730def9..2716cb8 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -57,3 +57,24 @@ const argseval = message.content.split(" ").slice(1); }) } } + +exports.conf = { + enabled: true, + + guildOnly: false, + + aliases: [], + + permLevel: 0 + +}; + +exports.help = { + + name: 'eval', + + description: 'It injects code but you cannot use it only the person host it is allow!', + + usage: 'eval [code]' + +}; diff --git a/commands/git.js b/commands/git.js index c513d60..9e5d4be 100644 --- a/commands/git.js +++ b/commands/git.js @@ -2,3 +2,23 @@ const Discord = require('discord.js'); exports.run = (client, message, args, config) => { message.channel.send ("Here's the github repo: https://github.com/AleeCorp/AleeBot"); } +exports.conf = { + enabled: true, + + guildOnly: false, + + aliases: [], + + permLevel: 0 + +}; + +exports.help = { + + name: 'git', + + description: 'Tells you the repository of AleeBot.', + + usage: 'git' + +}; diff --git a/commands/help.js b/commands/help.js index b7da131..1cf6f06 100644 --- a/commands/help.js +++ b/commands/help.js @@ -33,3 +33,24 @@ var embed = new Discord.RichEmbed() ''+prefix+'ask\n' + ''+prefix+'ship\n\n' + "Copyright "+ year +". Created by Alee14\n```"); */ + exports.conf = { + enabled: true, + + guildOnly: false, + + aliases: ['h', 'halp'], + + permLevel: 0 + + }; + + + exports.help = { + + name: 'help', + + description: 'Displays all the available commands for your permission level.', + + usage: 'help [command]' + + }; diff --git a/commands/ping.js b/commands/ping.js index 7291018..d6481bb 100644 --- a/commands/ping.js +++ b/commands/ping.js @@ -2,3 +2,24 @@ const Discord = require('discord.js'); exports.run = (client, message, args, config) => { message.reply("**PONG!** :ping_pong: " + Math.round(client.ping) + " ms"); } + +exports.conf = { + enabled: true, + + guildOnly: false, + + aliases: [], + + permLevel: 0 + +}; + +exports.help = { + + name: 'ping', + + description: 'It tells you the pingtime.', + + usage: 'ping' + +}; diff --git a/commands/say.js b/commands/say.js index 6d395c6..f32544b 100644 --- a/commands/say.js +++ b/commands/say.js @@ -5,3 +5,24 @@ exports.run = (client, message, args, config) => { message.delete(); } + +exports.conf = { + enabled: true, + + guildOnly: false, + + aliases: [], + + permLevel: 0 + +}; + +exports.help = { + + name: 'say', + + description: 'You cannot use this command host of the bot can use it!', + + usage: 'say [input]' + +}; diff --git a/commands/serverinvite.js b/commands/serverinvite.js index cf0a696..0293821 100644 --- a/commands/serverinvite.js +++ b/commands/serverinvite.js @@ -3,3 +3,24 @@ exports.run = (client, message, args, config) => { message.reply(':arrow_left: Continue in DMs.'); message.author.sendMessage("You want a invite to the AleeArmy server? Here's the link: https://discord.gg/JqgXrAJ"); } + +exports.conf = { + enabled: true, + + guildOnly: false, + + aliases: [], + + permLevel: 0 + +}; + +exports.help = { + + name: 'serverinvite', + + description: 'The bot will DM you the server invite', + + usage: 'serverinvite' + +}; diff --git a/commands/ship.js b/commands/ship.js index 5ea5900..2d10ff5 100644 --- a/commands/ship.js +++ b/commands/ship.js @@ -2,3 +2,24 @@ const Discord = require('discord.js'); exports.run = (client, message, args, config) => { message.channel.send(":ship: "+ message.author.username + " x " + message.guild.members.random().displayName); } + +exports.conf = { + enabled: true, + + guildOnly: false, + + aliases: [], + + permLevel: 0 + +}; + +exports.help = { + + name: 'ship', + + description: 'The Bot will randomize random people that you will ship with.', + + usage: 'ship' + +}; diff --git a/commands/uptime.js b/commands/uptime.js index 63f9242..dc61369 100644 --- a/commands/uptime.js +++ b/commands/uptime.js @@ -39,3 +39,24 @@ message.reply("It looks like AleeBot has been up for " + timeString + " hours.") commandProcessed = true; } + +exports.conf = { + enabled: true, + + guildOnly: false, + + aliases: [], + + permLevel: 0 + +}; + +exports.help = { + + name: 'uptime', + + description: 'It will tell you how long AleeBot has been on for.', + + usage: 'uptime' + +}; diff --git a/commands/userinfo.js b/commands/userinfo.js index 4721e37..d6b0825 100644 --- a/commands/userinfo.js +++ b/commands/userinfo.js @@ -11,3 +11,24 @@ exports.run = (client, message, args, config) => { message.channel.sendEmbed(embed); } + +exports.conf = { + enabled: true, + + guildOnly: false, + + aliases: [], + + permLevel: 0 + +}; + +exports.help = { + + name: 'userinfo', + + description: 'It will tell your user info!', + + usage: 'userinfo' + +}; diff --git a/package.json b/package.json index 01356f8..7db00da 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "blessed": "^0.1.81", "discord.js": "^11.1.0", "fs": "^0.0.1-security", + "moment": "^2.18.1", "profanities": "^2.5.0" }, "devDependencies": {}, |
