diff options
| author | Alee14 <alee14498@gmail.com> | 2018-01-26 17:38:08 -0500 |
|---|---|---|
| committer | Alee14 <alee14498@gmail.com> | 2018-01-26 17:38:08 -0500 |
| commit | 4083aacf8c5b9cd3204faa3c788190c730e346f5 (patch) | |
| tree | 1b49637d4e832188c82f4fb674bd4ebaf373fd6c /src | |
| parent | 533bf07438478a93c498ef831f99c3c1ab93eb2f (diff) | |
| download | AleeBot-4083aacf8c5b9cd3204faa3c788190c730e346f5.tar.gz AleeBot-4083aacf8c5b9cd3204faa3c788190c730e346f5.tar.bz2 AleeBot-4083aacf8c5b9cd3204faa3c788190c730e346f5.zip | |
Added run.bat to gitignore
Diffstat (limited to 'src')
| -rw-r--r-- | src/bot_discord.js | 154 | ||||
| -rw-r--r-- | src/commands/changelog.js | 30 | ||||
| -rw-r--r-- | src/commands/git.js | 12 | ||||
| -rw-r--r-- | src/commands/help.js | 28 | ||||
| -rw-r--r-- | src/commands/ping.js | 12 | ||||
| -rw-r--r-- | src/commands/uptime.js | 36 |
6 files changed, 136 insertions, 136 deletions
diff --git a/src/bot_discord.js b/src/bot_discord.js index 174612d..9724b96 100644 --- a/src/bot_discord.js +++ b/src/bot_discord.js @@ -1,77 +1,77 @@ -/********************************************* - * - * 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 prefix = "abb:"; -const fs = require("fs"); -const config = require('./absettings.json'); -console.log(`Welcome to AleeBot NodeJS Terminal!`); - -client.commands = new Discord.Collection(); - -fs.readdir(`./commands/`, (err, files) => { - if(err) console.log(err); - - var jsfiles = files.filter(f => f.split('.').pop() === 'js'); - if(jsfiles.length <= 0) { return console.log('[X] No commands found...')} - else { console.log('[i] ' + jsfiles.length + ' commands found.') } - - jsfiles.forEach((f, i) => { - var cmds = require(`./commands/${f}`); - console.log(`[i] Command ${f} loading...`); - client.commands.set(cmds.config.command, cmds); - }) - console.log('[>] Success! All commands are loaded...') -}) - - -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: 'AleeBot '+ abVersion + ' | ' + config.prefix +'help', - 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.on("guildDelete", guild => { - - console.log(`[i] 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; - var msg = message.content; - var cont = message.content.slice(prefix.length).split(" "); - var args = cont.slice(1); - - - if (!message.content.startsWith(prefix)) return; - - var cmd = client.commands.get(cont[0]) - if (cmd) cmd.run(client, message, args); - -}); -client.login(config.abtoken).catch(function() { - console.log("[X] Login failed. Please contact Alee14#9928 or email him at alee14498@gmail.com."); -}); +/*********************************************
+ *
+ * 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 prefix = "abb:";
+const fs = require("fs");
+const config = require('./absettings.json');
+console.log(`Welcome to AleeBot NodeJS Terminal!`);
+
+client.commands = new Discord.Collection();
+
+fs.readdir(`./commands/`, (err, files) => {
+ if(err) console.log(err);
+
+ var jsfiles = files.filter(f => f.split('.').pop() === 'js');
+ if(jsfiles.length <= 0) { return console.log('[X] No commands found...')}
+ else { console.log('[i] ' + jsfiles.length + ' commands found.') }
+
+ jsfiles.forEach((f, i) => {
+ var cmds = require(`./commands/${f}`);
+ console.log(`[i] Command ${f} loading...`);
+ client.commands.set(cmds.config.command, cmds);
+ })
+ console.log('[>] Success! All commands are loaded...')
+})
+
+
+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: 'AleeBot '+ abVersion + ' | ' + config.prefix +'help',
+ 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.on("guildDelete", guild => {
+
+ console.log(`[i] 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;
+ var msg = message.content;
+ var cont = message.content.slice(prefix.length).split(" ");
+ var args = cont.slice(1);
+
+
+ if (!message.content.startsWith(prefix)) return;
+
+ var cmd = client.commands.get(cont[0])
+ if (cmd) cmd.run(client, message, args);
+
+});
+client.login(config.abtoken).catch(function() {
+ console.log("[X] Login failed. Please contact Alee14#9928 or email him at alee14498@gmail.com.");
+});
diff --git a/src/commands/changelog.js b/src/commands/changelog.js index 93efcb6..4480ba0 100644 --- a/src/commands/changelog.js +++ b/src/commands/changelog.js @@ -1,16 +1,16 @@ -module.exports.run = async (client, message, args) => { - var embed = new Discord.RichEmbed() - .setAuthor('AleeBot ' + abVersion + `Changelog`, "https://cdn.discordapp.com/avatars/282547024547545109/6c147a444ae328c38145ef1f74169e38.png?size=2048") - .setDescription("What's new in AleeBot?") - .addField("+ Rewritten command handler", true) - .addField("+ New uptime command (Thanks to Rain)", true) - .addField("? Some commands are the same from 1.x", true) - .setFooter("AleeCorp Copyright 2017") - .setColor("#1fd619") - message.channel.sendEmbed(embed); - -} - -module.exports.config = { - command: "changelog" +module.exports.run = async (client, message, args) => {
+ var embed = new Discord.RichEmbed()
+ .setAuthor('AleeBot ' + abVersion + `Changelog`, "https://cdn.discordapp.com/avatars/282547024547545109/6c147a444ae328c38145ef1f74169e38.png?size=2048")
+ .setDescription("What's new in AleeBot?")
+ .addField("+ Rewritten command handler", true)
+ .addField("+ New uptime command (Thanks to Rain)", true)
+ .addField("? Some commands are the same from 1.x", true)
+ .setFooter("AleeCorp Copyright 2017")
+ .setColor("#1fd619")
+ message.channel.sendEmbed(embed);
+
+}
+
+module.exports.config = {
+ command: "changelog"
}
\ No newline at end of file diff --git a/src/commands/git.js b/src/commands/git.js index 934ee78..63bb0a0 100644 --- a/src/commands/git.js +++ b/src/commands/git.js @@ -1,7 +1,7 @@ -module.exports.run = async (client, message, args) => { - message.author.send("I can see you want to contribute to this project.\nHere's the link: https://github.com/AleeCorp/AleeBot") - } - - module.exports.config = { - command: "git" +module.exports.run = async (client, message, args) => {
+ message.author.send("I can see you want to contribute to this project.\nHere's the link: https://github.com/AleeCorp/AleeBot")
+ }
+
+ module.exports.config = {
+ command: "git"
}
\ No newline at end of file diff --git a/src/commands/help.js b/src/commands/help.js index 54136f7..fe084cf 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -1,15 +1,15 @@ -const Discord = require('discord.js'); -module.exports.run = async (client, message, args) => { - var embed = new Discord.RichEmbed() - .setAuthor('AleeBot ' + abVersion + ` Help and on ${client.guilds.size} servers`, "https://cdn.discordapp.com/avatars/282547024547545109/6c147a444ae328c38145ef1f74169e38.png?size=2048") - .setDescription("Every command you input into AleeBot is `" + config.prefix + "`") - .addField("- General Commands", "ping\nuptime\ngit\nchangelog", true) - .setFooter("AleeCorp Copyright 2017") - .setColor("#1fd619") - message.channel.sendEmbed(embed); - -} - -module.exports.config = { - command: "help" +const Discord = require('discord.js');
+module.exports.run = async (client, message, args) => {
+ var embed = new Discord.RichEmbed()
+ .setAuthor('AleeBot ' + abVersion + ` Help and on ${client.guilds.size} servers`, "https://cdn.discordapp.com/avatars/282547024547545109/6c147a444ae328c38145ef1f74169e38.png?size=2048")
+ .setDescription("Every command you input into AleeBot is `" + config.prefix + "`")
+ .addField("- General Commands", "ping\nuptime\ngit\nchangelog", true)
+ .setFooter("AleeCorp Copyright 2017")
+ .setColor("#1fd619")
+ message.channel.sendEmbed(embed);
+
+}
+
+module.exports.config = {
+ command: "help"
}
\ No newline at end of file diff --git a/src/commands/ping.js b/src/commands/ping.js index 95a561e..3ed1702 100644 --- a/src/commands/ping.js +++ b/src/commands/ping.js @@ -1,7 +1,7 @@ -module.exports.run = async (client, message, args) => { - message.reply("**PONG!** :ping_pong: " + Math.round(client.ping) + " ms"); -} - -module.exports.config = { - command: "ping" +module.exports.run = async (client, message, args) => {
+ message.reply("**PONG!** :ping_pong: " + Math.round(client.ping) + " ms");
+}
+
+module.exports.config = {
+ command: "ping"
}
\ No newline at end of file diff --git a/src/commands/uptime.js b/src/commands/uptime.js index 737a386..99f9f50 100644 --- a/src/commands/uptime.js +++ b/src/commands/uptime.js @@ -1,19 +1,19 @@ -module.exports.run = async (client, message, args) => { - - var uptime = parseInt(client.uptime); - uptime = Math.floor(uptime / 1000); - var uptimeMinutes = Math.floor(uptime / 60); - var minutes = uptime % 60; - var hours = 0; - while (uptimeMinutes >= 60) { - hours++; - uptimeMinutes = uptimeMinutes - 60; - } - var uptimeSeconds = minutes % 60; - message.channel.send(":clock3: AleeBot has been up for " + hours + " hours, " + uptimeMinutes + " minutes, and " + uptimeSeconds + " seconds.") - -} - -module.exports.config = { - command: "uptime" +module.exports.run = async (client, message, args) => {
+
+ var uptime = parseInt(client.uptime);
+ uptime = Math.floor(uptime / 1000);
+ var uptimeMinutes = Math.floor(uptime / 60);
+ var minutes = uptime % 60;
+ var hours = 0;
+ while (uptimeMinutes >= 60) {
+ hours++;
+ uptimeMinutes = uptimeMinutes - 60;
+ }
+ var uptimeSeconds = minutes % 60;
+ message.channel.send(":clock3: AleeBot has been up for " + hours + " hours, " + uptimeMinutes + " minutes, and " + uptimeSeconds + " seconds.")
+
+}
+
+module.exports.config = {
+ command: "uptime"
}
\ No newline at end of file |
