Telegram Database Schema (schema/database.ts)

corsair · packages/telegram/schema/database.ts · typescript · Apache-2.0
database, chat, fw:zod, tag:validation

Zod schema definitions for Telegram entities like messages, chats, users, files, and polls for validation and storage.

// Source: https://github.com/corsairdev/corsair | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import { z } from 'zod';

export const TelegramMessage = z
	.object({
		id: z.string(),
		message_id: z.number(),
		chat_id: z.string(),
		from_id: z.string().optional(),
		authorId: z.string().optional(),
		date: z.number().optional(),
		text: z.string().optional(),
		caption: z.string().optional(),
		createdAt: z.coerce.date().nullable().optional(),
		edit_date: z.number().optional(),
		media_group_id: z.string().optional(),
		reply_to_message_id: z.number().optional(),
		forward_from_id: z.number().optional(),
		forward_from_chat_id: z.number().optional(),
		forward_from_message_id:

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key