mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +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,4 +1,4 @@
|
||||
import type { REST } from '@discordjs/rest';
|
||||
import type { RequestData, REST } from '@discordjs/rest';
|
||||
import {
|
||||
Routes,
|
||||
type RESTGetAPIStickerResult,
|
||||
@@ -13,9 +13,10 @@ export class StickersAPI {
|
||||
* Fetches all of the nitro sticker packs
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/sticker#list-nitro-sticker-packs}
|
||||
* @param options - The options to use when fetching the sticker packs
|
||||
*/
|
||||
public async getNitroStickers() {
|
||||
return this.rest.get(Routes.nitroStickerPacks()) as Promise<RESTGetNitroStickerPacksResult>;
|
||||
public async getNitroStickers({ signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
return this.rest.get(Routes.nitroStickerPacks(), { signal }) as Promise<RESTGetNitroStickerPacksResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,8 +24,9 @@ export class StickersAPI {
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/sticker#get-sticker}
|
||||
* @param stickerId - The id of the sticker
|
||||
* @param options - The options to use when fetching the sticker
|
||||
*/
|
||||
public async get(stickerId: Snowflake) {
|
||||
return this.rest.get(Routes.sticker(stickerId)) as Promise<RESTGetAPIStickerResult>;
|
||||
public async get(stickerId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
return this.rest.get(Routes.sticker(stickerId), { signal }) as Promise<RESTGetAPIStickerResult>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user