【发布时间】:2021-08-24 06:48:29
【问题描述】:
我怎样才能让我的不和谐 js 机器人从频道中获取消息并将它们添加到嵌入并在频道中发送它们。 我试过https://stackoverflow.com/questions/53696875/get-last-message-sent-to-channel#:~:text=You%20can%20call%20the%20MessageManager,and%20get%20the%20latest%20message.&text=There%20is%20a%20property%20containing,let%20lm%20%3D%20channel。 但它会抛出
channel.messages.fetch({ limit: 1 }).then(messages => {
^
TypeError: Cannot read property 'fetch' of undefined
at Object.<anonymous> (/home/container/index.js:35:19)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
在控制台中。 请帮忙。
【问题讨论】:
-
您使用的是哪个 discord.js 版本。你的频道是什么样子的
-
channel.messages是undefined,你的channel变量中存储了什么?请添加console.log(channel)的输出
标签: node.js discord discord.js