Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuzzy search not working #2031

Closed
Tobotimus opened this issue Aug 19, 2018 · 2 comments
Closed

Fuzzy search not working #2031

Tobotimus opened this issue Aug 19, 2018 · 2 comments
Assignees
Labels
Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing.
Milestone

Comments

@Tobotimus
Copy link
Member

Tobotimus commented Aug 19, 2018

Other bugs

It appears we have an issue with fuzzy search. When enabled in DMs, sending a misspelled command yields this:

[19/08/2018 19:47] ERROR events on_error 181: Exception in on_command_error
Traceback (most recent call last):
  File "/home/tobyh/PycharmProjects/Red-DiscordBot/.venv/src/discord.py/discord/client.py", line 220, in _run_event
    await coro(*args, **kwargs)
  File "/home/tobyh/PycharmProjects/Red-DiscordBot/redbot/core/events.py", line 234, in on_command_error
    fuzzy_result = await fuzzy_command_search(ctx, ctx.invoked_with)
  File "/home/tobyh/PycharmProjects/Red-DiscordBot/redbot/core/utils/__init__.py", line 52, in fuzzy_command_search
    is_alias, alias = await alias_cog.is_alias(ctx.guild, term)
  File "/home/tobyh/PycharmProjects/Red-DiscordBot/redbot/cogs/alias/alias.py", line 60, in is_alias
    server_aliases = await self.unloaded_aliases(guild)
  File "/home/tobyh/PycharmProjects/Red-DiscordBot/redbot/cogs/alias/alias.py", line 41, in unloaded_aliases
    return (AliasEntry.from_json(d) for d in (await self._aliases.guild(guild).entries()))
  File "/home/tobyh/PycharmProjects/Red-DiscordBot/redbot/core/config.py", line 761, in guild
    return self._get_base_group(self.GUILD, guild.id)
AttributeError: 'NoneType' object has no attribute 'id'

And server fuzzy doesn't seem to work at all (Edit: It was just a high ratio, I'm going to lower it). I'll investigate.

@Tobotimus Tobotimus added Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing. V3 Status: Accepted We want this labels Aug 19, 2018
@Tobotimus Tobotimus added this to the Beta 20 milestone Aug 19, 2018
@Tobotimus Tobotimus self-assigned this Aug 19, 2018
@Tobotimus
Copy link
Member Author

Tobotimus commented Aug 19, 2018

Having resolved the above traceback on my local branch, I ran into this one which seems to be caused by typing a command similar to a guild-only one whilst in DM:

Traceback (most recent call last):
  File "/home/tobyh/PycharmProjects/Red-DiscordBot/.venv/src/discord.py/discord/client.py", line 220, in _run_event
    await coro(*args, **kwargs)
  File "/home/tobyh/PycharmProjects/Red-DiscordBot/redbot/core/events.py", line 231, in on_command_error
    fuzzy_result = await fuzzy_command_search(ctx, ctx.invoked_with)
  File "/home/tobyh/PycharmProjects/Red-DiscordBot/redbot/core/utils/__init__.py", line 69, in fuzzy_command_search
    ctx, extracted
  File "/home/tobyh/PycharmProjects/Red-DiscordBot/redbot/core/utils/__init__.py", line 33, in filter_commands
    for i in extracted
  File "/home/tobyh/PycharmProjects/Red-DiscordBot/redbot/core/utils/__init__.py", line 37, in <listcomp>
    and all([await p.can_run(ctx) for p in i[0].parents])
  File "/home/tobyh/PycharmProjects/Red-DiscordBot/redbot/core/utils/__init__.py", line 37, in <listcomp>
    and all([await p.can_run(ctx) for p in i[0].parents])
  File "/home/tobyh/PycharmProjects/Red-DiscordBot/.venv/src/discord.py/discord/ext/commands/core.py", line 734, in can_run
    return (await discord.utils.async_all(predicate(ctx) for predicate in predicates))
  File "/home/tobyh/PycharmProjects/Red-DiscordBot/.venv/src/discord.py/discord/utils.py", line 276, in async_all
    for elem in gen:
  File "/home/tobyh/PycharmProjects/Red-DiscordBot/.venv/src/discord.py/discord/ext/commands/core.py", line 734, in <genexpr>
    return (await discord.utils.async_all(predicate(ctx) for predicate in predicates))
  File "/home/tobyh/PycharmProjects/Red-DiscordBot/.venv/src/discord.py/discord/ext/commands/core.py", line 1282, in predicate
    raise NoPrivateMessage('This command cannot be used in private messages.')
discord.ext.commands.errors.NoPrivateMessage: This command cannot be used in private messages.

@Tobotimus Tobotimus modified the milestones: Beta 20, Beta 21 Aug 25, 2018
@Tobotimus Tobotimus modified the milestones: Beta 21, RC 1 Sep 9, 2018
Tobotimus added a commit to Tobotimus/Red-DiscordBot that referenced this issue Sep 11, 2018
I'm really sorry this is a big diff. There was lots to refactor though.

What's changed:
- Fixed issues mentioned on Cog-Creators#2031
- Fuzzy help displays more like help manual
- Fuzzy help is easier and more flexible to use
- Fuzzy help string-matching ratio lowered to 80
- Help formatter is more extendable
- Help command has been optimized, cleaned up and better incorporates fuzzy help
- Added async_filter and async_enumerate utility functions because I was using them for this PR, then no longer needed them, but decided they might be useful anyway.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
@Tobotimus Tobotimus added Status: In Progress There's a PR open to deal with this, or an org member is working on this internally and removed Status: Accepted We want this labels Sep 13, 2018
Tobotimus added a commit that referenced this issue Sep 24, 2018
What's changed:
- Fixed issues mentioned on #2031
- Fuzzy help displays more like help manual
- Fuzzy help is easier and more flexible to use
- Fuzzy help string-matching ratio lowered to 80
- Help formatter is more extendable
- Help command has been optimized, cleaned up and better incorporates fuzzy help
- Added async_filter and async_enumerate utility functions because I was using them for this PR, then no longer needed them, but decided they might be useful anyway.
- Added `Context.me` property which is a shortcut to `Context.guild.me` or `Context.bot.user`, depending on the channel type.
@Tobotimus
Copy link
Member Author

Resolved by #2122.

@Tobotimus Tobotimus removed the Status: In Progress There's a PR open to deal with this, or an org member is working on this internally label Sep 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing.
Projects
None yet
Development

No branches or pull requests

1 participant