【问题标题】:SyntaxError: Unexpected identifier Embed Message Discord.jsSyntaxError:意外的标识符嵌入消息 Discord.js
【发布时间】:2021-04-11 11:30:51
【问题描述】:

我正在尝试使用 Embed 发出帮助命令,但不起作用

/home/container/commands/other/help.js:15
    const helpEmbed = new MessageEmbed()
          ^^^^^^^^^

SyntaxError: Unexpected identifier
    at wrapSafe (internal/modules/cjs/loader.js:931:16)
    at Module._compile (internal/modules/cjs/loader.js:979:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at /home/container/node_modules/require-all/index.js:56:46
    at Array.forEach (<anonymous>)
    at requireAll (/home/container/node_modules/require-all/index.js:34:9)

这是代码

【问题讨论】:

    标签: javascript discord discord.js bots


    【解决方案1】:

    基本上你在什么都没有使用嵌入。您的 module.exports 应该与此类似:

    module.exports = class extends Command {
      constructor(...args) {
        super(...args, {
          description: 'Testing.',
          category: "Information",
        });
      }
    
      async run(message, args) {
         
          const helpEmbed...
    
      }
    }
    

    上面的代码示例来自我的命令处理程序,因此您的可能会有所不同,但您需要像 runexecute 这样的起点。

    【讨论】:

      猜你喜欢
      • 2020-11-10
      • 1970-01-01
      • 2020-10-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-28
      • 2017-10-11
      • 1970-01-01
      相关资源
      最近更新 更多