zahmis 5 лет назад
Родитель
Сommit
619ee26a83
1 измененных файлов с 4 добавлено и 5 удалено
  1. 4 5
      src/server/service/bolt.js

+ 4 - 5
src/server/service/bolt.js

@@ -117,11 +117,10 @@ class BoltService {
   }
 
   async searchResults(command, inputSlack) {
-    console.log(inputSlack);
-    const growiCommand = inputSlack[0];
     const keyword = inputSlack[1];
-
-    if (growiCommand == null) {
+    // remove leading 'search'.
+    const replacedCommandText = command.text.replace(inputSlack[0], '');
+    if (keyword == null) {
       return this.client.chat.postEphemeral({
         channel: command.channel_id,
         user: command.user_id,
@@ -133,7 +132,7 @@ class BoltService {
 
     const { searchService } = this.crowi;
     const option = { limit: 10 };
-    const results = await searchService.searchKeyword(keyword, null, {}, option);
+    const results = await searchService.searchKeyword(replacedCommandText, null, {}, option);
 
     // no search results
     if (results.data.length === 0) {