zahmis 5 лет назад
Родитель
Сommit
937ce67074

+ 2 - 2
packages/slackbot-proxy/src/controllers/slack.ts

@@ -1,3 +1,4 @@
+import { SlashCommand } from '@slack/bolt';
 import {
   BodyParams, Controller, Get, Inject, Post, Req, Res,
 } from '@tsed/common';
@@ -58,11 +59,10 @@ export class SlackCtrl {
   }
 
   @Post('/events')
-  handleEvent(@BodyParams() body:{[key:string]:string}, @Res() res: Res): string {
+  handleEvent(@BodyParams() body:SlashCommand, @Res() res: Res): string {
     // Send response immediately to avoid opelation_timeout error
     // See https://api.slack.com/apis/connections/events-api#the-events-api__responding-to-events
 
-    console.log(body);
     const slackInput = this.receiveService.receiveContentsFromSlack(body);
     console.log('Controller/events', slackInput);
     res.send();

+ 2 - 1
packages/slackbot-proxy/src/services/RecieveService.ts

@@ -1,9 +1,10 @@
 import { Service } from '@tsed/di';
+import { SlashCommand } from '@slack/bolt';
 
 @Service()
 export class ReceiveService {
 
-  receiveContentsFromSlack(body:{[key:string]:string}) : string {
+  receiveContentsFromSlack(body:SlashCommand) : string {
     if (body.text === 'register') {
       console.log('register action occured');
       return 'register action occurd';