This is C# port of Java teleroute library
IRoute
and ICmd
interfaces return IEnumerable
, that contains one element or nothing. This is done to avoid null checks in the code.
// find suitable command for update in route tree
IEnumerable<YourCommand> command = route.Route(update);
if(!command.Any())
{
// not found processing or just ignore
}
IEnumerable<YourSend> send = command.Single().Execute(update);
// send your message to Telegram
send.Single().Send(yourTgClient);