diff --git a/pkg/connector/matrix.go b/pkg/connector/matrix.go index 18a9e9bd..52dd1405 100644 --- a/pkg/connector/matrix.go +++ b/pkg/connector/matrix.go @@ -49,7 +49,7 @@ func (t *TelegramClient) transferMediaToTelegram(ctx context.Context, content *e return nil, fmt.Errorf("failed to upload media to Telegram: %w", err) } - if content.MsgType == event.MsgImage { + if content.MsgType == event.MsgImage && (content.Info.MimeType == "image/jpeg" || content.Info.MimeType == "image/png") { return &tg.InputMediaUploadedPhoto{File: upload}, nil } @@ -100,7 +100,7 @@ func (t *TelegramClient) HandleMatrixMessage(ctx context.Context, msg *bridgev2. var updates tg.UpdatesClass switch msg.Content.MsgType { - case event.MsgText, event.MsgNotice: + case event.MsgText, event.MsgNotice, event.MsgEmote: updates, err = t.client.API().MessagesSendMessage(ctx, &tg.MessagesSendMessageRequest{ Peer: peer, NoWebpage: noWebpage, diff --git a/pkg/connector/matrixfmt/convert.go b/pkg/connector/matrixfmt/convert.go index 5465222e..e3d82f48 100644 --- a/pkg/connector/matrixfmt/convert.go +++ b/pkg/connector/matrixfmt/convert.go @@ -82,7 +82,7 @@ func toTelegramEntity(br telegramfmt.BodyRange) tg.MessageEntityClass { } func Parse(ctx context.Context, parser *HTMLParser, content *event.MessageEventContent) (string, []tg.MessageEntityClass) { - if content.MsgType.IsMedia() && content.FileName == "" { + if content.MsgType.IsMedia() && (content.FileName == "" || content.FileName == content.Body) { // The body is the filename. return "", nil }