mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-13 03:50:44 +08:00
feat: add stable proactive delivery
This commit is contained in:
parent
410cb822d7
commit
31792d7bc8
88 changed files with 6427 additions and 488 deletions
|
|
@ -189,6 +189,20 @@ export class SlackController {
|
|||
});
|
||||
}
|
||||
|
||||
async sendProactiveText(botId, target, text, options = {}) {
|
||||
const config = this.#configStore.get(botId);
|
||||
if (!config) throw new Error('Unknown Slack bot');
|
||||
return this.#withBotTransition(botId, async () => {
|
||||
const runtime = this.#runtimes.get(botId);
|
||||
if (!runtime?.status?.ready || typeof runtime.sendProactiveText !== 'function') {
|
||||
const error = new Error(t('Slack机器人尚未连接'));
|
||||
error.code = 'bot-not-connected';
|
||||
throw error;
|
||||
}
|
||||
return runtime.sendProactiveText(target, text, options);
|
||||
});
|
||||
}
|
||||
|
||||
async deleteBot(botId) {
|
||||
const config = this.#configStore.get(botId);
|
||||
if (!config) throw new Error('Unknown Slack bot');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue