|
|
@@ -74,11 +74,26 @@ class BoltService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ verifyAccessToken(body, command) {
|
|
|
+ const slackBotAccessToken = body.slack_bot_access_token || null;
|
|
|
+ if (slackBotAccessToken == null || slackBotAccessToken !== this.crowi.configManager.getConfig('crowi', 'slackbot:access-token')) {
|
|
|
+ logger.error('slack_bot_access_token is inValid.');
|
|
|
+ this.client.chat.postEphemeral({
|
|
|
+ channel: command.channel_id,
|
|
|
+ user: command.user_id,
|
|
|
+ blocks: [this.generateMarkdownSectionBlock('*Access token is inValid*')],
|
|
|
+ });
|
|
|
+ throw new Error('slack_bot_access_token is inValid');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
init() {
|
|
|
this.bolt.command('/growi', async({
|
|
|
command, client, body, ack,
|
|
|
}) => {
|
|
|
await ack();
|
|
|
+ this.verifyAccessToken(body, command);
|
|
|
+
|
|
|
const args = command.text.split(' ');
|
|
|
const firstArg = args[0];
|
|
|
|