feat: add dynamic autonomous DAVE presence

This commit is contained in:
2026-07-05 22:47:08 +02:00
parent 35e4f901f7
commit 08b6016dfb
10 changed files with 429 additions and 4 deletions

View File

@@ -51,6 +51,7 @@ export class TelegramAlerter {
this._commandHandlers = {}; // Registered command callbacks
this._messageHandler = null; // Conversational free-text callback
this._callbackHandler = null;
this._activityHandler = null;
this._pollingInterval = null;
this._pollInProgress = false;
this._botUsername = null;
@@ -331,6 +332,10 @@ export class TelegramAlerter {
this._callbackHandler = handler;
}
onActivity(handler) {
this._activityHandler = handler;
}
async sendChatAction(chatId, action = 'typing') {
if (!this.isConfigured) return false;
try {
@@ -456,6 +461,7 @@ export class TelegramAlerter {
}
async _handleMessage(msg) {
try { this._activityHandler?.(msg); } catch {}
const text = msg.text.trim();
const parts = text.split(/\s+/);
const rawCommand = parts[0].toLowerCase();
@@ -573,6 +579,7 @@ export class TelegramAlerter {
}
async _handleCallbackQuery(query) {
try { this._activityHandler?.(query.message); } catch {}
if (!this._callbackHandler || !query?.data) return;
const chatId = query.message?.chat?.id;
const stopTyping = this._startTyping(chatId);