Cog file (import omitted):
class Admin(Cog):
def __init__(self, bot: Bot) -> None:
self.bot: Bot = bot
self.webhooks: Dict[str, TextChannel] = {}
@cmd.group(name="admin", pass_context=True)
async def admin(self, ctx: Context):
await ctx.reply("Admin cog is loaded.")
@admin.group(name="badwords", pass_context=True)
async def badwords(self, ctx: Context):
pass
@badwords.command(name="addchannels", pass_context=True)
async def addchannels(self, ctx: Context, channels: Greedy[TextChannel]):
self.webhooks.update(
{channel.id: await channel.create_webhook(name=f'webhook{channel.id}') for channel in channels}
)
await ctx.send(f"Current channels are: {[webhook for webhook in self.webhooks.keys()]}")
@badwords.command(name="removechannels", pass_context=True)
async def removechannel(self, ctx: Context, channels: Greedy[TextChannel], reason: str):
reason = reason if reason else "No reason provided."
for channel in channels:
await self.webhooks[channel.id].delete()
del self.webhooks[channel.id]
await ctx.send(f"Current channels are: {[webhook for webhook in self.webhooks.keys()]}")
def setup(bot: Bot):
bot.add_cog(Admin(bot))
Extension loading function:
@bot.group(name="service")
async def service(ctx: Context):
pass
@service.command(name="load")
async def load(ctx: Context, cog_name: str):
try:
bot.unload_extension(f"commands.{cog_name}")
except:
pass
bot.load_extension(f'commands.{cog_name}')
e = Embed(
title=f"{cog_name} loaded.",
color=Colour.dark_green()
)
await ctx.reply(embed=e)
Directory layout:
commands/
admin.py
main.py
When I try to load the extension throughservice load admin it informs me it's been successfully loaded but when I try to invoke it I get error in console about no such command existing. What gives?

