From 6789522255f074ffafb0169486c641851e1092f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=A6=85KoNekoD?= Date: Sat, 6 Jul 2024 23:02:48 +0300 Subject: [PATCH] feat: add resolve deep link join --- telegram/peers/resolve.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/telegram/peers/resolve.go b/telegram/peers/resolve.go index 953ea89abc..4ed0a04d90 100644 --- a/telegram/peers/resolve.go +++ b/telegram/peers/resolve.go @@ -216,3 +216,22 @@ func (m *Manager) ResolveDeeplink(ctx context.Context, u string) (Peer, error) { return m.ResolveDomain(ctx, domain) } + +func (m *Manager) ResolveDeeplinkJoin(ctx context.Context, u string) (tg.ChatInviteClass, error) { + link, err := deeplink.Expect(u, deeplink.Join) + if err != nil { + return nil, err + } + domain := link.Args.Get("domain") + + if err := validateDomain(domain); err != nil { + return nil, errors.Wrap(err, "validate domain") + } + + inviteInfo, err := m.api.MessagesCheckChatInvite(ctx, link.Args.Get("invite")) + if err != nil { + return nil, errors.Wrap(err, "check invite") + } + + return inviteInfo, nil +}