コード例 #1
0
 public async Task HandleAsync(string text, Message message, CancellationToken cancellationToken)
 {
     if (text.Contains(HubIACommand))
     {
         text = text.Replace($"#{HubIACommand}#", "");
         var param = text.Split('|');
         var resp  = await _nlpService.ProcessAsync(param[0], message, cancellationToken);
     }
     else if (text.Contains(SearchLanguage))
     {
         text = text.Replace($"#{SearchLanguage}#", "");
         await SearchLanguageAsync(message.From, cancellationToken);
     }
     else if (text.Contains(SearchUser))
     {
         text = text.Replace($"#{SearchUser}#", "");
         await SearchUserAsync(message.From, cancellationToken);
     }
     else if (text.Contains(SearchRepo))
     {
         text = text.Replace($"#{SearchRepo}#", "");
         await SearchRepoAsync(message.From, cancellationToken);
     }
     else if (text.Contains(GetUser))
     {
         text = text.Replace($"#{GetUser}#", "");
         await GetUserAsync(text, message.From, cancellationToken);
     }
 }
コード例 #2
0
 public async Task HandleAsync(string text, Message messageOriginator, CancellationToken cancellationToken)
 {
     if (text.Contains(HubIACommand))
     {
         text = text.Replace($"#{HubIACommand}#", "");
         var param = text.Split('|');
         var resp  = await _nlpService.ProcessAsync(param[0], messageOriginator, cancellationToken);
     }
     //Example of if statement for "ping" noaction example. You can delete it.
     else if (text.Contains("#ping#"))
     {
         await CommandPing(messageOriginator.From, cancellationToken);
     }
 }