首页 > 解决方案 > 有没有办法在 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") 
});

我希望机器人在线时向我发送消息

标签: javascriptdiscord.js

解决方案


bot.on("ready", async () => {
    bot.users.get("Your ID").send("Message")
});

推荐阅读