Skip to content

GuildStickerManager

classe · Source

Manages API methods for Guild Stickers and stores their cache.

Extends: CachedManager

Properties

guild

guild: Guild

The guild this manager belongs to Source

cache

cache: Collection<Snowflake, Sticker>

The cache of Guild Stickers Source

_cache

readonly · private

_cache: Collection

The private cache of items for this manager. Source

holds

readonly · private

holds: function

The data structure belonging to this manager. Source

client

readonly

client: Client

The client that instantiated this Manager Source

Methods

create

async

async create(file: BufferResolvable | Stream | FileOptions | MessageAttachment, name: string, tags: string, options?: GuildStickerCreateOptions): Promise<Sticker>

Creates a new custom sticker in the guild. Parameters

NameTypeDescription
fileBufferResolvable | Stream | FileOptions | MessageAttachmentThe file for the sticker
namestringThe name for the sticker
tagsstringThe Discord name of a unicode emoji representing the sticker's expression
options?GuildStickerCreateOptionsOptions

Returns: Promise<Sticker> — The created sticker

js
// Create a new sticker from a URL
guild.stickers.create('https://i.imgur.com/w3duR07.png', 'rip', 'headstone')
  .then(sticker => console.log(`Created new sticker with name ${sticker.name}!`))
  .catch(console.error);
js
// Create a new sticker from a file on your computer
guild.stickers.create('./memes/banana.png', 'banana', 'banana')
  .then(sticker => console.log(`Created new sticker with name ${sticker.name}!`))
  .catch(console.error);

Source

resolve

resolve(sticker: StickerResolvable): Sticker

Resolves a StickerResolvable to a Sticker object. Parameters

NameTypeDescription
stickerStickerResolvableThe Sticker resolvable to identify

Returns: StickerSource

resolveId

resolveId(sticker: StickerResolvable): Snowflake

Resolves a StickerResolvable to a Sticker id string. Parameters

NameTypeDescription
stickerStickerResolvableThe Sticker resolvable to identify

Returns: SnowflakeSource

edit

async

async edit(sticker: StickerResolvable, data?: GuildStickerEditData, reason?: string): Promise<Sticker>

Edits a sticker. Parameters

NameTypeDescription
stickerStickerResolvableThe sticker to edit
data?GuildStickerEditDataThe new data for the sticker
reason?stringReason for editing this sticker

Returns: Promise<Sticker>Source

delete

async

async delete(sticker: StickerResolvable, reason?: string): Promise<void>

Deletes a sticker. Parameters

NameTypeDescription
stickerStickerResolvableThe sticker to delete
reason?stringReason for deleting this sticker

Returns: Promise<void>Source

fetch

async

async fetch(id?: Snowflake, options?: BaseFetchOptions): Promise<(Sticker|Collection<Snowflake, Sticker>)>

Obtains one or more stickers from Discord, or the sticker cache if they're already available. Parameters

NameTypeDescription
id?SnowflakeThe Sticker's id
options?BaseFetchOptionsAdditional options for this fetch

Returns: Promise<(Sticker\|Collection<Snowflake, Sticker>)>

js
// Fetch all stickers from the guild
message.guild.stickers.fetch()
  .then(stickers => console.log(`There are ${stickers.size} stickers.`))
  .catch(console.error);
js
// Fetch a single sticker
message.guild.stickers.fetch('222078108977594368')
  .then(sticker => console.log(`The sticker name is: ${sticker.name}`))
  .catch(console.error);

Source

fetchUser

async

async fetchUser(sticker: StickerResolvable): Promise<?User>

Fetches the user who uploaded this sticker, if this is a guild sticker. Parameters

NameTypeDescription
stickerStickerResolvableThe sticker to fetch the user for

Returns: Promise<?User>Source

Unofficial software. Not affiliated with or supported by Discord.