mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 04:51:25 +00:00
refactor: rename clawdbot to moltbot with legacy compat
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import type { App } from "@slack/bolt";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import type { ClawdbotConfig } from "../../config/config.js";
|
||||
import type { MoltbotConfig } from "../../config/config.js";
|
||||
import type { RuntimeEnv } from "../../runtime.js";
|
||||
import { createSlackMonitorContext, normalizeSlackChannelType } from "./context.js";
|
||||
|
||||
const baseParams = () => ({
|
||||
cfg: {} as ClawdbotConfig,
|
||||
cfg: {} as MoltbotConfig,
|
||||
accountId: "default",
|
||||
botToken: "token",
|
||||
app: { client: {} } as App,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { App } from "@slack/bolt";
|
||||
import type { HistoryEntry } from "../../auto-reply/reply/history.js";
|
||||
import type { ClawdbotConfig, SlackReactionNotificationMode } from "../../config/config.js";
|
||||
import type { MoltbotConfig, SlackReactionNotificationMode } from "../../config/config.js";
|
||||
import { resolveSessionKey, type SessionScope } from "../../config/sessions.js";
|
||||
import type { DmPolicy, GroupPolicy } from "../../config/types.js";
|
||||
import { logVerbose } from "../../globals.js";
|
||||
@@ -42,7 +42,7 @@ export function normalizeSlackChannelType(
|
||||
}
|
||||
|
||||
export type SlackMonitorContext = {
|
||||
cfg: ClawdbotConfig;
|
||||
cfg: MoltbotConfig;
|
||||
accountId: string;
|
||||
botToken: string;
|
||||
app: App;
|
||||
@@ -115,7 +115,7 @@ export type SlackMonitorContext = {
|
||||
};
|
||||
|
||||
export function createSlackMonitorContext(params: {
|
||||
cfg: ClawdbotConfig;
|
||||
cfg: MoltbotConfig;
|
||||
accountId: string;
|
||||
botToken: string;
|
||||
app: App;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { App } from "@slack/bolt";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import type { ClawdbotConfig } from "../../../config/config.js";
|
||||
import type { MoltbotConfig } from "../../../config/config.js";
|
||||
import type { RuntimeEnv } from "../../../runtime.js";
|
||||
import { expectInboundContextContract } from "../../../../test/helpers/inbound-contract.js";
|
||||
import type { ResolvedSlackAccount } from "../../accounts.js";
|
||||
@@ -14,7 +14,7 @@ describe("slack prepareSlackMessage inbound contract", () => {
|
||||
const slackCtx = createSlackMonitorContext({
|
||||
cfg: {
|
||||
channels: { slack: { enabled: true } },
|
||||
} as ClawdbotConfig,
|
||||
} as MoltbotConfig,
|
||||
accountId: "default",
|
||||
botToken: "token",
|
||||
app: { client: {} } as App,
|
||||
@@ -82,7 +82,7 @@ describe("slack prepareSlackMessage inbound contract", () => {
|
||||
const slackCtx = createSlackMonitorContext({
|
||||
cfg: {
|
||||
channels: { slack: { enabled: true, replyToMode: "all" } },
|
||||
} as ClawdbotConfig,
|
||||
} as MoltbotConfig,
|
||||
accountId: "default",
|
||||
botToken: "token",
|
||||
app: { client: {} } as App,
|
||||
|
||||
@@ -126,7 +126,7 @@ describe("Slack native command argument menus", () => {
|
||||
const { actions, ctx, account } = createHarness();
|
||||
registerSlackMonitorSlashCommands({ ctx: ctx as never, account: account as never });
|
||||
|
||||
const handler = actions.get("clawdbot_cmdarg");
|
||||
const handler = actions.get("moltbot_cmdarg");
|
||||
if (!handler) throw new Error("Missing arg-menu action handler");
|
||||
|
||||
const respond = vi.fn().mockResolvedValue(undefined);
|
||||
@@ -152,7 +152,7 @@ describe("Slack native command argument menus", () => {
|
||||
const { actions, ctx, account } = createHarness();
|
||||
registerSlackMonitorSlashCommands({ ctx: ctx as never, account: account as never });
|
||||
|
||||
const handler = actions.get("clawdbot_cmdarg");
|
||||
const handler = actions.get("moltbot_cmdarg");
|
||||
if (!handler) throw new Error("Missing arg-menu action handler");
|
||||
|
||||
const respond = vi.fn().mockResolvedValue(undefined);
|
||||
@@ -180,7 +180,7 @@ describe("Slack native command argument menus", () => {
|
||||
const { actions, postEphemeral, ctx, account } = createHarness();
|
||||
registerSlackMonitorSlashCommands({ ctx: ctx as never, account: account as never });
|
||||
|
||||
const handler = actions.get("clawdbot_cmdarg");
|
||||
const handler = actions.get("moltbot_cmdarg");
|
||||
if (!handler) throw new Error("Missing arg-menu action handler");
|
||||
|
||||
await handler({
|
||||
@@ -202,7 +202,7 @@ describe("Slack native command argument menus", () => {
|
||||
const { actions, postEphemeral, ctx, account } = createHarness();
|
||||
registerSlackMonitorSlashCommands({ ctx: ctx as never, account: account as never });
|
||||
|
||||
const handler = actions.get("clawdbot_cmdarg");
|
||||
const handler = actions.get("moltbot_cmdarg");
|
||||
if (!handler) throw new Error("Missing arg-menu action handler");
|
||||
|
||||
await handler({
|
||||
|
||||
@@ -41,7 +41,7 @@ import { deliverSlackSlashReplies } from "./replies.js";
|
||||
|
||||
type SlackBlock = { type: string; [key: string]: unknown };
|
||||
|
||||
const SLACK_COMMAND_ARG_ACTION_ID = "clawdbot_cmdarg";
|
||||
const SLACK_COMMAND_ARG_ACTION_ID = "moltbot_cmdarg";
|
||||
const SLACK_COMMAND_ARG_VALUE_PREFIX = "cmdarg";
|
||||
|
||||
function chunkItems<T>(items: T[], size: number): T[][] {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ClawdbotConfig, SlackSlashCommandConfig } from "../../config/config.js";
|
||||
import type { MoltbotConfig, SlackSlashCommandConfig } from "../../config/config.js";
|
||||
import type { RuntimeEnv } from "../../runtime.js";
|
||||
import type { SlackFile, SlackMessageEvent } from "../types.js";
|
||||
|
||||
@@ -7,7 +7,7 @@ export type MonitorSlackOpts = {
|
||||
appToken?: string;
|
||||
accountId?: string;
|
||||
mode?: "socket" | "http";
|
||||
config?: ClawdbotConfig;
|
||||
config?: MoltbotConfig;
|
||||
runtime?: RuntimeEnv;
|
||||
abortSignal?: AbortSignal;
|
||||
mediaMaxMb?: number;
|
||||
|
||||
Reference in New Issue
Block a user