Adds telegram/user, a bootstrap for user accounts next to telegram/bot, and updates the API docs and error constants from getdoc v0.54.0.
Highlights
telegram/user (#1977)
user.Start/user.Newconnect, sign in only if the stored session isn't authorized, and start the updates and peer managers. Session, update state and access hashes of channels and users live inOptions.Dir, so updates sent while stopped are delivered after a restart and known channels need no extragetDifference.- Sign in with
user.Phone(code + 2FA viaauth.NewFlow),user.QR(login token, imported on another DC) oruser.AuthFunc. WithAuth == nil,StartreturnsErrNotAuthorizedand sends nothing. A bot session or another account thanOptions.UserIDfails withErrSessionMismatch. FLOOD_WAITon sign in is waited out (up toMaxLoginWait) only where it can't send a second code: before the code was requested forPhone, always for QR, never forAuthFunc.- New example
examples/userbot-echo.telegram/botnow shares the internals (telegram/internal/bootstrap); its API and behaviour are unchanged. - Docs: User authentication.
API docs and errors (#1979)
- getdoc v0.54.0: refreshed doc comments and 42 new error constants (e.g.
ErrURLExpired,ErrTopicNotModified,ErrBotCreateLimitExceeded).
Upgrading
Eight error constants that Telegram no longer documents are removed: ErrAnonymousReactionsDisabled, ErrEncryptionDeclineAdminFailed, ErrGroupcallAddParticipantsFailed, ErrNeedDocInvalid, ErrParticipantCallFailed, ErrPasskeyAuthRestart, ErrSavedPeerInvalid, ErrVolumeMoveInvalid. Use the string instead, e.g. tgerr.Is(err, "SAVED_PEER_INVALID").
All changes
- feat(user): add batteries-included user bootstrap by @ernado in #1977
- feat: update getdoc to v0.54.0 by @ernado in #1979
Full Changelog: v0.165.1...v0.166.0