Beispiel #1
0
    private async Task HandleMessageEvent(Message message)
    {
        await _commandsService.ExecuteCommand(message, OnSuccess, OnFailed);

        async Task OnSuccess(IResult res)
        {
            await _sender.Send(message.ChatId, res.Message, res.Keyboard);
        }

        async Task OnFailed(IResult res)
        {
            await _sender.Send(message.ChatId, res.Message);
        }
    }
Beispiel #2
0
    private async Task MessageNew(Message message)
    {
        _logger.Debug("Обработка сообщения");
        await _commandsService.ExecuteCommand(message, OnSuccess, OnFailed);

        _logger.Information("Обработка сообщения завершена");

        async Task OnSuccess(IResult res)
        {
            await _sender.Send(message.ChatId, res.Message, res.Keyboard);
        }

        async Task OnFailed(IResult res)
        {
            await _sender.Send(message.ChatId, res.Message, res.Keyboard);
        }
    }