diff --git a/CHANGELOG.md b/CHANGELOG.md index 77ccca6..00a09a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.26.5 + +- Fixed in `ReactionTypeCustomEmoji.customEmojiId` + # 1.26.4 - Added `LocalFile` class. diff --git a/lib/src/telegram/models/reaction_type_custom_emoji.dart b/lib/src/telegram/models/reaction_type_custom_emoji.dart index e2c5e2a..39fe796 100644 --- a/lib/src/telegram/models/reaction_type_custom_emoji.dart +++ b/lib/src/telegram/models/reaction_type_custom_emoji.dart @@ -7,11 +7,11 @@ class ReactionTypeCustomEmoji implements ReactionType { final ReactionTypeType type = ReactionTypeType.customEmoji; /// Custom emoji identifier - final String customEmoji; + final String customEmojiId; /// Constructs a [ReactionTypeCustomEmoji] object const ReactionTypeCustomEmoji({ - required this.customEmoji, + required this.customEmojiId, }); /// Converts a [ReactionTypeCustomEmoji] object to JSON object @@ -19,14 +19,14 @@ class ReactionTypeCustomEmoji implements ReactionType { Map toJson() { return { 'type': type.value, - 'custom_emoji': customEmoji, + 'custom_emoji_id': customEmojiId, }; } /// Creates a [ReactionTypeCustomEmoji] object from JSON object factory ReactionTypeCustomEmoji.fromJson(Map json) { return ReactionTypeCustomEmoji( - customEmoji: json['custom_emoji']!, + customEmojiId: json['custom_emoji_id']!, ); } } diff --git a/lib/src/televerse/api/raw_api.dart b/lib/src/televerse/api/raw_api.dart index 878d91c..66b003b 100644 --- a/lib/src/televerse/api/raw_api.dart +++ b/lib/src/televerse/api/raw_api.dart @@ -171,6 +171,8 @@ class RawAPI { e.field: LocalFile( e.file.getBytes(), fileName: e.name, + headers: e.file.headers, + contentType: e.file.mimeType, ), }; }).toList(); diff --git a/lib/src/televerse/models/input_file.dart b/lib/src/televerse/models/input_file.dart index fd3a25d..97bc6cf 100644 --- a/lib/src/televerse/models/input_file.dart +++ b/lib/src/televerse/models/input_file.dart @@ -35,18 +35,28 @@ class InputFile { /// The bytes of the file. final Uint8List? bytes; + /// Mime Type of the File + final String? mimeType; + + /// Additional headers + final Map>? headers; + /// Private constructor for [InputFile]. const InputFile._({ this.fileId, this.url, this.bytes, this.name, + this.headers, + this.mimeType, }); /// Creates a new [InputFile] using a local file. factory InputFile.fromFile( io.File file, { String? name, + String? mimeType, + Map>? headers, }) { if (!file.existsSync()) { throw TeleverseException.fileDoesNotExist(file.path); @@ -54,6 +64,8 @@ class InputFile { return InputFile._( bytes: file.readAsBytesSync(), name: name ?? file.filename, + mimeType: mimeType, + headers: headers, ); } @@ -70,9 +82,17 @@ class InputFile { ); /// Creates a new [InputFile] using the bytes of the file. - factory InputFile.fromBytes(Uint8List bytes, {String? name}) => InputFile._( + factory InputFile.fromBytes( + Uint8List bytes, { + String? name, + String? mimeType, + Map>? headers, + }) => + InputFile._( bytes: bytes, name: name, + mimeType: mimeType, + headers: headers, ); /// Returns the type of the [InputFile]. diff --git a/pubspec.yaml b/pubspec.yaml index 12a5761..7ba61f0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: televerse description: Televerse lets you create your own efficient Telegram bots with ease in Dart. Supports latest Telegram Bot API - 7.10! -version: 1.26.4 +version: 1.26.5 homepage: https://televerse.xooniverse.com repository: https://github.com/xooniverse/televerse topics: