我正在使用discord.js并试图创建一个机器人,以便每次该特定人员从该机器人所在的另一台服务器发出某句话时,我都希望该机器人在特定频道中重复此消息。
client.on('message', message => {
if (message.author === ("244921929495085057")){
client.channels.get("655598459268759593").send(message.content);
}
})
我不知道该怎么做。谢谢!
答案 0 :(得分:1)
我假设您在编写本文时使用的是Discord.js的最新版本,该版本为v12。
您需要在content={[
{
heading: "Add Company",
icon: "plus",
options: [ // remove the curly boy that was here
{
image: "srcimage",
text: "New Company",
link: "test"
}, {
image: "srcimage",
text: "Existing Company",
link: "test"
}
] // and here
}, {
heading: "Import Company",
icon: "download",
options: [ // and here
{
image: "/src/image",
text: "Class",
link: "/test"
},
{
image: "/src/image",
text: "BGL",
link: "/test"
},
{
image: "/src/image",
text: "SuperMate",
link: "/test"
}
] // and here
}]}
之后添加.cache
才能访问频道列表。