mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-13 02:30:45 +08:00
feat: send test messages during bot connection checks
This commit is contained in:
parent
94da24538f
commit
fb61c4235f
78 changed files with 3460 additions and 210 deletions
|
|
@ -111,6 +111,7 @@ export function normalizeTelegramUpdate(update, { botId, username, loadFile = as
|
|||
replyToMessageId: messageId,
|
||||
messageThreadId,
|
||||
},
|
||||
connectionTestTarget: { chatId, messageThreadId },
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -229,6 +230,15 @@ export class TelegramRuntime {
|
|||
return structuredClone(this.#status);
|
||||
}
|
||||
|
||||
async sendConnectionTest(text) {
|
||||
if (!this.#status.ready || !this.#bridge) {
|
||||
const error = new Error('Telegram bot is not connected');
|
||||
error.code = 'test-target-unavailable';
|
||||
throw error;
|
||||
}
|
||||
return this.#bridge.sendConnectionTest(text);
|
||||
}
|
||||
|
||||
async start() {
|
||||
if (this.#status.ready && this.#pollTask) return this.status;
|
||||
if (this.#starting) return this.#starting;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue