0
我試圖從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')
你想要它做什麼?連接它們? –
什麼是'async def ... * game_chosen:str'?這看起來不像標準的Python(這是你標記的)。 –
雖然有一個簡單的答案,但很可能你應該傳遞一個名字給'changegame',而不是多個參數。你在哪裏打這個功能? – spectras