Kxffie

Cog

Jul 29th, 2022
858
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. #! --------------------------------------------------
  2.  
  3. for fn in os.listdir("./cogs"):
  4.     if fn.endswith(".py"):
  5.         client.load_extension(f"cogs.{fn[:-3]}")
  6.         print(f"Cog '{fn[:-3]}' loaded.")
  7.  
  8.  
  9. @client.command()
  10. async def load(ctx, extension):
  11.     client.load_extension(f"cogs.{extension}")
  12.     await ctx.send(f"Loaded {extension}.")
  13.  
  14.  
  15. @client.command()
  16. async def unload(ctx, extension):
  17.     client.unload_extension(f"cogs.{extension}")
  18.     await ctx.send(f"Unloaded {extension}.")
  19.  
  20.  
  21. @client.command()
  22. async def reload(ctx, extension):
  23.     client.reload_extension(f"cogs.{extension}")
  24.     await ctx.send(f"Reloaded {extension}.")
  25.  
  26. #! --------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment