【发布时间】:2020-08-12 12:32:52
【问题描述】:
所以我正在使用 Python 制作一个不和谐的机器人,我想让它循环直到满足某些条件,这是一个简单的例子,只是为了让我想要做的事情变得清晰。
@bot.command(name='join')
async def Yacine(ctx):
user = bot.get_user(ID)
await user.send("What is your name ?")
@bot.event
async def on_message(message):
if message.content == "Yacine":
user = bot.get_user(ID)
await user.send("Great name")
所以在它回答我(“伟大的名字”)之后,我希望它在我尝试时从顶部再次询问
@bot.command(name='join')
async def Yacine(ctx):
user = bot.get_user(ID)
await user.send("What is your name ?")
@bot.event
async def on_message(message):
if message.content == "Yacine":
user = bot.get_user(ID)
await user.send("Great name")
Yacine(ctx)
它一直在问(“你叫什么名字?”),甚至在我回答之前。 希望你能帮我解决这个问题。
【问题讨论】:
-
您的代码存在缩进问题。请更新问题。
标签: python loops bots discord discord.py