connector: support messages sent by a channel

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
Co-authored-by: Tulir Asokan <tulir@maunium.net>
This commit is contained in:
Sumner Evans
2024-09-03 12:36:28 -06:00
parent 8925318ec4
commit 3b6af95976
5 changed files with 78 additions and 10 deletions
+14
View File
@@ -209,6 +209,20 @@ func (t *Transferer) WithUserPhoto(ctx context.Context, store *store.ScopedStore
}
}
// WithChannelPhoto transforms a [Transferer] to a [ReadyTransferer] by setting
// the given chat photo as the location that will be downloaded by the
// [ReadyTransferer].
func (t *Transferer) WithChannelPhoto(channelID, accessHash, photoID int64) *ReadyTransferer {
return &ReadyTransferer{
inner: t,
loc: &tg.InputPeerPhotoFileLocation{
Peer: &tg.InputPeerChannel{ChannelID: channelID, AccessHash: accessHash},
PhotoID: photoID,
Big: true,
},
}
}
// 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