Python 如何对执行命令的人员进行DM

Python 如何对执行命令的人员进行DM,python,python-3.x,discord,discord.py,Python,Python 3.x,Discord,Discord.py,我试图发出一个命令,让DM是一个有文本和一些参数的人,同时将带有这些参数的消息发送到一个频道 现在我正试图找出DM部分。所有可能对我有帮助的线索都来自旧discord.py的2年 以下是我尝试管理运行该命令的人员的步骤: @bot.command async def report(ctx): user = await ctx.message.author.id await DMChannel.send(user, "lol") await ctx.ch

我试图发出一个命令,让DM是一个有文本和一些参数的人,同时将带有这些参数的消息发送到一个频道


现在我正试图找出DM部分。所有可能对我有帮助的线索都来自旧discord.py的2年

以下是我尝试管理运行该命令的人员的步骤:

@bot.command
async def report(ctx):
    user = await ctx.message.author.id
    await DMChannel.send(user, "lol")
    await ctx.channel.purge(limit=1)
我基本上只有两个字符串参数,
!报告
。我将在DM中使用它们,并将消息发送到一个通道。但现在,我所需要的是找到一种方法让一个人做点什么


我从这个视频中得到了DMchannel的想法,但它向您展示了如何将其发送给特定的人,而不是上下文(我想)

我也在尝试生成一个DM命令,这是我所能做到的

@bot.command
async def dm(ctx,member:discord.Member,*,content):
    user = await member.create_dm()
    await user.send(content)
    await ctx.message.delete()

这里是我作为帮助的链接

,所以它实际上非常简单

要让wait语句向命令的invocator发送DM,我必须执行以下操作:

@bot.command()
async def report(ctx, user, reason):
    await ctx.author.send("Haha :D")

您是否尝试过等待user.send(“message”)?“可能帮助我的所有线程都来自旧discord.py的2年时间。”您是否正在使用重写?如果是这样,则有一个
discord.py rewrite
标记可用于该问题。