mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-30 23:14:37 +00:00
- 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.
26 lines
676 B
TypeScript
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 };
|
|
}
|