Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forcing optional param to exist #265

Closed
riccardocescon opened this issue Feb 3, 2024 · 1 comment
Closed

Forcing optional param to exist #265

riccardocescon opened this issue Feb 3, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@riccardocescon
Copy link

Describe the bug

The stopPoll function reuires chatId, messageId and replyMarkup:

  Future<Poll> stopPoll(
      dynamic chatId, int messageId, InlineKeyboardMarkup replyMarkup) async {
    if (chatId is! String && chatId is! int) {
      return Future.error(TelegramException(
          'Attribute \'chatId\' can only be either type of String or int'));
    }
    var requestUrl = _apiUri('stopPoll');
    var body = <String, dynamic>{
      'chat_id': chatId,
      'message_id': messageId,
      'reply_markup': replyMarkup,
    };
    return Poll.fromJson(await HttpClient.httpPost(requestUrl, body: body));
  }

But the telegram api does not require replyMarkup, it's an optional parameter: https://core.telegram.org/bots/api#stoppoll

Expected behavior

The replyMarkup should be nullable

@HeySreelal
Copy link
Contributor

I've added the fix for this in #262, hoping this would get merged soon. In the meantime, if you're looking for a local fix, feel free to check this commit: 00341c9

Regards!

DinoLeung added a commit that referenced this issue Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants