[RedTree] add UserFeedbackCheckFailure for app_commands #6397

Merged
japandotorg merged 8 commits from feat/tree-error into V3/develop 2024-07-12 19:30:23 +02:00
japandotorg commented 2024-07-08 09:56:25 +02:00 (Migrated from github.com)

Description of the changes

Add a UserFeedbackCheclkFailure exception class with configurable message which is handled within RedTree.on_error

Have the changes in this PR been tested?

No

### Description of the changes Add a `UserFeedbackCheclkFailure` exception class with configurable message which is handled within `RedTree.on_error` ### Have the changes in this PR been tested? No
Flame442 (Migrated from github.com) requested changes 2024-07-10 20:46:45 +02:00
@ -0,0 +1,10 @@
"""Errors module for the app_commands package."""
Flame442 (Migrated from github.com) commented 2024-07-10 20:46:03 +02:00

This package will not be public, so __all__ should not be used. This class name should remain in the __all__ of app_commands.__init__, as it is only guaranteed to exist when imported directly from redbot.core.app_commands.

Lack of __all__ in the module means that all of its names are considered private APIs.

https://docs.discord.red/en/stable/version_guarantees.html#developer-guarantees

This package will not be public, so `__all__` should not be used. This class name should remain in the `__all__` of `app_commands.__init__`, as it is only guaranteed to exist when imported directly from `redbot.core.app_commands`. > Lack of `__all__` in the module means that all of its names are considered private APIs. https://docs.discord.red/en/stable/version_guarantees.html#developer-guarantees
@ -328,2 +329,4 @@
)
await self._send_from_interaction(interaction, msg, delete_after=error.retry_after)
elif isinstance(error, UserFeedbackCheckFailure):
if error.message:
Flame442 (Migrated from github.com) commented 2024-07-10 20:41:49 +02:00

This must be before the CheckFailure branch, or that branch will trigger first due to UserFeedbackCheckFailure being a subclass.

This must be before the `CheckFailure` branch, or that branch will trigger first due to `UserFeedbackCheckFailure` being a subclass.
japandotorg commented 2024-07-10 22:14:22 +02:00 (Migrated from github.com)

that should be it, requested changes have been made.

that should be it, requested changes have been made.
Jackenmen (Migrated from github.com) reviewed 2024-07-10 22:16:34 +02:00
@ -0,0 +1,10 @@
"""Errors module for the app_commands package."""
Jackenmen (Migrated from github.com) commented 2024-07-10 22:16:34 +02:00

The docstring from commands.CheckFailure makes more sense than this one:

    """A version of CheckFailure which isn't suppressed."""
The docstring from `commands.CheckFailure` makes more sense than this one: ```suggestion """A version of CheckFailure which isn't suppressed.""" ```
japandotorg (Migrated from github.com) reviewed 2024-07-10 22:21:07 +02:00
@ -0,0 +1,10 @@
"""Errors module for the app_commands package."""
japandotorg (Migrated from github.com) commented 2024-07-10 22:21:07 +02:00

i was gonna use that as well, but unlike Red.on_command_error app_commands.CheckFailure isn't really suppressed on RedTree.on_error github.com/Cog-Creators/Red-DiscordBot@efc99c5dce/redbot/core/tree.py (L336)

i was gonna use that as well, but unlike `Red.on_command_error` `app_commands.CheckFailure` isn't really suppressed on `RedTree.on_error` https://github.com/Cog-Creators/Red-DiscordBot/blob/efc99c5dceda82537f75c24f734d4fb4dd4a8e11/redbot/core/tree.py#L336
japandotorg (Migrated from github.com) reviewed 2024-07-10 22:21:47 +02:00
@ -0,0 +1,10 @@
"""Errors module for the app_commands package."""
japandotorg (Migrated from github.com) commented 2024-07-10 22:21:47 +02:00

would there be something more appropriate in this case?

would there be something more appropriate in this case?
Jackenmen (Migrated from github.com) reviewed 2024-07-10 22:23:48 +02:00
@ -0,0 +1,10 @@
"""Errors module for the app_commands package."""
Jackenmen (Migrated from github.com) commented 2024-07-10 22:23:48 +02:00

I see... Maybe something like this?

    """A version of CheckFailure responding with a custom error message."""
I see... Maybe something like this? ```suggestion """A version of CheckFailure responding with a custom error message.""" ```
japandotorg (Migrated from github.com) reviewed 2024-07-10 22:32:26 +02:00
@ -0,0 +1,10 @@
"""Errors module for the app_commands package."""
japandotorg (Migrated from github.com) commented 2024-07-10 22:32:26 +02:00

I suppose this would be a better one for now.

I suppose this would be a better one for now.
Flame442 (Migrated from github.com) approved these changes 2024-07-12 19:29:57 +02:00
Flame442 (Migrated from github.com) left a comment

image

![image](https://github.com/user-attachments/assets/6a4263bf-3dd1-494b-bbf9-379e37fc0034)
Sign in to join this conversation.
No reviewers
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!6397
No description provided.