Merge branch 'beta'

This commit is contained in:
Andrew Lee 2017-08-18 13:37:11 -04:00
commit b937dd609f
15 changed files with 301 additions and 27 deletions

View file

@ -24,48 +24,50 @@
* *
**************************************/ **************************************/
const Discord = require('discord.js'); const Discord = require('discord.js');
const moment = require('moment');
const blessed = require('blessed'); const blessed = require('blessed');
const fs = require('fs'); const fs = require('fs');
const client = new Discord.Client(); const client = new Discord.Client();
const config = require('./absettings.json'); const config = require('./absettings.json');
const log = message => {
console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${message}`);
};
var logsChannel = "318874545593384970"; 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', () => { 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.setPresence({ game: { name: 'with version '+ config.abversion +'', type: 0 } });
client.user.setStatus('online') 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 => { client.on("guildCreate", guild => {
// This event triggers when the bot joins a 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`.") 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. // 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`); let commandFile = require(`./commands/${command}.js`);
commandFile.run(client, message, args, config); commandFile.run(client, message, args, config);
} catch (err) { } catch (err) {
message.reply (`:no_entry_sign: Error!\nThe command ${command} isn't found. (Reported to console.)`)
console.error(err); console.error(err);
} }
@ -112,9 +115,9 @@ client.on("message", function(message){
}); });
process.on('unhandledRejection', function(err, p) { 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() { 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.");
}); });

View file

@ -17,3 +17,23 @@ if (args[1]) {
message.channel.sendMessage("Sorry, I don't know what your saying.") 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]'
};

View file

@ -7,3 +7,23 @@ message.channel.send("<@" + message.author.id + "> :right_facing_fist: " + args)
commandProcessed = true; 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]'
};

View file

@ -2,3 +2,24 @@ const Discord = require('discord.js');
exports.run = (client, message, args, config) => { exports.run = (client, message, args, config) => {
message.reply(message.author.avatarURL); 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'
};

View file

@ -3,3 +3,24 @@ exports.run = (client, message, args, config) => {
message.reply(':arrow_left: Continue in DMs.'); message.reply(':arrow_left: Continue in DMs.');
message.author.sendMessage("AleeBot on your server? Great! Here's the link: https://goo.gl/KDQyrp"); 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'
};

View file

@ -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]'
};

View file

@ -2,3 +2,23 @@ const Discord = require('discord.js');
exports.run = (client, message, args, config) => { exports.run = (client, message, args, config) => {
message.channel.send ("Here's the github repo: https://github.com/AleeCorp/AleeBot"); 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'
};

View file

@ -33,3 +33,24 @@ var embed = new Discord.RichEmbed()
''+prefix+'ask\n' + ''+prefix+'ask\n' +
''+prefix+'ship\n\n' + ''+prefix+'ship\n\n' +
"Copyright "+ year +". Created by Alee14\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]'
};

View file

@ -2,3 +2,24 @@ const Discord = require('discord.js');
exports.run = (client, message, args, config) => { exports.run = (client, message, args, config) => {
message.reply("**PONG!** :ping_pong: " + Math.round(client.ping) + " ms"); 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'
};

View file

@ -5,3 +5,24 @@ exports.run = (client, message, args, config) => {
message.delete(); 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]'
};

View file

@ -3,3 +3,24 @@ exports.run = (client, message, args, config) => {
message.reply(':arrow_left: Continue in DMs.'); 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"); 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'
};

View file

@ -2,3 +2,24 @@ const Discord = require('discord.js');
exports.run = (client, message, args, config) => { exports.run = (client, message, args, config) => {
message.channel.send(":ship: "+ message.author.username + " x " + message.guild.members.random().displayName); 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'
};

View file

@ -39,3 +39,24 @@ message.reply("It looks like AleeBot has been up for " + timeString + " hours.")
commandProcessed = true; 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'
};

View file

@ -11,3 +11,24 @@ exports.run = (client, message, args, config) => {
message.channel.sendEmbed(embed); 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'
};

View file

@ -7,6 +7,7 @@
"blessed": "^0.1.81", "blessed": "^0.1.81",
"discord.js": "^11.1.0", "discord.js": "^11.1.0",
"fs": "^0.0.1-security", "fs": "^0.0.1-security",
"moment": "^2.18.1",
"profanities": "^2.5.0" "profanities": "^2.5.0"
}, },
"devDependencies": {}, "devDependencies": {},