【发布时间】:2021-07-20 03:28:25
【问题描述】:
我正在处理 discord.py rewrite 中的机器人,并试图发出命令以通过 dm 进行嵌入。问题是机器人不等待消息。这是我的代码谢谢!
@client.command()
async def c_embed(ctx):
user = ctx.author
perms = ctx.author.permissions_in(ctx.channel)
if perms.administrator:
em = discord.Embed(description='What would you like the title to be?', color = discord.Colour.red())
await user.send(embed=em)
msg = await client.wait_for('message')
title = msg.content
em = discord.Embed(description='What would you like the Description to be?', color = discord.Colour.red())
await user.send(embed=em)
msg = await client.wait_for('message')
desc = msg.content
em = discord.Embed(title = "**Confirm Channel**", description = "Choose a channel for this msg to be in. Put Channel ID")
em = discord.Embed(title=title, description=desc,color=discord.Colour.red())
channel = msg.content
await ctx.channel.send(embed=em)
return
【问题讨论】:
-
这里有什么问题?你只是放了一堆代码,我们应该用它做什么?任何错误/追溯?结果是什么?预期的结果是什么。请看how to ask
-
测试您的代码后,我没有看到任何错误。请更详细地解释,正如 Łukasz Kwieciński 所说,出了什么问题。
-
我运行它时没有错误。但是当我使用该命令时,它不会等待用户消息。
-
可能是用户不允许私信
-
不,我在自己身上测试命令,我已经打开了我的 dm。
标签: python-3.x discord.py