I can’t figure out how to send a sticker in discord.js. Here is my code (ids removed):
let reply = { content: `hello world`, stickers: client.guilds.cache.get('guild id').stickers.fetch('sticker id') } msg.reply(reply)
And when trying that I get this error:
sticker_ids: this.options.stickers?.map(sticker => sticker.id ?? sticker), ^ TypeError: this.options.stickers?.map is not a function
But if I just try stickers: client.guilds.cache.get('guild id').stickers.cache
it works but instead sends every sticker in the server
Does anyone know what this error means, how to fix it, and if there is just a better way of doing all this? Thanks.
Advertisement
Answer
it looks like stickers still needs to be a
Collection
so trystickers: client.guilds.cache.get("guild id").stickers.cache.filter(s => s.id === "sticker id")
And that worked fine for me.