itizawa пре 4 година
родитељ
комит
56f89ce012

+ 10 - 0
packages/slackbot-proxy/src/controllers/slack.ts

@@ -83,6 +83,16 @@ export class SlackCtrl {
       return this.registerService.process(growiCommand, authorizeResult, body as {[key:string]:string});
     }
 
+
+    // unregister
+    if (growiCommand.growiCommandType === 'unregister') {
+      // Send response immediately to avoid opelation_timeout error
+      // See https://api.slack.com/apis/connections/events-api#the-events-api__responding-to-events
+      res.send();
+
+      return this.registerService.unregister(growiCommand, authorizeResult, body as {[key:string]:string});
+    }
+
     /*
      * forward to GROWI server
      */

+ 8 - 0
packages/slackbot-proxy/src/services/RegisterService.ts

@@ -83,4 +83,12 @@ export class RegisterService implements GrowiCommandProcessor {
     return;
   }
 
+  async unregister(growiCommand: GrowiCommand, authorizeResult: AuthorizeResult, body: {[key:string]:string}): Promise<void> {
+    const { botToken } = authorizeResult;
+
+    const client = new WebClient(botToken, { logLevel: isProduction ? LogLevel.DEBUG : LogLevel.INFO });
+    console.log(growiCommand)
+  }
+
+
 }