mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 03:18:26 +00:00
refactor: rename to openclaw
This commit is contained in:
@@ -22,7 +22,7 @@ vi.mock("../auto-reply/skill-commands.js", () => ({
|
||||
}));
|
||||
|
||||
const { sessionStorePath } = vi.hoisted(() => ({
|
||||
sessionStorePath: `/tmp/moltbot-telegram-bot-${Math.random().toString(16).slice(2)}.json`,
|
||||
sessionStorePath: `/tmp/openclaw-telegram-bot-${Math.random().toString(16).slice(2)}.json`,
|
||||
}));
|
||||
|
||||
function resolveSkillCommands(config: Parameters<typeof listNativeCommandSpecsForConfig>[0]) {
|
||||
@@ -382,7 +382,7 @@ describe("createTelegramBot", () => {
|
||||
message_id: 10,
|
||||
},
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -425,7 +425,7 @@ describe("createTelegramBot", () => {
|
||||
message_id: 11,
|
||||
},
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -454,7 +454,7 @@ describe("createTelegramBot", () => {
|
||||
message_id: 12,
|
||||
},
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -506,7 +506,7 @@ describe("createTelegramBot", () => {
|
||||
message_id: 13,
|
||||
},
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -539,7 +539,7 @@ describe("createTelegramBot", () => {
|
||||
};
|
||||
await handler({
|
||||
message,
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -583,7 +583,7 @@ describe("createTelegramBot", () => {
|
||||
date: 1736380800,
|
||||
from: { id: 999, username: "random" },
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -621,12 +621,12 @@ describe("createTelegramBot", () => {
|
||||
|
||||
await handler({
|
||||
message,
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
await handler({
|
||||
message: { ...message, text: "hello again" },
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -642,7 +642,7 @@ describe("createTelegramBot", () => {
|
||||
const handler = getOnHandler("message") as (ctx: Record<string, unknown>) => Promise<void>;
|
||||
await handler({
|
||||
message: { chat: { id: 42, type: "private" }, text: "hi" },
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -681,7 +681,7 @@ describe("createTelegramBot", () => {
|
||||
message_id: 1,
|
||||
from: { id: 9, first_name: "Ada" },
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -733,7 +733,7 @@ describe("createTelegramBot", () => {
|
||||
username: "ada",
|
||||
},
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -781,7 +781,7 @@ describe("createTelegramBot", () => {
|
||||
message_id: 123,
|
||||
from: { id: 9, first_name: "Ada" },
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -824,7 +824,7 @@ describe("createTelegramBot", () => {
|
||||
message_id: 2,
|
||||
from: { id: 9, first_name: "Ada" },
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -886,7 +886,7 @@ describe("createTelegramBot", () => {
|
||||
from: { first_name: "Ada" },
|
||||
},
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -922,7 +922,7 @@ describe("createTelegramBot", () => {
|
||||
text: "summarize this",
|
||||
},
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -953,7 +953,7 @@ describe("createTelegramBot", () => {
|
||||
text: "summarize this",
|
||||
},
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -982,7 +982,7 @@ describe("createTelegramBot", () => {
|
||||
date: 1736380800,
|
||||
message_id: 101,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1011,7 +1011,7 @@ describe("createTelegramBot", () => {
|
||||
date: 1736380800,
|
||||
message_id: 101,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1044,7 +1044,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hi",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1071,7 +1071,7 @@ describe("createTelegramBot", () => {
|
||||
date: 1736380800,
|
||||
message_id: 101,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1101,10 +1101,10 @@ describe("createTelegramBot", () => {
|
||||
await handler({
|
||||
message: {
|
||||
chat: { id: 456, type: "group", title: "Ops" },
|
||||
text: "@moltbot_bot hello",
|
||||
text: "@openclaw_bot hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1130,7 +1130,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1158,10 +1158,10 @@ describe("createTelegramBot", () => {
|
||||
reply_to_message: {
|
||||
message_id: 42,
|
||||
text: "original reply",
|
||||
from: { id: 999, first_name: "Moltbot" },
|
||||
from: { id: 999, first_name: "OpenClaw" },
|
||||
},
|
||||
},
|
||||
me: { id: 999, username: "moltbot_bot" },
|
||||
me: { id: 999, username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1174,7 +1174,7 @@ describe("createTelegramBot", () => {
|
||||
onSpy.mockReset();
|
||||
const replySpy = replyModule.__replySpy as unknown as ReturnType<typeof vi.fn>;
|
||||
replySpy.mockReset();
|
||||
const storeDir = fs.mkdtempSync(path.join(os.tmpdir(), "moltbot-telegram-"));
|
||||
const storeDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-telegram-"));
|
||||
const storePath = path.join(storeDir, "sessions.json");
|
||||
fs.writeFileSync(
|
||||
storePath,
|
||||
@@ -1211,7 +1211,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1253,7 +1253,7 @@ describe("createTelegramBot", () => {
|
||||
date: 1736380800,
|
||||
message_id: 42,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1288,7 +1288,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1331,7 +1331,7 @@ describe("createTelegramBot", () => {
|
||||
date: 1736380800,
|
||||
message_thread_id: 99,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1375,7 +1375,7 @@ describe("createTelegramBot", () => {
|
||||
date: 1736380800,
|
||||
message_thread_id: 99,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1418,7 +1418,7 @@ describe("createTelegramBot", () => {
|
||||
date: 1736380800,
|
||||
message_thread_id: 99,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1447,7 +1447,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1509,7 +1509,7 @@ describe("createTelegramBot", () => {
|
||||
message_id: 5,
|
||||
from: { first_name: "Ada" },
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1543,10 +1543,10 @@ describe("createTelegramBot", () => {
|
||||
message: {
|
||||
chat: { id: -100123456789, type: "group", title: "Test Group" },
|
||||
from: { id: 123456789, username: "testuser" },
|
||||
text: "@moltbot_bot hello",
|
||||
text: "@openclaw_bot hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1574,10 +1574,10 @@ describe("createTelegramBot", () => {
|
||||
message: {
|
||||
chat: { id: -100123456789, type: "group", title: "Test Group" },
|
||||
from: { id: 999999, username: "notallowed" }, // Not in allowFrom
|
||||
text: "@moltbot_bot hello",
|
||||
text: "@openclaw_bot hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1608,7 +1608,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1639,7 +1639,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1670,7 +1670,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1701,7 +1701,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1731,7 +1731,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1762,7 +1762,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1792,7 +1792,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1821,7 +1821,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1850,7 +1850,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1881,7 +1881,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1911,7 +1911,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1942,7 +1942,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hello from prefixed user",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -1974,7 +1974,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hello from prefixed user",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -2005,7 +2005,7 @@ describe("createTelegramBot", () => {
|
||||
text: "hello",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -2036,7 +2036,7 @@ describe("createTelegramBot", () => {
|
||||
text: "/status",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -2075,7 +2075,7 @@ describe("createTelegramBot", () => {
|
||||
message_id: 42,
|
||||
message_thread_id: 99,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -2121,7 +2121,7 @@ describe("createTelegramBot", () => {
|
||||
date: 1736380800,
|
||||
message_id: 42,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -2163,7 +2163,7 @@ describe("createTelegramBot", () => {
|
||||
date: 1736380800,
|
||||
message_id: 42,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -2215,7 +2215,7 @@ describe("createTelegramBot", () => {
|
||||
message_id: 42,
|
||||
message_thread_id: 99,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -2260,7 +2260,7 @@ describe("createTelegramBot", () => {
|
||||
message_id: 42,
|
||||
message_thread_id: 99,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
@@ -2507,7 +2507,7 @@ describe("createTelegramBot", () => {
|
||||
date: 1736380800,
|
||||
message_id: 42,
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
};
|
||||
|
||||
@@ -2545,7 +2545,7 @@ describe("createTelegramBot", () => {
|
||||
message_id: 9001,
|
||||
},
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({}),
|
||||
};
|
||||
|
||||
@@ -2582,7 +2582,7 @@ describe("createTelegramBot", () => {
|
||||
message_id: 9001,
|
||||
},
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({}),
|
||||
});
|
||||
|
||||
@@ -2597,7 +2597,7 @@ describe("createTelegramBot", () => {
|
||||
message_id: 9001,
|
||||
},
|
||||
},
|
||||
me: { username: "moltbot_bot" },
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({}),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user