Skip to content

Commit

Permalink
remove outdated workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
VoxBorealis committed Jul 21, 2023
1 parent 9eab985 commit 5c4dfd9
Showing 1 changed file with 21 additions and 34 deletions.
55 changes: 21 additions & 34 deletions app/src/index.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
require('./tools/timestampedLogger').replaceLoggers();
require('dotenv').config();
require('./tools/quotenv').checkEnv([
'SLACK_BOT_TOKEN',
'SLACK_APP_TOKEN',
'SLACK_SIGNING_SECRET',
]);
const { App } = require('@slack/bolt');
const scheduler = require('./scheduler/scheduler');
const usergroups = require('./usergroups');
const { enableActionFunctions } = require('./actionFunctions');
const { enableEventListeners } = require('./eventListeners');
const { enableUserCache } = require('./userCache');
const { enableMiddleware } = require('./middleware');
const { enableSlashCommands } = require('./slashCommands');
require("./tools/timestampedLogger").replaceLoggers();
require("dotenv").config();
require("./tools/quotenv").checkEnv(["SLACK_BOT_TOKEN", "SLACK_APP_TOKEN", "SLACK_SIGNING_SECRET"]);
const { App } = require("@slack/bolt");
const scheduler = require("./scheduler/scheduler");
const usergroups = require("./usergroups");
const { enableActionFunctions } = require("./actionFunctions");
const { enableEventListeners } = require("./eventListeners");
const { enableUserCache } = require("./userCache");
const { enableMiddleware } = require("./middleware");
const { enableSlashCommands } = require("./slashCommands");

const app = new App({
token: process.env.SLACK_BOT_TOKEN,
signingSecret: process.env.SLACK_SIGNING_SECRET,
socketMode: true,
appToken: process.env.SLACK_APP_TOKEN,
token: process.env.SLACK_BOT_TOKEN,
signingSecret: process.env.SLACK_SIGNING_SECRET,
socketMode: true,
appToken: process.env.SLACK_APP_TOKEN,
});

const state = {
app,
usergroups,
app,
usergroups,
};

const userCache = enableUserCache(state);
Expand All @@ -38,17 +34,8 @@ enableSlashCommands(state);
* Starts the bot.
*/
(async () => {
await app.start();
scheduler.startScheduling(state);
scheduler.scheduleUsergroupReadings(state);
console.log('⚡️ Bolt app is running!');
await app.start();
scheduler.startScheduling(state);
scheduler.scheduleUsergroupReadings(state);
console.log("⚡️ Bolt app is running!");
})();

/**
* Workaround so Node 14.x doesn't crash if our WebSocket disconnects and Bolt doesn't reconnect.
* See https://github.com/slackapi/node-slack-sdk/issues/1243.
* We could specify node 16.x in our Dockerfile which would make that a crashing error.
*/
process.on('unhandledRejection', (error) => {
throw error;
});

0 comments on commit 5c4dfd9

Please sign in to comment.