mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 15:44:02 +00:00
32 lines
539 B
TypeScript
32 lines
539 B
TypeScript
export interface TelegramWebAppUser {
|
|
id: number
|
|
first_name?: string
|
|
username?: string
|
|
language_code?: string
|
|
}
|
|
|
|
export interface TelegramWebApp {
|
|
initData: string
|
|
initDataUnsafe?: {
|
|
user?: TelegramWebAppUser
|
|
}
|
|
ready?: () => void
|
|
expand?: () => void
|
|
}
|
|
|
|
declare global {
|
|
interface Window {
|
|
Telegram?: {
|
|
WebApp?: TelegramWebApp
|
|
}
|
|
}
|
|
}
|
|
|
|
export function getTelegramWebApp(): TelegramWebApp | undefined {
|
|
if (typeof window === 'undefined') {
|
|
return undefined
|
|
}
|
|
|
|
return window.Telegram?.WebApp
|
|
}
|