Explorar o código

restore and create growi-search

zahmis %!s(int64=5) %!d(string=hai) anos
pai
achega
8d3f68d7e7
Modificáronse 1 ficheiros con 8 adicións e 4 borrados
  1. 8 4
      src/server/service/bolt.js

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

@@ -60,14 +60,11 @@ class BoltService {
   }
 
   async init() {
+    // Example of listening for event
     // See. https://github.com/slackapi/bolt-js#listening-for-events
     // or https://slack.dev/bolt-js/concepts#basic
     this.bolt.command('/growi-bot', async({ command, ack, say }) => { // demo
       await say('Hello');
-      const { searchService } = this.crowi;
-      const results = await searchService.searchKeyword(command.text, null, {}, {});
-      // get 10 result from slack input
-      console.log(results.data.slice(0, 10));
     });
 
     // The echo command simply echoes on command
@@ -77,6 +74,13 @@ class BoltService {
 
       await say(`${command.text}`);
     });
+
+    this.bolt.command('/growi-search', async({ command, ack, say }) => {
+      const { searchService } = this.crowi;
+      const results = await searchService.searchKeyword(command.text, null, {}, {});
+      // get 10 result from slack input
+      console.log(results.data.slice(0, 10));
+    });
   }
 
 }