Skip to content

Commit 008b106

Browse files
committed
Fixed help formatter
1 parent 43ea713 commit 008b106

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

cogs/events.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@
1010

1111

1212
async def send_cmd_help(ctx):
13+
help_cmd = ctx.bot.get_command('help')
1314
if ctx.invoked_subcommand:
14-
_help = await ctx.bot.formatter.format_help_for(ctx, ctx.invoked_subcommand)
15+
await ctx.invoke(help_cmd, command=str(ctx.invoked_subcommand))
1516
else:
16-
_help = await ctx.bot.formatter.format_help_for(ctx, ctx.command)
17-
18-
for page in _help:
19-
await ctx.send(page)
17+
await ctx.invoke(help_cmd, command=str(ctx.command))
2018

2119

2220
class Events(commands.Cog):

cogs/mod.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,8 @@ async def unmute(self, ctx, member: discord.Member, *, reason: str = None):
140140
async def find(self, ctx):
141141
""" Finds a user within your search term """
142142
if ctx.invoked_subcommand is None:
143-
_help = await ctx.bot.formatter.format_help_for(ctx, ctx.command)
144-
145-
for page in _help:
146-
await ctx.send(page)
143+
help_cmd = self.bot.get_command('help')
144+
await ctx.invoke(help_cmd, command=str(ctx.command))
147145

148146
@find.command(name="playing")
149147
async def find_playing(self, ctx, *, search: str):
@@ -181,7 +179,6 @@ async def find_discriminator(self, ctx, *, search: str):
181179
@permissions.has_permissions(manage_messages=True)
182180
async def prune(self, ctx):
183181
""" Removes messages from the current server. """
184-
185182
if ctx.invoked_subcommand is None:
186183
help_cmd = self.bot.get_command('help')
187184
await ctx.invoke(help_cmd, command=str(ctx.command))

index.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,30 @@
1313

1414

1515
class HelpFormat(DefaultHelpCommand):
16-
async def get_destination(self, local=False):
16+
async def get_destination(self, no_pm: bool = False):
1717
try:
1818
if permissions.can_react(self.context):
1919
await self.context.message.add_reaction(chr(0x2709))
2020
except discord.Forbidden:
2121
pass
2222

23-
if local:
23+
if no_pm:
2424
return self.context.channel
2525
else:
2626
return self.context.author
2727

28-
async def send_pages(self):
29-
destination = await self.get_destination()
28+
async def send_command_help(self, command):
29+
self.add_command_formatting(command)
30+
self.paginator.close_page()
31+
await self.send_pages(no_pm=True)
32+
33+
async def send_pages(self, no_pm: bool = False):
34+
destination = await self.get_destination(no_pm=no_pm)
3035
try:
3136
for page in self.paginator.pages:
3237
await destination.send(page)
3338
except discord.Forbidden:
34-
destination = await self.get_destination(local=True)
39+
destination = await self.get_destination(no_pm=True)
3540
await destination.send("Couldn't send help to you due to blocked DMs...")
3641

3742

0 commit comments

Comments
 (0)