Allow force enabling app commands using flag in extras #6018

Merged
Flame442 merged 7 commits from force_enable_app into V3/develop 2023-04-14 23:59:21 +02:00
Flame442 commented 2023-04-14 21:19:53 +02:00 (Migrated from github.com)

Description of the changes

Alternative to #6010

Unlike that PR, this PR does not subclass any of the app_commands objects to add kwargs to their constructors. Instead, it relies on the same data being passed via Command.extras, serving the same purpose once it is there. A list of differences in the two options are listed below.

#6010 This PR
Enabling a command @app_commands.command(
red_force_enable=True
)
@app_commands.command(
extras={"red_force_enable": True}
)
Accessing the setting command.red_force_enable command.extras.get(
"red_force_enable",
False
)
Avoids subclassing? No Yes

Still not certain how to approach the UX on [p]slash disableing a force enabled cog, or displaying force enabled cogs in [p]slash list. The UX is, however, implemented the same on both this PR and #6010 from the perspective of a user.

Have the changes in this PR been tested?

Yes

### Description of the changes Alternative to #6010 Unlike that PR, this PR does not subclass any of the `app_commands` objects to add kwargs to their constructors. Instead, it relies on the same data being passed via `Command.extras`, serving the same purpose once it is there. A list of differences in the two options are listed below. | | #6010 | This PR | | --- | --- | --- | | Enabling a command | `@app_commands.command(`<br />` red_force_enable=True`<br />`)` | `@app_commands.command(`<br />` extras={"red_force_enable": True}`<br />`)` | | Accessing the setting | `command.red_force_enable` | `command.extras.get(`<br />` "red_force_enable",`<br />` False`<br />`)` | | Avoids subclassing? | No | Yes | Still not certain how to approach the UX on `[p]slash disable`ing a force enabled cog, or displaying force enabled cogs in `[p]slash list`. The UX is, however, implemented the same on both this PR and #6010 from the perspective of a user. ### Have the changes in this PR been tested? <!-- Choose one (remove the line that doesn't apply): --> Yes <!-- If the question doesn't apply (for example, it's not a code change), choose Yes. Please respond to this question truthfully. We do not delay nor reject PRs based on the answer to this question but it allows to better review this PR. -->
TrustyJAID commented 2023-04-14 23:11:26 +02:00 (Migrated from github.com)

I think we should at least explain to the user attempting to disable a force enabled commands that it is force enabled and the command will not be removed. Cog creators have some requirements on this and we shouldn't restrict them too much on this regard. We can handle the administration side by requiring approved cog creators that choose to utilize force enabled commands to explain it in the cog install string.

I think we should at least explain to the user attempting to disable a force enabled commands that it is force enabled and the command will not be removed. Cog creators have some requirements on this and we shouldn't restrict them too much on this regard. We can handle the administration side by requiring approved cog creators that choose to utilize force enabled commands to explain it in the cog install string.
TrustyJAID (Migrated from github.com) approved these changes 2023-04-14 23:27:21 +02:00
TrustyJAID (Migrated from github.com) left a comment

This is looking good to me.

This is looking good to me.
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!6018
No description provided.