AleeBot/aleebot.js

175 lines
6.1 KiB
JavaScript
Raw Normal View History

2017-05-31 16:26:45 -04:00
/****************************************
2017-07-29 15:46:00 -04:00
*
* AleeBot for AleeArmy Community and other servers
* Copyright (C) 2017 AleeCorp
2017-05-31 16:26:45 -04:00
*
* This script is made by Alee14 and other people.
2017-07-31 16:46:27 -04:00
* Some stuff was made by swawesome95 (no longer a dev), Rain and AKidFromTheUK.
2017-07-27 21:29:16 -04:00
* Please say thanks to swawesome95 to laying the basics of this bot, and Rain for improving some of the code.
2017-07-29 15:46:00 -04:00
*
2017-05-31 16:26:45 -04:00
* *************************************/
2017-05-31 16:09:24 -04:00
const Discord = require('discord.js');
const client = new Discord.Client();
2017-07-29 17:57:02 -04:00
const config = require('./absettings.json');
2017-07-29 15:46:00 -04:00
const prefix = "ab:";
var abversion = "1.0.8";
var logsChannel = "318874545593384970";
client.on('ready', () => {
console.log("[SUCCESS] AleeBot is now ready! Running version "+ abversion +"!");
2017-07-31 18:51:04 -04:00
client.user.setGame(`on ${client.guilds.size} servers`);
2017-08-04 18:47:20 -04:00
client.user.setStatus('online'))
});
//Only works for AleeAmry Community I need someone to work it for Public and it's disabled because it crashes AleeBot :(
client.on("guildMemberAdd", function(member) {
2017-08-03 22:58:29 -04:00
member.guild.channels.find("name", "welcomes-and-byes").sendMessage(member.toString() + " has joined the server");
});
client.on("guildMemberRemove", function(member) {
2017-08-03 22:58:29 -04:00
member.guild.channels.find("name", "welcomes-and-byes").sendMessage(member.toString() + " has left the server");
2017-08-03 22:49:47 -04:00
});
2017-07-29 15:46:00 -04:00
2017-08-03 22:54:01 -04:00
/*
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);
2017-07-29 15:46:00 -04:00
if (word != -1) {
return true;
} else {
return false;
}
} */
2017-06-01 22:26:22 +00:00
2017-07-31 16:46:27 -04:00
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!`);
client.user.setGame(`on ${client.guilds.size} servers`);
});
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})`);
client.user.setGame(`on ${client.guilds.size} servers`);
});
client.on("message", function(message){
2017-07-29 16:31:10 -04:00
if (message.author.bot) return;
if (!message.content.startsWith(prefix)) return;
let command = message.content.split(" ")[0];
command = command.slice(prefix.length);
let args = message.content.split(" ").slice(1);
/* if (wordFilter(message.content))
{
message.delete();
client.channels.get('318874545593384970').sendMessage(":information_source: " + message.author.username + " just swore!");
console.log("[INFO] " + message.author.username + " just swore!");
switch (Math.floor(Math.random() * 1000) % 3) {
message.reply("You have been caught swearing.");
message.author.send("You have been caught swearing in AleeArmy Community.");
} */
2017-07-29 15:46:00 -04:00
2017-07-29 16:31:10 -04:00
if (command === 'help'){
2017-07-29 00:19:15 -04:00
var embed = new Discord.RichEmbed()
2017-07-29 15:46:00 -04:00
.addField('Commands for AleeBot!\n\n',
'**'+prefix+'profile** Shows your profile pic in a image.\n' +
'**'+prefix+'git** Shows the repo of AleeBot.\n' +
"**"+prefix+"ping** Type this command and you'll see ;).\n" +
'**'+prefix+'owner** Shows who made this bot.\n' +
'**'+prefix+'suggest** You suggest things (working progress).\n' +
2017-07-30 20:21:18 -04:00
'**'+prefix+'userinfo** Tells you your info about you.\n' +
2017-07-30 20:28:55 -04:00
'**'+prefix+'botinvite** Lets you bring AleeBot to your server.\n' +
'**'+prefix+'serverinvite** Invites you to the AleeArmy Server.\n' +
'**'+prefix+'mod** (For staff only) Displays the commands for moderation.\n', true)
.setFooter("AleeBot Copyright 2017. The version that AleeBot's running is " + abversion + "!")
.setColor("#7af442")
2017-07-29 00:19:15 -04:00
message.channel.sendEmbed(embed);
2017-07-31 16:46:27 -04:00
2017-07-28 22:37:47 -04:00
}
2017-07-29 15:46:00 -04:00
2017-07-29 16:31:10 -04:00
if(command === 'profile'){
2017-06-01 22:26:22 +00:00
message.reply(message.author.avatarURL);
}
2017-07-29 16:31:10 -04:00
if(command === 'git'){
2017-07-27 15:52:31 -04:00
message.channel.send ('Here is the github repo: https://github.com/AleeCorp/AleeBot');
2017-06-01 22:26:22 +00:00
}
2017-07-29 16:31:10 -04:00
if(command === 'ping'){
2017-06-01 22:26:22 +00:00
message.reply('Pong! :ping_pong:');
}
2017-07-29 16:31:10 -04:00
if(command === 'owner'){
2017-07-29 21:28:14 -04:00
message.channel.send ('The person who made this bot is Alee14#9928!');
2017-06-01 22:26:22 +00:00
}
2017-07-29 16:31:10 -04:00
if(command === 'suggest'){
2017-06-06 20:18:46 +00:00
message.reply('Sorry this feature is still being worked on :(');
}
2017-07-29 15:46:00 -04:00
if(command === 'userinfo'){
var embed = new Discord.RichEmbed()
.setAuthor(message.author.username)
.setDescription("This is your user info!")
.setColor("#7af442")
.addField("Username", `${message.author.username}#${message.author.discriminator}`)
.addField("Created At", message.author.createdAt)
message.channel.sendEmbed(embed);
}
if(command === 'serverinfo'){
var embed = new Discord.RichEmbed()
.addField("Coming soon!")
.setColor("#7af442")
message.channel.sendEmbed(embed);
}
2017-07-30 20:21:18 -04:00
2017-07-30 20:28:55 -04:00
if (command === 'botinvite'){
2017-08-01 15:32:56 -04:00
message.reply(':arrow_left: Continue in DMs.');
2017-07-31 16:46:27 -04:00
message.author.sendMessage("AleeBot on your server? Great! Here's the link: https://goo.gl/KDQyrp");
2017-07-30 20:21:18 -04:00
}
2017-07-30 20:28:55 -04:00
if (command === 'serverinvite'){
2017-08-01 15:32:56 -04:00
message.reply(':arrow_left: Continue in DMs.');
2017-07-31 16:46:27 -04:00
message.author.sendMessage("You want a invite to the AleeArmy server? Here's the link: https://discord.gg/JqgXrAJ");
2017-07-31 00:39:23 -04:00
}
2017-07-31 16:46:27 -04:00
if(command === 'mod'){
2017-08-01 21:33:14 -04:00
message.reply("This is working progress if you want to help do **"+prefix+"git** then go to the site and start a pull request")
2017-08-02 17:53:27 -04:00
if(!message.member.roles.some(r=>["Admin", "Moderator","Co-Owner", "AleeBot Creator", "Staff", "Owner","King Alee"].includes(r.name)) )
2017-08-02 17:56:59 -04:00
return message.reply("Hey! Your not a staff!");
message.channel.send ('```Commands for Staff!\n\n' +
2017-08-01 15:36:51 -04:00
'ab:kick Kicks people\n' +
'ab:ban Bans People\n' +
"ab:rm Removes the message with a amount\n" +
2017-07-31 18:56:09 -04:00
'Please note that we are still working on this feature!```');
2017-07-31 16:46:27 -04:00
}
2017-08-02 19:33:30 -04:00
2017-06-06 20:18:46 +00:00
});
2017-06-01 22:26:22 +00:00
2017-07-30 20:21:18 -04:00
process.on('unhandledRejection', function(err, p) {
2017-07-29 21:42:13 -04:00
console.log("[ERROR | UNCAUGHT PROMISE] " + err.stack);
});
2017-07-29 15:46:00 -04:00
2017-06-01 19:59:50 +00:00
client.login (config.token).catch(function() {
2017-07-27 15:59:49 -04:00
console.log("[ERROR] Login failed. Please contact Alee14#9928 or email him at alee14498@gmail.com.");
2017-05-31 16:09:24 -04:00
});