aboutsummaryrefslogtreecommitdiff
path: root/aleebot.js
blob: 808bc8cc0097b5e3c8a30def1d048e85bad0c38e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/****************************************
 *
 *   AleeBot for AleeArmy Community and other servers
 *   Copyright (C) 2017 AleeCorp
 *
 *   This script is made by Alee14 and other people.
 *   Some stuff was made by swawesome95 (no longer a dev), Rain and AKidFromTheUK.
 *   Please say thanks to swawesome95 to laying the basics of this bot, and Rain for improving some of the code.
 *
 * *************************************/
const Discord = require('discord.js');
const client = new Discord.Client();
const config = require('./absettings.json');

const prefix = "ab:";
var abversion = "1.0.8";
var logsChannel = "318874545593384970";

client.on('ready', () => {
       console.log("[SUCCESS] AleeBot is now ready! Running version "+ abversion +"!");
       client.user.setGame(`on ${client.guilds.size} servers`);
   });
//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) {
	member.guild.channels.find("name", "welcomes-and-byes").sendMessage(member.toString() + " Welcome to the AleeArmy!");
});

client.on("guildMemberRemove", function(member) {
	member.guild.channels.find("name", "welcomes-and-byes").sendMessage(member.toString() + " Nice knowing you bye...");
});*/

/*
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!`);

  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){
  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.");
	} */

	 if (command === 'help'){
		 var embed = new Discord.RichEmbed()
			.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' +
      '**'+prefix+'userinfo** Tells you your info about you.\n' +
      '**'+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")
			message.channel.sendEmbed(embed);

	}

    if(command === 'profile'){
        message.reply(message.author.avatarURL);
    }

    if(command === 'git'){
        message.channel.send ('Here is the github repo: https://github.com/AleeCorp/AleeBot');
    }

    if(command === 'ping'){
        message.reply('Pong! :ping_pong:');
    }

    if(command === 'owner'){
		message.channel.send ('The person who made this bot is Alee14#9928!');
    }

    if(command === 'suggest'){
        message.reply('Sorry this feature is still being worked on :(');
    }

    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);
    }

    if (command === 'botinvite'){
      message.reply(':arrow_left: Continue in DMs.');
      message.author.sendMessage("AleeBot on your server? Great! Here's the link: https://goo.gl/KDQyrp");
    }

    if (command === 'serverinvite'){
      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");

    }

    if(command === 'mod'){
      if(!message.member.roles.some(r=>["Admin", "Moderator","Co-Owner", "AleeBot Creator"].includes(r.name)) )
      return message.reply("Hey! Your not a Co-Owner or Admin or Moderator!");
      message.reply("This is working progress if you want to help do **"+prefix+"git** then go to the site and start a pull request")
      message.channel.send ('```Commands for Staff!\n\n' +
                  ''+prefix+'kick Kicks people\n' +
                  ''+prefix'ban Bans People\n' +
                  ""+prefiix+"rm Removes the message with a amount\n" +
                  'Please note that we are still working on this feature!```');
    }

 });

 process.on('unhandledRejection', function(err, p) {
   console.log("[ERROR | UNCAUGHT PROMISE] " + err.stack);
});

 client.login (config.token).catch(function() {
       console.log("[ERROR] Login failed. Please contact Alee14#9928 or email him at alee14498@gmail.com.");
   });