我试图从changegame
函数的属性中获取一个字符串,以便更改我正在开发的bot的状态。在
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))
这不会导致识别字符串,但会导致:
Game correctly changed to ('Test', 'string', '123')
要解决初始问题,请尝试一个简单的连接:
然而,你更大的问题是:
^{pr2}$在这里,您正在将一个元组传递给
discord.Game
,您确定这是正确的吗?如果要像这样调用初始函数:changegame("League of Legends")
,则需要修改函数定义:我怀疑这就是你想做的。在
相关问题 更多 >
编程相关推荐