sendSticker method

Future<Message> sendSticker(
  1. ID chatId,
  2. InputFile sticker, {
  3. String? businessConnectionId,
  4. int? messageThreadId,
  5. String? emoji,
  6. bool? disableNotification,
  7. bool? protectContent,
  8. bool? allowPaidBroadcast,
  9. String? messageEffectId,
  10. ReplyParameters? replyParameters,
  11. ReplyMarkup? replyMarkup,
  12. int? directMessagesTopicId,
  13. SuggestedPostParameters? suggestedPostParameters,
})

Sends static .WEBP, animated .TGS, or video .WEBM stickers.

On success, the sent Message is returned.

See: https://core.telegram.org/bots/api#sendsticker

Implementation

Future<Message> sendSticker(
  ID chatId,
  InputFile sticker, {
  String? businessConnectionId,
  int? messageThreadId,
  String? emoji,
  bool? disableNotification,
  bool? protectContent,
  bool? allowPaidBroadcast,
  String? messageEffectId,
  ReplyParameters? replyParameters,
  ReplyMarkup? replyMarkup,
  int? directMessagesTopicId,
  SuggestedPostParameters? suggestedPostParameters,
}) async {
  final params = <String, dynamic>{
    'chat_id': chatId,
    'sticker': sticker,
    'business_connection_id': ?businessConnectionId,
    'message_thread_id': ?messageThreadId,
    'emoji': ?emoji,
    'disable_notification': ?disableNotification,
    'protect_content': ?protectContent,
    'allow_paid_broadcast': ?allowPaidBroadcast,
    'message_effect_id': ?messageEffectId,
    'reply_parameters': ?replyParameters,
    'reply_markup': ?replyMarkup,
    'direct_messages_topic_id': ?directMessagesTopicId,
    'suggested_post_parameters': ?suggestedPostParameters,
  };

  final files = _prepareFiles([('sticker', sticker)]);
  final payload = Payload(params, files);
  final response = await _makeRequest<Map<String, dynamic>>(
    APIMethod.sendSticker.name,
    payload,
  );

  return Message.fromJson(response);
}