Open artem-lazarev opened 6 days ago
import type { WebApp } from "@twa-dev/types"; function getMiniApp(): WebApp | null { if ( typeof window !== "undefined" && window.Telegram && window.Telegram.WebApp ) { return window?.Telegram?.WebApp; } return null; }
export default function InviteFriends() { const app = getMiniApp(); const shareUrl = encodeURIComponent(`https://t.me/WhalemapBot/app?startapp=${userId}`); const telegramUrl = `https://t.me/share/url?url=${shareUrl}`; return ( <div> <Button onClick={() => {app.openTelegramLink(telegramUrl))> Send </Button> </div> ) }