summaryrefslogtreecommitdiff
path: root/bot_discord.js
diff options
context:
space:
mode:
authorAlee <alee14498@gmail.com>2018-07-11 22:44:14 -0400
committerAlee <alee14498@gmail.com>2018-07-11 22:44:14 -0400
commitd37c1ce1cf30dbd1be9e2436e6e84bf91d09eb74 (patch)
treeeebb42ba983fa8eca7e4f0a9b7de9fe0c69b0cab /bot_discord.js
parentac2c40b0eb76dc462462d129982217cd0c47178b (diff)
downloadAleeBot-d37c1ce1cf30dbd1be9e2436e6e84bf91d09eb74.tar.gz
AleeBot-d37c1ce1cf30dbd1be9e2436e6e84bf91d09eb74.tar.bz2
AleeBot-d37c1ce1cf30dbd1be9e2436e6e84bf91d09eb74.zip
Added some bot events and exit the process if AB can't find token
Diffstat (limited to 'bot_discord.js')
-rw-r--r--bot_discord.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/bot_discord.js b/bot_discord.js
index 775a1e7..3b6f0fa 100644
--- a/bot_discord.js
+++ b/bot_discord.js
@@ -64,12 +64,14 @@ if (process.argv.indexOf("--debug") == -1) {
if (process.argv.indexOf("--beta") == -1) {
client.login(api.abtoken).catch(function() {
- log('[X] Login failed. The token that you put in is invalid, please put in a new one...'.red);
+ console.log('[X] Login failed. The token that you put in is invalid, please put in a new one...'.red);
+ process.exit(0);
});
} else {
client.login(api.abbtoken).catch(function() {
- log('[X] Login failed. The token that you put in is invalid, please put in a new one...'.red);
+ console.log('[X] Login failed. The token that you put in is invalid, please put in a new one...'.red);
+ process.exit(0);
});
}
@@ -315,7 +317,11 @@ process.on('unhandledRejection', function(err, p) {
log("[X | UNCAUGHT PROMISE] " + err.stack.red);
});
-
-process.on('uncaughtException', function (exception) {
- log("[X | UNCAUGHT EXCEPTION]" + exception.red);
+client.on('reconnecting', function() {
+ log("[!] AleeBot has disconnected from Discord and is now attempting to reconnect.".yellow);
});
+
+client.on('disconnect', function() {
+ log("[X] AleeBot has disconnected from Discord and will not attempt to reconnect.".red);
+ console.log("At this point, you'll need to restart AleeBot.".red);
+}); \ No newline at end of file