summaryrefslogtreecommitdiff
path: root/abwelcome.js
blob: 0a54cf1089f089b4bef26fabcf5f6e9a465c5968 (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
const Discord = require('discord.js');
const profanities = require('profanities');
const client = new Discord.Client();
const config = require('./absettings.json');


client.on('ready', () => {
       console.log("[SUCCESS] AleeArmy Welcomer is now ready!");
       client.user.setStatus('invisible')
   });

   client.on("guildMemberAdd", function(member) {
     member.guild.channels.find("name", "welcomes-and-byes").sendMessage(member.toString() + " has joined the server")

});

client.on("guildMemberRemove", function(member) {
  member.guild.channels.find("name", "welcomes-and-byes").sendMessage(member.toString() + " has left the server");

});

client.on('message', message => {
  for (x = 0; x < profanities.length; x++) {
    if (message.content.toUpperCase() == profanities[x].toUpperCase()) {
        message.reply('Hey! Don\'t say that word!')
        message.delete();
        return;
    }
  }
});

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

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