mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 11:37:38 +00:00
refactor: route channel runtime via plugin api
This commit is contained in:
@@ -7,7 +7,7 @@ import { resolveTelegramAccount } from "../telegram/accounts.js";
|
||||
import { normalizeE164 } from "../utils.js";
|
||||
import { resolveWhatsAppAccount } from "../web/accounts.js";
|
||||
import { normalizeWhatsAppTarget } from "../whatsapp/normalize.js";
|
||||
import { getActivePluginRegistry } from "../plugins/runtime.js";
|
||||
import { requireActivePluginRegistry } from "../plugins/runtime.js";
|
||||
import {
|
||||
resolveDiscordGroupRequireMention,
|
||||
resolveIMessageGroupRequireMention,
|
||||
@@ -320,8 +320,7 @@ function buildDockFromPlugin(plugin: ChannelPlugin): ChannelDock {
|
||||
}
|
||||
|
||||
function listPluginDockEntries(): Array<{ id: ChannelId; dock: ChannelDock; order?: number }> {
|
||||
const registry = getActivePluginRegistry();
|
||||
if (!registry) return [];
|
||||
const registry = requireActivePluginRegistry();
|
||||
const entries: Array<{ id: ChannelId; dock: ChannelDock; order?: number }> = [];
|
||||
const seen = new Set<string>();
|
||||
for (const entry of registry.channels) {
|
||||
@@ -358,8 +357,8 @@ export function listChannelDocks(): ChannelDock[] {
|
||||
export function getChannelDock(id: ChannelId): ChannelDock | undefined {
|
||||
const core = DOCKS[id as ChatChannelId];
|
||||
if (core) return core;
|
||||
const registry = getActivePluginRegistry();
|
||||
const pluginEntry = registry?.channels.find((entry) => entry.plugin.id === id);
|
||||
const registry = requireActivePluginRegistry();
|
||||
const pluginEntry = registry.channels.find((entry) => entry.plugin.id === id);
|
||||
if (!pluginEntry) return undefined;
|
||||
return pluginEntry.dock ?? buildDockFromPlugin(pluginEntry.plugin);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user