fileid

package
v0.0.0-...-f756a1e Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package fileid contains BotAPI and tdlib file_id decoder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeFileID

func EncodeFileID(id FileID) (string, error)

EncodeFileID parses FileID to a string.

Types

type ChatPhoto

type ChatPhoto interface {
	GetDCID() int
	GetPhotoID() int64
}

ChatPhoto is interface for user profile photo and chat photo structures.

type FileID

type FileID struct {
	Type            Type
	DC              int
	ID              int64
	AccessHash      int64
	FileReference   []byte
	URL             string
	PhotoSizeSource PhotoSizeSource
}

FileID represents parsed Telegram Bot API file_id.

func DecodeFileID

func DecodeFileID(s string) (fileID FileID, _ error)

DecodeFileID parses FileID from a string.

func FromChatPhoto

func FromChatPhoto(id constant.TDLibPeerID, accessHash int64, photo ChatPhoto, big bool) FileID

FromChatPhoto creates new FileID from ChatPhoto.

func FromDocument

func FromDocument(doc *tg.Document) FileID

FromDocument creates FileID from tg.Document.

func FromPhoto

func FromPhoto(photo *tg.Photo, thumbType rune) FileID

FromPhoto creates FileID from tg.Photo.

func (FileID) AsInputFileLocation

func (f FileID) AsInputFileLocation() (tg.InputFileLocationClass, bool)

AsInputFileLocation converts file ID to tg.InputFileLocationClass.

func (FileID) AsInputWebFileLocation

func (f FileID) AsInputWebFileLocation() (tg.InputWebFileLocationClass, bool)

AsInputWebFileLocation converts file ID to tg.InputWebFileLocationClass.

type PhotoSizeSource

type PhotoSizeSource struct {
	Type      PhotoSizeSourceType
	VolumeID  int64
	LocalID   int
	Secret    int64
	PhotoSize string

	FileType      Type
	ThumbnailType rune

	DialogID         constant.TDLibPeerID
	DialogAccessHash int64

	StickerSetID         int64
	StickerSetAccessHash int64
	StickerVersion       int32
}

PhotoSizeSource represents photo metadata stored in file_id.

type PhotoSizeSourceType

type PhotoSizeSourceType int

PhotoSizeSourceType represents photo_size_source type.

const (
	// PhotoSizeSourceLegacy is Legacy type.
	PhotoSizeSourceLegacy PhotoSizeSourceType = iota
	// PhotoSizeSourceThumbnail is Thumbnail type.
	PhotoSizeSourceThumbnail
	// PhotoSizeSourceDialogPhotoSmall is DialogPhotoSmall type.
	PhotoSizeSourceDialogPhotoSmall
	// PhotoSizeSourceDialogPhotoBig is DialogPhotoBig type.
	PhotoSizeSourceDialogPhotoBig
	// PhotoSizeSourceStickerSetThumbnail is StickerSetThumbnail type.
	PhotoSizeSourceStickerSetThumbnail
	// PhotoSizeSourceFullLegacy is FullLegacy type.
	PhotoSizeSourceFullLegacy
	// PhotoSizeSourceDialogPhotoSmallLegacy is DialogPhotoSmallLegacy type.
	PhotoSizeSourceDialogPhotoSmallLegacy
	// PhotoSizeSourceDialogPhotoBigLegacy is DialogPhotoBigLegacy type.
	PhotoSizeSourceDialogPhotoBigLegacy
	// PhotoSizeSourceStickerSetThumbnailLegacy is StickerSetThumbnailLegacy type.
	PhotoSizeSourceStickerSetThumbnailLegacy
	// PhotoSizeSourceStickerSetThumbnailVersion is StickerSetThumbnailVersion type.
	PhotoSizeSourceStickerSetThumbnailVersion
)

func (PhotoSizeSourceType) String

func (i PhotoSizeSourceType) String() string

type Type

type Type int

Type represents file_id type.

const (
	// Thumbnail is Thumbnail file type.
	Thumbnail Type = iota
	// ProfilePhoto is ProfilePhoto file type.
	ProfilePhoto
	// Photo is Photo file type.
	Photo
	// Voice is Voice file type.
	Voice
	// Video is Video file type.
	Video
	// Document is Document file type.
	Document
	// Encrypted is Encrypted file type.
	Encrypted
	// Temp is Temp file type.
	Temp
	// Sticker is Sticker file type.
	Sticker
	// Audio is Audio file type.
	Audio
	// Animation is Animation file type.
	Animation
	// EncryptedThumbnail is EncryptedThumbnail file type.
	EncryptedThumbnail
	// Wallpaper is Wallpaper file type.
	Wallpaper
	// VideoNote is VideoNote file type.
	VideoNote
	// SecureRaw is SecureRaw file type.
	SecureRaw
	// Secure is Secure file type.
	Secure
	// Background is Background file type.
	Background
	// DocumentAsFile is DocumentAsFile file type.
	DocumentAsFile
)

func (Type) String

func (i Type) String() string

Jump to

Keyboard shortcuts

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