Skip to content

[Task] Hypothetically implementing parsing the m.bot.command mixin from MSC4332 #50

Description

@Gnuxie

matrix-org/matrix-spec-proposals#4332

Modifying the MatrixInterfaceCommandDispatcher interface

Implementing the MatrixInterfaceCommandDispatcher['handleMessageMixinCommand'] method

Option 1: Substituting the arguments into a string.

You could simply substitute each argument into the string and then call handleMessageBodyCommand instead.

Option 2: Building a presentation argument string from the command ID

⚠️ this is a badly formed stream of thought

It may be possible instead to edit the CommandTable to automatically produce and intern command by their ID as designated in the MSC. But this is dirty and adds implementation detail from the MSC to the interface-manager abstraction. Why does the MSC not just use the designator parts as the command ID?

In any case if somehow this was made possible:

The command would be located from the command table by the ID in syntax (probably by modifying the command dispatcher abstraction or by parsing the designator parts from the command ID and using that instead).

Trying to use each parameter description name is used to find a variable in the mixin and place it into the stream, and then parsing the command from that stream would lead to a duplication of error tracking information, as interface-manager handles unexpected argument errors from parsing commands from the stream itself. So the only real option here would be to lazily parse the mixin with a custom PresentationArgumentStream specific to the m.bot.command mixin, and feeding that to the existing code that produces CompleteCommand's.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions