Documentation ¶
Index ¶
- Constants
- Variables
- func APICallWithOnlyChatUpdates[U hasChatUpdates](ctx context.Context, t *TelegramClient, fn func() (U, error)) (U, error)
- func APICallWithOnlyUserUpdates[U hasUserUpdates](ctx context.Context, t *TelegramClient, fn func() (U, error)) (U, error)
- func APICallWithUpdates[U hasUpdates](ctx context.Context, t *TelegramClient, fn func() (U, error)) (U, error)
- type DeviceInfo
- type GeoURI
- type GhostMetadata
- type IGetMessage
- type IGetMessages
- type MemberListConfig
- type MessageMetadata
- type PhoneLogin
- type PortalMetadata
- type QRLogin
- type TelegramClient
- func (t *TelegramClient) Connect(ctx context.Context) error
- func (t *TelegramClient) CreateGroup(ctx context.Context, name string, users ...networkid.UserID) (*bridgev2.CreateChatResponse, error)
- func (t *TelegramClient) Disconnect()
- func (t *TelegramClient) FetchMessages(ctx context.Context, fetchParams bridgev2.FetchMessagesParams) (*bridgev2.FetchMessagesResponse, error)
- func (c *TelegramClient) GetBackfillMaxBatchCount(ctx context.Context, portal *bridgev2.Portal, task *database.BackfillTask) int
- func (t *TelegramClient) GetCapabilities(ctx context.Context, portal *bridgev2.Portal) *bridgev2.NetworkRoomCapabilities
- func (t *TelegramClient) GetChatInfo(ctx context.Context, portal *bridgev2.Portal) (*bridgev2.ChatInfo, error)
- func (t *TelegramClient) GetContactList(ctx context.Context) (resp []*bridgev2.ResolveIdentifierResponse, err error)
- func (t *TelegramClient) GetPushConfigs() *bridgev2.PushConfig
- func (t *TelegramClient) GetUserInfo(ctx context.Context, ghost *bridgev2.Ghost) (*bridgev2.UserInfo, error)
- func (t *TelegramClient) HandleMatrixEdit(ctx context.Context, msg *bridgev2.MatrixEdit) error
- func (t *TelegramClient) HandleMatrixMessage(ctx context.Context, msg *bridgev2.MatrixMessage) (resp *bridgev2.MatrixMessageResponse, err error)
- func (t *TelegramClient) HandleMatrixMessageRemove(ctx context.Context, msg *bridgev2.MatrixMessageRemove) error
- func (t *TelegramClient) HandleMatrixReaction(ctx context.Context, msg *bridgev2.MatrixReaction) (reaction *database.Reaction, err error)
- func (t *TelegramClient) HandleMatrixReactionRemove(ctx context.Context, msg *bridgev2.MatrixReactionRemove) error
- func (t *TelegramClient) HandleMatrixReadReceipt(ctx context.Context, msg *bridgev2.MatrixReadReceipt) error
- func (t *TelegramClient) HandleMatrixTyping(ctx context.Context, msg *bridgev2.MatrixTyping) error
- func (t *TelegramClient) HandleMute(ctx context.Context, msg *bridgev2.MatrixMute) error
- func (t *TelegramClient) HandleRoomTag(ctx context.Context, msg *bridgev2.MatrixRoomTag) error
- func (t *TelegramClient) IsLoggedIn() bool
- func (t *TelegramClient) IsThisUser(ctx context.Context, userID networkid.UserID) bool
- func (t *TelegramClient) LogoutRemote(ctx context.Context)
- func (t *TelegramClient) PreHandleMatrixReaction(ctx context.Context, msg *bridgev2.MatrixReaction) (bridgev2.MatrixReactionPreResponse, error)
- func (t *TelegramClient) RegisterPushNotifications(ctx context.Context, pushType bridgev2.PushType, token string) error
- func (t *TelegramClient) ResolveIdentifier(ctx context.Context, identifier string, createChat bool) (*bridgev2.ResolveIdentifierResponse, error)
- func (t *TelegramClient) SearchUsers(ctx context.Context, query string) (resp []*bridgev2.ResolveIdentifierResponse, err error)
- func (t *TelegramClient) SyncChats(ctx context.Context) error
- type TelegramConfig
- type TelegramConnector
- func (tg *TelegramConnector) CreateLogin(ctx context.Context, user *bridgev2.User, flowID string) (bridgev2.LoginProcess, error)
- func (tc *TelegramConnector) Download(ctx context.Context, mediaID networkid.MediaID, params map[string]string) (mediaproxy.GetMediaResponse, error)
- func (tg *TelegramConnector) GetCapabilities() *bridgev2.NetworkGeneralCapabilities
- func (tg *TelegramConnector) GetConfig() (example string, data any, upgrader up.Upgrader)
- func (tg *TelegramConnector) GetDBMetaTypes() database.MetaTypes
- func (tg *TelegramConnector) GetLoginFlows() []bridgev2.LoginFlow
- func (tg *TelegramConnector) GetName() bridgev2.BridgeName
- func (tg *TelegramConnector) Init(bridge *bridgev2.Bridge)
- func (tc *TelegramConnector) LoadUserLogin(ctx context.Context, login *bridgev2.UserLogin) (err error)
- func (tg *TelegramConnector) SetMaxFileSize(maxSize int64)
- func (tg *TelegramConnector) SetUseDirectMedia()
- func (tg *TelegramConnector) Start(ctx context.Context) error
- func (tg *TelegramConnector) ValidateConfig() error
- type UpdateDispatcher
- type UserLoginMetadata
- type UserLoginSession
Constants ¶
View Source
const ( LoginFlowIDPhone = "phone" LoginFlowIDQR = "qr" LoginStepIDComplete = "fi.mau.telegram.login.complete" )
View Source
const ( LoginStepIDPhoneNumber = "fi.mau.telegram.login.phone_number" LoginStepIDCode = "fi.mau.telegram.login.code" LoginStepIDPassword = "fi.mau.telegram.login.password" )
View Source
const LoginStepIDShowQR = "fi.mau.telegram.login.show_qr"
Variables ¶
View Source
var ExampleConfig string
Functions ¶
func APICallWithOnlyChatUpdates ¶
func APICallWithOnlyChatUpdates[U hasChatUpdates](ctx context.Context, t *TelegramClient, fn func() (U, error)) (U, error)
func APICallWithOnlyUserUpdates ¶
func APICallWithOnlyUserUpdates[U hasUserUpdates](ctx context.Context, t *TelegramClient, fn func() (U, error)) (U, error)
func APICallWithUpdates ¶
func APICallWithUpdates[U hasUpdates](ctx context.Context, t *TelegramClient, fn func() (U, error)) (U, error)
Wrapper for API calls that return a response with updates.
Types ¶
type DeviceInfo ¶
type GhostMetadata ¶
type IGetMessage ¶
type IGetMessage interface {
GetMessage() tg.MessageClass
}
type IGetMessages ¶
type IGetMessages interface {
GetMessages() []int
}
type MemberListConfig ¶
type MemberListConfig struct { MaxInitialSync int `yaml:"max_initial_sync"` SyncBroadcastChannels bool `yaml:"sync_broadcast_channels"` SkipDeleted bool `yaml:"skip_deleted"` }
func (MemberListConfig) NormalizedMaxInitialSync ¶
func (c MemberListConfig) NormalizedMaxInitialSync() int
type MessageMetadata ¶
type MessageMetadata struct { ContentHash []byte `json:"content_hash,omitempty"` ContentURI id.ContentURIString `json:"content_uri,omitempty"` }
type PhoneLogin ¶
type PhoneLogin struct {
// contains filtered or unexported fields
}
func (*PhoneLogin) Cancel ¶
func (p *PhoneLogin) Cancel()
func (*PhoneLogin) SubmitUserInput ¶
type PortalMetadata ¶
type QRLogin ¶
type QRLogin struct {
// contains filtered or unexported fields
}
func (*QRLogin) SubmitUserInput ¶
type TelegramClient ¶
type TelegramClient struct { ScopedStore *store.ScopedStore // contains filtered or unexported fields }
func NewTelegramClient ¶
func NewTelegramClient(ctx context.Context, tc *TelegramConnector, login *bridgev2.UserLogin) (*TelegramClient, error)
func (*TelegramClient) CreateGroup ¶
func (t *TelegramClient) CreateGroup(ctx context.Context, name string, users ...networkid.UserID) (*bridgev2.CreateChatResponse, error)
TODO support channels
func (*TelegramClient) Disconnect ¶
func (t *TelegramClient) Disconnect()
func (*TelegramClient) FetchMessages ¶
func (t *TelegramClient) FetchMessages(ctx context.Context, fetchParams bridgev2.FetchMessagesParams) (*bridgev2.FetchMessagesResponse, error)
func (*TelegramClient) GetBackfillMaxBatchCount ¶
func (c *TelegramClient) GetBackfillMaxBatchCount(ctx context.Context, portal *bridgev2.Portal, task *database.BackfillTask) int
func (*TelegramClient) GetCapabilities ¶
func (t *TelegramClient) GetCapabilities(ctx context.Context, portal *bridgev2.Portal) *bridgev2.NetworkRoomCapabilities
func (*TelegramClient) GetChatInfo ¶
func (*TelegramClient) GetContactList ¶
func (t *TelegramClient) GetContactList(ctx context.Context) (resp []*bridgev2.ResolveIdentifierResponse, err error)
func (*TelegramClient) GetPushConfigs ¶
func (t *TelegramClient) GetPushConfigs() *bridgev2.PushConfig
func (*TelegramClient) GetUserInfo ¶
func (*TelegramClient) HandleMatrixEdit ¶
func (t *TelegramClient) HandleMatrixEdit(ctx context.Context, msg *bridgev2.MatrixEdit) error
func (*TelegramClient) HandleMatrixMessage ¶
func (t *TelegramClient) HandleMatrixMessage(ctx context.Context, msg *bridgev2.MatrixMessage) (resp *bridgev2.MatrixMessageResponse, err error)
func (*TelegramClient) HandleMatrixMessageRemove ¶
func (t *TelegramClient) HandleMatrixMessageRemove(ctx context.Context, msg *bridgev2.MatrixMessageRemove) error
func (*TelegramClient) HandleMatrixReaction ¶
func (t *TelegramClient) HandleMatrixReaction(ctx context.Context, msg *bridgev2.MatrixReaction) (reaction *database.Reaction, err error)
func (*TelegramClient) HandleMatrixReactionRemove ¶
func (t *TelegramClient) HandleMatrixReactionRemove(ctx context.Context, msg *bridgev2.MatrixReactionRemove) error
func (*TelegramClient) HandleMatrixReadReceipt ¶
func (t *TelegramClient) HandleMatrixReadReceipt(ctx context.Context, msg *bridgev2.MatrixReadReceipt) error
func (*TelegramClient) HandleMatrixTyping ¶
func (t *TelegramClient) HandleMatrixTyping(ctx context.Context, msg *bridgev2.MatrixTyping) error
func (*TelegramClient) HandleMute ¶
func (t *TelegramClient) HandleMute(ctx context.Context, msg *bridgev2.MatrixMute) error
func (*TelegramClient) HandleRoomTag ¶
func (t *TelegramClient) HandleRoomTag(ctx context.Context, msg *bridgev2.MatrixRoomTag) error
func (*TelegramClient) IsLoggedIn ¶
func (t *TelegramClient) IsLoggedIn() bool
func (*TelegramClient) IsThisUser ¶
func (*TelegramClient) LogoutRemote ¶
func (t *TelegramClient) LogoutRemote(ctx context.Context)
func (*TelegramClient) PreHandleMatrixReaction ¶
func (t *TelegramClient) PreHandleMatrixReaction(ctx context.Context, msg *bridgev2.MatrixReaction) (bridgev2.MatrixReactionPreResponse, error)
func (*TelegramClient) RegisterPushNotifications ¶
func (*TelegramClient) ResolveIdentifier ¶
func (t *TelegramClient) ResolveIdentifier(ctx context.Context, identifier string, createChat bool) (*bridgev2.ResolveIdentifierResponse, error)
func (*TelegramClient) SearchUsers ¶
func (t *TelegramClient) SearchUsers(ctx context.Context, query string) (resp []*bridgev2.ResolveIdentifierResponse, err error)
type TelegramConfig ¶
type TelegramConfig struct { APIID int `yaml:"api_id"` APIHash string `yaml:"api_hash"` DeviceInfo DeviceInfo `yaml:"device_info"` AnimatedSticker media.AnimatedStickerConfig `yaml:"animated_sticker"` ImageAsFilePixels int `yaml:"image_as_file_pixels"` DisableViewOnce bool `yaml:"disable_view_once"` DisableDisappearing bool `yaml:"disable_disappearing"` MemberList MemberListConfig `yaml:"member_list"` MaxMemberCount int `yaml:"max_member_count"` Ping struct { IntervalSeconds int `yaml:"interval_seconds"` TimeoutSeconds int `yaml:"timeout_seconds"` } `yaml:"ping"` Sync struct { UpdateLimit int `yaml:"update_limit"` CreateLimit int `yaml:"create_limit"` DirectChats bool `yaml:"direct_chats"` } `yaml:"sync"` AlwaysCustomEmojiReaction bool `yaml:"always_custom_emoji_reaction"` SavedMessagesAvatar id.ContentURIString `yaml:"saved_message_avatar"` }
func (TelegramConfig) ShouldBridge ¶
func (c TelegramConfig) ShouldBridge(participantCount int) bool
type TelegramConnector ¶
type TelegramConnector struct { Bridge *bridgev2.Bridge Config TelegramConfig Store *store.Container // contains filtered or unexported fields }
func (*TelegramConnector) CreateLogin ¶
func (tg *TelegramConnector) CreateLogin(ctx context.Context, user *bridgev2.User, flowID string) (bridgev2.LoginProcess, error)
func (*TelegramConnector) Download ¶
func (tc *TelegramConnector) Download(ctx context.Context, mediaID networkid.MediaID, params map[string]string) (mediaproxy.GetMediaResponse, error)
func (*TelegramConnector) GetCapabilities ¶
func (tg *TelegramConnector) GetCapabilities() *bridgev2.NetworkGeneralCapabilities
func (*TelegramConnector) GetConfig ¶
func (tg *TelegramConnector) GetConfig() (example string, data any, upgrader up.Upgrader)
func (*TelegramConnector) GetDBMetaTypes ¶
func (tg *TelegramConnector) GetDBMetaTypes() database.MetaTypes
func (*TelegramConnector) GetLoginFlows ¶
func (tg *TelegramConnector) GetLoginFlows() []bridgev2.LoginFlow
func (*TelegramConnector) GetName ¶
func (tg *TelegramConnector) GetName() bridgev2.BridgeName
func (*TelegramConnector) Init ¶
func (tg *TelegramConnector) Init(bridge *bridgev2.Bridge)
func (*TelegramConnector) LoadUserLogin ¶
func (*TelegramConnector) SetMaxFileSize ¶
func (tg *TelegramConnector) SetMaxFileSize(maxSize int64)
func (*TelegramConnector) SetUseDirectMedia ¶
func (tg *TelegramConnector) SetUseDirectMedia()
func (*TelegramConnector) ValidateConfig ¶
func (tg *TelegramConnector) ValidateConfig() error
type UpdateDispatcher ¶
type UpdateDispatcher struct { tg.UpdateDispatcher EntityHandler func(context.Context, tg.Entities) error }
func (UpdateDispatcher) Handle ¶
func (u UpdateDispatcher) Handle(ctx context.Context, updates tg.UpdatesClass) error
type UserLoginMetadata ¶
type UserLoginMetadata struct { Phone string `json:"phone"` Session UserLoginSession `json:"session"` TakeoutID int64 `json:"takeout_id,omitempty"` TakeoutDialogCrawlDone bool `json:"takeout_portal_crawl_done,omitempty"` TakeoutDialogCrawlCursor networkid.PortalID `json:"takeout_portal_crawl_cursor,omitempty"` PinnedDialogs []networkid.PortalID `json:"pinned_dialogs,omitempty"` PushEncryptionKey []byte `json:"push_encryption_key,omitempty"` }
type UserLoginSession ¶
type UserLoginSession struct { AuthKey []byte `json:"auth_key,omitempty"` Datacenter int `json:"dc_id,omitempty"` ServerAddress string `json:"server_address,omitempty"` ServerPort int `json:"port,omitempty"` Salt int64 `json:"salt,omitempty"` }
func (UserLoginSession) HasAuthKey ¶
func (u UserLoginSession) HasAuthKey() bool
Source Files ¶
Click to show internal directories.
Click to hide internal directories.