scripts/utils/telegram.ts

12 lines
375 B
TypeScript
Raw Permalink Normal View History

2025-01-14 05:38:00 +03:00
import { TelegramClient, type TelegramClientOptions } from '@mtcute/node'
import { getEnv } from './misc.ts'
export function createTg(session: string, extra?: Partial<TelegramClientOptions>) {
return new TelegramClient({
apiId: getEnv('TELEGRAM_API_ID', Number),
apiHash: getEnv('TELEGRAM_API_HASH'),
storage: `assets/${session}.session`,
...extra,
})
}