Implement command router
FiniteReality opened this issue · 4 comments
FiniteReality commented
Somehow commands need to be routed to the correct location so they can be handled.
I could possibly use the previous structures defined in 0.2, but they weren't necessarily the best...
FiniteReality commented
Currently this is done as part of the command parser in ab0e75c
FiniteReality commented
Since there are multiple ways to route a command (e.g. in Discord, each command has a unique identifier) this might be better to implement as part of the command store, and transition it to a semi-tree based structure
FiniteReality commented
The command store now uses a semi-tree based structure
FiniteReality commented
ICommandBinder can be used to bind an ICommand to a context, which in effect does the routing:
var binder = services.GetRequiredService<ICommandBinder>();
foreach (var command in potentialCommands)
{
if (binder.TryBind(context, command))
{
context.Command = command;
return
}
}