AttributeError: 'ClientUser' 对象没有属性'create_dm'(discord.py, 我正试图dm一个公会的所有成员)

问题描述 投票:0回答:1

我一直在尝试向一个公会的所有成员发送DM,但我总是得到这个错误。

AttributeError: 'ClientUser' object has no attribute 'create_dm'

这是我的代码

@bot.command()
async def send(ctx, *, message):
    for member in ctx.guild.members:
        channel = await member.create_dm()
        channel.send(message)
    await ctx.send('Messages successfully sent!')

我到底做错了什么?

python discord.py send dm
1个回答
0
投票

我想明白了,我必须等待channel.send的到来。

© www.soinside.com 2019 - 2024. All rights reserved.