diff options
| -rw-r--r-- | absettings.json.example | 2 | ||||
| -rw-r--r-- | abwelcome.js | 3 | ||||
| -rw-r--r-- | aleebot.js | 105 | ||||
| -rw-r--r-- | commands/help.js | 6 |
4 files changed, 54 insertions, 62 deletions
diff --git a/absettings.json.example b/absettings.json.example index 3d12948..7ae1f82 100644 --- a/absettings.json.example +++ b/absettings.json.example @@ -2,6 +2,4 @@ "abtoken": "token", "ownerID": "242775871059001344", "prefix": "ab:", - "abversion": "1.1.0", - "year": "2017" } diff --git a/abwelcome.js b/abwelcome.js index 6ff257b..9a8a3fb 100644 --- a/abwelcome.js +++ b/abwelcome.js @@ -11,6 +11,7 @@ client.on('ready', () => { client.on("guildMemberAdd", function(member) { member.guild.channels.find("name", "welcomes-and-byes").sendMessage(member.toString() + " has joined the server") + message.author.sendMessage(`Welcome to the AleeArmy Server **${member.user.username}**! Make sure to read the rules first and wait until Alee or a staff makes you part of member!`); }); @@ -22,7 +23,7 @@ client.on("guildMemberRemove", function(member) { client.on('message', message => { for (x = 0; x < profanities.length; x++) { if (message.content.toUpperCase() == profanities[x].toUpperCase()) { - client.channels.get('318874545593384970').sendMessage(":information_source: " + message.author.username + " just swore in #"+ message.channel.name +"!"); + client.channels.get('318874545593384970').sendMessage(":information_source: **" + message.author.username + "** just swore in #"+ message.channel.name +"!"); console.log('[WARNING] '+ message.author.username +' just swore in #'+ message.channel.name +'!') switch (Math.floor(Math.random() * 1000) % 3) { case 0: @@ -1,6 +1,6 @@ /**************************************** * - * AleeBot for AleeArmy Community and other servers + * AleeBot 1.1.1 for AleeArmy Community and other servers * Copyright (C) 2017 AleeCorp * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -29,48 +29,50 @@ const blessed = require('blessed'); const fs = require('fs'); const client = new Discord.Client(); const config = require('./absettings.json'); +const abversion = "1.1.1"; const log = message => { - console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${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) => { +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); - }); + 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', () => { - log("[>] AleeBot is now ready! Running version "+ config.abversion +"!"); - client.user.setPresence({ game: { name: 'with version '+ config.abversion +'', type: 0 } }); - client.user.setStatus('online') - }); + log("[>] AleeBot is now ready! Running version " + abversion + "!"); + client.user.setPresence({ + game: { + name: 'with version ' + abversion, + type: 0 + } + }); + client.user.setStatus('online') +}); client.on("guildCreate", guild => { - // This event triggers when the bot joins a guild. + // This event triggers when the bot joins a guild. - 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,46 +80,37 @@ client.on("guildCreate", guild => { 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. - log(`I have been removed from: ${guild.name} (id: ${guild.id})`); + log(`I have been removed from: ${guild.name} (id: ${guild.id})`); }); -client.on("message", function(message){ - if (message.author.bot) return; - if (message.channel.type === "dm") return; - if(message.content.indexOf(config.prefix) !== 0) return; - - const args = message.content.slice(config.prefix.length).trim().split(/ +/g); - const command = args.shift().toLowerCase(); - - try { - 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); -} - -/* 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."); - } */ - - }); - - process.on('unhandledRejection', function(err, p) { - log("[X | UNCAUGHT PROMISE] " + err.stack); +client.on("message", function(message) { + if (message.author.bot) return; + if (message.channel.type === "dm") return; + if (message.content.indexOf(config.prefix) !== 0) return; + + const args = message.content.slice(config.prefix.length).trim().split(/ +/g); + const command = args.shift().toLowerCase(); + + try { + let commandFile = require(`./commands/${command}.js`); + commandFile.run(client, message, args, config, abversion); + } catch (err) { + message.reply(`:no_entry_sign: Error!\nThe command ${command} isn't found. (Reported to console.)`) + console.error(err); + } + + }); - client.login (config.abtoken).catch(function() { - log("[X] Login failed. Please contact Alee14#9928 or email him at alee14498@gmail.com."); - }); +process.on('unhandledRejection', function(err, p) { + log("[X | UNCAUGHT PROMISE] " + err.stack); +}); + +client.login(config.abtoken).catch(function() { + log("[X] Login failed. Please contact Alee14#9928 or email him at alee14498@gmail.com."); +}); diff --git a/commands/help.js b/commands/help.js index 1cf6f06..e9384de 100644 --- a/commands/help.js +++ b/commands/help.js @@ -1,10 +1,10 @@ const Discord = require('discord.js'); //const config = require('./absettings.json'); //const abversion = require(config.abversion) -exports.run = (client, message, args, config) => { +exports.run = (client, message, args, config, abversion) => { var embed = new Discord.RichEmbed() - .setTitle(`Commands for AleeBot ` + config.abversion + ` and running on ${client.guilds.size} servers.`) + .setTitle(`Commands for AleeBot ` + abversion + ` and running on ${client.guilds.size} servers.`) .setDescription('Every command you put in this bot must start with `ab:`') .setThumbnail("https://cdn.discordapp.com/avatars/282547024547545109/6c147a444ae328c38145ef1f74169e38.png?size=2048") .addField('Fun Stuff:', 'attack\nask\nship',true) @@ -13,7 +13,7 @@ var embed = new Discord.RichEmbed() .addField('Owner Only:', 'say\neval',true) .addField('Monitor:', 'ping\nuptime',true) .addField('Etc:', 'avatarurl', true) - .setFooter("AleeBot "+ config.abversion +" Copyright "+ config.year +". Created by Alee14", "https://cdn.discordapp.com/avatars/282547024547545109/6c147a444ae328c38145ef1f74169e38.png?size=2048") + .setFooter("AleeBot "+ abversion +" Copyright 2017. Created by Alee14", "https://cdn.discordapp.com/avatars/282547024547545109/6c147a444ae328c38145ef1f74169e38.png?size=2048") .setColor("#7af442") message.channel.sendEmbed(embed); } /* This feature is broken |
