|
|
@@ -9,6 +9,7 @@ const { verifySlackRequest, generateWebClient } = require('@growi/slack');
|
|
|
const logger = loggerFactory('growi:routes:apiv3:slack-integration');
|
|
|
const router = express.Router();
|
|
|
const SlackAppIntegration = mongoose.model('SlackAppIntegration');
|
|
|
+const slackBotResponse = require('../../service/slack-command-handler/slack-bot-response');
|
|
|
|
|
|
module.exports = (crowi) => {
|
|
|
this.app = crowi.express;
|
|
|
@@ -103,12 +104,9 @@ module.exports = (crowi) => {
|
|
|
const args = body.text.split(' ');
|
|
|
const command = args[0];
|
|
|
|
|
|
- try {
|
|
|
+ await slackBotResponse(client, body, async() => {
|
|
|
await crowi.slackBotService.handleCommandRequest(command, client, body, args);
|
|
|
- }
|
|
|
- catch (error) {
|
|
|
- logger.error(error);
|
|
|
- }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
router.post('/commands', addSigningSecretToReq, verifySlackRequest, async(req, res) => {
|
|
|
@@ -151,10 +149,14 @@ module.exports = (crowi) => {
|
|
|
try {
|
|
|
switch (type) {
|
|
|
case 'block_actions':
|
|
|
- await crowi.slackBotService.handleBlockActionsRequest(client, payload);
|
|
|
+ await slackBotResponse(client, req.body, async() => {
|
|
|
+ await crowi.slackBotService.handleBlockActionsRequest(client, payload);
|
|
|
+ });
|
|
|
break;
|
|
|
case 'view_submission':
|
|
|
- await crowi.slackBotService.handleViewSubmissionRequest(client, payload);
|
|
|
+ await slackBotResponse(client, req.body, async() => {
|
|
|
+ await crowi.slackBotService.handleViewSubmissionRequest(client, payload);
|
|
|
+ });
|
|
|
break;
|
|
|
default:
|
|
|
break;
|