我正在尝试制作一个模拟回合制战斗的机器人,但我不知道如何在我发送命令后让机器人做出响应。我现在尝试的是:
async def battle(ctx):
keyword = (1,2,3)
enemy1 = ('Skeleton', 'Goblin', 'Bandit',)
enemy2 = ('Knight', 'Barbarian', 'Archer')
enemy3 = ('Elf Mage', 'Dwarf Warrior', 'Orc Brute')
enemy1hp = 50
enemy1dmg = 25
enemy2hp = 75
enemy2dmg = 35
enemy3hp = 100
enemy3dmg = 25
playerhp = 150
playerdmg = random.randint(10, 40)
await ctx.send('Pick a number between 1 and 3')
enemypicked = ctx.content.lower()
for keyword in enemypicked:
if keyword == '1':
opponent1 = random.choice(enemy1)
await ctx.send(f'{opponent1}, {enemy1hp}HP')
我想做的是让用户选择一个数字并依赖于一个数字,机器人将选择出现哪个敌人,但我收到以下错误:
discord.ext.commands.errors.CommandInvokeError:命令引发异常:AttributeError:'Context'对象没有属性'content'
而且我对如何使它起作用没有想法。非常感谢任何帮助。