diff options
| author | Andrew Lee <andrew@alee14.me> | 2025-03-24 01:29:33 -0400 |
|---|---|---|
| committer | Andrew Lee <andrew@alee14.me> | 2025-03-24 01:29:33 -0400 |
| commit | 0453bafa63ccd1057279a1be9286b3e7ebcb62d2 (patch) | |
| tree | 0a71e0c06912a81ac009b196c5fee8dc9037cb60 /bot | |
| parent | a19b6ed4ef829697fd0be153af5e27c99f267787 (diff) | |
| download | AleeBot-0453bafa63ccd1057279a1be9286b3e7ebcb62d2.tar.gz AleeBot-0453bafa63ccd1057279a1be9286b3e7ebcb62d2.tar.bz2 AleeBot-0453bafa63ccd1057279a1be9286b3e7ebcb62d2.zip | |
Depcreating web server, returning back to using Discord as settings
Diffstat (limited to 'bot')
| -rw-r--r-- | bot/bun.lockb | bin | 124855 -> 124855 bytes | |||
| -rw-r--r-- | bot/package.json | 2 | ||||
| -rw-r--r-- | bot/src/api/routes/settings.js | 22 |
3 files changed, 11 insertions, 13 deletions
diff --git a/bot/bun.lockb b/bot/bun.lockb Binary files differindex 13af9e0..a14de88 100644 --- a/bot/bun.lockb +++ b/bot/bun.lockb 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) { |
