Skip to content

Commit

Permalink
feat: add resolve deep link join
Browse files Browse the repository at this point in the history
  • Loading branch information
KoNekoD committed Jul 6, 2024
1 parent 1a7623f commit 6789522
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions telegram/peers/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 6789522

Please sign in to comment.