Added promises and logout

This commit is contained in:
hydrabolt
2015-08-25 11:49:59 +01:00
parent f2e3be0bad
commit 15f995c07c
3 changed files with 181 additions and 136 deletions

View File

@@ -2,36 +2,40 @@ var Discord = require("../lib/index.js");
var Auth = require("./auth.json");
var mybot = new Discord.Client();
mybot.login(Auth.email, Auth.password, function(err, res){
});
mybot.login(Auth.email+"a", Auth.password)
mybot.on("ready", function(){
.then(function (token) {
console.log("wooo!");
}).catch(function (error) {
console.log(error);
});
mybot.on("ready", function () {
console.log("Ready!");
})
mybot.on("message", function(msg){
console.log("Another message by "+msg.author.username+"... now I have "+mybot.messages.length + " I have been online for " + mybot.uptime);
mybot.on("message", function (msg) {
console.log("Another message by " + msg.author.username + "... now I have " + mybot.messages.length + " I have been online for " + mybot.uptime);
})
mybot.on("messageDelete", function(channel, message){
console.log("MESSAGE WAS DELETED BY " + ( message ? message.author.username : channel.name ));
mybot.on("messageDelete", function (channel, message) {
console.log("MESSAGE WAS DELETED BY " + (message ? message.author.username : channel.name));
});
mybot.on("messageUpdate", function(message, formerMessage){
mybot.on("messageUpdate", function (message, formerMessage) {
console.log(message.author.username, "changed", formerMessage.content, "to", message.content);
});
mybot.on("serverNewMember", function(user){
mybot.on("serverNewMember", function (user) {
console.log("new user", user.username);
});
mybot.on("serverRemoveMember", function(user){
mybot.on("serverRemoveMember", function (user) {
console.log("left user", user.username);
});
mybot.on("userUpdate", function(oldUser, newUser){
mybot.on("userUpdate", function (oldUser, newUser) {
console.log(oldUser, "vs", newUser);
});