javascript - 如何让 bot 将消息发送到 'general' channel 或消息最多的 channel ?

标签 javascript bots discord discord.js

我正在创建一个 discord 机器人,它每天在特定时间向公会发送消息。我正在为预定消息使用 cron,但不确定要为机器人编写什么代码以将消息发送到公会的“通用” channel ,如果他们没有“通用” channel ' channel ,发送到事件或消息最多的 channel 。

自从 defaultChannel 被删除后,我不确定我应该怎么做。此外,我不想使用 channel ID 将消息发送到特定 channel ,因为我想公开此机器人,以便许多不同的公会可以使用。

 cron.schedule('00 45 12,20 * * *', () => {

      //code to send a message to guild's 'default channel' or 'channel with most activity goes here'
}, {
    scheduled: true,
    timeZone: "America/Los_Angeles"}
);

它不一定必须发送到“默认” channel 或大多数消息的 channel 。这些只是我想出的选项。基本上,我希望消息只发送到每个人都可以看到的 1 个 channel 。任何帮助,将不胜感激。谢谢!

最佳答案

This guide should be able to help you.尽管要小心机器人可以发送的第一个 channel ,但这也可能是公告。

不过,我的建议是使用数据库中的配置。这应该允许人们设置发送消息的 channel 。

关于javascript - 如何让 bot 将消息发送到 'general' channel 或消息最多的 channel ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52940937/

相关文章:

javascript - 创建二维 View

javascript - 机器人不断重复

node.js - 有没有办法在中断后将自定义数据返回到提示?

javascript - 如何向特定的discord channel 发送消息?

javascript - 我正在为我的 Discord 机器人创建一个用户信息命令,想知道是否有办法让 .createdAt 看起来更好

javascript - 学习 Q 中的 promise 和异常(exception)与拒绝

javascript - asp.net mvc 动态 javascript 菜单

javascript - Highstocks - 在日期时间轴上使用 tickmarkPlacement "between"(无类别)

python - SQLAlchemy 不支持的类型问题 Python

javascript - 类型错误 : Cannot read property 'user' of null | discord. js