Javascript Discord.js v12表情列表命令

Javascript Discord.js v12表情列表命令,javascript,node.js,discord,discord.js,Javascript,Node.js,Discord,Discord.js,我正在尝试在discord.jsv12中创建一个表情列表命令。但是,如果在具有许多emoji的服务器中运行该命令,则会出现无效的表单正文错误,因为嵌入描述不能超过2048个字符。因此,我试图分割消息。这是我的密码: const{MessageEmbed}=require('discord.js'); module.exports={ 名称:“表情符号”, 描述:“获取公会的表情符号”, 异步运行(客户端、消息、参数){ const charactersMessage=2000; const em

我正在尝试在discord.jsv12中创建一个表情列表命令。但是,如果在具有许多emoji的服务器中运行该命令,则会出现无效的表单正文错误,因为嵌入描述不能超过2048个字符。因此,我试图分割消息。这是我的密码:

const{MessageEmbed}=require('discord.js');
module.exports={
名称:“表情符号”,
描述:“获取公会的表情符号”,
异步运行(客户端、消息、参数){
const charactersMessage=2000;
const emojis=message.guild.emojis.cache.map((e)=>{
返回`${e}**-**`:${e.name}:\`;
});
const numberOfMessages=Math.ceil(emojis.length/charactersMessage);
const embed=new MessageEmbed().setTitle(`Emoji List`);
对于(i=0;i
即使在这之后,我也会得到同样的无效体形式错误。以下是我得到的错误:

(node:211) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.description: Must be 2048 or fewer in length.
    at RequestHandler.execute (/home/runner/Utki-the-bot/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:211) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:211) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

你能帮我吗?提前谢谢

问题在于
emojis
是一个数组,而不是字符串。该函数返回一个数组(在本例中为字符串)。修复应该非常简单,只需在
.map
函数的末尾添加一个字符串即可。检查以下代码:

const emojis=message.guild.emojis.cache
.map((e)=>`${e}**-**`:${e.name}:\`)
。加入(‘,’);

如果可能的话也可以。因此,以这种方式发送列表,但是在列表的末尾,列表的一部分被切断,其余部分在另一个嵌入中继续。有没有可能机器人会在第一个列表中发送完整的表情符号,而不会切断任何表情符号,然后继续下一步的操作呢?看看是如何做到的。这将尝试在换行符(\n)上干净地拆分邮件。您可以尝试用逗号分隔消息,因为逗号是代码中表情符号之间的分隔符