fix(User): get VoiceState from guild cache

This commit is contained in:
March 7th 2022-12-25 18:17:42 +07:00
parent ebdd92240b
commit 609c9acc78

View File

@ -229,7 +229,11 @@ class User extends Base {
* @readonly * @readonly
*/ */
get voice() { get voice() {
return this.client.voiceStates.cache.get(this.id) ?? new VoiceState({ client: this.client }, { user_id: this.id }); return (
this.client.voiceStates.cache.get(this.id) ??
this.client.guilds.cache.find(g => g?.voiceStates?.cache?.get(this.id))?.voiceStates?.cache?.get(this.id) ??
new VoiceState({ client: this.client }, { user_id: this.id })
);
} }
_ProfilePatch(data) { _ProfilePatch(data) {