Skip to content

Commit

Permalink
fix: filenames of documents to wa sent via tg
Browse files Browse the repository at this point in the history
  • Loading branch information
akshettrj committed Aug 29, 2024
1 parent 5426cd3 commit 54d8ce5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions utils/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -776,13 +776,11 @@ func TgSendToWhatsApp(b *gotgbot.Bot, c *ext.Context,
return TgReplyWithErrorByContext(b, c, "Failed to upload document to WhatsApp", err)
}

splitName := strings.Split(msgToForward.Document.FileName, ".")
documentFileName := strings.Join(splitName[:len(splitName)-1], ".")

msgToSend := &waE2E.Message{
DocumentMessage: &waE2E.DocumentMessage{
Caption: proto.String(msgToForward.Caption),
Title: proto.String(documentFileName),
Title: proto.String(msgToForward.Document.FileName),
FileName: proto.String(msgToForward.Document.FileName),
URL: proto.String(uploadedDocument.URL),
DirectPath: proto.String(uploadedDocument.DirectPath),
MediaKey: uploadedDocument.MediaKey,
Expand Down

0 comments on commit 54d8ce5

Please sign in to comment.