Arman92 / go-tdlib

Golang Telegram TdLib JSON bindings
GNU General Public License v3.0
436 stars 100 forks source link

How to use EditMessageText? #77

Closed comerc closed 3 years ago

comerc commented 3 years ago

Please help me! :)

er-azh commented 3 years ago

I guess you already figured it out, putting it here for the others:

for non-formatted text:

// msg is a *tdlib.Message
// client is a *tdlib.Client
txt := "my text"
inputMsgTxt := tdlib.NewInputMessageText(tdlib.NewFormattedText(txt, nil), true, true)
client.EditMessageText(msg.ChatID, msg.ID, nil, inputMsgTxt)

and for markdown text:

// msg is a *tdlib.Message
// client is a *tdlib.Client
txt := "my text"
parsed, err := client.ParseMarkdown(tdlib.NewFormattedText(txt, nil))
if err != nil {
        panic(err)
}
client.EditMessageText(msg.ChatID, msg.ID, nil, tdlib.NewInputMessageText(parsed, true, true))