@iletai/nzb 1.3.1 → 1.3.2
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/telegram/bot.js +23 -4
- package/package.json +1 -1
package/dist/telegram/bot.js
CHANGED
|
@@ -80,8 +80,7 @@ const mainMenu = new Menu("main-menu")
|
|
|
80
80
|
await ctx.reply("No memories stored.");
|
|
81
81
|
}
|
|
82
82
|
else {
|
|
83
|
-
|
|
84
|
-
await ctx.reply(lines.join("\n") + `\n\n${memories.length} total`);
|
|
83
|
+
await ctx.reply(formatMemoryList(memories));
|
|
85
84
|
}
|
|
86
85
|
})
|
|
87
86
|
.submenu("⚙️ Settings", "settings-menu", async (ctx) => {
|
|
@@ -103,6 +102,27 @@ mainMenu.register(settingsMenu);
|
|
|
103
102
|
// This bypasses corporate proxy (HTTP_PROXY/HTTPS_PROXY env vars) without
|
|
104
103
|
// modifying process.env, so other services (Copilot SDK, MCP, npm) are unaffected.
|
|
105
104
|
const telegramAgent = new HttpsAgent({ keepAlive: true });
|
|
105
|
+
const CATEGORY_ICONS = {
|
|
106
|
+
project: "📦",
|
|
107
|
+
preference: "⚙️",
|
|
108
|
+
fact: "💡",
|
|
109
|
+
person: "👤",
|
|
110
|
+
routine: "🔄",
|
|
111
|
+
};
|
|
112
|
+
function formatMemoryList(memories) {
|
|
113
|
+
// Group by category
|
|
114
|
+
const groups = {};
|
|
115
|
+
for (const m of memories) {
|
|
116
|
+
(groups[m.category] ??= []).push(m);
|
|
117
|
+
}
|
|
118
|
+
const sections = Object.entries(groups).map(([cat, items]) => {
|
|
119
|
+
const icon = CATEGORY_ICONS[cat] || "📝";
|
|
120
|
+
const header = `${icon} ${cat.charAt(0).toUpperCase() + cat.slice(1)}`;
|
|
121
|
+
const lines = items.map((m) => ` #${m.id} ${m.content}`);
|
|
122
|
+
return `${header}\n${lines.join("\n")}`;
|
|
123
|
+
});
|
|
124
|
+
return `🧠 Memory (${memories.length})\n\n${sections.join("\n\n")}`;
|
|
125
|
+
}
|
|
106
126
|
export function createBot() {
|
|
107
127
|
if (!config.telegramBotToken) {
|
|
108
128
|
throw new Error("Telegram bot token is missing. Run 'nzb setup' and enter the bot token from @BotFather.");
|
|
@@ -187,8 +207,7 @@ export function createBot() {
|
|
|
187
207
|
await ctx.reply("No memories stored.");
|
|
188
208
|
}
|
|
189
209
|
else {
|
|
190
|
-
|
|
191
|
-
await ctx.reply(lines.join("\n") + `\n\n${memories.length} total`);
|
|
210
|
+
await ctx.reply(formatMemoryList(memories));
|
|
192
211
|
}
|
|
193
212
|
});
|
|
194
213
|
bot.command("skills", async (ctx) => {
|