addStickerToSet method

Future<bool> addStickerToSet(
  1. int userId,
  2. String name,
  3. InputSticker sticker
)

Use this method to add a new sticker to a set created by the bot

You must use exactly one of the fields png_sticker, tgs_sticker, or webm_sticker. Animated stickers can be added to animated sticker sets and only to them. Animated sticker sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers.

Returns True on success.

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

Implementation

Future<bool> addStickerToSet(
    int userId, String name, InputSticker sticker) async {
  var requestUrl = _apiUri('addStickerToSet');
  var body = <String, dynamic>{
    'user_id': userId,
    'name': name,
    'stickers': jsonEncode(sticker),
  };

  if (sticker.stickerFile != null) {
    return await HttpClient.httpMultipartPost(
        requestUrl, List.from([sticker.stickerFile]),
        body: body);
  } else {
    return await HttpClient.httpPost(requestUrl, body: body);
  }
}