类sendAPICallback扩展dAPIMessage{^TypeError:类扩展值未定义不是构造函数或为空

2022-02-23 00:00:00 discord node.js javascript discord.js
现在我有一个新错误 如果可以,请帮帮我

完整错误

class sendAPICallback extends dAPIMessage {
                              ^

TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (C:UsersdanieDesktopDiscordBot-Template-master
ode_modules←[4mdiscord-buttons←[24msrcv12ClassesAPIMessage.js:9:31)
←[90m    at Module._compile (node:internal/modules/cjs/loader:1101:14)←[39m
←[90m    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)←[39m
←[90m    at Module.load (node:internal/modules/cjs/loader:981:32)←[39m
←[90m    at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39m
←[90m    at Module.require (node:internal/modules/cjs/loader:1005:19)←[39m
←[90m    at require (node:internal/modules/cjs/helpers:94:18)←[39m
    at Object.<anonymous> (C:UsersdanieDesktopDiscordBot-Template-master
ode_modules←[4mdiscord-buttons←[24msrcv12ClassesWebhookClient.js:2:20)
←[90m    at Module._compile (node:internal/modules/cjs/loader:1101:14)←[39m
←[90m    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)←[39m```
the full error ^^

解决方案

discord-buttons具有discord.js v12依赖项,该依赖项对已完成的ExtendableStructures方法Structure#extend已从库本身中删除this pull request,discord-buttons的开发人员已拒绝继续包,因此处于存档状态。

您有两个选项可以修复错误

  • 将您的discord.js版本降级(建议)
    在您的控制台中运行此命令:
npm uninstall discord.js 
npm install discord.js@12.5.3
  • 使用添加到discord.js V13的新消息组件方法重写机器人的源代码(可选)

相关文章