javascript - 有没有办法在 bot.on("ready") 函数中向特定用户发送消息?
问题描述
我正试图让我的机器人在它上线/准备好时向我发送一条直接消息
我尝试使用诸如bot.guilds.members.find("id", "my id")
and之类的函数,bot.guilds.members.get("id", "my id")
但它只返回 find/get is not a function
bot.on("ready", async message => {
bot.guilds.members.find("id", "my id")
});
我希望机器人在线时向我发送消息
解决方案
bot.on("ready", async () => {
bot.users.get("Your ID").send("Message")
});
推荐阅读
- laravel - Laravel 雄辩的块方法不返回所有记录
- javascript - 在网页中使用光滑的滑块后出现水平滚动条
- c# - VSIX:IErrorTag 工具提示内容未显示
- java - Spring/Hibernate 数据访问并发问题
- artifactory - 有没有办法使用 API 将存储库从 zip 导入到 jfrog 工件?
- r - 如何在r中获取整数的十进制值
- grails - 如果重命名 id 列,Grails 数据将不会绑定
- python - 在jetson nano上使用python opencv加载相机的问题
- python - ml-workspace 保留已安装的扩展和 pip,而不会因重新启动而丢失
- c# - 哪种 Azure 指标聚合类型返回十进制值?