Skip to content

Commit 48fa876

Browse files
committed
feat: 更新发送照片和编辑消息的参数,添加ParseMode支持
1 parent a2f21c7 commit 48fa876

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

telegram/message.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ func (m *Message) toSendMessageParams(chatID int64) *bot.SendMessageParams {
5959
func (m *Message) toSendPhotoParams(chatID int64) *bot.SendPhotoParams {
6060
params := &bot.SendPhotoParams{
6161
ChatID: chatID,
62+
Photo: m.Media,
6263
Caption: m.Text,
6364
ParseMode: m.ParseMode,
64-
Photo: m.Media,
6565
}
6666
if len(m.Button) > 0 {
6767
params.ReplyMarkup = &models.InlineKeyboardMarkup{
@@ -91,6 +91,7 @@ func (m *Message) toEditMessageCaptionParams(chatID int64, messageID int) *bot.E
9191
ChatID: chatID,
9292
MessageID: messageID,
9393
Caption: m.Text,
94+
ParseMode: m.ParseMode,
9495
}
9596
if len(m.Button) > 0 {
9697
params.ReplyMarkup = &models.InlineKeyboardMarkup{
@@ -104,12 +105,12 @@ func (m *Message) toEditMessageMediaParams(chatID int64, messageID int) *bot.Edi
104105
params := &bot.EditMessageMediaParams{
105106
ChatID: chatID,
106107
MessageID: messageID,
107-
Media: &models.InputMediaPhoto{
108-
Caption: m.Text,
109-
ParseMode: m.ParseMode,
110-
},
108+
Media: nil,
109+
}
110+
photo := &models.InputMediaPhoto{
111+
Caption: m.Text,
112+
ParseMode: m.ParseMode,
111113
}
112-
photo := &models.InputMediaPhoto{}
113114
if upload, ok := m.Media.(*models.InputFileUpload); ok {
114115
photo.Media = "attach://" + upload.Filename
115116
photo.MediaAttachment = upload.Data

0 commit comments

Comments
 (0)