feat(helpers): add stickers helpers (#2466)

* 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
This commit is contained in:
LTS20050703
2022-09-22 11:31:41 -04:00
committed by GitHub
parent f0f9791ccd
commit 17132aaf61
25 changed files with 412 additions and 3 deletions
+27
View File
@@ -0,0 +1,27 @@
import { StickerFormatTypes } from "../../mod.ts";
import { assertEquals } from "../deps.ts";
import { loadBot } from "../mod.ts";
import { CACHED_COMMUNITY_GUILD_ID } from "../utils.ts";
Deno.test("[stickers] Create guild sticker", async () => {
const bot = loadBot();
const sticker = await bot.helpers.createGuildSticker(CACHED_COMMUNITY_GUILD_ID, {
name: "sticker name",
description: "sticker description",
tags: "sticker tags",
file: { blob: new Blob(), name: "test.png" },
});
assertEquals(sticker.name, "sticker name");
assertEquals(sticker.description, "sticker description");
assertEquals(sticker.tags, "sticker tags");
const channel = await bot.helpers.createChannel(CACHED_COMMUNITY_GUILD_ID);
const message = await bot.helpers.sendMessage(channel.id, { stickerIds: [sticker.id] });
assertEquals(message.stickerItems?.[0].formatType, StickerFormatTypes.Png);
assertEquals(message.stickerItems?.[0].id, sticker.id);
assertEquals(message.stickerItems?.[0].name, sticker.name);
await bot.helpers.deleteGuildSticker(CACHED_COMMUNITY_GUILD_ID, sticker.id);
});