memos/plugin/telegram/api_edit_message.go
2023-05-26 09:43:51 +08:00

24 lines
501 B
Go

package telegram
import (
"context"
"net/url"
"strconv"
)
// EditMessage make an editMessageText api request.
func (r *Robot) EditMessage(ctx context.Context, chatID, messageID int, text string) (*Message, error) {
formData := url.Values{
"message_id": {strconv.Itoa(messageID)},
"chat_id": {strconv.Itoa(chatID)},
"text": {text},
}
var result Message
err := r.postForm(ctx, "/editMessageText", formData, &result)
if err != nil {
return nil, err
}
return &result, nil
}