mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-17 17:13:25 +08:00
fix: support Harness interactions across IM channels
This commit is contained in:
parent
3e7e1dcdd7
commit
cd8175d341
30 changed files with 5433 additions and 555 deletions
|
|
@ -238,6 +238,7 @@ export class DiscordRuntime {
|
|||
status: this.#status,
|
||||
logger: this.#logger,
|
||||
replyTimeoutMs: this.#replyTimeoutMs,
|
||||
signal: controller.signal,
|
||||
});
|
||||
let timer;
|
||||
try {
|
||||
|
|
@ -346,7 +347,16 @@ export class DiscordRuntime {
|
|||
markReady();
|
||||
} else if (packet.t === 'MESSAGE_CREATE') {
|
||||
const message = normalizeDiscordMessage(packet.d, this.#config.platformId);
|
||||
if (message) void this.#bridge?.accept(message);
|
||||
const bridge = this.#bridge;
|
||||
if (message && bridge) {
|
||||
void bridge.accept(message).catch((error) => {
|
||||
if (generation !== this.#generation || this.#stopped) return;
|
||||
this.#logger.error?.(
|
||||
`[dsh-im:discord] bot ${this.#config.botId} message handling failed:`,
|
||||
error,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
addSocketListener(socket, 'close', (event = {}) => {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,11 @@
|
|||
import { HarnessClient } from '../weixin/harness-client.mjs';
|
||||
import { HarnessClient } from '../shared/harness-client.mjs';
|
||||
|
||||
export class DiscordHarnessClient extends HarnessClient {}
|
||||
export class DiscordHarnessClient extends HarnessClient {
|
||||
constructor(options) {
|
||||
super({
|
||||
...options,
|
||||
rpcIdPrefix: 'discord',
|
||||
logPrefix: 'dsh-discord',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue