Switch to LF and aliases
This commit is contained in:
parent
1c8a0c9cd0
commit
a3af978caa
@ -5,7 +5,7 @@ import string
|
|||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from redbot.core import Config, commands
|
from redbot.core import Config, checks, commands
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from redbot.core.commands import Cog, PrivilegeLevel
|
from redbot.core.commands import Cog, PrivilegeLevel
|
||||||
from redbot.core.data_manager import cog_data_path
|
from redbot.core.data_manager import cog_data_path
|
||||||
@ -43,6 +43,13 @@ def prepare_description(comm_or_cog: Union[commands.Command, Cog]):
|
|||||||
return description
|
return description
|
||||||
|
|
||||||
|
|
||||||
|
def produce_aliases(command: commands.Command):
|
||||||
|
return ", ".join(
|
||||||
|
f"``{command.full_parent_name+' ' if command.full_parent_name else ''}{alias}``"
|
||||||
|
for alias in command.aliases
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class CogGuide(commands.Cog):
|
class CogGuide(commands.Cog):
|
||||||
"""
|
"""
|
||||||
Cog to create cog guides
|
Cog to create cog guides
|
||||||
@ -64,6 +71,7 @@ class CogGuide(commands.Cog):
|
|||||||
"""Nothing to delete"""
|
"""Nothing to delete"""
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@checks.is_owner()
|
||||||
@commands.group()
|
@commands.group()
|
||||||
async def cogguideset(self, ctx: commands.Context):
|
async def cogguideset(self, ctx: commands.Context):
|
||||||
"""Base command for configuring cogguide"""
|
"""Base command for configuring cogguide"""
|
||||||
@ -82,6 +90,7 @@ class CogGuide(commands.Cog):
|
|||||||
|
|
||||||
await ctx.tick()
|
await ctx.tick()
|
||||||
|
|
||||||
|
@checks.is_owner()
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def allcogguides(self, ctx: commands.Context):
|
async def allcogguides(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
@ -96,6 +105,7 @@ class CogGuide(commands.Cog):
|
|||||||
await self.create_cog_guide(cog_name, cog)
|
await self.create_cog_guide(cog_name, cog)
|
||||||
await ctx.tick()
|
await ctx.tick()
|
||||||
|
|
||||||
|
@checks.is_owner()
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def cogguide(self, ctx: commands.Context, camel_cog_name: str):
|
async def cogguide(self, ctx: commands.Context, camel_cog_name: str):
|
||||||
"""
|
"""
|
||||||
@ -184,7 +194,7 @@ Commands
|
|||||||
"""
|
"""
|
||||||
if command.aliases:
|
if command.aliases:
|
||||||
cog_command += f"""
|
cog_command += f"""
|
||||||
.. tip:: Alias{'es' if len(command.aliases)>1 else ''}: {', '.join(f"{alias}" for alias in command.aliases)}
|
.. tip:: Alias{'es' if len(command.aliases)>1 else ''}: {produce_aliases(command)}
|
||||||
"""
|
"""
|
||||||
cog_command += f"""
|
cog_command += f"""
|
||||||
**Description**
|
**Description**
|
||||||
@ -194,10 +204,12 @@ Commands
|
|||||||
return cog_command
|
return cog_command
|
||||||
|
|
||||||
cog_commands_list = []
|
cog_commands_list = []
|
||||||
# com_list = [com for com in cog.walk_commands()]
|
com_list = [com for com in cog.walk_commands()]
|
||||||
# com_list.sort()
|
com_list.sort(key=lambda x: x.qualified_name)
|
||||||
for com in cog.walk_commands():
|
for com in com_list:
|
||||||
cog_commands_list.append(get_command_rst(com))
|
cog_commands_list.append(get_command_rst(com))
|
||||||
|
# for com in cog.walk_commands():
|
||||||
|
# cog_commands_list.append(get_command_rst(com))
|
||||||
with filepath.open("w", encoding="utf-8") as f:
|
with filepath.open("w", encoding="utf-8") as f:
|
||||||
f.write(intro)
|
f.write(intro)
|
||||||
f.write(cog_commands_intro)
|
f.write(cog_commands_intro)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user