refactor: remove typing caching (#6114)

Co-authored-by: DTrombett <73136330+DTrombett@users.noreply.github.com>
This commit is contained in:
Antonio Román
2021-07-16 13:20:05 +02:00
committed by GitHub
parent 4206e35b23
commit 576eee8de2
13 changed files with 140 additions and 200 deletions

View File

@@ -159,34 +159,6 @@ class User extends Base {
return typeof this.username === 'string' ? `${this.username}#${this.discriminator}` : null;
}
/**
* Checks whether the user is typing in a channel.
* @param {ChannelResolvable} channel The channel to check in
* @returns {boolean}
*/
typingIn(channel) {
return this.client.channels.resolve(channel)._typing.has(this.id);
}
/**
* Gets the time that the user started typing.
* @param {ChannelResolvable} channel The channel to get the time in
* @returns {?Date}
*/
typingSinceIn(channel) {
channel = this.client.channels.resolve(channel);
return channel._typing.has(this.id) ? new Date(channel._typing.get(this.id).since) : null;
}
/**
* Gets the amount of time the user has been typing in a channel for (in milliseconds), or -1 if they're not typing.
* @param {ChannelResolvable} channel The channel to get the time in
* @returns {number}
*/
typingDurationIn(channel) {
return this.client.channels.resolve(channel)._typing.get(this.id)?.elapsedTime ?? -1;
}
/**
* The DM between the client's user and this user
* @type {?DMChannel}