api_answer_callback_query.go 422 B

123456789101112131415161718192021
  1. package telegram
  2. import (
  3. "context"
  4. "net/url"
  5. )
  6. // AnswerCallbackQuery make an answerCallbackQuery api request.
  7. func (b *Bot) AnswerCallbackQuery(ctx context.Context, callbackQueryID, text string) error {
  8. formData := url.Values{
  9. "callback_query_id": {callbackQueryID},
  10. "text": {text},
  11. }
  12. err := b.postForm(ctx, "/answerCallbackQuery", formData, nil)
  13. if err != nil {
  14. return err
  15. }
  16. return nil
  17. }