|
|
@@ -74,32 +74,11 @@ class BoltService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // Check if the access token is correct
|
|
|
- isValidAccessToken(body, command) {
|
|
|
- const slackBotAccessToken = body.slack_bot_access_token || null;
|
|
|
-
|
|
|
- if (slackBotAccessToken == null) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- return slackBotAccessToken === this.crowi.configManager.getConfig('crowi', 'slackbot:access-token');
|
|
|
- }
|
|
|
-
|
|
|
init() {
|
|
|
this.bolt.command('/growi', async({
|
|
|
command, client, body, ack,
|
|
|
}) => {
|
|
|
await ack();
|
|
|
-
|
|
|
- if (!this.isValidAccessToken(body, command)) {
|
|
|
- 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');
|
|
|
- }
|
|
|
-
|
|
|
const args = command.text.split(' ');
|
|
|
const firstArg = args[0];
|
|
|
|