Create a new GuildAssets Method handler
Usually SnowTransfer creates a method handler for you, this is here for completion
You can access the methods listed via client.guildAssets.method, where client is an initialized SnowTransfer instance
request handler that calls the rest api
Create a new Emoji
| Permissions needed | Condition |
|---|---|
| MANAGE_EMOJIS_AND_STICKERS | always |
// upload a simple png emoji with a name of "niceEmoji"
const client = new SnowTransfer("TOKEN")
const fileData = fs.readFileSync("nice_emoji.png") // You should probably use fs.readFile, since it is asynchronous, synchronous methods pause the thread.
const emojiData = {
name: "niceEmoji",
image: data:image/png;base64,${fileData.toString("base64")} // base64 data url: data:mimetype;base64,base64String
}
client.guildAssets.createEmoji("guild id", emojiData)
Id of the guild
Emoji data, check the example
Create a guild sticker
| Permissions needed | Condition |
|---|---|
| MANAGE_EMOJIS_AND_STICKERS | always |
| Guild Features needed | Condition |
|---|---|
| VERIFIED or PARTNERED | If CurrentUser tries to create a LOTTIE sticker |
// Creates a LOTTIE sticker
const client = new SnowTransfer("TOKEN")
const fileData = fs.readFileSync("nice_sticker.json") // You should probably use fs.readFile, since it is asynchronous, synchronous methods pause the thread.
const stickerData = {
name: "niceSticker",
file: fileData,
description: "A very nice sticker",
tags: ["nice", "sticker"],
reason: "because it was nice"
}
const sticker = await client.guildAssets.createGuildSticker("guild id", stickerData)
Id of the guild
Sticker data
Delete an emoji
Resolves the Promise on successful execution
| Permissions needed | Condition |
|---|---|
| MANAGE_EMOJIS_AND_STICKERS | always |
// Deletes an emoji because it wasn't nice
const client = new SnowTransfer("TOKEN")
client.guildAssets.deleteEmoji("guild id", "emoji id", "wasn't nice")
Id of the guild
Id of the emoji
Optional reason: stringReason for deleting the emoji
Delete a guild sticker
Resolves the Promise on successful execution
| Permissions needed | Condition |
|---|---|
| MANAGE_EMOJIS_AND_STICKERS | always |
// Deletes a sticker because it was too nice
const client = new SnowTransfer("TOKEN")
client.guildAssets.deleteGuildSticker("guild id", "sticker id", "It was too nice")
Id of the guild
Id of the sticker
Optional reason: stringGet an emoji via guildId + emojiId
const client = new SnowTransfer("TOKEN")
const emoji = await client.guildAssets.getEmoji("guild id", "emoji id")
Id of the guild
Id of the emoji
Get a list of emojis of a guild
Array of emoji objects
const client = new SnowTransfer("TOKEN")
const emojis = await client.guildAssets.getEmojis("guild id")
Id of the guild
Get a guild sticker
| Permissions needed | Condition |
|---|---|
| MANAGE_EMOJIS_AND_STICKERS | if the CurrentUser desires the user field |
const client = new SnowTransfer("TOKEN")
const sticker = await client.guildAssets.getGuildSticker("guild id", "sticker id")
Id of the guild
Id of the sticker
Get all guild stickers
An Array of sticker objects
| Permissions needed | Condition |
|---|---|
| MANAGE_EMOJIS_AND_STICKERS | if the CurrentUser desires the user field |
const client = new SnowTransfer("TOKEN")
const stickers = await client.guildAssets.getGuildStickers("guild id")
Id of the guild
Update an existing emoji
| Permissions needed | Condition |
|---|---|
| MANAGE_EMOJIS_AND_STICKERS | always |
// Change the name of an existing emoji to "niceEmote"
const client = new SnowTransfer("TOKEN")
const emojiData = {
name: "niceEmote"
}
client.guildAssets.updateEmoji("guild id", "emoji id", emojiData)
Id of the guild
Id of the emoji
Emoji data
Optional name?: stringOptional reason?: stringOptional roles?: null | string[]Update a guild sticker
| Permissions needed | Condition |
|---|---|
| MANAGE_EMOJIS_AND_STICKERS | always |
// Updates a sticker's name to "nicerSticker"
const client = new SnowTransfer("TOKEN")
const sticker = await client.guildAssets.updateGuildSticker("guild id", "sticker id", { name: "nicerSticker", reason: "because it was nicer" })
Id of the guild
Id of the sticker
Sticker data
Optional description?: null | stringOptional name?: stringOptional reason?: stringOptional tags?: stringGenerated using TypeDoc
Methods for interacting with emojis