refactor: remove unused channel utilities

This commit is contained in:
Peter Steinberger
2026-05-01 09:36:47 +01:00
parent 86a563e899
commit 22a74de693
7 changed files with 0 additions and 78 deletions

View File

@@ -13,13 +13,6 @@ type FeishuMentionLike = {
name?: string;
};
/**
* Escape regex metacharacters so user-controlled mention fields are treated literally.
*/
export function escapeRegExp(input: string): string {
return input.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
export function isFeishuBroadcastMention(mention: FeishuMentionLike): boolean {
const normalizedKey = mention.key?.trim().toLowerCase();
if (normalizedKey === "@all" || normalizedKey === "@_all") {

View File

@@ -65,22 +65,6 @@ export function normalizeIrcAllowlist(entries?: Array<string | number>): string[
return (entries ?? []).map((entry) => normalizeIrcAllowEntry(String(entry))).filter(Boolean);
}
export function formatIrcSenderId(message: IrcInboundMessage): string {
const base = message.senderNick.trim();
const user = message.senderUser?.trim();
const host = message.senderHost?.trim();
if (user && host) {
return `${base}!${user}@${host}`;
}
if (user) {
return `${base}!${user}`;
}
if (host) {
return `${base}@${host}`;
}
return base;
}
export function buildIrcAllowlistCandidates(
message: IrcInboundMessage,
params?: { allowNameMatching?: boolean },

View File

@@ -1,5 +1,4 @@
import type { webhook } from "@line/bot-sdk";
import type { NextFunction, Request, Response } from "express";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-types";
import { DEFAULT_GROUP_HISTORY_LIMIT, type HistoryEntry } from "openclaw/plugin-sdk/reply-history";
import { getRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
@@ -12,7 +11,6 @@ import { resolveLineAccount } from "./accounts.js";
import { createLineWebhookReplayCache, handleLineWebhookEvents } from "./bot-handlers.js";
import type { LineInboundContext } from "./bot-message-context.js";
import type { ResolvedLineAccount } from "./types.js";
import { startLineWebhook } from "./webhook.js";
export interface LineBotOptions {
channelAccessToken: string;
@@ -70,17 +68,3 @@ export function createLineBot(opts: LineBotOptions): LineBot {
account,
};
}
export function createLineWebhookCallback(
bot: LineBot,
channelSecret: string,
path = "/line/webhook",
): { path: string; handler: (req: Request, res: Response, _next: NextFunction) => Promise<void> } {
const { handler } = startLineWebhook({
channelSecret,
onEvents: bot.handleWebhook,
path,
});
return { path, handler };
}

View File

@@ -139,9 +139,3 @@ export function resolveMattermostReplyToMode(
}
return account.config.replyToMode ?? "off";
}
export function listEnabledMattermostAccounts(cfg: OpenClawConfig): ResolvedMattermostAccount[] {
return listMattermostAccountIds(cfg)
.map((accountId) => resolveMattermostAccount({ cfg, accountId }))
.filter((account) => account.enabled);
}

View File

@@ -1,7 +1,6 @@
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
import { convertMarkdownTables } from "openclaw/plugin-sdk/text-runtime";
import { loadOutboundMediaFromUrl, type OpenClawConfig } from "../runtime-api.js";
import { createMSTeamsConversationStoreFs } from "./conversation-store-fs.js";
import {
classifyMSTeamsSendError,
formatMSTeamsSendErrorHint,
@@ -636,22 +635,3 @@ export async function deleteMessageMSTeams(
return { conversationId };
}
/**
* List all known conversation references (for debugging/CLI).
*/
export async function listMSTeamsConversations(): Promise<
Array<{
conversationId: string;
userName?: string;
conversationType?: string;
}>
> {
const store = createMSTeamsConversationStoreFs();
const all = await store.list();
return all.map(({ conversationId, reference }) => ({
conversationId,
userName: reference.user?.name,
conversationType: reference.conversation?.conversationType,
}));
}

View File

@@ -137,9 +137,3 @@ export function resolveNextcloudTalkAccount(params: {
resolveDefaultAccountId: () => resolveDefaultNextcloudTalkAccountId(params.cfg),
});
}
export function listEnabledNextcloudTalkAccounts(cfg: CoreConfig): ResolvedNextcloudTalkAccount[] {
return listNextcloudTalkAccountIds(cfg)
.map((accountId) => resolveNextcloudTalkAccount({ cfg, accountId }))
.filter((account) => account.enabled);
}

View File

@@ -1,12 +1,5 @@
import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
export function normalizeSlackToken(raw?: unknown): string | undefined {
return normalizeResolvedSecretInputString({
value: raw,
path: "channels.slack.*.token",
});
}
export function resolveSlackBotToken(
raw?: unknown,
path = "channels.slack.botToken",