Separate cog_commands.py and move into new folder

This commit is contained in:
Parker M. 2024-04-03 15:40:02 -05:00
parent a40f812081
commit b8d7289bb8
No known key found for this signature in database
GPG Key ID: 95CD2E0C7E329F2A
2 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,22 @@
from discord.ext import commands
class LoadCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
@commands.dm_only()
@commands.is_owner()
async def loadcog(self, ctx: commands.Context, cog: str = None):
if not cog:
return await ctx.send("No cog provided.")
cog = cog.lower()
await self.bot.load_extension(f"cogs.{cog}")
await ctx.send(f"Cog {cog} has been loaded")
async def setup(bot):
await bot.add_cog(LoadCog(bot))

View File

@ -0,0 +1,22 @@
from discord.ext import commands
class ReloadCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
@commands.dm_only()
@commands.is_owner()
async def reloadcog(self, ctx: commands.Context, cog: str = None):
if not cog:
return await ctx.send("No cog provided.")
cog = cog.lower()
await self.bot.reload_extension(f"cogs.{cog}")
await ctx.send(f"Cog {cog} has been reloaded")
async def setup(bot):
await bot.add_cog(ReloadCog(bot))