1
0
Fork 0

Add help and make list command

This commit is contained in:
Ethanell 2020-11-05 00:58:39 +01:00
parent d740869609
commit f818205ad2

View file

@ -20,13 +20,25 @@ class Extension(commands.Cog):
@commands.is_owner()
async def extension(self, ctx: commands.Context):
if ctx.invoked_subcommand is None:
embed = Embed(title="Extensions")
await ctx.invoke(self.extension_help)
@extension.group("help", pass_context=True)
async def extension_help(self, ctx: commands.Context):
embed = Embed(title="Extension help")
embed.add_field(name="extension list", value="List all loaded extensions", inline=False)
embed.add_field(name="extension load <name>", value="Load an extension", inline=False)
embed.add_field(name="extension unload <name>", value="Unload an extension", inline=False)
embed.add_field(name="extension reload <name>", value="Reload an extension", inline=False)
await ctx.send(embed=embed)
@extension.group("list", pass_context=True)
async def extension_list(self, ctx: commands.Context):
embed = Embed(title="Extensions list")
for extension in self.bot.extensions:
embed.add_field(name=extension, value="Loaded", inline=False)
await ctx.send(embed=embed)
@extension.group("load", pass_context=True)
@commands.is_owner()
async def extension_load(self, ctx: commands.Context, name: str):
try:
self.bot.load_extension(name)
@ -37,7 +49,6 @@ class Extension(commands.Cog):
await ctx.message.add_reaction("\U0001f44d")
@extension.group("unload", pass_context=True)
@commands.is_owner()
async def extension_unload(self, ctx: commands.Context, name: str):
try:
self.bot.unload_extension(name)
@ -48,7 +59,6 @@ class Extension(commands.Cog):
await ctx.message.add_reaction("\U0001f44d")
@extension.group("reload", pass_context=True)
@commands.is_owner()
async def extension_reload(self, ctx: commands.Context, name: str):
try:
self.bot.unload_extension(name)