mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
refactor(core): move setVoiceState to GuildsAPI (#9228)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import type { RawFile } from '@discordjs/rest';
|
||||
import { makeURLSearchParams, type REST } from '@discordjs/rest';
|
||||
import type {
|
||||
RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody,
|
||||
RESTPatchAPIGuildVoiceStateCurrentMemberResult,
|
||||
} from 'discord-api-types/v10';
|
||||
import {
|
||||
Routes,
|
||||
type GuildMFALevel,
|
||||
@@ -976,4 +980,17 @@ export class GuildsAPI {
|
||||
public async getWebhooks(id: Snowflake) {
|
||||
return this.rest.get(Routes.guildWebhooks(id)) as Promise<RESTGetAPIGuildWebhooksResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the voice state for the current user
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state}
|
||||
* @param guildId - The id of the guild
|
||||
* @param options - The options to use when setting the voice state
|
||||
*/
|
||||
public async setVoiceState(guildId: Snowflake, options: RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody = {}) {
|
||||
return this.rest.patch(Routes.guildVoiceState(guildId, '@me'), {
|
||||
body: options,
|
||||
}) as Promise<RESTPatchAPIGuildVoiceStateCurrentMemberResult>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user