sendTyping, setStatus, and channel position

This commit is contained in:
abalabahaha
2015-11-15 11:45:35 -08:00
parent 2e498c82a0
commit 7af104a892
3 changed files with 122 additions and 4 deletions

View File

@@ -29,11 +29,19 @@ class Client extends EventEmitter {
get privateChannels(){
return this.internal.private_channels;
}
get voiceConnection(){
return this.internal.voiceConnection;
}
get readyTime(){
return this.internal.readyTime;
}
get uptime(){
return this.internal.uptime;
}
// def login
login(email, password, cb = function (err, token) { }) {
var self = this;
@@ -497,6 +505,50 @@ class Client extends EventEmitter {
});
}
//def setStatus
setStatus(idleStatus, gameID, callback=function(err){}){
var self = this;
return new Promise((resolve, reject) => {
if (typeof gameID === "function") {
// gameID is the callback
callback = gameID;
}
else if (typeof idleStatus === "function") {
// idleStatus is the callback
callback = idleStatus;
}
self.internal.setStatus(idleStatus, gameID)
.then(() => {
callback();
resolve();
})
.catch(e => {
callback(e);
reject(e);
});
})
}
//def sendTyping
sendTyping(channel, callback=function(err){}){
var self = this;
return new Promise((resolve, reject) => {
self.internal.sendTyping(channel)
.then(() => {
callback();
resolve();
})
.catch(e => {
callback(e);
reject(e);
});
})
}
// def setTopic
setTopic(channel, topic, callback=function(err){}){
var self = this;