Browse Source

Merge pull request #3632 from weseek/fix/TypeError-trim-of-undefined

Fix/type error trim of undefined
Yuki Takei 5 years ago
parent
commit
f3f79a5a9b
1 changed files with 8 additions and 0 deletions
  1. 8 0
      packages/slackbot-proxy/src/controllers/slack.ts

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

@@ -79,8 +79,16 @@ export class SlackCtrl {
     // Send response immediately to avoid opelation_timeout error
     // Send response immediately to avoid opelation_timeout error
     // See https://api.slack.com/apis/connections/events-api#the-events-api__responding-to-events
     // See https://api.slack.com/apis/connections/events-api#the-events-api__responding-to-events
 
 
+    if (body.text == null) {
+      return 'No text.';
+    }
+
     const parsedBody = parseSlashCommand(body);
     const parsedBody = parseSlashCommand(body);
     const executeGrowiCommand = this.growiCommandsMappings[parsedBody.growiCommandType];
     const executeGrowiCommand = this.growiCommandsMappings[parsedBody.growiCommandType];
+
+    if (executeGrowiCommand == null) {
+      return 'No executeGrowiCommand';
+    }
     await executeGrowiCommand(body);
     await executeGrowiCommand(body);
     res.send();
     res.send();