Spaces:
Runtime error
Runtime error
Update server.js
Browse files
server.js
CHANGED
|
@@ -441,7 +441,11 @@ app.get('/api/config/:guildId', requireAuth, (req, res) => {
|
|
| 441 |
autoFriendlyChannel: config.autoFriendlyChannel || null,
|
| 442 |
postEnabled: !!config.postEnabled, // Default to false (off)
|
| 443 |
postChannelId: config.postChannelId || null,
|
| 444 |
-
friendlyText: config.friendlyText || "⭐▬▬▬▬▬ **FRIENDLY** ▬▬▬▬▬⭐\n🤝 Session\n🟩 I'm In\n🟥 Busy\n⭐▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬⭐\n🗳️ Needed: {needed}\n@everyone"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 445 |
});
|
| 446 |
});
|
| 447 |
|
|
@@ -459,7 +463,7 @@ app.get('/api/channels/:guildId', requireAuth, (req, res) => {
|
|
| 459 |
|
| 460 |
app.post('/api/config/:guildId', requireAuth, (req, res) => {
|
| 461 |
const { guildId } = req.params;
|
| 462 |
-
const { prefix, autoFriendlyEnabled, autoFriendlyInterval, autoFriendlyChannel, postEnabled, postChannelId, friendlyText } = req.body;
|
| 463 |
const userGuilds = req.dashSession.guilds || [];
|
| 464 |
const ug = userGuilds.find(g => g.id === guildId);
|
| 465 |
|
|
@@ -482,6 +486,10 @@ app.post('/api/config/:guildId', requireAuth, (req, res) => {
|
|
| 482 |
if (postEnabled !== undefined) storage.data.config[guildId].postEnabled = !!postEnabled;
|
| 483 |
if (postChannelId !== undefined) storage.data.config[guildId].postChannelId = postChannelId;
|
| 484 |
if (friendlyText !== undefined) storage.data.config[guildId].friendlyText = friendlyText;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 485 |
|
| 486 |
storage.save('config');
|
| 487 |
res.json({ success: true, message: 'Settings updated successfully' });
|
|
|
|
| 441 |
autoFriendlyChannel: config.autoFriendlyChannel || null,
|
| 442 |
postEnabled: !!config.postEnabled, // Default to false (off)
|
| 443 |
postChannelId: config.postChannelId || null,
|
| 444 |
+
friendlyText: config.friendlyText || "⭐▬▬▬▬▬ **FRIENDLY** ▬▬▬▬▬⭐\n🤝 Session\n🟩 I'm In\n🟥 Busy\n⭐▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬⭐\n🗳️ Needed: {needed}\n@everyone",
|
| 445 |
+
cleanupHours: config.cleanupHours || 2,
|
| 446 |
+
lineupCleanupHours: config.lineupCleanupHours || 2,
|
| 447 |
+
remindersEnabled: !!config.remindersEnabled,
|
| 448 |
+
remindersLead: config.remindersLead || 30
|
| 449 |
});
|
| 450 |
});
|
| 451 |
|
|
|
|
| 463 |
|
| 464 |
app.post('/api/config/:guildId', requireAuth, (req, res) => {
|
| 465 |
const { guildId } = req.params;
|
| 466 |
+
const { prefix, autoFriendlyEnabled, autoFriendlyInterval, autoFriendlyChannel, postEnabled, postChannelId, friendlyText, cleanupHours, lineupCleanupHours, remindersEnabled, remindersLead } = req.body;
|
| 467 |
const userGuilds = req.dashSession.guilds || [];
|
| 468 |
const ug = userGuilds.find(g => g.id === guildId);
|
| 469 |
|
|
|
|
| 486 |
if (postEnabled !== undefined) storage.data.config[guildId].postEnabled = !!postEnabled;
|
| 487 |
if (postChannelId !== undefined) storage.data.config[guildId].postChannelId = postChannelId;
|
| 488 |
if (friendlyText !== undefined) storage.data.config[guildId].friendlyText = friendlyText;
|
| 489 |
+
if (cleanupHours !== undefined) storage.data.config[guildId].cleanupHours = parseInt(cleanupHours) || 2;
|
| 490 |
+
if (lineupCleanupHours !== undefined) storage.data.config[guildId].lineupCleanupHours = parseInt(lineupCleanupHours) || 2;
|
| 491 |
+
if (remindersEnabled !== undefined) storage.data.config[guildId].remindersEnabled = !!remindersEnabled;
|
| 492 |
+
if (remindersLead !== undefined) storage.data.config[guildId].remindersLead = parseInt(remindersLead) || 30;
|
| 493 |
|
| 494 |
storage.save('config');
|
| 495 |
res.json({ success: true, message: 'Settings updated successfully' });
|