【发布时间】:2021-03-04 10:48:14
【问题描述】:
如何让我的机器人通过 id 向另一个频道发送消息,例如 !say 6969420420 hello
我目前对整个 discord bot 这种东西还是新手,所以请帮帮我,这真的很有帮助
我记得它就像get cache find channel 之类的......
【问题讨论】:
标签: javascript node.js discord discord.js
如何让我的机器人通过 id 向另一个频道发送消息,例如 !say 6969420420 hello
我目前对整个 discord bot 这种东西还是新手,所以请帮帮我,这真的很有帮助
我记得它就像get cache find channel 之类的......
【问题讨论】:
标签: javascript node.js discord discord.js
您可以从客户端获取频道并将消息发送到该频道
channel = client.channels.cache.get('6969420420');
channel.send('hello');
你可以阅读更多关于 discord 的缓存here
【讨论】:
使用 args 获取 id 并获取要发送的消息
client.channels.cache.get(args[0]).send(args[1]);
【讨论】: