-
-
Notifications
You must be signed in to change notification settings - Fork 732
Migrated !tags command to slash command /tag
#2403
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
Conversation
wookie184
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm currently getting an error when running this if there are too many matches, we should probably trim the results in these cases:
bot-bot-1 | 2023-02-19 15:45:18 | asyncio | ERROR | Task exception was never retrieved
bot-bot-1 | future: <Task finished name='CommandTree-invoker' coro=<CommandTree._from_interaction.<locals>.wrapper() done, defined at /opt/poetry/cache/virtualenvs/bot-TFcQMFAJ-py3.10/lib/python3.10/site-packages/discord/app_commands/tree.py:1089> exception=HTTPException('400 Bad Request (error code: 50035): Invalid Form Body\nIn data.choices: Must be 25 or fewer in length.')>
bot-bot-1 | Traceback (most recent call last):
bot-bot-1 | File "/opt/poetry/cache/virtualenvs/bot-TFcQMFAJ-py3.10/lib/python3.10/site-packages/discord/app_commands/tree.py", line 1091, in wrapper
bot-bot-1 | await self._call(interaction)
bot-bot-1 | File "/opt/poetry/cache/virtualenvs/bot-TFcQMFAJ-py3.10/lib/python3.10/site-packages/discord/app_commands/tree.py", line 1238, in _call
bot-bot-1 | await command._invoke_autocomplete(interaction, focused, namespace)
bot-bot-1 | File "/opt/poetry/cache/virtualenvs/bot-TFcQMFAJ-py3.10/lib/python3.10/site-packages/discord/app_commands/commands.py", line 931, in _invoke_autocomplete
bot-bot-1 | await interaction.response.autocomplete(choices)
bot-bot-1 | File "/opt/poetry/cache/virtualenvs/bot-TFcQMFAJ-py3.10/lib/python3.10/site-packages/discord/interactions.py", line 966, in autocomplete
bot-bot-1 | await adapter.create_interaction_response(
bot-bot-1 | File "/opt/poetry/cache/virtualenvs/bot-TFcQMFAJ-py3.10/lib/python3.10/site-packages/discord/webhook/async_.py", line 220, in request
bot-bot-1 | raise HTTPException(response, data)
bot-bot-1 | discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
bot-bot-1 | In data.choices: Must be 25 or fewer in length.
I think we should try to avoid any cases of "The application did not respond" errors on the client. Another case where this can happen is where no match can be found e.g. /tag get fionferonfero
Fixed. |
+ Remove commented code + Remove unecessarily syncting the bot + Handle direct tag commads + 3.10 type hinting in concerned functions + Add `MockInteractionMessage` + Fix tests for `try_get_tag`
wookie184
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, thanks!
I wonder whether it would be better to just have a /tag <name> command, since currently /tag get with no arguments is the same as /tag list, so i'm not sure there's any point in having two commands. One would be shorter to type and simplify the code a little.
I had a conversation about this on discord with @ChrisLovering, he suggested making the commands like that. |
+ used both `discord.User` and `discord.Member` in typehinting as `InteractionResponse.user` returns `discord.User` object + removed `ErrorHandler()._can_run` + edited `try_get_tag` to use `bot.can_run` + removed `/tag list` + change `/tag get <name>` to `/tag <name>` + remove redundant `GUILD_ID` in `tags.py` + using `discord.abc.Messageable` because `ctx.channel` returns that instead of `Channel` Object
wookie184
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thanks!
shtlrs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few nitpicks, other than that, it looks good !
+ removed using of discord.User + update docstring for `get_command_ctx` + renamed user variables to member
shtlrs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you!
#2394
/tag listlists all the accessible tags/tag get <tag_name>empty<tag_name>returns the same output as/tag listsearchsub-groupScreenshots: