sendDice method

Future<Message> sendDice(
  1. dynamic chatId, {
  2. int? messageThreadId,
  3. String emoji = Dice.emojiDice,
  4. bool? disableNotification,
  5. bool? protectContent,
  6. int? replyToMessageId,
  7. bool? allowSendingWithoutReply,
  8. ReplyMarkup? replyMarkup,
})

Use this method to send an animated emoji that will display a random value

On success, the sent Message is returned.

Implementation

Future<Message> sendDice(dynamic chatId,
    {int? messageThreadId,
    String emoji = Dice.emojiDice,
    bool? disableNotification,
    bool? protectContent,
    int? replyToMessageId,
    bool? allowSendingWithoutReply,
    ReplyMarkup? 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('sendDice');
  var body = <String, dynamic>{
    'chat_id': chatId,
    'message_thread_id': messageThreadId,
    'emoji': emoji,
    'disable_notification': disableNotification,
    'protect_content': protectContent,
    'reply_to_message_id': replyToMessageId,
    'allow_sending_without_reply': allowSendingWithoutReply,
    'reply_markup': replyMarkup == null ? null : jsonEncode(replyMarkup),
  };
  return Message.fromJson(await HttpClient.httpPost(requestUrl, body: body));
}