ids

package
v0.0.0-...-7bda4f7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetChatID

func GetChatID(peer tg.PeerClass) int64

func GetMessageIDFromMessage

func GetMessageIDFromMessage(message tg.MessageClass) networkid.MessageID

func InternalMakePortalKey

func InternalMakePortalKey(peer tg.PeerClass, receiver networkid.UserLoginID) networkid.PortalKey

func MakeAvatarID

func MakeAvatarID(photoID int64) networkid.AvatarID

func MakeChannelUserID

func MakeChannelUserID(channelID int64) networkid.UserID

func MakeEmojiIDFromDocumentID

func MakeEmojiIDFromDocumentID(documentID int64) networkid.EmojiID

func MakeEmojiIDFromEmoticon

func MakeEmojiIDFromEmoticon(emoji string) networkid.EmojiID

func MakeMessageID

func MakeMessageID(rawChatID any, messageID int) networkid.MessageID

func MakePaginationCursorID

func MakePaginationCursorID(messageID int) networkid.PaginationCursor

func MakeUserID

func MakeUserID(userID int64) networkid.UserID

func MakeUserLoginID

func MakeUserLoginID(userID int64) networkid.UserLoginID

func ParseEmojiID

func ParseEmojiID(emojiID networkid.EmojiID) (documentID int64, emoji string, err error)

func ParseMessageID

func ParseMessageID(networkID networkid.MessageID) (channelID int64, messageID int, err error)

func ParseUserLoginID

func ParseUserLoginID(userID networkid.UserLoginID) (int64, error)

Types

type DirectMediaInfo

type DirectMediaInfo struct {
	PeerType        PeerType
	ChatID          int64
	ReceiverID      int64
	MessageID       int64
	TelegramMediaID int64
	Thumbnail       bool
}

DirectMediaInfo is the information that is encoded in the media ID when using direct media.

The format of the media ID is as follows (each character represents a single byte, |'s added for clarity):

v|p|cccccccc|rrrrrrrr|mmmmmmmm|T|MMMMMMMM

v (int8) = binary encoding format version. Should be 0. p (byte) = the peer type of the Telegram chat ID cccccccc (int64) = the Telegram chat ID (big endian) rrrrrrrr (int64) = the receiver ID (big endian) mmmmmmmm (int64) = the Telegram message ID (big endian) MMMMMMMM (int64) = the Telegram media ID (big endian) T (byte) = 0 or 1 depending on whether it's a thumbnail

func ParseDirectMediaInfo

func ParseDirectMediaInfo(mediaID networkid.MediaID) (info DirectMediaInfo, err error)

func (DirectMediaInfo) AsMediaID

func (m DirectMediaInfo) AsMediaID() (networkid.MediaID, error)

type PeerType

type PeerType string
const (
	PeerTypeUser    PeerType = "user"
	PeerTypeChat    PeerType = "chat"
	PeerTypeChannel PeerType = "channel"
)

func ParsePortalID

func ParsePortalID(portalID networkid.PortalID) (pt PeerType, id int64, err error)

func ParseUserID

func ParseUserID(userID networkid.UserID) (PeerType, int64, error)

func PeerTypeFromByte

func PeerTypeFromByte(pt byte) (PeerType, error)

func (PeerType) AsByte

func (pt PeerType) AsByte() byte

func (PeerType) InternalAsPortalKey

func (pt PeerType) InternalAsPortalKey(chatID int64, receiver networkid.UserLoginID) networkid.PortalKey

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL