예제 #1
0
 private async Task GetParameterValueFromClient(MethodInfo methodInfo, ParameterInfo parameterInfo, TelegramClientInfo clientInfo, MessageEventArgs e)
 {
     if (!CurrentBotStructureInfo.OnParameterSelecting(methodInfo, parameterInfo, clientInfo, e.Message.Text))
     {
         if (parameterInfo == null)
         {
             List <List <BotButtonInfo> > buttons = GetMethodParametersButtons(methodInfo, clientInfo);
             CurrentBotStructureInfo.OnButtonsGenerating(buttons, BotLevelType.Parameters, clientInfo.CurrentServiceName, clientInfo.CurrentMethodName, clientInfo);
             ReplyKeyboardMarkup replyMarkup = new ReplyKeyboardMarkup
             {
                 Keyboard = BotButtonsToKeyboardButtons(buttons, clientInfo)
             };
             await _botClient.SendTextMessageAsync(
                 chatId : e.Message.Chat,
                 text : CurrentBotStructureInfo.GetParameterNotFoundText(e.Message.Text, clientInfo),
                 replyMarkup : replyMarkup
                 );
         }
         else
         {
             clientInfo.CurrentParameterName = parameterInfo.Name;
             List <List <BotButtonInfo> > buttons = GetMethodParametersButtons(methodInfo, clientInfo);
             CurrentBotStructureInfo.OnButtonsGenerating(buttons, BotLevelType.Parameters, clientInfo.CurrentServiceName, clientInfo.CurrentMethodName, clientInfo);
             ReplyKeyboardMarkup replyMarkup = new ReplyKeyboardMarkup
             {
                 Keyboard = BotButtonsToKeyboardButtons(buttons, clientInfo)
             };
             await _botClient.SendTextMessageAsync(
                 chatId : e.Message.Chat,
                 text : CurrentBotStructureInfo.GetParameterSelectedText(GetParameterCaption(methodInfo, parameterInfo), clientInfo),
                 replyMarkup : replyMarkup
                 );
         }
     }
 }