stopPoll method

Future<Poll> stopPoll(
  1. dynamic chatId,
  2. int messageId,
  3. InlineKeyboardMarkup replyMarkup
)

Use this method to stop a poll which was sent by the bot

On success, the stopped Poll with the final results is returned.

https://core.telegram.org/bots/api#stoppoll

Implementation

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));
}