Files
openhuman/src/lib/telegram/api/markAsRead.ts
T
Steven Enamakel 95e06bc54a Refactor Telegram MCP integration and add new API functionalities
- Updated import paths for Telegram types and API functions to improve module organization.
- Introduced new helper functions for reading typed values from MCP tool arguments.
- Added comprehensive API functions for managing Telegram contacts, chats, and messages, including creating groups, channels, and polls.
- Implemented a tool action parser to convert tool inputs into human-readable descriptions.
- Added tests for new functionalities to ensure reliability and correctness.

This update enhances the Telegram MCP server's capabilities and improves code maintainability.
2026-01-31 00:51:52 +05:30

26 lines
676 B
TypeScript

/**
* API: Mark as read
*/
import { mtprotoService } from "../../../services/mtprotoService";
import { getChatById } from "./helpers";
import type { ApiResult } from "./types";
export async function markAsRead(
chatId: string | number
): Promise<ApiResult<void>> {
const chat = getChatById(chatId);
if (!chat) {
throw new Error(`Chat not found: ${chatId}`);
}
const entity = chat.username ? `@${chat.username.replace("@", "")}` : chat.id;
const client = mtprotoService.getClient();
await mtprotoService.withFloodWaitHandling(async () => {
await client.markAsRead(entity);
});
return { data: undefined as unknown as void, fromCache: false };
}