Source File
tdlib_ids.go
Belonging Package
github.com/gotd/td/constant
package constantconst (// MaxTDLibChatID is maximum chat TDLib ID.MaxTDLibChatID = 999999999999// MaxTDLibChannelID is maximum channel TDLib ID (non-monoforum).MaxTDLibChannelID = 1000000000000 - int64(1<<31) // 997852516352// ZeroTDLibChannelID is base for channel IDs.ZeroTDLibChannelID = -1000000000000// ZeroTDLibSecretChatID is minimum secret chat TDLib ID.ZeroTDLibSecretChatID = -2000000000000// MaxTDLibUserID is maximum user TDLib ID.MaxTDLibUserID = (1 << 40) - 1// MinMTProtoMonoforumID is the minimum MTProto ID for monoforums.MinMTProtoMonoforumID = 1002147483649// MaxMTProtoMonoforumID is the maximum MTProto ID for monoforums.MaxMTProtoMonoforumID = 3000000000000// MinBotAPIMonoforumID = -(1e12 + MaxMTProtoMonoforumID)MinBotAPIMonoforumID = -4000000000000// MaxBotAPIMonoforumID = -(1e12 + MinMTProtoMonoforumID)MaxBotAPIMonoforumID = -2002147483649)// TDLibPeerID is TDLib's peer ID.type TDLibPeerID int64// User sets TDLibPeerID value as user.func ( *TDLibPeerID) ( int64) {* = TDLibPeerID()}// Chat sets TDLibPeerID value as chat.func ( *TDLibPeerID) ( int64) {* = TDLibPeerID(-)}// Channel sets TDLibPeerID value as channel (including monoforum).func ( *TDLibPeerID) ( int64) {* = TDLibPeerID(ZeroTDLibChannelID - ) // same as ZeroTDLibChannelID + (p * -1)}// ToPlain converts TDLib ID to plain (MTProto) ID.func ( TDLibPeerID) () ( int64) {switch {case .IsUser():= int64()case .IsChat():= -int64()case .IsChannel():= -(int64() - ZeroTDLibChannelID)}return}// IsUser whether that given ID is user ID.func ( TDLibPeerID) () bool {return > 0 && <= MaxTDLibUserID}// IsChat whether that given ID is chat ID.func ( TDLibPeerID) () bool {return < 0 && >= -MaxTDLibChatID}// IsMonoforum checks if the ID belongs to a monoforum.func ( TDLibPeerID) () bool {return >= MinBotAPIMonoforumID && <= MaxBotAPIMonoforumID}// IsChannel whether that given ID is channel ID (including monoforums).func ( TDLibPeerID) () bool {if >= 0 {return false}if == ZeroTDLibChannelID || .IsChat() {return false}// Regular channels: -1997852516352 to -1000000000001if >= -1997852516352 && <= -1000000000001 {return true}// Monoforums: -4000000000000 to -2002147483649return >= MinBotAPIMonoforumID && <= MaxBotAPIMonoforumID}
![]() |
The pages are generated with Golds v0.8.4. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |