From 609c9acc789a412a874feb349419030b0956aa56 Mon Sep 17 00:00:00 2001 From: March 7th <71698422+aiko-chan-ai@users.noreply.github.com> Date: Sun, 25 Dec 2022 18:17:42 +0700 Subject: [PATCH] fix(User): get VoiceState from guild cache --- src/structures/User.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/structures/User.js b/src/structures/User.js index 568f690..b6a463d 100644 --- a/src/structures/User.js +++ b/src/structures/User.js @@ -229,7 +229,11 @@ class User extends Base { * @readonly */ 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) {