Spaces:
Runtime error
Runtime error
Update server.js
Browse files
server.js
CHANGED
|
@@ -284,7 +284,9 @@ app.get('/api/config/:guildId', requireAuth, (req, res) => {
|
|
| 284 |
prefix: storage.getPrefix(guildId),
|
| 285 |
autoFriendlyEnabled: config.autoFriendlyEnabled || false,
|
| 286 |
autoFriendlyInterval: config.autoFriendlyInterval || 40,
|
| 287 |
-
autoFriendlyChannel: config.autoFriendlyChannel || null
|
|
|
|
|
|
|
| 288 |
});
|
| 289 |
});
|
| 290 |
|
|
@@ -302,7 +304,7 @@ app.get('/api/channels/:guildId', requireAuth, (req, res) => {
|
|
| 302 |
|
| 303 |
app.post('/api/config/:guildId', requireAuth, (req, res) => {
|
| 304 |
const { guildId } = req.params;
|
| 305 |
-
const { prefix, autoFriendlyEnabled, autoFriendlyInterval, autoFriendlyChannel } = req.body;
|
| 306 |
const userGuilds = req.dashSession.guilds || [];
|
| 307 |
const ug = userGuilds.find(g => g.id === guildId);
|
| 308 |
|
|
@@ -322,6 +324,8 @@ app.post('/api/config/:guildId', requireAuth, (req, res) => {
|
|
| 322 |
if (autoFriendlyEnabled !== undefined) storage.data.config[guildId].autoFriendlyEnabled = !!autoFriendlyEnabled;
|
| 323 |
if (autoFriendlyInterval !== undefined) storage.data.config[guildId].autoFriendlyInterval = parseInt(autoFriendlyInterval) || 40;
|
| 324 |
if (autoFriendlyChannel !== undefined) storage.data.config[guildId].autoFriendlyChannel = autoFriendlyChannel;
|
|
|
|
|
|
|
| 325 |
|
| 326 |
storage.save('config');
|
| 327 |
res.json({ success: true, message: 'Settings updated successfully' });
|
|
|
|
| 284 |
prefix: storage.getPrefix(guildId),
|
| 285 |
autoFriendlyEnabled: config.autoFriendlyEnabled || false,
|
| 286 |
autoFriendlyInterval: config.autoFriendlyInterval || 40,
|
| 287 |
+
autoFriendlyChannel: config.autoFriendlyChannel || null,
|
| 288 |
+
postEnabled: config.postEnabled !== false, // Default to true
|
| 289 |
+
postChannelId: config.postChannelId || null
|
| 290 |
});
|
| 291 |
});
|
| 292 |
|
|
|
|
| 304 |
|
| 305 |
app.post('/api/config/:guildId', requireAuth, (req, res) => {
|
| 306 |
const { guildId } = req.params;
|
| 307 |
+
const { prefix, autoFriendlyEnabled, autoFriendlyInterval, autoFriendlyChannel, postEnabled, postChannelId } = req.body;
|
| 308 |
const userGuilds = req.dashSession.guilds || [];
|
| 309 |
const ug = userGuilds.find(g => g.id === guildId);
|
| 310 |
|
|
|
|
| 324 |
if (autoFriendlyEnabled !== undefined) storage.data.config[guildId].autoFriendlyEnabled = !!autoFriendlyEnabled;
|
| 325 |
if (autoFriendlyInterval !== undefined) storage.data.config[guildId].autoFriendlyInterval = parseInt(autoFriendlyInterval) || 40;
|
| 326 |
if (autoFriendlyChannel !== undefined) storage.data.config[guildId].autoFriendlyChannel = autoFriendlyChannel;
|
| 327 |
+
if (postEnabled !== undefined) storage.data.config[guildId].postEnabled = !!postEnabled;
|
| 328 |
+
if (postChannelId !== undefined) storage.data.config[guildId].postChannelId = postChannelId;
|
| 329 |
|
| 330 |
storage.save('config');
|
| 331 |
res.json({ success: true, message: 'Settings updated successfully' });
|