diff --git a/app.js b/app.js index 2210545f..b3587371 100644 --- a/app.js +++ b/app.js @@ -1,24 +1,30 @@ import 'dotenv/config'; import express from 'express'; import { - InteractionType, + ButtonStyleTypes, + InteractionResponseFlags, InteractionResponseType, + InteractionType, + MessageComponentTypes, verifyKeyMiddleware, } from 'discord-interactions'; -import { getRandomEmoji } from './utils.js'; +import { getRandomEmoji, DiscordRequest } from './utils.js'; +import { getShuffledOptions, getResult } from './game.js'; // Create an express app const app = express(); // Get port, or default to 3000 const PORT = process.env.PORT || 3000; +// To keep track of our active games +const activeGames = {}; /** * Interactions endpoint URL where Discord will send HTTP requests * Parse request body and verifies incoming requests using discord-interactions package */ app.post('/interactions', verifyKeyMiddleware(process.env.PUBLIC_KEY), async function (req, res) { - // Interaction type and data - const { type, data } = req.body; + // Interaction id, type and data + const { id, type, data } = req.body; /** * Handle verification requests