Skip to content

Commit

Permalink
(feat): test fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
samyakkkk committed Jul 12, 2024
1 parent ae1e2a5 commit 74db396
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion discord/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
require('dotenv').config();
const { Client, GatewayIntentBits, ChannelType } = require('discord.js');
const express = require('express');
const app = express();
const port = process.env.PORT || 3000;

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
Expand Down Expand Up @@ -180,4 +184,13 @@ client.on('error', error => {
console.error('An error occurred:', error);
});

client.login(process.env.DISCORD_TOKEN);
client.login(process.env.DISCORD_TOKEN);

// API endpoint to return the Discord token
app.get('/api/token', (req, res) => {
res.json({ token: process.env.DISCORD_TOKEN });
});

app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});

0 comments on commit 74db396

Please sign in to comment.