mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 16:57:22 +00:00
* tests: fix stickers test * tests: fix stickers size must be 320x320 * deno fmt * Update README.md Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
45 lines
1.6 KiB
TypeScript
45 lines
1.6 KiB
TypeScript
import { Bot } from "../../bot.ts";
|
|
import { Sticker } from "../../transformers/sticker.ts";
|
|
import { FileContent, WithReason } from "../../types/discordeno.ts";
|
|
|
|
/**
|
|
* Create a new sticker for the guild.
|
|
*
|
|
* @param bot The bot instance to use to make the request.
|
|
* @param guildId The ID of the guild to get
|
|
* @return A {@link Sticker}
|
|
*
|
|
* @remarks
|
|
* Requires the `MANAGE_EMOJIS_AND_STICKERS` permission.
|
|
* Fires a Guild Stickers Update Gateway event.
|
|
* Every guilds has five free sticker slots by default, and each Boost level will grant access to more slots.
|
|
* Lottie stickers can only be uploaded on guilds that have either the `VERIFIED` and/or the `PARTNERED` guild feature.
|
|
*
|
|
* @see {@link https://discord.com/developers/docs/resources/sticker#create-guild-sticker}
|
|
*/
|
|
export async function createGuildSticker(
|
|
bot: Bot,
|
|
guildId: bigint,
|
|
options: CreateGuildStickerOptions,
|
|
): Promise<Sticker> {
|
|
const result = await bot.rest.runMethod(bot.rest, "POST", bot.constants.routes.GUILD_STICKERS(guildId), {
|
|
name: options.name,
|
|
description: options.description,
|
|
tags: options.tags,
|
|
file: options.file,
|
|
reason: options.reason,
|
|
});
|
|
return bot.transformers.sticker(bot, result);
|
|
}
|
|
|
|
export interface CreateGuildStickerOptions extends WithReason {
|
|
/** Name of the sticker (2-30 characters) */
|
|
name: string;
|
|
/** Description of the sticker (empty or 2-100 characters) */
|
|
description: string;
|
|
/** Autocomplete/suggestion tags for the sticker (max 200 characters) */
|
|
tags: string;
|
|
/** The sticker file to upload, must be a PNG, APNG, or Lottie JSON file, max 500 KB */
|
|
file: FileContent;
|
|
}
|