Documentation ¶
Index ¶
- type AnimatedStickerConfig
- type ConvertedSticker
- type ReadyTransferer
- func (t *ReadyTransferer) DirectDownloadURL(ctx context.Context, loggedInUserID int64, portal *bridgev2.Portal, msgID int, ...) (id.ContentURIString, *event.FileInfo, error)
- func (t *ReadyTransferer) DownloadBytes(ctx context.Context) ([]byte, error)
- func (t *ReadyTransferer) Stream(ctx context.Context) (r io.Reader, mimeType string, fileSize int, err error)
- func (t *ReadyTransferer) Transfer(ctx context.Context, store *store.Container, intent bridgev2.MatrixAPI) (mxc id.ContentURIString, encryptedFileInfo *event.EncryptedFileInfo, ...)
- type Transferer
- func (t *Transferer) WithChannelPhoto(channelID, accessHash, photoID int64) *ReadyTransferer
- func (t *Transferer) WithDocument(doc tg.DocumentClass, thumbnail bool) *ReadyTransferer
- func (t *Transferer) WithFilename(filename string) *Transferer
- func (t *Transferer) WithImageSize(attr *tg.DocumentAttributeImageSize) *Transferer
- func (t *Transferer) WithPhoto(pc tg.PhotoClass) *ReadyTransferer
- func (t *Transferer) WithRoomID(roomID id.RoomID) *Transferer
- func (t *Transferer) WithStickerConfig(cfg AnimatedStickerConfig) *Transferer
- func (t *Transferer) WithThumbnail(uri id.ContentURIString, file *event.EncryptedFileInfo, info *event.FileInfo) *Transferer
- func (t *Transferer) WithUserPhoto(ctx context.Context, store *store.ScopedStore, user *tg.User, photoID int64) (*ReadyTransferer, error)
- func (t *Transferer) WithVideo(attr *tg.DocumentAttributeVideo) *Transferer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnimatedStickerConfig ¶
type ConvertedSticker ¶
type ReadyTransferer ¶
type ReadyTransferer struct {
// contains filtered or unexported fields
}
func (*ReadyTransferer) DirectDownloadURL ¶
func (t *ReadyTransferer) DirectDownloadURL(ctx context.Context, loggedInUserID int64, portal *bridgev2.Portal, msgID int, thumbnail bool, telegramMediaID int64) (id.ContentURIString, *event.FileInfo, error)
DirectDownloadURL returns the direct download URL for the media.
func (*ReadyTransferer) DownloadBytes ¶
func (t *ReadyTransferer) DownloadBytes(ctx context.Context) ([]byte, error)
DownloadBytes downloads the media from Telegram to a byte buffer.
func (*ReadyTransferer) Stream ¶
func (t *ReadyTransferer) Stream(ctx context.Context) (r io.Reader, mimeType string, fileSize int, err error)
Stream streams the media from Telegram to an io.Reader.
func (*ReadyTransferer) Transfer ¶
func (t *ReadyTransferer) Transfer(ctx context.Context, store *store.Container, intent bridgev2.MatrixAPI) (mxc id.ContentURIString, encryptedFileInfo *event.EncryptedFileInfo, outFileInfo *event.FileInfo, err error)
Transfer downloads the media from Telegram and uploads it to Matrix.
If the file is already in the database, the MXC URI will be reused. The file's MXC URI will only be cached if the room ID is unset or if the room is not encrypted.
If there is a sticker config on the Transferer, this function converts animated stickers to the target format specified by the specified AnimatedStickerConfig.
type Transferer ¶
type Transferer struct {
// contains filtered or unexported fields
}
Transferer is a utility for downloading media from Telegram and uploading it to Matrix.
func NewTransferer ¶
func NewTransferer(client downloader.Client) *Transferer
NewTransferer creates a new Transferer with the given downloader.Client. The client is used to download the media from Telegram.
func (*Transferer) WithChannelPhoto ¶
func (t *Transferer) WithChannelPhoto(channelID, accessHash, photoID int64) *ReadyTransferer
WithChannelPhoto transforms a Transferer to a ReadyTransferer by setting the given chat photo as the location that will be downloaded by the ReadyTransferer.
func (*Transferer) WithDocument ¶
func (t *Transferer) WithDocument(doc tg.DocumentClass, thumbnail bool) *ReadyTransferer
WithDocument transforms a Transferer to a ReadyTransferer by setting the given document as the location that will be downloaded by the ReadyTransferer.
func (*Transferer) WithFilename ¶
func (t *Transferer) WithFilename(filename string) *Transferer
WithFilename sets the filename for the Transferer.
func (*Transferer) WithImageSize ¶
func (t *Transferer) WithImageSize(attr *tg.DocumentAttributeImageSize) *Transferer
func (*Transferer) WithPhoto ¶
func (t *Transferer) WithPhoto(pc tg.PhotoClass) *ReadyTransferer
WithPhoto transforms a Transferer to a ReadyTransferer by setting the given photo as the location that will be downloaded by the ReadyTransferer.
func (*Transferer) WithRoomID ¶
func (t *Transferer) WithRoomID(roomID id.RoomID) *Transferer
WithRoomID sets the room ID for the Transferer.
func (*Transferer) WithStickerConfig ¶
func (t *Transferer) WithStickerConfig(cfg AnimatedStickerConfig) *Transferer
WithStickerConfig sets the animated sticker config for the Transferer.
func (*Transferer) WithThumbnail ¶
func (t *Transferer) WithThumbnail(uri id.ContentURIString, file *event.EncryptedFileInfo, info *event.FileInfo) *Transferer
func (*Transferer) WithUserPhoto ¶
func (t *Transferer) WithUserPhoto(ctx context.Context, store *store.ScopedStore, user *tg.User, photoID int64) (*ReadyTransferer, error)
WithUser transforms a Transferer to a ReadyTransferer by setting the given user's photo as the location that will be downloaded by the ReadyTransferer.
func (*Transferer) WithVideo ¶
func (t *Transferer) WithVideo(attr *tg.DocumentAttributeVideo) *Transferer