ptgb
A complete Telegram Bot API client for Dart

Polls & Dice

Part of the API Reference.

sendPoll

Future<Json> sendPoll(
    Object chatId,
    String question,
    List<String> options, {
    String? businessConnectionId,
    int? messageThreadId,
    List<Json>? questionEntities,
    bool? isAnonymous,
    PollType? type,
    bool? allowsMultipleAnswers,
    int? correctOptionId,
    String? explanation,
    ParseMode? explanationParseMode,
    List<Json>? explanationEntities,
    int? openPeriod,
    int? closeDate,
    bool? isClosed,
    bool? disableNotification,
    bool? protectContent,
    bool? allowPaidBroadcast,
    String? messageEffectId,
    ReplyParameters? replyParameters,
    ReplyMarkup? replyMarkup,
  }) async =>

Sends a native Telegram poll or quiz. Use [type] set to PollType.quiz for a quiz poll and provide [correctOptionId].

sendDice

Future<Json> sendDice(
    Object chatId, {
    String? businessConnectionId,
    int? messageThreadId,
    DiceEmoji? emoji,
    bool? disableNotification,
    bool? protectContent,
    bool? allowPaidBroadcast,
    String? messageEffectId,
    ReplyParameters? replyParameters,
    ReplyMarkup? replyMarkup,
  }) async =>

Sends an animated dice-style emoji (dice, dart, basketball, etc). Telegram computes the result server-side, unlike a plain emoji message.

stopPoll

Future<Json> stopPoll(
    Object chatId,
    int messageId, {
    String? businessConnectionId,
    InlineKeyboardMarkup? replyMarkup,
  }) async =>

Immediately closes a poll so it no longer accepts new answers, and returns the final results.