Merge pull request #51 from flifloo/extension
Fix extension help on private messages
This commit is contained in:
commit
f726d3c8b5
1 changed files with 14 additions and 15 deletions
|
@ -2,7 +2,7 @@ from traceback import format_exc
|
||||||
|
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from discord import Embed, Guild
|
from discord import Embed, Guild
|
||||||
from discord.ext.commands import MissingPermissions, BadArgument
|
from discord.ext.commands import MissingPermissions, BadArgument, CommandError
|
||||||
|
|
||||||
import db
|
import db
|
||||||
from administrator.logger import logger
|
from administrator.logger import logger
|
||||||
|
@ -27,20 +27,19 @@ class Extension(commands.Cog):
|
||||||
@extension.group("help", pass_context=True)
|
@extension.group("help", pass_context=True)
|
||||||
async def extension_help(self, ctx: commands.Context):
|
async def extension_help(self, ctx: commands.Context):
|
||||||
embed = Embed(title="Extension help")
|
embed = Embed(title="Extension help")
|
||||||
if await self.extension_list.can_run(ctx):
|
for c, n, v in [[self.extension_list, "extension list", "List all enabled extensions"],
|
||||||
embed.add_field(name="extension list", value="List all enabled extensions", inline=False)
|
[self.extension_enable, "extension enable", "Enable an extensions"],
|
||||||
if await self.extension_enable.can_run(ctx):
|
[self.extension_disable, "extension disable", "Disable an extensions"],
|
||||||
embed.add_field(name="extension enable", value="Enable an extensions", inline=False)
|
[self.extension_loaded, "extension loaded", "List all loaded extensions"],
|
||||||
if await self.extension_disable.can_run(ctx):
|
[self.extension_load, "extension load <name>", "Load an extension"],
|
||||||
embed.add_field(name="extension disable", value="Disable an extensions", inline=False)
|
[self.extension_unload, "extension unload <name>", "Unload an extension"],
|
||||||
if await self.extension_load.can_run(ctx):
|
[self.extension_reload, "extension reload <name>", "Reload an extension"]]:
|
||||||
embed.add_field(name="extension loaded", value="List all loaded extensions", inline=False)
|
try:
|
||||||
if await self.extension_load.can_run(ctx):
|
if await c.can_run(ctx):
|
||||||
embed.add_field(name="extension load <name>", value="Load an extension", inline=False)
|
embed.add_field(name=n, value=v, inline=False)
|
||||||
if await self.extension_unload.can_run(ctx):
|
except CommandError:
|
||||||
embed.add_field(name="extension unload <name>", value="Unload an extension", inline=False)
|
pass
|
||||||
if await self.extension_reload.can_run(ctx):
|
|
||||||
embed.add_field(name="extension reload <name>", value="Reload an extension", inline=False)
|
|
||||||
if not embed.fields:
|
if not embed.fields:
|
||||||
raise MissingPermissions(None)
|
raise MissingPermissions(None)
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
Reference in a new issue