Skip to content

Commit 2e95f20

Browse files
committed
Fix activity help and add multiple close matches
1 parent f9b1ce4 commit 2e95f20

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cogs/utility.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from difflib import get_close_matches
88
from io import StringIO
99
from typing import Union
10+
from types import SimpleNamespace as param
1011
from json import JSONDecodeError
1112
from textwrap import indent
1213

@@ -154,10 +155,9 @@ async def send_error_message(self, msg): # pylint: disable=W0221
154155
if not cmd.hidden:
155156
choices.add(name)
156157
command = self.context.kwargs.get('command')
157-
# print(self.context.message.content[self.context.in])
158-
closest = get_close_matches(command, choices, n=1, cutoff=0.75)
158+
closest = get_close_matches(command, choices)
159159
if closest:
160-
embed.add_field(name=f'Perhaps you meant:', value=f'`{closest[0]}`')
160+
embed.add_field(name=f'Perhaps you meant:', value="\n".join(f'`{x}`' for x in closest))
161161
else:
162162
embed.title = 'Cannot find command or category'
163163
embed.set_footer(text=f'Type "{self.clean_prefix}{self.command_attrs["name"]}" '
@@ -453,15 +453,15 @@ async def activity(self, ctx, activity_type: str.lower, *, message: str = ''):
453453
return await ctx.send(embed=embed)
454454

455455
if not message:
456-
raise commands.UserInputError
456+
raise commands.MissingRequiredArgument(param(name='message'))
457457

458458
activity, msg = (await self.set_presence(
459459
activity_identifier=activity_type,
460460
activity_by_key=True,
461461
activity_message=message
462462
))['activity']
463463
if activity is None:
464-
raise commands.UserInputError
464+
raise commands.MissingRequiredArgument(param(name='activity'))
465465

466466
self.bot.config['activity_type'] = activity.type.value
467467
self.bot.config['activity_message'] = message
@@ -506,7 +506,7 @@ async def status(self, ctx, *, status_type: str.lower):
506506
status_by_key=True
507507
))['status']
508508
if status is None:
509-
raise commands.UserInputError
509+
raise commands.MissingRequiredArgument(param(name='status'))
510510

511511
self.bot.config['status'] = status.value
512512
await self.bot.config.update()

0 commit comments

Comments
 (0)