memos/plugin/telegram/api_send_message.go
Athurg Gooth 9987337eca
fix: all ID from int to int64 to avoid 32bits machine break (#2191)
Fix all ID from int to int64 to avoid 32bits machine break
2023-09-06 21:14:07 +08:00

25 lines
543 B
Go

package telegram
import (
"context"
"net/url"
"strconv"
)
// SendReplyMessage make a sendMessage api request.
func (b *Bot) SendReplyMessage(ctx context.Context, chatID, replyID int64, text string) (*Message, error) {
formData := url.Values{
"reply_to_message_id": {strconv.FormatInt(replyID, 10)},
"chat_id": {strconv.FormatInt(chatID, 10)},
"text": {text},
}
var result Message
err := b.postForm(ctx, "/sendMessage", formData, &result)
if err != nil {
return nil, err
}
return &result, nil
}