diff options
| -rw-r--r-- | abwelcome.js | 31 | ||||
| -rw-r--r-- | aleebot.js | 121 | ||||
| -rw-r--r-- | commands/help.js | 56 | ||||
| -rw-r--r-- | package.json | 29 |
4 files changed, 237 insertions, 0 deletions
diff --git a/abwelcome.js b/abwelcome.js new file mode 100644 index 0000000..1dba844 --- /dev/null +++ b/abwelcome.js @@ -0,0 +1,31 @@ +const Discord = require('discord.js'); +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.user.username}** has left the server`); + +}); + +client.on('message', message => { + +}); + +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."); + }); diff --git a/aleebot.js b/aleebot.js new file mode 100644 index 0000000..8030c64 --- /dev/null +++ b/aleebot.js @@ -0,0 +1,121 @@ +/**************************************** + * + * AleeBot for AleeArmy Community and other servers + * Copyright (C) 2017 AleeCorp + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + **************************************/ +const Discord = require('discord.js'); +const moment = require('moment'); +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}`); + +}; + + + +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', () => { + log(`[>] AleeBot is now ready! Running version ${abversion} in ${client.guilds.size} guilds`); + client.user.setPresence({ + + + game: { + name: 'AleeBot 1.1.1 | ab:help', + type: 0 + } + }); + + + client.user.setStatus('online') +}); + + +client.on("guildCreate", 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!`); + + + guild.defaultChannel.sendMessage(":wave: Hello I am AleeBot thanks for inviting me to your server for help type `" + config.prefix + "help`.") + +}); + + + +client.on("guildDelete", guild => { + + // this event triggers when the bot is removed from a guild. + + 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, abversion); + } catch (err) { + log(err); + } + + +}); + +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 new file mode 100644 index 0000000..bc6ace5 --- /dev/null +++ b/commands/help.js @@ -0,0 +1,56 @@ +const Discord = require('discord.js'); +//const config = require('./absettings.json'); +//const abversion = require(config.abversion) +exports.run = (client, message, args, config, abversion) => { + +var embed = new Discord.RichEmbed() + .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:', 'ask\nship',true) + .addField('Info:', 'userinfo\n',true) + .addField('Link:', 'botinvite\nserverinvite\ngit',true) + .addField('Owner Only:', 'say\neval',true) + .addField('Monitor:', 'ping\nuptime',true) + .addField('Etc:', 'avatarurl', true) + .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 + else if { + message.channel.send ("```Commands for AleeBot "+ abversion +".\nYou are using this view because this bot doesn't have permission to send embed link.\n\n" + + ''+prefix+'avatarurl\n' + + ''+prefix+'git\n' + + ''+prefix+'ping\n' + + ''+prefix+'suggest\n' + + ''+prefix+'uptime\n' + + ''+prefix+'userinfo\n' + + ''+prefix+'serverinfo\n' + + ''+prefix+'botinvite\n' + + ''+prefix+'serverinvite\n' + + ''+prefix+'plan\n' + + ''+prefix+'attack\n' + + ''+prefix+'ask\n' + + ''+prefix+'ship\n\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]' + + }; diff --git a/package.json b/package.json index b10a8a1..48bb974 100644 --- a/package.json +++ b/package.json @@ -1,3 +1,31 @@ +<<<<<<< HEAD +{ + "name": "aleebot", + "version": "1.1.0", + "description": "A chat bot for discord written in discord.js", + "main": "aleebot.js", + "dependencies": { + "blessed": "^0.1.81", + "discord.js": "^11.1.0", + "fs": "^0.0.1-security", + "moment": "^2.18.1" + }, + "devDependencies": {}, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/AleeCorp/AleeBot.git" + }, + "author": "alee14", + "license": "MIT", + "bugs": { + "url": "https://github.com/AleeCorp/AleeBot/issues" + }, + "homepage": "https://github.com/AleeCorp/AleeBot#readme" +} +======= {
"name": "aleebot",
"version": "2.0.0",
@@ -21,3 +49,4 @@ "node-telegram-bot-api": "^0.29.0"
}
}
+>>>>>>> beta |
