我正在制作一个不和谐机器人,它应该从人们那里收集分数,但它一次发送多条消息



https://i.stack.imgur.com/ZNQTa.png

代码在这里^^^

我正在制作一个不和机器人,它应该收集人们的分数,并将其存储在文本文件中,以便稍后检索,我不知道为什么,在你发消息后!在锦标赛中,机器人会问:康纳进了多少球?:然后你输入数字,在你输入数字后,机器人应该问伊万有多少个进球,它会这样做,但它会问杰克和托马斯的进球,而用户没有输入任何信息,那么我该如何输入,以便在你输入后显示下一条消息?

当前,您不会阻止代码执行上面的选项。

当它在寻找Jack时,tournament就是True,所以它也会谈论Conner。

以下是一些应该有效的代码。

@client.event
async def on_message(message):
print("Received message")
global tournament, scoreset1, scoreset2
if message.content.startswith("!tournament") and not tournament:
tournament = True
await message.channel.send("Goals for Conner:")
elif message.content.isdigit():
if tournament and not scoreset1:
scoreset1 = True
await message.channel.send("Goals for Ewan:")
elif scoreset1 and not scoreset2:
scoreset2 = True
await message.channel.send("Goals for Jack:")
elif scoreset2:
await message.channel.send("Goals for Thomas:")

最新更新