diff --git a/src/structures/VoiceState.ts b/src/structures/VoiceState.ts index 6ed6c4c..de52e31 100644 --- a/src/structures/VoiceState.ts +++ b/src/structures/VoiceState.ts @@ -22,7 +22,7 @@ export class VoiceState extends Base { } async member(force?: boolean) { - return (this.withMember ??= await this.client.members.fetch(this.guildId, this.userId, force)); + return (this.withMember = await this.client.members.fetch(this.guildId, this.userId, force)); } async user(force?: boolean) { @@ -48,6 +48,24 @@ export class VoiceState extends Base { }); } + async setSuppress(suppress = !this.suppress) { + await this.client.proxy.guilds(this.guildId)['voice-states']['@me'].patch({ + body: { suppress }, + }); + this.suppress = suppress; + } + + async requestSpeak(date: string | Date = new Date()) { + if (typeof date === 'string') date = new Date(date); + if (Number.isNaN(date)) return Promise.reject('Invalid date'); + date = date.toISOString(); + + await this.client.proxy.guilds(this.guildId)['voice-states']['@me'].patch({ + body: { request_to_speak_timestamp: date }, + }); + this.requestToSpeakTimestamp = date; + } + async disconnect(reason?: string) { return this.setChannel(null, reason); }