aboutsummaryrefslogtreecommitdiff
path: root/bot
diff options
context:
space:
mode:
Diffstat (limited to 'bot')
-rw-r--r--bot/bun.lockbbin124855 -> 124855 bytes
-rw-r--r--bot/package.json2
-rw-r--r--bot/src/api/routes/settings.js22
3 files changed, 11 insertions, 13 deletions
diff --git a/bot/bun.lockb b/bot/bun.lockb
index 13af9e0..a14de88 100644
--- a/bot/bun.lockb
+++ b/bot/bun.lockb
Binary files differ
diff --git a/bot/package.json b/bot/package.json
index 72568aa..5a0f631 100644
--- a/bot/package.json
+++ b/bot/package.json
@@ -16,7 +16,7 @@
"discord.js": "^14.18.0",
"express": "^4.21.2",
"ollama": "^0.5.14",
- "sequelize": "^6.37.5",
+ "sequelize": "^6.37.6",
"sqlite3": "^5.1.7"
},
"devDependencies": {
diff --git a/bot/src/api/routes/settings.js b/bot/src/api/routes/settings.js
index 8757874..ce28acd 100644
--- a/bot/src/api/routes/settings.js
+++ b/bot/src/api/routes/settings.js
@@ -5,22 +5,12 @@ import { guildSettings } from '../../models/guild-settings.js';
export function settingsRouter(client) {
const router = Router();
- router.get('/settings/guild', async (req, res) => {
- try {
- const { guildID } = req.body;
- if (!guildID) return res.status(400).send('Guild ID not provided');
- const settings = await guildSettings.findOne({ where: { guildID: guildID } });
- res.json(settings);
- } catch (e) {
- console.error('Error fetching settings:', e);
- res.status(500).send('Internal Server Error');
- }
- });
-
router.get('/settings/guild/:id', async (req, res) => {
try {
const settings = await guildSettings.findOne({ where: { guildID: req.params.id } });
+ if (!settings) return res.sendStatus(404);
+
let channels = [];
client.guilds.cache.get(settings.guildID).channels.cache
@@ -29,6 +19,7 @@ export function settingsRouter(client) {
const channelInfo = {
name: channel.name,
id: channel.id,
+ position: channel.position,
category: channel.parent ? channel.parent.name : 'No Category'
};
@@ -36,6 +27,13 @@ export function settingsRouter(client) {
});
res.json({
+ settings: settings,
+ guild: [
+ {
+ name: client.guilds.cache.get(settings.guildID).name,
+ id: settings.guildID
+ }
+ ],
channels: channels
});
} catch (e) {