我正在尝试创建需要输入的命令。到目前为止,这是我的代码:
@bot.command()
async def eat(ctx)
await ctx.channel.send("What would you like to eat? Apple, Cake, or Cookie?")
我需要在这里输入内容,以便我做剩下的事情……但这是剩下的事情:
if eat=apple:
print("You ate an apple!")
elif eat=cake:
print("You ate Cake!")
elif eat=cookie:
print("You ate a Cookie!")
else:
print("Sorry I don't know that food in there. Please try again")
答案 0 :(得分:2)
只需在def中添加另一个参数:
git config --global user.email "your_email"
答案 1 :(得分:1)
使用wait_for
,您可以等待用户回复邮件并根据他们的回复进行操作。
@bot.command()
async def eat(ctx):
await ctx.send('What would you like to eat? Apple, Cake, or Cookie?')
msg = await bot.wait_for('message')
if msg.content == 'Apple'.lower():
await ctx.send('You ate an apple!')
elif msg.content == 'Cake'.lower():
await ctx.send('You ate Cake!')
elif msg.content == 'Cookie'.lower():
await ctx.send('You ate a Cookie!')
else:
await ctx.send('Sorry I don\'t know that food in there. Please try again')