[英]Discord.py : How do I get user input?
我开始为我的 discord 机器人编写命令,让用户与之交互。 除了获取用户输入外,我几乎一切都做对了(感谢 Stack Overflow)。 “输入”命令似乎不起作用。
@client.command()
async def bot (ctx):
async def Bot1(ctx):
while True:
Initiate = input ("Type in anything to start, type 'Quit' to end ")
if Initiate == 'Hello':
await ctx.send ("Hello there!")
elif Initiate == 'Quit':
break
else:
Responses = ['How are you doing today', 'What do you want to talk about', 'The bot is at your service']
Response = random.choose(Responses)
await ctx.send (Response)
await ctx.send (await Bot1(ctx))
您正在使用 input(),您正在尝试从终端中的用户那里获取输入,使用 on_message 或类似的东西:
msg = await client.wait_for("message", check=check, timeout=60)
或者如果您仍然无法获得输入,请使用此网站
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.