mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +01:00
Added startTyping and stopTyping
This commit is contained in:
@@ -43,7 +43,7 @@ var Client = (function () {
|
||||
this.user = null;
|
||||
this.alreadySentData = false;
|
||||
this.serverCreateListener = {};
|
||||
|
||||
this.typingIntervals = {};
|
||||
this.email = "abc";
|
||||
this.password = "abc";
|
||||
|
||||
@@ -1354,7 +1354,7 @@ var Client = (function () {
|
||||
op: 2,
|
||||
d: {
|
||||
token: this.token,
|
||||
v: 2,
|
||||
v: 3,
|
||||
properties: {
|
||||
"$os": "discord.js",
|
||||
"$browser": "discord.js",
|
||||
@@ -1666,6 +1666,47 @@ var Client = (function () {
|
||||
value: function setStatusAway() {
|
||||
this.setStatusIdle();
|
||||
}
|
||||
}, {
|
||||
key: "startTyping",
|
||||
value: function startTyping(chann) {
|
||||
var self = this;
|
||||
|
||||
this.resolveDestination(chann).then(next);
|
||||
|
||||
function next(channel) {
|
||||
if (self.typingIntervals[channel]) {
|
||||
return;
|
||||
}
|
||||
|
||||
var fn = function fn() {
|
||||
console.log(Endpoints.CHANNELS + "/" + channel + "/typing");
|
||||
request.post(Endpoints.CHANNELS + "/" + channel + "/typing").set("authorization", self.token).end();
|
||||
};
|
||||
|
||||
fn();
|
||||
|
||||
var interval = setInterval(fn, 3000);
|
||||
|
||||
self.typingIntervals[channel] = interval;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "stopTyping",
|
||||
value: function stopTyping(chann) {
|
||||
var self = this;
|
||||
|
||||
this.resolveDestination(chann).then(next);
|
||||
|
||||
function next(channel) {
|
||||
if (!self.typingIntervals[channel]) {
|
||||
return;
|
||||
}
|
||||
|
||||
clearInterval(self.typingIntervals[channel]);
|
||||
|
||||
delete self.typingIntervals[channel];
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "setStatus",
|
||||
value: function setStatus(stat) {
|
||||
|
||||
Reference in New Issue
Block a user