diff options
| author | Alee14 <Alee14498@gmail.com> | 2017-10-22 12:49:49 -0400 |
|---|---|---|
| committer | Alee14 <Alee14498@gmail.com> | 2017-10-22 12:49:49 -0400 |
| commit | 7cc7c8984b532b1dc12c720c045a23bc827a553c (patch) | |
| tree | d3171ac353a67300065455a00c50bb968acb334c | |
| parent | fc1418f89362c1b637026dc8f6a13ab4bb195762 (diff) | |
| download | AleeBot-7cc7c8984b532b1dc12c720c045a23bc827a553c.tar.gz AleeBot-7cc7c8984b532b1dc12c720c045a23bc827a553c.tar.bz2 AleeBot-7cc7c8984b532b1dc12c720c045a23bc827a553c.zip | |
Beautifing AleeBot
| -rw-r--r-- | Start Electron.bat | 4 | ||||
| -rw-r--r-- | src/bot.js | 131 | ||||
| -rw-r--r-- | src/index.js | 65 | ||||
| -rw-r--r-- | src/renderer.js | 0 | ||||
| -rw-r--r-- | src/setup.html | 32 |
5 files changed, 130 insertions, 102 deletions
diff --git a/Start Electron.bat b/Start Electron.bat new file mode 100644 index 0000000..f9bdcf3 --- /dev/null +++ b/Start Electron.bat @@ -0,0 +1,4 @@ +@echo off +title Starting Electron +echo Starting Electron +npm start
\ No newline at end of file @@ -1,88 +1,89 @@ /********************************************* -* -* AleeBot for Discord servers -* Copyright (C) 2017 AleeCorp -* -**********************************************/ + * + * AleeBot for Discord servers + * Copyright (C) 2017 AleeCorp + * License: MIT + * + **********************************************/ const Discord = require('discord.js'); -const client = new Discord.Client(); -const abVersion = "2.0.0 Beta"; +const client = new Discord.Client(); +const abVersion = "2.0.0 Beta"; const prefix = "abb:" -const config = require('./absettings.json'); +const config = require('./absettings.json'); client.on('ready', () => { - console.log("[>] AleeBot is now ready!") - console.log("[i] Running version " + abVersion + ` and in ${client.guilds.size} guilds`) - client.user.setPresence({ - game: { - name: `ab:help | ${client.guilds.size} servers`, - type: 0 - } - }); - client.user.setStatus('online') + console.log("[>] AleeBot is now ready!") + console.log("[i] Running version " + abVersion + ` and in ${client.guilds.size} guilds`) + client.user.setPresence({ + game: { + name: `ab:help | ${client.guilds.size} servers`, + type: 0 + } + }); + client.user.setStatus('online') }); client.on("guildCreate", guild => { - + console.log(`[i] New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!`); - - client.user.setPresence({ - game: { - name: `ab:help | ${client.guilds.size} servers`, - type: 0 - } - }); - + + client.user.setPresence({ + game: { + name: `ab:help | ${client.guilds.size} servers`, + type: 0 + } + }); + }); - - + + client.on("guildDelete", guild => { - + console.log(`[i] I have been removed from: ${guild.name} (id: ${guild.id})`); - - client.user.setPresence({ - game: { - name: `ab:help | ${client.guilds.size} servers`, - type: 0 - } - }); - - + + client.user.setPresence({ + game: { + name: `ab:help | ${client.guilds.size} servers`, + type: 0 + } + }); + + }); client.on('guildMemberAdd', member => { - member.guild.channels.find("name", "welcomes-and-byes").sendMessage(member.toString() + " has joined the server"); + member.guild.channels.find("name", "welcomes-and-byes").sendMessage(member.toString() + " has joined the server"); }); client.on('guildMemberRemove', member => { - member.guild.channels.find("name", "welcomes-and-byes").sendMessage(`**${member.user.username}** has left the server`); + member.guild.channels.find("name", "welcomes-and-byes").sendMessage(`**${member.user.username}** has left the server`); }); -client.on("message", function(message) { - if (message.author.bot) return; - if (message.channel.type === "dm") return; +client.on("message", function(message) { + if (message.author.bot) return; + if (message.channel.type === "dm") return; if (message.content.indexOf(config.prefix) !== 0) return; - - let command = message.content.split(" ")[0]; - command = command.slice(prefix.length); - - let args = message.content.split(" ").slice(1); - - if(command === 'help'){ - var embed = new Discord.RichEmbed() - .setAuthor('AleeBot '+ abVersion +' Commands', "https://cdn.discordapp.com/avatars/282547024547545109/6c147a444ae328c38145ef1f74169e38.png?size=2048") - .addField('**ab:ping** Ping Pong!', true) - .setFooter("AleeCorp Copyright 2017") - .setColor("#1fd619") - message.channel.sendEmbed(embed); - } - - if(command === 'ping'){ - message.reply("**PONG!** :ping_pong: " + Math.round(client.ping) + " ms"); - } - + + let command = message.content.split(" ")[0]; + command = command.slice(prefix.length); + + let args = message.content.split(" ").slice(1); + + if (command === 'help') { + var embed = new Discord.RichEmbed() + .setAuthor('AleeBot ' + abVersion + ' Commands', "https://cdn.discordapp.com/avatars/282547024547545109/6c147a444ae328c38145ef1f74169e38.png?size=2048") + .addField('**ab:ping** Ping Pong!', true) + .setFooter("AleeCorp Copyright 2017") + .setColor("#1fd619") + message.channel.sendEmbed(embed); + } + + if (command === 'ping') { + message.reply("**PONG!** :ping_pong: " + Math.round(client.ping) + " ms"); + } + +}); +client.login(config.abtoken).catch(function() { + console.log("[X] Login failed. Please contact Alee14#9928 or email him at alee14498@gmail.com."); }); -client.login(config.abtoken).catch(function() { - console.log("[X] Login failed. Please contact Alee14#9928 or email him at alee14498@gmail.com."); -});
\ No newline at end of file diff --git a/src/index.js b/src/index.js index 27b7f3a..93856e3 100644 --- a/src/index.js +++ b/src/index.js @@ -1,35 +1,42 @@ /********************************************* -* -* AleeBot for Discord servers -* Copyright (C) 2017 AleeCorp -* -**********************************************/ -const {app, BrowserWindow} = require('electron'); + * + * AleeBot for Discord servers + * Copyright (C) 2017 AleeCorp + * License: MIT + * + **********************************************/ +const { + app, + BrowserWindow +} = require('electron'); const path = require('path'); const url = require('url'); let win; -function createWindow(){ - win = new BrowserWindow({width:800, height:600}) - - win.loadURL(url.format({ - pathname: path.join(__dirname, 'setup.html'), - protocol: 'file:', - slashes: true - })); - - win.webContents.openDevTools(); - - win.on('closed', () => { - win = null; - }); - } - - app.on('ready', createWindow); - - app.on('window-all-closed', () => { - if(process.platform !== 'darwin'){ - app.quit(); - } - });
\ No newline at end of file +function createWindow() { + win = new BrowserWindow({ + width: 800, + height: 600 + }) + + win.loadURL(url.format({ + pathname: path.join(__dirname, 'setup.html'), + protocol: 'file:', + slashes: true + })); + + win.webContents.openDevTools(); + + win.on('closed', () => { + win = null; + }); +} + +app.on('ready', createWindow); + +app.on('window-all-closed', () => { + if (process.platform !== 'darwin') { + app.quit(); + } +}); diff --git a/src/renderer.js b/src/renderer.js new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/renderer.js diff --git a/src/setup.html b/src/setup.html index f2e4b7b..7d47b7a 100644 --- a/src/setup.html +++ b/src/setup.html @@ -1,10 +1,26 @@ +<!-- +********************************************** +* +* AleeBot for Discord servers +* Copyright (C) 2017 AleeCorp +* License: MIT +* +********************************************** +--> <!DOCTYPE HTML> <html> - <head> - </head> - <body> - <h1>Welcome to AleeBot!</h1> - <br> - <b>Please note that this isn't the final design for this setup</b> - </body> -</html>
\ No newline at end of file + +<head> +</head> + +<body> + <h1>Welcome to AleeBot!</h1> + <br> + <b>Please note that this isn't the final design for this setup</b> +</body> +<script> + const aleebot = require('bot.js') + console.log(aleebot) +</script> + +</html> |
