node.js - How to handle time taking processes in slack app view - Stack Overflow
import { NextApiRequest, NextApiResponse } from 'next';
import NextConnectReceiver from 'src/utils/NextConnectReceiver';
import { App } from "@slack/bolt";
//@ts-ignore
import dotenv from 'dotenv';
import { handleOpenReportModal, handleGenerateReport } from "../../events/report";
import { handleAppLoad } from "../../events/home";
import { handleCherryReaction } from "../../events/reaction";
import initializeFirebase from "../../db";
import { respondToReportQuestions } from 'src/utils/ask';
dotenv.config();
const receiver = new NextConnectReceiver({
signingSecret: process.env.SLACK_SIGNING_SECRET || 'invalid',
processBeforeResponse: true
});
const processedMessages = new Set<string>();
const MESSAGE_EXPIRY = 60000;
const app = new App({
token: process.env.SLACK_BOT_TOKEN,
signingSecret: process.env.SLACK_SIGNING_SECRET,
receiver: receiver
});
// Single initialization flag
let isInitialized = false;
const initializeApp = async () => {
if (!isInitialized) {
try {
await initializeFirebase();
// Command handlers
appmand("/report", async ({ ack, ...req }) => {
await ack();
await handleOpenReportModal(req);
});
// // View handlers
app.view({ callback_id: "report_modal" }, async (req) => {
const { ack } = req;
await ack();
console.log("Report modal view");
try {
handleGenerateReport(req);
} catch (error) {
console.error("Error adding job to queue:", error);
}
});
app.error(async (error) => {
console.error("Cherry app error:", error);
});
receiver.init(app);
isInitialized = true;
console.log("
最新文章
- 移动互联网屡败屡战 鲍尔默打通微软墙
- The uid generator is giving negative value(-8201645565344219221) and using this implementation DefaultUidGenerator.java to gener
- c++ - juce::Image::RGB seems to produce 4 channel image - Stack Overflow
- linux - How to use GNU ld with rustc-compiled obj file without cargo? - Stack Overflow
- ios - Flutter: works on Xcode but not on VS code and Android Studio - Stack Overflow
- Struggling to Configure Solvers for MINLP Optimization with Pyomo (using NEOS or Local Installation) - Stack Overflow
- ruby on rails - ActiveRecord not getting id after save - Stack Overflow
- python - Ipywidgets : How to get the list of comm opened in a jupyter notebook? - Stack Overflow
- Makefile: Execute target multiple times - Stack Overflow
- i tried to get read edit manage storage in android java and output permission denied and not found in device setting - Stack Ove
- c - I'm getting segmentation error: core dumped when loading a list of string, especially for long lists. There is a mem
- python - Text with transparent background to make crosshair - Stack Overflow
- How to filter a Drupal View using text entered into a Textfield - Stack Overflow
- c# - Unity build error for Android when use CMake with Ninja on Mac - Stack Overflow
- visual studio code - VSCode support fully integrated IPython terminal - Stack Overflow
- Missing opentelemetry-java SERVER span with nested span - Stack Overflow
- r - How to change the collapse breakpoints of a bslib navbar? - Stack Overflow