Fuzzy search not working #2031

Closed
opened 2018-08-19 11:49:56 +02:00 by Tobotimus · 2 comments
Tobotimus commented 2018-08-19 11:49:56 +02:00 (Migrated from github.com)

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.

# 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 commented 2018-08-19 12:14:40 +02:00 (Migrated from github.com)

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.
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 commented 2018-09-24 02:35:14 +02:00 (Migrated from github.com)

Resolved by #2122.

Resolved by #2122.
Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot#2031
No description provided.