mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-14 18:51:04 +00:00
38 lines
1009 B
TypeScript
38 lines
1009 B
TypeScript
import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing";
|
|
import { PAIRING_APPROVED_MESSAGE } from "openclaw/plugin-sdk/channel-status";
|
|
import type { OpenClawConfig } from "./runtime-api.js";
|
|
import { normalizeBlueBubblesHandle } from "./targets.js";
|
|
|
|
type SendBlueBubblesMessage = (
|
|
id: string,
|
|
message: string,
|
|
params: {
|
|
cfg: OpenClawConfig;
|
|
accountId?: string;
|
|
},
|
|
) => Promise<unknown>;
|
|
|
|
export function createBlueBubblesPairingText(sendMessageBlueBubbles: SendBlueBubblesMessage) {
|
|
return {
|
|
idLabel: "bluebubblesSenderId",
|
|
message: PAIRING_APPROVED_MESSAGE,
|
|
normalizeAllowEntry: createPairingPrefixStripper(/^bluebubbles:/i, normalizeBlueBubblesHandle),
|
|
notify: async ({
|
|
cfg,
|
|
id,
|
|
message,
|
|
accountId,
|
|
}: {
|
|
cfg: OpenClawConfig;
|
|
id: string;
|
|
message: string;
|
|
accountId?: string;
|
|
}) => {
|
|
await sendMessageBlueBubbles(id, message, {
|
|
cfg,
|
|
accountId,
|
|
});
|
|
},
|
|
};
|
|
}
|