I'm trying to get all emojis that my bot had access to from all servers it is in. The bot is in like 35 server so I will get a bit of emojis. Whenever I run the command in console I get DISCORD API ERROR: Cannot send empty message
My code:
const emojiList = msg.guild.emojis.cache.map(emoji => emoji.toString()).join(" ");
msg.channel.send(`${emojiList}`)
It doesn't matter how many servers the bot is in, it only sends the emotes of the server in which the command is used, firstly make sure the server has emotes of its own. secondly try logging emojiList
This you can either use an escape character or (\n) on this
const emotes = message.guild.emojis.cache.map(emoji => emoji.toString()).join(' ');
message.channel.send(emojiList);;
console.log(emotes);
msg.channel.send(emotes);
Try:
const emojiList = msg.guild.emojis.cache.map(emoji => emoji.toString()).join('/n');
msg.channel.send(`${emojiList}`);
Replaced empty space with '\n'
.
Also, try message.channel.send(emojList, { split: true });
instead of .join
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.