|
7 | 7 | from difflib import get_close_matches
|
8 | 8 | from io import StringIO
|
9 | 9 | from typing import Union
|
| 10 | +from types import SimpleNamespace as param |
10 | 11 | from json import JSONDecodeError
|
11 | 12 | from textwrap import indent
|
12 | 13 |
|
@@ -154,10 +155,9 @@ async def send_error_message(self, msg): # pylint: disable=W0221
|
154 | 155 | if not cmd.hidden:
|
155 | 156 | choices.add(name)
|
156 | 157 | 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) |
159 | 159 | 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)) |
161 | 161 | else:
|
162 | 162 | embed.title = 'Cannot find command or category'
|
163 | 163 | 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 = ''):
|
453 | 453 | return await ctx.send(embed=embed)
|
454 | 454 |
|
455 | 455 | if not message:
|
456 |
| - raise commands.UserInputError |
| 456 | + raise commands.MissingRequiredArgument(param(name='message')) |
457 | 457 |
|
458 | 458 | activity, msg = (await self.set_presence(
|
459 | 459 | activity_identifier=activity_type,
|
460 | 460 | activity_by_key=True,
|
461 | 461 | activity_message=message
|
462 | 462 | ))['activity']
|
463 | 463 | if activity is None:
|
464 |
| - raise commands.UserInputError |
| 464 | + raise commands.MissingRequiredArgument(param(name='activity')) |
465 | 465 |
|
466 | 466 | self.bot.config['activity_type'] = activity.type.value
|
467 | 467 | self.bot.config['activity_message'] = message
|
@@ -506,7 +506,7 @@ async def status(self, ctx, *, status_type: str.lower):
|
506 | 506 | status_by_key=True
|
507 | 507 | ))['status']
|
508 | 508 | if status is None:
|
509 |
| - raise commands.UserInputError |
| 509 | + raise commands.MissingRequiredArgument(param(name='status')) |
510 | 510 |
|
511 | 511 | self.bot.config['status'] = status.value
|
512 | 512 | await self.bot.config.update()
|
|
0 commit comments