Brozy123 commited on
Commit
8889224
·
verified ·
1 Parent(s): 5a6265f

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +10 -2
server.js CHANGED
@@ -257,10 +257,18 @@ app.get('/api/servers', requireAuth, (req, res) => {
257
  if (!discordClient || !discordClient.isReady()) return res.json([]);
258
 
259
  const userGuilds = req.dashSession.guilds || [];
 
 
 
 
260
  const sharedGuilds = userGuilds.filter(ug => {
261
- // Must have MANAGE_GUILD (0x20) or ADMINISTRATOR (0x8)
 
 
 
 
262
  const hasPerms = (BigInt(ug.permissions) & BigInt(0x20)) || (BigInt(ug.permissions) & BigInt(0x8));
263
- return hasPerms && discordClient.guilds.cache.has(ug.id);
264
  });
265
 
266
  const list = sharedGuilds.map(ug => {
 
257
  if (!discordClient || !discordClient.isReady()) return res.json([]);
258
 
259
  const userGuilds = req.dashSession.guilds || [];
260
+ const app = await discordClient.application.fetch().catch(() => null);
261
+ const ownerId = app?.owner?.ownerId || app?.owner?.id;
262
+ const isBotOwner = req.dashSession.user.id === ownerId;
263
+
264
  const sharedGuilds = userGuilds.filter(ug => {
265
+ const g = discordClient.guilds.cache.get(ug.id);
266
+ if (!g) return false;
267
+
268
+ if (isBotOwner) return true; // Owner sees all bot servers
269
+
270
  const hasPerms = (BigInt(ug.permissions) & BigInt(0x20)) || (BigInt(ug.permissions) & BigInt(0x8));
271
+ return hasPerms;
272
  });
273
 
274
  const list = sharedGuilds.map(ug => {