feat: add dynamic autonomous DAVE presence
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user