mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 18:13:29 +01:00
feat(core): Add AbortSignal support. (#9042)
* feat: add abort signal to guilds api * feat: add to application commands, channels, and users classes * chore: finish up * chore: centralize types * chore: make requested changes * chore: make requested changes * refactor: consistently use empty objects * Update packages/core/src/api/webhook.ts Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> * chore: make requested changes * refactor: update `setVoiceState` after rebase * chore: requested changes * refactor: use -types interface for query --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { REST } from '@discordjs/rest';
|
||||
import { Routes, type GetAPIVoiceRegionsResult } from 'discord-api-types/v10';
|
||||
import type { RequestData, REST } from '@discordjs/rest';
|
||||
import { Routes, type RESTGetAPIVoiceRegionsResult } from 'discord-api-types/v10';
|
||||
|
||||
export class VoiceAPI {
|
||||
public constructor(private readonly rest: REST) {}
|
||||
@@ -8,8 +8,9 @@ export class VoiceAPI {
|
||||
* Fetches all voice regions
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/voice#list-voice-regions}
|
||||
* @param options - The options to use when fetching the voice regions
|
||||
*/
|
||||
public async getVoiceRegions() {
|
||||
return this.rest.get(Routes.voiceRegions()) as Promise<GetAPIVoiceRegionsResult>;
|
||||
public async getVoiceRegions({ signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
return this.rest.get(Routes.voiceRegions(), { signal }) as Promise<RESTGetAPIVoiceRegionsResult>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user