too-many-claw 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1249,11 +1249,39 @@ var ConfigManager = class {
1249
1249
  if (discord?.token) {
1250
1250
  settings.token = discord.token;
1251
1251
  }
1252
- if (discord?.guildId) {
1252
+ if (channelsDiscord?.guilds) {
1253
+ const guildIds = Object.keys(channelsDiscord.guilds);
1254
+ if (guildIds.length > 0) {
1255
+ const firstGuildId = guildIds[0];
1256
+ if (!settings.guildId && /^\d{17,19}$/.test(firstGuildId)) {
1257
+ settings.guildId = firstGuildId;
1258
+ }
1259
+ const guildConfig = channelsDiscord.guilds[firstGuildId];
1260
+ if (guildConfig?.channels) {
1261
+ const channelKeys = Object.keys(guildConfig.channels);
1262
+ const channelIds = [];
1263
+ for (const channelKey of channelKeys) {
1264
+ if (/^\d{17,19}$/.test(channelKey)) {
1265
+ channelIds.push(channelKey);
1266
+ }
1267
+ }
1268
+ if (channelIds.length > 0 && !settings.chatChannelId) {
1269
+ settings.chatChannelId = channelIds[0];
1270
+ }
1271
+ if (channelIds.length > 1 && !settings.statusChannelId) {
1272
+ settings.statusChannelId = channelIds[1];
1273
+ }
1274
+ if (channelIds.length > 0) {
1275
+ settings.allowedChannels = channelIds;
1276
+ }
1277
+ }
1278
+ }
1279
+ }
1280
+ if (!settings.guildId && discord?.guildId) {
1253
1281
  settings.guildId = discord.guildId;
1254
- } else if (discord?.serverId) {
1282
+ } else if (!settings.guildId && discord?.serverId) {
1255
1283
  settings.guildId = discord.serverId;
1256
- } else if (discord?.allowlist?.guilds && discord.allowlist.guilds.length > 0) {
1284
+ } else if (!settings.guildId && discord?.allowlist?.guilds && discord.allowlist.guilds.length > 0) {
1257
1285
  settings.guildId = discord.allowlist.guilds[0];
1258
1286
  }
1259
1287
  if (channelsDiscord?.channel) {
@@ -2571,6 +2599,19 @@ program.command("debug").description("Debug OpenClaw configuration detection").o
2571
2599
  console.log(chalk3.gray(` \u25CB ${path2} - not found`));
2572
2600
  }
2573
2601
  });
2602
+ const guilds = rawConfig?.channels?.discord?.guilds;
2603
+ if (guilds && typeof guilds === "object") {
2604
+ console.log(chalk3.white("\nGuilds found in channels.discord.guilds:"));
2605
+ const guildIds = Object.keys(guilds);
2606
+ guildIds.forEach((guildId) => {
2607
+ const guildConfig = guilds[guildId];
2608
+ const channelKeys = guildConfig?.channels ? Object.keys(guildConfig.channels) : [];
2609
+ console.log(chalk3.green(` \u2713 Guild: ${guildId}`));
2610
+ if (channelKeys.length > 0) {
2611
+ console.log(chalk3.gray(` Channels: ${channelKeys.join(", ")}`));
2612
+ }
2613
+ });
2614
+ }
2574
2615
  if (options.raw) {
2575
2616
  console.log(chalk3.yellow("\n\u26A0 Raw OpenClaw config (may contain sensitive data):"));
2576
2617
  console.log(chalk3.gray(JSON.stringify(rawConfig, null, 2)));