该
global关键字不会被正确使用。
global应该在每个函数中定义。
例:
voting_enabled = False@bot.command()async def start(): global voting_enabled voting_enabled = True@bot.command()async def finish(): global voting_enabled voting_enabled = False@bot.command()async def vote(): global voting_enabled if voting_enabled: # Do something else: # Do something else
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)