Files
discord.js/packages/core/src/api/sticker.ts
Jiralite 332b624aed docs(stickers): Reveal link in the website (#9870)
docs(stickers): reveal link

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-10 13:19:52 +00:00

46 lines
1.5 KiB
TypeScript

/* eslint-disable jsdoc/check-param-names */
import type { RequestData, REST } from '@discordjs/rest';
import {
Routes,
type RESTGetAPIStickerResult,
type RESTGetStickerPacksResult,
type Snowflake,
} from 'discord-api-types/v10';
export class StickersAPI {
public constructor(private readonly rest: REST) {}
/**
* Fetches all of the sticker packs
*
* @see {@link https://discord.com/developers/docs/resources/sticker#list-sticker-packs}
* @param options - The options for fetching the sticker packs
*/
public async getStickers({ signal }: Pick<RequestData, 'signal'> = {}) {
return this.rest.get(Routes.stickerPacks(), { signal }) as Promise<RESTGetStickerPacksResult>;
}
/**
* Fetches all of the sticker packs
*
* @see {@link https://discord.com/developers/docs/resources/sticker#list-sticker-packs}
* @param options - The options for fetching the sticker packs
* @deprecated Use {@link StickersAPI.getStickers} instead.
*/
public async getNitroStickers(options: Pick<RequestData, 'signal'> = {}) {
return this.getStickers(options);
}
/**
* Fetches a sticker
*
* @see {@link https://discord.com/developers/docs/resources/sticker#get-sticker}
* @param stickerId - The id of the sticker
* @param options - The options for fetching the sticker
*/
public async get(stickerId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
return this.rest.get(Routes.sticker(stickerId), { signal }) as Promise<RESTGetAPIStickerResult>;
}
}