Skip to content

Commit

Permalink
Merge pull request #1407 from KoNekoD/my
Browse files Browse the repository at this point in the history
feat: add resolve deep link join
  • Loading branch information
ernado authored Jul 9, 2024
2 parents 2dfca4d + 6789522 commit d3c688c
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 d3c688c

Please sign in to comment.