Add fallback for unthreaded telegram message

This commit is contained in:
Alexander Korelskiy
2022-03-23 17:39:20 +03:00
parent 962f1b3eac
commit 8cc78c1053

View File

@@ -1,6 +1,7 @@
package btelegram package btelegram
import ( import (
"fmt"
"html" "html"
"log" "log"
"strconv" "strconv"
@@ -108,6 +109,12 @@ func (b *Btelegram) Send(msg config.Message) (string, error) {
return b.handleDelete(&msg, chatid) return b.handleDelete(&msg, chatid)
} }
// Handle prefix hint for unthreaded messages.
if msg.ParentNotFound() {
msg.ParentID = ""
msg.Text = fmt.Sprintf("[reply]: %s", msg.Text)
}
// Upload a file if it exists // Upload a file if it exists
if msg.Extra != nil { if msg.Extra != nil {
for _, rmsg := range helper.HandleExtra(&msg, b.General) { for _, rmsg := range helper.HandleExtra(&msg, b.General) {