Skip to content

Create a more robust and flexible command metadata system #2180

@akiraveliara

Description

@akiraveliara

The metadata system is one of the major problems the Commands library has at this time. It is designed to support a minimal denominator between slash commands and text commands, with many seemingly arbitrary restrictions such as not supporting commands nested deeper than three layers (incidentally, this restriction is erroneously applied to the C# representations of command types as well, even if the tree would be legal to represent as slash commands), not supporting commands with names longer than 32 characters, not supporting any form of overloading and severely limiting the representible metadata that doesn't concern both of these two cases. Most other metadata currently has to use attributes, which come with their own restrictions imposed by the .NET platform.

Furthermore, there is presently only one single command tree tasked with supporting all different registrations and registration clusters (for instance; guild-specific commands are registered to the central tree). This tree has no concept of exclusivity beyond what can be simulated and parsed in attributes.

I propose to create a new tree system under the following design:

  1. Tree segments shall be divided into roots, themselves not executable; branches, leaves and overload nodes. Each leaf node may have an unlimited amount of unnamed overload nodes, and each branch may have exactly one unnamed leaf node representing itself as an executable node.
  2. Tree objects shall be immutable from the point of construction onwards.
  3. Tree objects shall expose all metadata indexably, and may at their discretion store important/commonly accessed properties directly in their object.
  4. Tree objects shall not impose any constraints on their metadata that is not technically necessary to ensure their very function.
  5. Tree objects shall clearly state binding requirements. If all children of a node declare themselves to be constrained in some way, the parent node shall declare itself constrained in the same way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    commandsFor issues related to DSharpPlus.Commands

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions