sendDice method

Future<Message> sendDice(
  1. dynamic chat_id, {
  2. String emoji = Dice.DICE,
  3. bool? disable_notification,
  4. int? reply_to_message_id,
  5. bool? allow_sending_without_reply,
  6. ReplyMarkup? reply_markup,
})
inherited

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 chat_id,
    {String emoji = Dice.DICE,
    bool? disable_notification,
    int? reply_to_message_id,
    bool? allow_sending_without_reply,
    ReplyMarkup? reply_markup}) async {
  if (chat_id is! String && chat_id is! int) {
    return Future.error(TelegramException(
        'Attribute \'chat_id\' can only be either type of String or int'));
  }
  var requestUrl = _apiUri('sendDice');
  var body = <String, dynamic>{
    'chat_id': chat_id,
    'emoji': emoji,
    'disable_notification': disable_notification,
    'reply_to_message_id': reply_to_message_id,
    'allow_sending_without_reply': allow_sending_without_reply,
    'reply_markup': reply_markup == null ? null : jsonEncode(reply_markup),
  };
  return Message.fromJson(await HttpClient.httpPost(requestUrl, body: body));
}