|
|
@@ -311,8 +311,7 @@ export class SlackCtrl {
|
|
|
}
|
|
|
|
|
|
@Post('/events')
|
|
|
- @UseBefore(AuthorizeCommandMiddleware)
|
|
|
- async handleEvent(@BodyParams() body:{[key:string]:string}, @Req() req: SlackOauthReq/* , @Res() res: Res */): Promise<void|string> {
|
|
|
+ async handleEvent(@BodyParams() body:{[key:string]:string}/* , @Res() res: Res */): Promise<void|string> {
|
|
|
// eslint-disable-next-line max-len
|
|
|
// see: https://api.slack.com/apis/connections/events-api#the-events-api__subscribing-to-event-types__events-api-request-urls__request-url-configuration--verification
|
|
|
if (body.type === 'url_verification') {
|
|
|
@@ -321,20 +320,6 @@ export class SlackCtrl {
|
|
|
|
|
|
logger.info('receive event', body);
|
|
|
|
|
|
- if (req.authorizeResult.botToken == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- const client = generateWebClient(req.authorizeResult.botToken);
|
|
|
- const user = req.user;
|
|
|
- const channel = req.body.event.channel;
|
|
|
-
|
|
|
- await client.chat.postMessage({
|
|
|
- channel,
|
|
|
- user,
|
|
|
- text: 'yeeeah hooo',
|
|
|
- });
|
|
|
-
|
|
|
return;
|
|
|
}
|
|
|
|