mirror of
https://github.com/danbulant/discord.js
synced 2026-07-08 20:51:14 +00:00
added parameter for optional stopTypeTime in startTyping
This commit is contained in:
parent
c32f600a6a
commit
a70d6f9b32
3 changed files with 15 additions and 8 deletions
|
|
@ -1728,7 +1728,7 @@ var Client = (function () {
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: "startTyping",
|
key: "startTyping",
|
||||||
value: function startTyping(chann) {
|
value: function startTyping(chann, stopTypeTime) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.resolveDestination(chann).then(next);
|
this.resolveDestination(chann).then(next);
|
||||||
|
|
@ -1747,6 +1747,12 @@ var Client = (function () {
|
||||||
var interval = setInterval(fn, 3000);
|
var interval = setInterval(fn, 3000);
|
||||||
|
|
||||||
self.typingIntervals[channel] = interval;
|
self.typingIntervals[channel] = interval;
|
||||||
|
|
||||||
|
if (stopTypeTime) {
|
||||||
|
setTimeout(function () {
|
||||||
|
self.stopTyping(channel);
|
||||||
|
}, stopTypeTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
|
|
||||||
|
|
@ -1469,7 +1469,7 @@ class Client {
|
||||||
this.setStatusIdle();
|
this.setStatusIdle();
|
||||||
}
|
}
|
||||||
|
|
||||||
startTyping(chann){
|
startTyping(chann, stopTypeTime){
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.resolveDestination(chann).then(next);
|
this.resolveDestination(chann).then(next);
|
||||||
|
|
@ -1491,6 +1491,12 @@ class Client {
|
||||||
var interval = setInterval(fn, 3000);
|
var interval = setInterval(fn, 3000);
|
||||||
|
|
||||||
self.typingIntervals[channel] = interval;
|
self.typingIntervals[channel] = interval;
|
||||||
|
|
||||||
|
if(stopTypeTime){
|
||||||
|
setTimeout(function(){
|
||||||
|
self.stopTyping(channel);
|
||||||
|
}, stopTypeTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,7 @@ mybot.on("message", function (message) {
|
||||||
|
|
||||||
var onlineUsers = 0;
|
var onlineUsers = 0;
|
||||||
|
|
||||||
mybot.startTyping(message.channel);
|
mybot.startTyping(message.channel, 6000);
|
||||||
|
|
||||||
setTimeout(function(){
|
|
||||||
mybot.reply(message, "stopping now k");
|
|
||||||
mybot.stopTyping(message.channel);
|
|
||||||
}, 6000);
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue