简体   繁体   English

错误:RangeError [MESSAGE_CONTENT_TYPE]:消息内容必须是非空字符串

[英]Error : RangeError [MESSAGE_CONTENT_TYPE]: Message content must be a non-empty string

I'm trying to make a regular send command that takes the content from the slash command, but I get this error, I tried to fix it according to the previous answers that I received here, but, unfortunately, it doesn't work either.我正在尝试制作一个常规的发送命令,该命令从斜杠命令中获取内容,但我收到此错误,我尝试根据我在此处收到的先前答案修复它,但不幸的是,它也不起作用.

RangeError [MESSAGE_CONTENT_TYPE]: Message content must be a non-empty string.
    at Function.verifyString (C:\Users\wiskj\Desktop\adminadminov\node_modules\discord.js\src\util\Util.js:416:41)
    at MessagePayload.makeContent (C:\Users\wiskj\Desktop\adminadminov\node_modules\discord.js\src\structures\MessagePayload.js:114:22)
    at MessagePayload.resolveData (C:\Users\wiskj\Desktop\adminadminov\node_modules\discord.js\src\structures\MessagePayload.js:129:26)
    at TextChannel.send (C:\Users\wiskj\Desktop\adminadminov\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:171:61)
    at module.exports (C:\Users\wiskj\Desktop\adminadminov\commands\send.js:5:19)
    at module.exports (C:\Users\wiskj\Desktop\adminadminov\events\interactionCreate.js:13:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {

Code:代码:

module.exports = async (bot, message, args, argsF) => {
    const {channel} = message;
    const content = Array.from(argsF).join(" ")
    await channel.send(content);
};
module.exports.names = ["send"];
module.exports.interaction = {
    name: 'send',
    description: 'Отправить сообщение от имени бота',
    options: [
        {
            name: "сообщение",
            description: "Укажите что хотите отправить",
            type: "STRING",
            required: true
        },
    ],
    defaultPermission: true
}, "962964961687138385";
        
module.exports.names = ['send'];
  • As the error says, message content must be non-empty-strings .正如错误所说,消息内容必须是non-empty-strings
channel.send(`${content}`)

or或者

channel.send(String(content))
  • Either of these will work, since both are converting content into a String .这些中的任何一个都可以工作,因为两者都将content转换为String

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 discord.js RangeError [MESSAGE_CONTENT_TYPE]: 消息内容必须是非空字符串 - discord.js RangeError [MESSAGE_CONTENT_TYPE]: Message content must be a non-empty string RangeError [MESSAGE_CONTENT_TYPE]: 消息内容必须是非空字符串。 (discord.js v13) - RangeError [MESSAGE_CONTENT_TYPE]: Message content must be a non-empty string. (discord.js v13) 消息内容必须是非空字符串 MessageEmbed - Message Content Must Be A Non-Empty String MessageEmbed ESLint 7.1.0 错误:“模式”必须是非空字符串或非空字符串数组 - ESLint 7.1.0 Error: 'patterns' must be a non-empty string or an array of non-empty strings Firebase错误:提供给sendToDevice()的注册令牌必须是非空字符串或非空数组 - Firebase Error: Registration token(s) provided to sendToDevice() must be a non-empty string or a non-empty array Discord.js v13 错误:RangeError [EMBED_FIELD_VALUE]:MessageEmbed 字段值必须是非空字符串 - Discord.js v13 error: RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings Firebase Cloud Function错误:提供给sendToDevice()的注册令牌必须是非空字符串或非空数组 - Firebase Cloud Function error: Registration token(s) provided to sendToDevice() must be a non-empty string or a non-empty array RangeError [EMBED_FIELD_VALUE]:MessageEmbed 字段值必须是非空字符串 - RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty stringss TypeError [COMMAND_INTERACTION_OPTION_EMPTY]:必需选项“消息”的类型:_MESSAGE; 期望一个非空值。 (不和谐.js) - TypeError [COMMAND_INTERACTION_OPTION_EMPTY]: Required option "message" is of type: _MESSAGE; expected a non-empty value. (Discord.js) 错误:参数“documentPath”的值不是有效的资源路径。 路径必须是非空字符串 - Error: Value for argument “documentPath” is not a valid resource path. Path must be a non-empty string
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM