mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-01 16:30:08 +00:00
* helpers: add stickers helpers * deno fmt * undo move getNitroStickerPack to stickers * helpers/stickers: fix jsdocs * plugins/permissions: check stickers permissions * plugins/validations: validate stickers stuff * tests: stickers unit tests * helpers/stickers: add support for reason * plugins/permissions: MANAGE_EMOJIS -> MANAGE_EMOJIS_AND_STICKERS * tests/stickers: delete sticker after test createGuildSticker: add send sticker test getGuildStickers: create another sticker then test > 1 stickers
28 lines
935 B
TypeScript
28 lines
935 B
TypeScript
import { Bot } from "../../bot.ts";
|
|
import { StickerPack } from "../../transformers/sticker.ts";
|
|
import { DiscordStickerPack } from "../../types/discord.ts";
|
|
import { Collection } from "../../util/collection.ts";
|
|
|
|
/**
|
|
* Returns the list of sticker packs available to Nitro subscribers.
|
|
*
|
|
* @param bot The bot instance to use to make the request.
|
|
* @returns A collection of {@link StickerPack} objects assorted by sticker ID.
|
|
*
|
|
* @see {@link https://discord.com/developers/docs/resources/sticker#list-nitro-sticker-packs}
|
|
*/
|
|
export async function getNitroStickerPacks(bot: Bot): Promise<Collection<bigint, StickerPack>> {
|
|
const results = await bot.rest.runMethod<DiscordStickerPack[]>(
|
|
bot.rest,
|
|
"GET",
|
|
bot.constants.routes.NITRO_STICKER_PACKS(),
|
|
);
|
|
|
|
return new Collection(
|
|
results.map((result) => {
|
|
const pack = bot.transformers.stickerPack(bot, result);
|
|
return [pack.id, pack];
|
|
}),
|
|
);
|
|
}
|