我正试图从changegame
函数的属性中获取一个字符串,以便改变我正在开发的机器人的状态。
async def changegame(*game_chosen: str):
"""Changes the game the bot is playing"""
game_str = discord.Game(name=game_chosen)
try:
await bot.change_status(game=game_str, idle=False)
await bot.say("```Game correctly changed to {0}```".format(game_chosen))
这不会使字符串被识别,而是会得到以下结果:
游戏正确更改为('Test','string','123')。
changegame
,而不是多个参数。你在哪里调用这个函数? - spectras