Class GuildAssetsMethods

Methods for interacting with emojis

Hierarchy

  • GuildAssetsMethods

Constructors

  • 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

    Parameters

    • requestHandler: RequestHandler

      request handler that calls the rest api

    Returns GuildAssetsMethods

Methods

  • Create a new Emoji

    Returns

    Emoji object

    Permissions needed Condition
    MANAGE_EMOJIS_AND_STICKERS always

    Example

    // 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)

    Parameters

    • guildId: string

      Id of the guild

    • data: CreateEmojiData

      Emoji data, check the example

    Returns Promise<Emoji>

  • Create a guild sticker

    Returns

    A sticker object

    Permissions needed Condition
    MANAGE_EMOJIS_AND_STICKERS always
    Guild Features needed Condition
    VERIFIED or PARTNERED If CurrentUser tries to create a LOTTIE sticker

    Example

    // 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)

    Parameters

    Returns Promise<Sticker>

  • Delete an emoji

    Returns

    Resolves the Promise on successful execution

    Permissions needed Condition
    MANAGE_EMOJIS_AND_STICKERS always

    Example

    // Deletes an emoji because it wasn't nice
    const client = new SnowTransfer("TOKEN")
    client.guildAssets.deleteEmoji("guild id", "emoji id", "wasn't nice")

    Parameters

    • guildId: string

      Id of the guild

    • emojiId: string

      Id of the emoji

    • Optional reason: string

      Reason for deleting the emoji

    Returns Promise<void>

  • Delete a guild sticker

    Returns

    Resolves the Promise on successful execution

    Permissions needed Condition
    MANAGE_EMOJIS_AND_STICKERS always

    Example

    // Deletes a sticker because it was too nice
    const client = new SnowTransfer("TOKEN")
    client.guildAssets.deleteGuildSticker("guild id", "sticker id", "It was too nice")

    Parameters

    • guildId: string

      Id of the guild

    • stickerId: string

      Id of the sticker

    • Optional reason: string

    Returns Promise<void>

  • Get an emoji via guildId + emojiId

    Returns

    Emoji object

    Example

    const client = new SnowTransfer("TOKEN")
    const emoji = await client.guildAssets.getEmoji("guild id", "emoji id")

    Parameters

    • guildId: string

      Id of the guild

    • emojiId: string

      Id of the emoji

    Returns Promise<Emoji>

  • Get a list of emojis of a guild

    Returns

    Array of emoji objects

    Example

    const client = new SnowTransfer("TOKEN")
    const emojis = await client.guildAssets.getEmojis("guild id")

    Parameters

    • guildId: string

      Id of the guild

    Returns Promise<Emoji[]>

  • Get a guild sticker

    Returns

    A sticker object

    Permissions needed Condition
    MANAGE_EMOJIS_AND_STICKERS if the CurrentUser desires the user field

    Example

    const client = new SnowTransfer("TOKEN")
    const sticker = await client.guildAssets.getGuildSticker("guild id", "sticker id")

    Parameters

    • guildId: string

      Id of the guild

    • stickerId: string

      Id of the sticker

    Returns Promise<Sticker>

  • Get all guild stickers

    Returns

    An Array of sticker objects

    Permissions needed Condition
    MANAGE_EMOJIS_AND_STICKERS if the CurrentUser desires the user field

    Example

    const client = new SnowTransfer("TOKEN")
    const stickers = await client.guildAssets.getGuildStickers("guild id")

    Parameters

    • guildId: string

      Id of the guild

    Returns Promise<Sticker[]>

  • Get a global sticker

    Returns

    Sticker object

    Example

    const client = new SnowTransfer("TOKEN")
    const sticker = await client.guildAssets.getSticker("sticker id")

    Parameters

    • stickerId: string

      Id of the sticker

    Returns Promise<Sticker>

  • Update an existing emoji

    Returns

    Emoji object

    Permissions needed Condition
    MANAGE_EMOJIS_AND_STICKERS always

    Example

    // 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)

    Parameters

    • guildId: string

      Id of the guild

    • emojiId: string

      Id of the emoji

    • data: {
          name?: string;
          reason?: string;
          roles?: null | string[];
      }

      Emoji data

      • Optional name?: string
      • Optional reason?: string
      • Optional roles?: null | string[]

    Returns Promise<Emoji>

  • Update a guild sticker

    Returns

    A sticker object

    Permissions needed Condition
    MANAGE_EMOJIS_AND_STICKERS always

    Example

    // 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" })

    Parameters

    • guildId: string

      Id of the guild

    • stickerId: string

      Id of the sticker

    • data: {
          description?: null | string;
          name?: string;
          reason?: string;
          tags?: string;
      }

      Sticker data

      • Optional description?: null | string
      • Optional name?: string
      • Optional reason?: string
      • Optional tags?: string

    Returns Promise<Sticker>

Properties

requestHandler: RequestHandler

Generated using TypeDoc