setStickerSetThumb method
Use this method to set the thumbnail of a sticker set
Animated thumbnails can be set for animated sticker sets only.
Returns True on success.
Implementation
Future<bool> setStickerSetThumb(String name, int user_id,
{dynamic thumb}) async {
var requestUrl = _apiUri('setStickerSetThumb');
var body = <String, dynamic>{
'name': name,
'user_id': user_id,
};
if (thumb == null) {
return await HttpClient.httpPost(requestUrl, body: body);
} else if (thumb is io.File) {
// filename cannot be empty to post to Telegram server
var files = List<MultipartFile>.filled(
1,
MultipartFile('thumb', thumb.openRead(), thumb.lengthSync(),
filename: '${thumb.lengthSync()}'));
return await HttpClient.httpMultipartPost(requestUrl, files, body: body);
} else if (thumb is String) {
body.addAll({'thumb': thumb});
return await HttpClient.httpPost(requestUrl, body: body);
} else {
return Future.error(TelegramException(
'Attribute \'thumb\' can only be either io.File or String (Telegram file_id or image url)'));
}
}