📜  重新加载所有扩展 discord.py - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:07.997000             🧑  作者: Mango

代码示例1
# Make sure you don't have a command called "commands"
@client.command()
@commands.is_owner() # Makes sure the person running the command is the owner
async def restart():
    for filename in os.listdir("./cogs"): # Change "cogs" to your folder name
        if filename.endswith(".py"):
            client.reload_extension(f"cogs.{filename[:-3]}") # Change "cogs" to your folder name