Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions discord-bot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ const { token } = require('./config.json');
const fs = require('fs');
const path = require('node:path');
const mongoose = require('mongoose');
const express = require('express');
const studio = require('@mongoosejs/studio/express');

const app = express();
// Create a new client instance
const client = new Client({ intents: [GatewayIntentBits.Guilds] });



client.commands = new Collection();
const commandsPath = path.join(__dirname, 'commands');
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
Expand Down Expand Up @@ -45,8 +50,13 @@ client.on('interactionCreate', async interaction => {
run();

async function run() {
// connect to mongoose
// connect to mongoose
await mongoose.connect('mongodb://localhost:27017');
// Login to Discord with your client's token
app.use('/studio', await studio('/studio/api', mongoose));
app.listen(3000, () => {
console.log('Server is running on port 3000');
});

// Login to Discord with your client's token
client.login(token);
}
4 changes: 3 additions & 1 deletion discord-bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
"license": "ISC",
"dependencies": {
"@discordjs/rest": "^1.1.0",
"@mongoosejs/studio": "^0.0.138",
"@sapphire/framework": "^3.1.1",
"discord.js": "^14.3.0",
"mongoose": "^6.6.1"
"express": "^4.21.2",
"mongoose": "^7.8.7"
}
}