当人们想要使用我的feedback命令给出关于机器人的反馈时,我希望能够通过机器人返回给他们,但我的dm命令不起作用,即使他们与机器人有一个共同的服务器。当我运行该命令时,我得到这个错误:/usr/lib/python3.7/asyncio/events.py:88: RuntimeWarning: coroutine 'Client.fetch_user' was never awaited。有人能帮我吗?下面是我的代码:
@client.command(description="This command DMs people and can only be used by the owner.")
@commands.is_owner()
async def dm(ctx, id, *, message):
user = await client.fetch_user(id)
await user.send(message)
return发布于 2021-08-02 03:41:31
@client.command(description="This command DMs people and can only be used by the owner.")
@commands.is_owner()
async def dm(ctx, member: discord.Member = None):
if member == None:
await ctx.send("Mention the user or provide user id of the user you want me to send a DM to.")
else:
embed=discord.Embed(title=f"Sure, What do you want me to send to {member.display_name} ?", description="write anything here")
await ctx.send(embed=embed)
def check(m):
return m.author.id == ctx.author.id
message = await client.wait_for('message', check=check)
await ctx.send(f'Message sent to {member.display_name}!')
await member.send(f"{ctx.author.mention} Sent a message - \n{message.content}")https://stackoverflow.com/questions/68614480
复制相似问题