DMing friends discord.py

DMing friends discord.py,discord,discord.py,Discord,Discord.py,我想做的是当机器人启动时,抓取好友列表并对其中的每个人进行DM。我不能使用ctx,因为on_ready不支持它。到目前为止,我的代码是: @bot.event async def on_ready(msg): for x in bot.user.friends: e = x.id await x.send('hi') ,但您可以有一个可以发送消息的联系人列表。这是一个例子: @bot.event async def on_ready(): for

我想做的是当机器人启动时,抓取好友列表并对其中的每个人进行DM。我不能使用ctx,因为on_ready不支持它。到目前为止,我的代码是:

@bot.event
async def on_ready(msg):
    for x in bot.user.friends:
        e = x.id
        await x.send('hi')
,但您可以有一个可以发送消息的联系人列表。这是一个例子:

@bot.event
async def on_ready():
    for friend in [listofuserids]:
        await friend.send("hi")

listofUserID
应该是朋友不一致ID的列表。有关如何获取用户不一致ID的详细信息,请阅读。

您的意思是向服务器上的每个人发送私人消息?当您与bot共享服务器时,您将自动成为bot的好友。否。我的意思是使用自助机器人。我想自助机器人的支持已经结束了。我正在使用自助机器人。那些不是反对discord的TOS?idk吗。“不过,这只是一个概念的证明。”“是的,他们是