From 9b8716bac359e9008fda5bd296f848e326c1b707 Mon Sep 17 00:00:00 2001 From: Daniel Diaz <39510674+IslandRhythms@users.noreply.github.com> Date: Mon, 3 Nov 2025 14:28:22 -0500 Subject: [PATCH] add studio to bot --- discord-bot/index.js | 14 ++++++++++++-- discord-bot/package.json | 4 +++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/discord-bot/index.js b/discord-bot/index.js index 297f79cb..c1746128 100644 --- a/discord-bot/index.js +++ b/discord-bot/index.js @@ -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')); @@ -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); } diff --git a/discord-bot/package.json b/discord-bot/package.json index cd4b5028..9616a221 100644 --- a/discord-bot/package.json +++ b/discord-bot/package.json @@ -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" } }