[RFC] Ephemeral Commands #3163
Labels
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
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot#3163
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Rationale
There are a lot of issues with our current handling of the core Alias and CustomCommand cogs.
Without enumerating all of these, the common thread is that we are dynamically creating command objects for these to get command like behavior without potentially causing a conflict with an existing command, or preventing loading a cog by registering the command object to the bot.
This comes with many issues, most noticeably a performance one.
We could go back to the old way of just waiting to see a non-command, and then issuing a response on these, but we would lose many benefits we gained from making these bahave as commands, such as restricting where they can be used, and who they can be used by with core settings.
I think we can do better than give up on this here.
How
If we allowed registering commands to a secondary command mapping for commands which should only exist while there isn't a real command by the same name, we could handle this.
Under the hood, this would use a ChainMap, and require some tweaks with our handling with permissions, adding and removing commands.
Ideally, this could be as simple as adding
ephemeral=Trueto the command constructor from the cog developer side if they want a command to be easily overriden, or if they want to register a response handler, but only when there isn't a conflicting command.Other benefits
We could make certain commands in core red which are frequently replaced with custom versions ephemeral commands, thereby making replacing their implementations easier to do without breaking other features.
There's also at least one 3rd party cog of which I'm aware which would be able to make use of this.
Limitations
To limit the complexities which may arise in handling this, only commands or command groups will actually use this, subcommands or subgroups will be attached to the parent.