mirror of
https://github.com/discordjs/discord.js.git
synced 2026-05-31 16:10:08 +00:00
docs(stickers): reveal link Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
46 lines
1.5 KiB
TypeScript
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>;
|
|
}
|
|
}
|