mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 20:46:08 +00:00
feat(VoiceState): setSuppress, requestSpeak (#212)
* feat: setSuppress, requestSpeak * fix: assing * fix: never * fix: set request timestamp
This commit is contained in:
parent
6547f71b1f
commit
ef5370462b
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user