zahmis há 5 anos atrás
pai
commit
28f285ba3f
1 ficheiros alterados com 13 adições e 4 exclusões
  1. 13 4
      src/server/service/bolt.js

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

@@ -91,21 +91,30 @@ class BoltService {
       const firstArg = inputSlack[0];
       const secondArg = inputSlack[1];
 
-      let searchResults;
+      let data;
+      let paths;
       if (firstArg === 'search') {
         const { searchService } = this.crowi;
         const option = { limit: 10 };
-        searchResults = await searchService.searchKeyword(secondArg, null, {}, option);
+        const searchResults = await searchService.searchKeyword(secondArg, null, {}, option);
+        data = searchResults.data;
+        paths = data.forEach((d) => { console.log(d._source) });
       }
 
+      console.log(paths);
       // TODO impl try-catch
       try {
         const result = await this.client.chat.postEphemeral({
           channel: this.channelId,
           user: this.userId,
-          text: searchResults,
+          blocks: [{
+            type: 'section',
+            text: {
+              type: 'mrkdwn',
+              text: `${paths}`,
+            },
+          }],
         });
-        console.log(result);
       }
       catch {
         console.log('This is error');