public static TelegramTextMessage CreateTelegramTextMessage(string messageText)
 {
     return(TelegramTextMessage.Create(
                TelegramMessage.Create(
                    new TelegramUpdate
     {
         Message = new Message
         {
             Text = messageText
         }
     })));
 }
 public static TelegramCommand CreateTelegramCommand(string messageText, long chatId = 42)
 {
     return(new TelegramCommand(
                TelegramTextMessage.Create(
                    TelegramMessage.Create(
                        new TelegramUpdate
     {
         Message = new Message
         {
             Chat = new Chat
             {
                 Id = chatId
             },
             Text = messageText
         }
     }))));
 }
        public void CanExecute_returns_false_if_command_is_not_a_command()
        {
            var executor = new EchoCommandExecutor(null, null);

            var command = new TelegramCommand(
                TelegramTextMessage.Create(
                    TelegramMessage.Create(
                        new TelegramUpdate
            {
                Message = new Message {
                    Text = ""
                }
            })));

            command.IsCommand.Should().BeFalse();

            var result = executor.CanExecute(command);

            result.Should().BeFalse();
        }
        public async Task HandleAsync(TelegramMessage message)
        {
            if (message == null)
            {
                return;
            }

            _logger.LogDebug("Message Received");

            switch (message.Type)
            {
            case MessageType.Unknown:
                break;

            case MessageType.Text:
                await _textMessageHandler.HandleAsync(TelegramTextMessage.Create(message));

                break;

            case MessageType.Photo:
                break;

            case MessageType.Audio:
                break;

            case MessageType.Video:
                break;

            case MessageType.Voice:
                break;

            case MessageType.Document:
                break;

            case MessageType.Sticker:
                break;

            case MessageType.Location:
                break;

            case MessageType.Contact:
                break;

            case MessageType.Venue:
                break;

            case MessageType.Game:
                break;

            case MessageType.VideoNote:
                break;

            case MessageType.Invoice:
                break;

            case MessageType.SuccessfulPayment:
                break;

            case MessageType.WebsiteConnected:
                break;

            case MessageType.ChatMembersAdded:
                break;

            case MessageType.ChatMemberLeft:
                break;

            case MessageType.ChatTitleChanged:
                break;

            case MessageType.ChatPhotoChanged:
                break;

            case MessageType.MessagePinned:
                break;

            case MessageType.ChatPhotoDeleted:
                break;

            case MessageType.GroupCreated:
                break;

            case MessageType.SupergroupCreated:
                break;

            case MessageType.ChannelCreated:
                break;

            case MessageType.MigratedToSupergroup:
                break;

            case MessageType.MigratedFromGroup:
                break;

            case MessageType.Poll:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }