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.
matrix-org/matrix-spec-proposals#4332
Modifying the
MatrixInterfaceCommandDispatcherinterfaceMatrixInterfaceCommandDispatcherinterface (https://github.com/the-draupnir-project/interface-manager/blob/9c4745bb06841c436089ad0a2afb0c399f26e12b/src/MatrixInterfaceAdaptor/MatrixInterfaceCommandDispatcher.ts#L24-L34).handleCommandMessageEventwould need to be renamed tohandleMessageBodyCommand, but its arguments would be the samehandleMessageMixinCommandwhich accepts them.bot.commandmixin.Implementing the
MatrixInterfaceCommandDispatcher['handleMessageMixinCommand']methodOption 1: Substituting the arguments into a string.
You could simply substitute each argument into the string and then call
handleMessageBodyCommandinstead.Option 2: Building a presentation argument string from the command ID
It may be possible instead to edit the
CommandTableto 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 theinterface-managerabstraction. 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
PresentationArgumentStreamspecific to them.bot.commandmixin, and feeding that to the existing code that producesCompleteCommand's.