I can’t figure out how to send a sticker in discord.js. Here is my code (ids removed):
JavaScript
x
6
1
let reply = {
2
content: `hello world`,
3
stickers: client.guilds.cache.get('guild id').stickers.fetch('sticker id')
4
}
5
msg.reply(reply)
6
And when trying that I get this error:
JavaScript
1
5
1
sticker_ids: this.options.stickers?.map(sticker => sticker.id ?? sticker),
2
^
3
4
TypeError: this.options.stickers?.map is not a function
5
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.