mirror of
https://github.com/TotalFreedomMC/TotalFreedomBot.git
synced 2024-12-22 23:54:58 +00:00
Permission specific display of commands
This commit is contained in:
parent
601015fd94
commit
0cd97cf2bf
1 changed files with 17 additions and 15 deletions
|
@ -15,9 +15,7 @@ class Help(commands.Cog):
|
||||||
em = discord.Embed()
|
em = discord.Embed()
|
||||||
em.title = 'Help Command'
|
em.title = 'Help Command'
|
||||||
command_list = ''
|
command_list = ''
|
||||||
|
|
||||||
cog_list = [c for c in self.bot.cogs.keys()]
|
cog_list = [c for c in self.bot.cogs.keys()]
|
||||||
|
|
||||||
page_count = math.ceil(len(cog_list) / 4)
|
page_count = math.ceil(len(cog_list) / 4)
|
||||||
|
|
||||||
page = int(page)
|
page = int(page)
|
||||||
|
@ -35,18 +33,22 @@ class Help(commands.Cog):
|
||||||
|
|
||||||
for cog in cogs_needed:
|
for cog in cogs_needed:
|
||||||
command_list = ''
|
command_list = ''
|
||||||
for command in self.bot.get_cog(cog).walk_commands():
|
for command in self.bot.get_cog(cog).get_commands():
|
||||||
|
showcommand = True
|
||||||
if command.hidden:
|
if command.hidden:
|
||||||
continue
|
showcommand = False
|
||||||
if command.parent:
|
if command.parent:
|
||||||
continue
|
showcommand = False
|
||||||
|
for check in command.checks:
|
||||||
command_list += f'**tf!{command.name}** - {command.help}\n'
|
try:
|
||||||
command_list += '\n'
|
check(ctx)
|
||||||
|
except:
|
||||||
|
showcommand = False
|
||||||
|
if showcommand:
|
||||||
|
command_list += f'**{ctx.prefix}{command.name}** - {command.help}\n'
|
||||||
|
if command_list:
|
||||||
em.add_field(name=cog, value=command_list, inline=False)
|
em.add_field(name=cog, value=command_list, inline=False)
|
||||||
|
em.set_footer(text=f'Requested by {ctx.message.author}', icon_url=tget_avatar(ctx.message.author))
|
||||||
em.set_footer(text=f'Requested by {ctx.message.author}', icon_url=get_avatar(ctx.message.author))
|
|
||||||
await ctx.send(embed=em)
|
await ctx.send(embed=em)
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
|
|
Loading…
Reference in a new issue