lazy-gravity 0.5.6 → 0.6.0
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/bot/index.js +20 -2
- package/dist/services/channelManager.js +4 -4
- package/package.json +1 -1
package/dist/bot/index.js
CHANGED
|
@@ -97,6 +97,20 @@ const modelButtonAction_1 = require("../handlers/modelButtonAction");
|
|
|
97
97
|
const autoAcceptButtonAction_1 = require("../handlers/autoAcceptButtonAction");
|
|
98
98
|
const templateButtonAction_1 = require("../handlers/templateButtonAction");
|
|
99
99
|
const modeSelectAction_1 = require("../handlers/modeSelectAction");
|
|
100
|
+
const channelManager_2 = require("../services/channelManager");
|
|
101
|
+
/**
|
|
102
|
+
* Normalize a candidate startup channel name for preference checks.
|
|
103
|
+
*/
|
|
104
|
+
function normalizeStartupChannelName(name) {
|
|
105
|
+
return name.trim().replace(/^#/, '').toLowerCase();
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Prefer the shared default channel name plus the localized 常规 variant.
|
|
109
|
+
*/
|
|
110
|
+
function isPreferredDiscordStartupChannel(name) {
|
|
111
|
+
const normalized = normalizeStartupChannelName(name);
|
|
112
|
+
return normalized === channelManager_2.DEFAULT_CHANNEL_NAME || normalized === '常规';
|
|
113
|
+
}
|
|
100
114
|
// =============================================================================
|
|
101
115
|
// Embed color palette (color-coded by phase)
|
|
102
116
|
// =============================================================================
|
|
@@ -801,10 +815,14 @@ const startBot = async (cliLogLevel) => {
|
|
|
801
815
|
.addFields({ name: 'Version', value: version, inline: true }, { name: 'Node.js', value: process.versions.node, inline: true }, { name: 'OS', value: `${os.platform()} ${os.release()}`, inline: true }, { name: 'CDP', value: cdpStatus, inline: true }, { name: 'Model', value: modelService.getCurrentModel(), inline: true }, { name: 'Mode', value: modeService.getCurrentMode(), inline: true }, { name: 'Projects', value: `${projects.length} registered`, inline: true }, { name: 'Extraction', value: config.extractionMode, inline: true })
|
|
802
816
|
.setFooter({ text: `Started at ${new Date().toLocaleString()}` })
|
|
803
817
|
.setTimestamp();
|
|
804
|
-
//
|
|
818
|
+
// Prefer the guild's general text channel, then fall back to the first sendable text channel.
|
|
805
819
|
const guild = readyClient.guilds.cache.first();
|
|
806
820
|
if (guild) {
|
|
807
|
-
const
|
|
821
|
+
const sendableTextChannels = guild.channels.cache.filter((ch) => ch.isTextBased()
|
|
822
|
+
&& !ch.isVoiceBased()
|
|
823
|
+
&& ch.permissionsFor(readyClient.user)?.has('SendMessages'));
|
|
824
|
+
const channel = sendableTextChannels.find((ch) => isPreferredDiscordStartupChannel(ch.name))
|
|
825
|
+
?? sendableTextChannels.first();
|
|
808
826
|
if (channel && channel.isTextBased()) {
|
|
809
827
|
await channel.send({ embeds: [dashboardEmbed] });
|
|
810
828
|
logger_1.logger.info('Startup dashboard embed sent.');
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ChannelManager = void 0;
|
|
3
|
+
exports.ChannelManager = exports.DEFAULT_CHANNEL_NAME = void 0;
|
|
4
4
|
const discord_js_1 = require("discord.js");
|
|
5
5
|
/** Category name prefix emoji */
|
|
6
6
|
const CATEGORY_PREFIX = '🗂️-';
|
|
7
7
|
/** Default channel name under the category */
|
|
8
|
-
|
|
8
|
+
exports.DEFAULT_CHANNEL_NAME = 'general';
|
|
9
9
|
/**
|
|
10
10
|
* Class that manages Discord categories and channels corresponding to workspace paths.
|
|
11
11
|
* Creates the category/channel if they don't exist for the given workspace name,
|
|
@@ -77,7 +77,7 @@ class ChannelManager {
|
|
|
77
77
|
const existingTextChannel = guild.channels.cache.find((ch) => ch.type === discord_js_1.ChannelType.GuildText &&
|
|
78
78
|
'parentId' in ch &&
|
|
79
79
|
ch.parentId === categoryId &&
|
|
80
|
-
ch.name === DEFAULT_CHANNEL_NAME);
|
|
80
|
+
ch.name === exports.DEFAULT_CHANNEL_NAME);
|
|
81
81
|
if (existingTextChannel) {
|
|
82
82
|
return {
|
|
83
83
|
categoryId,
|
|
@@ -85,7 +85,7 @@ class ChannelManager {
|
|
|
85
85
|
created: false,
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
const sessionResult = await this.createSessionChannel(guild, categoryId, DEFAULT_CHANNEL_NAME);
|
|
88
|
+
const sessionResult = await this.createSessionChannel(guild, categoryId, exports.DEFAULT_CHANNEL_NAME);
|
|
89
89
|
return {
|
|
90
90
|
categoryId,
|
|
91
91
|
channelId: sessionResult.channelId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lazy-gravity",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Control Antigravity from anywhere — a local, secure bot (Discord + Telegram) that lets you remotely operate Antigravity on your home PC from your smartphone.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|