fix(telegram): restore thread_id=1 handling for DMs (regression from 19b8416a8) (openclaw#10942) thanks @garnetlyx

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm test:macmini

Co-authored-by: garnetlyx <12513503+garnetlyx@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
Garnet Liu
2026-02-16 00:21:18 +08:00
committed by GitHub
parent 1843bcf1db
commit cc0bfa0f39
5 changed files with 42 additions and 11 deletions

View File

@@ -94,7 +94,7 @@ describe("createTelegramDraftStream", () => {
await vi.waitFor(() => expect(api.sendMessage).toHaveBeenCalledWith(123, "Hello", undefined));
});
it("keeps message_thread_id for dm threads and clears preview on cleanup", async () => {
it("omits message_thread_id for dm threads and clears preview on cleanup", async () => {
const api = {
sendMessage: vi.fn().mockResolvedValue({ message_id: 17 }),
editMessageText: vi.fn().mockResolvedValue(true),
@@ -108,9 +108,7 @@ describe("createTelegramDraftStream", () => {
});
stream.update("Hello");
await vi.waitFor(() =>
expect(api.sendMessage).toHaveBeenCalledWith(123, "Hello", { message_thread_id: 1 }),
);
await vi.waitFor(() => expect(api.sendMessage).toHaveBeenCalledWith(123, "Hello", undefined));
await stream.clear();
expect(api.deleteMessage).toHaveBeenCalledWith(123, 17);