gpt4 book ai didi

javascript - discord.js-commando TypeError : this. fetchUser 不是函数

转载 作者:行者123 更新时间:2023-12-04 17:30:12 29 4
gpt4 key购买 nike

我最近在我的个人电脑上用 nodejs 和 discord.js-commando 编写了一个 discord bot,它在 Windows 上工作得很好,但我试着把它放在我的树莓派 3b 上,我安装了最新版本的 nodejs,我用过用于传输文件的 scp 试图运行机器人,但它只是给了我这个错误:

(node:2609) UnhandledPromiseRejectionWarning: TypeError: this.fetchUser is not a function
at CommandoClient.<anonymous> (/home/pi/bot/node_modules/discord.js-commando/src/client.js:84:11)
at Object.onceWrapper (events.js:417:28)
at CommandoClient.emit (events.js:323:22)
at WebSocketManager.triggerClientReady (/home/pi/bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:433:17)
at WebSocketManager.checkShardsReady (/home/pi/bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:417:10)
at WebSocketShard.<anonymous> (/home/pi/bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:199:14)
at WebSocketShard.emit (events.js:311:20)
at WebSocketShard.checkReady (/home/pi/bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:466:12)
at WebSocketShard.onPacket (/home/pi/bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:438:16)
at WebSocketShard.onMessage (/home/pi/bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:293:10)
(node:2609) 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:2609) [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.

我真的认为这与 discord.js-commando 包有关,但我不确定。

最佳答案

client.fetchUser() 已贬值。现在是 client.user.fetch()。这适用于所有这些命令,例如:

client.channels.fetch() // Excepted output: TextChannel { ... }
client.guilds.fetch() // Excepted output: Guild { ... }
message.guild.members.fetch() // Excepted output: GuildMember { ... }

等等...更多信息在这里:页面已删除内容:p

重要提示:确保“this”是client 的一个实例。

关于javascript - discord.js-commando TypeError : this. fetchUser 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60495582/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com