feat: VoiceChannel.setVoiceState (#186)

* feat: threads methods

* fix: typing

* fix: fixes

* feat: setVoiceState

* fix: return promise
This commit is contained in:
Marcos Susaña 2024-04-19 14:06:55 -04:00 committed by GitHub
parent 989efb172e
commit f9cc5da7cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 0 deletions

View File

@ -253,5 +253,8 @@ export interface ChannelRoutes {
args: RestArguments<ProxyRequestMethod.Post, RESTPostAPIChannelWebhookJSONBody>,
): Promise<RESTPostAPIChannelWebhookResult>;
};
'voice-status': {
put(args: RestArguments<ProxyRequestMethod.Put, { status: string | null }>): Promise<never>;
};
};
}

View File

@ -183,6 +183,10 @@ export class ChannelShorter extends BaseShorter {
query,
});
}
setVoiceStatus(channelId: string, status: string | null = null) {
return this.client.proxy.channels(channelId)['voice-status'].put({ body: { status } });
}
}
export type ChannelShorterOptionalParams = Partial<{ guildId: string; reason: string }>;

View File

@ -352,6 +352,10 @@ export class VoiceChannelMethods extends DiscordBase {
return this.edit({ video_quality_mode: VideoQualityMode[quality] }, reason);
}
setVoiceState(status: string | null = null) {
return this.client.channels.setVoiceStatus(this.id, status);
}
async states() {
if (!this.guildId) return [];
const states = await this.cache.voiceStates?.values(this.guildId);