mirror of
https://github.com/usememos/memos.git
synced 2024-12-21 10:11:42 +03:00
845297ec03
* Change all `Robot` to `Bot` * Change all `r` of `Bot` to `b` * Change `Robot` to `bot` in comments * Fix typo --------- Co-authored-by: Athurg Feng <athurg@gooth.org>
25 lines
523 B
Go
25 lines
523 B
Go
package telegram
|
|
|
|
import (
|
|
"context"
|
|
"net/url"
|
|
"strconv"
|
|
)
|
|
|
|
// SendReplyMessage make a sendMessage api request.
|
|
func (b *Bot) SendReplyMessage(ctx context.Context, chatID, replyID int, text string) (*Message, error) {
|
|
formData := url.Values{
|
|
"reply_to_message_id": {strconv.Itoa(replyID)},
|
|
"chat_id": {strconv.Itoa(chatID)},
|
|
"text": {text},
|
|
}
|
|
|
|
var result Message
|
|
err := b.postForm(ctx, "/sendMessage", formData, &result)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &result, nil
|
|
}
|