Skip to content

Commit

Permalink
Merge pull request #35 from KaikyuLotus/APIv7.11
Browse files Browse the repository at this point in the history
Updated to bot API 7.11
  • Loading branch information
ale183 authored Jan 2, 2025
2 parents 1c16d68 + af87200 commit ca1164e
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.11.3

- Updated to bot API 7.11

## 1.11.2

- Added missing type factories
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Dart Telegram Bot is a [Dart](https://dart.dev) wrapper for [Telegram](https://t
bot [API](https://core.telegram.org/bots/api). \
It is compatible with Native, Flutter and JS.

[![Bot API Version](https://img.shields.io/badge/Bot%20API-7.9-blue.svg?style=flat-square)](https://core.telegram.org/bots/api)
[![Bot API Version](https://img.shields.io/badge/Bot%20API-7.11-blue.svg?style=flat-square)](https://core.telegram.org/bots/api)
[![Dart Version](https://img.shields.io/badge/Dart-3.2.0-blue.svg?style=flat-square)](https://dart.dev)

Using Dart Telegram Bot is straightforward, here's an example echo bot:
Expand Down
36 changes: 36 additions & 0 deletions lib/src/entities/internal/tgapi_methods.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ mixin TGAPIMethods {
LinkPreviewOptions? linkPreviewOptions,
bool? disableNotification,
bool? protectContent,
bool? allowPaidBroadcast,
String? messageEffectId,
ReplyParameters? replyParameters,
ReplyMarkup? replyMarkup,
Expand All @@ -109,6 +110,7 @@ mixin TGAPIMethods {
'link_preview_options': linkPreviewOptions,
'disable_notification': disableNotification,
'protect_content': protectContent,
'allow_paid_broadcast': allowPaidBroadcast,
'message_effect_id': messageEffectId,
'reply_parameters': replyParameters,
'reply_markup': replyMarkup,
Expand Down Expand Up @@ -188,6 +190,7 @@ mixin TGAPIMethods {
bool? showCaptionAboveMedia,
bool? disableNotification,
bool? protectContent,
bool? allowPaidBroadcast,
ReplyParameters? replyParameters,
ReplyMarkup? replyMarkup,
}) {
Expand All @@ -202,6 +205,7 @@ mixin TGAPIMethods {
'show_caption_above_media': showCaptionAboveMedia,
'disable_notification': disableNotification,
'protect_content': protectContent,
'allow_paid_broadcast': allowPaidBroadcast,
'reply_parameters': replyParameters,
'reply_markup': replyMarkup,
});
Expand Down Expand Up @@ -259,6 +263,7 @@ mixin TGAPIMethods {
bool? hasSpoiler,
bool? disableNotification,
bool? protectContent,
bool? allowPaidBroadcast,
String? messageEffectId,
ReplyParameters? replyParameters,
ReplyMarkup? replyMarkup,
Expand All @@ -275,6 +280,7 @@ mixin TGAPIMethods {
'has_spoiler': hasSpoiler,
'disable_notification': disableNotification,
'protect_content': protectContent,
'allow_paid_broadcast': allowPaidBroadcast,
'message_effect_id': messageEffectId,
'reply_parameters': replyParameters,
'reply_markup': replyMarkup,
Expand Down Expand Up @@ -306,6 +312,7 @@ mixin TGAPIMethods {
HttpFile? thumbnail,
bool? disableNotification,
bool? protectContent,
bool? allowPaidBroadcast,
String? messageEffectId,
ReplyParameters? replyParameters,
ReplyMarkup? replyMarkup,
Expand All @@ -324,6 +331,7 @@ mixin TGAPIMethods {
'thumbnail': thumbnail,
'disable_notification': disableNotification,
'protect_content': protectContent,
'allow_paid_broadcast': allowPaidBroadcast,
'message_effect_id': messageEffectId,
'reply_parameters': replyParameters,
'reply_markup': replyMarkup,
Expand All @@ -347,6 +355,7 @@ mixin TGAPIMethods {
List<MessageEntity>? captionEntities,
bool? disableNotification,
bool? protectContent,
bool? allowPaidBroadcast,
String? messageEffectId,
ReplyParameters? replyParameters,
ReplyMarkup? replyMarkup,
Expand All @@ -363,6 +372,7 @@ mixin TGAPIMethods {
'thumbnail': thumbnail,
'disable_notification': disableNotification,
'protect_content': protectContent,
'allow_paid_broadcast': allowPaidBroadcast,
'message_effect_id': messageEffectId,
'reply_parameters': replyParameters,
'reply_markup': replyMarkup,
Expand Down Expand Up @@ -395,6 +405,7 @@ mixin TGAPIMethods {
bool? supportsStreaming,
bool? disableNotification,
bool? protectContent,
bool? allowPaidBroadcast,
String? messageEffectId,
ReplyParameters? replyParameters,
ReplyMarkup? replyMarkup,
Expand All @@ -416,6 +427,7 @@ mixin TGAPIMethods {
'supports_streaming': supportsStreaming,
'disable_notification': disableNotification,
'protect_content': protectContent,
'allow_paid_broadcast': allowPaidBroadcast,
'message_effect_id': messageEffectId,
'reply_parameters': replyParameters,
'reply_markup': replyMarkup,
Expand Down Expand Up @@ -444,6 +456,7 @@ mixin TGAPIMethods {
bool? hasSpoiler,
bool? disableNotification,
bool? protectContent,
bool? allowPaidBroadcast,
String? messageEffectId,
ReplyParameters? replyParameters,
ReplyMarkup? replyMarkup,
Expand All @@ -464,6 +477,7 @@ mixin TGAPIMethods {
'has_spoiler': hasSpoiler,
'disable_notification': disableNotification,
'protect_content': protectContent,
'allow_paid_broadcast': allowPaidBroadcast,
'message_effect_id': messageEffectId,
'reply_parameters': replyParameters,
'reply_markup': replyMarkup,
Expand Down Expand Up @@ -492,6 +506,7 @@ mixin TGAPIMethods {
int? duration,
bool? disableNotification,
bool? protectContent,
bool? allowPaidBroadcast,
String? messageEffectId,
ReplyParameters? replyParameters,
ReplyMarkup? replyMarkup,
Expand All @@ -507,6 +522,7 @@ mixin TGAPIMethods {
'duration': duration,
'disable_notification': disableNotification,
'protect_content': protectContent,
'allow_paid_broadcast': allowPaidBroadcast,
'message_effect_id': messageEffectId,
'reply_parameters': replyParameters,
'reply_markup': replyMarkup,
Expand All @@ -526,6 +542,7 @@ mixin TGAPIMethods {
HttpFile? thumbnail,
bool? disableNotification,
bool? protectContent,
bool? allowPaidBroadcast,
String? messageEffectId,
ReplyParameters? replyParameters,
ReplyMarkup? replyMarkup,
Expand All @@ -540,6 +557,7 @@ mixin TGAPIMethods {
'thumbnail': thumbnail,
'disable_notification': disableNotification,
'protect_content': protectContent,
'allow_paid_broadcast': allowPaidBroadcast,
'message_effect_id': messageEffectId,
'reply_parameters': replyParameters,
'reply_markup': replyMarkup,
Expand Down Expand Up @@ -597,6 +615,7 @@ mixin TGAPIMethods {
int? messageThreadId,
bool? disableNotification,
bool? protectContent,
bool? allowPaidBroadcast,
String? messageEffectId,
ReplyParameters? replyParameters,
}) {
Expand All @@ -607,6 +626,7 @@ mixin TGAPIMethods {
'media': media,
'disable_notification': disableNotification,
'protect_content': protectContent,
'allow_paid_broadcast': allowPaidBroadcast,
'message_effect_id': messageEffectId,
'reply_parameters': replyParameters,
});
Expand All @@ -627,6 +647,7 @@ mixin TGAPIMethods {
int? proximityAlertRadius,
bool? disableNotification,
bool? protectContent,
bool? allowPaidBroadcast,
String? messageEffectId,
ReplyParameters? replyParameters,
ReplyMarkup? replyMarkup,
Expand All @@ -643,6 +664,7 @@ mixin TGAPIMethods {
'proximity_alert_radius': proximityAlertRadius,
'disable_notification': disableNotification,
'protect_content': protectContent,
'allow_paid_broadcast': allowPaidBroadcast,
'message_effect_id': messageEffectId,
'reply_parameters': replyParameters,
'reply_markup': replyMarkup,
Expand All @@ -666,6 +688,7 @@ mixin TGAPIMethods {
String? googlePlaceType,
bool? disableNotification,
bool? protectContent,
bool? allowPaidBroadcast,
String? messageEffectId,
ReplyParameters? replyParameters,
ReplyMarkup? replyMarkup,
Expand All @@ -684,6 +707,7 @@ mixin TGAPIMethods {
'google_place_type': googlePlaceType,
'disable_notification': disableNotification,
'protect_content': protectContent,
'allow_paid_broadcast': allowPaidBroadcast,
'message_effect_id': messageEffectId,
'reply_parameters': replyParameters,
'reply_markup': replyMarkup,
Expand All @@ -703,6 +727,7 @@ mixin TGAPIMethods {
String? vcard,
bool? disableNotification,
bool? protectContent,
bool? allowPaidBroadcast,
String? messageEffectId,
ReplyParameters? replyParameters,
ReplyMarkup? replyMarkup,
Expand All @@ -717,6 +742,7 @@ mixin TGAPIMethods {
'vcard': vcard,
'disable_notification': disableNotification,
'protect_content': protectContent,
'allow_paid_broadcast': allowPaidBroadcast,
'message_effect_id': messageEffectId,
'reply_parameters': replyParameters,
'reply_markup': replyMarkup,
Expand Down Expand Up @@ -746,6 +772,7 @@ mixin TGAPIMethods {
bool? isClosed,
bool? disableNotification,
bool? protectContent,
bool? allowPaidBroadcast,
String? messageEffectId,
ReplyParameters? replyParameters,
ReplyMarkup? replyMarkup,
Expand All @@ -770,6 +797,7 @@ mixin TGAPIMethods {
'is_closed': isClosed,
'disable_notification': disableNotification,
'protect_content': protectContent,
'allow_paid_broadcast': allowPaidBroadcast,
'message_effect_id': messageEffectId,
'reply_parameters': replyParameters,
'reply_markup': replyMarkup,
Expand All @@ -787,6 +815,7 @@ mixin TGAPIMethods {
Emoji? emoji,
bool? disableNotification,
bool? protectContent,
bool? allowPaidBroadcast,
String? messageEffectId,
ReplyParameters? replyParameters,
ReplyMarkup? replyMarkup,
Expand All @@ -798,6 +827,7 @@ mixin TGAPIMethods {
'emoji': emoji,
'disable_notification': disableNotification,
'protect_content': protectContent,
'allow_paid_broadcast': allowPaidBroadcast,
'message_effect_id': messageEffectId,
'reply_parameters': replyParameters,
'reply_markup': replyMarkup,
Expand Down Expand Up @@ -2190,6 +2220,7 @@ mixin TGAPIMethods {
String? emoji,
bool? disableNotification,
bool? protectContent,
bool? allowPaidBroadcast,
String? messageEffectId,
ReplyParameters? replyParameters,
ReplyMarkup? replyMarkup,
Expand All @@ -2202,6 +2233,7 @@ mixin TGAPIMethods {
'emoji': emoji,
'disable_notification': disableNotification,
'protect_content': protectContent,
'allow_paid_broadcast': allowPaidBroadcast,
'message_effect_id': messageEffectId,
'reply_parameters': replyParameters,
'reply_markup': replyMarkup,
Expand Down Expand Up @@ -2483,6 +2515,7 @@ mixin TGAPIMethods {
bool? isFlexible,
bool? disableNotification,
bool? protectContent,
bool? allowPaidBroadcast,
String? messageEffectId,
ReplyParameters? replyParameters,
InlineKeyboardMarkup? replyMarkup,
Expand Down Expand Up @@ -2513,6 +2546,7 @@ mixin TGAPIMethods {
'is_flexible': isFlexible,
'disable_notification': disableNotification,
'protect_content': protectContent,
'allow_paid_broadcast': allowPaidBroadcast,
'message_effect_id': messageEffectId,
'reply_parameters': replyParameters,
'reply_markup': replyMarkup,
Expand Down Expand Up @@ -2715,6 +2749,7 @@ mixin TGAPIMethods {
int? messageThreadId,
bool? disableNotification,
bool? protectContent,
bool? allowPaidBroadcast,
String? messageEffectId,
ReplyParameters? replyParameters,
InlineKeyboardMarkup? replyMarkup,
Expand All @@ -2726,6 +2761,7 @@ mixin TGAPIMethods {
'game_short_name': gameShortName,
'disable_notification': disableNotification,
'protect_content': protectContent,
'allow_paid_broadcast': allowPaidBroadcast,
'message_effect_id': messageEffectId,
'reply_parameters': replyParameters,
'reply_markup': replyMarkup,
Expand Down
26 changes: 26 additions & 0 deletions lib/src/entities/telegram/copy_text_button.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import 'dart:convert';

/// This object represents an inline keyboard button that copies specified text
/// to the clipboard.
class CopyTextButton {
/// The text to be copied to the clipboard; 1-256 characters
String text;

/// Basic constructor
CopyTextButton(this.text);

/// Creates an object from a json
factory CopyTextButton.fromJson(Map<String, dynamic> json) {
return CopyTextButton(json['text']);
}

/// Creates a json from the object
Map<String, dynamic> toJson() {
return {
'text': text,
};
}

@override
String toString() => json.encode(this);
}
10 changes: 10 additions & 0 deletions lib/src/entities/telegram/inline_keyboard_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ class InlineKeyboardButton {
/// Not supported for messages sent on behalf of a Telegram Business account.
SwitchInlineQueryChosenChat? switchInlineQueryChosenChat;

/// Optional. Description of the button that copies the specified text to the
/// clipboard
CopyTextButton? copy_text;

/// Optional. Description of the game that will be launched when the user
/// presses the button.
/// This type of button must always be the first button in the first row.
Expand All @@ -84,6 +88,7 @@ class InlineKeyboardButton {
this.switchInlineQuery,
this.switchInlineQueryCurrentChat,
this.switchInlineQueryChosenChat,
this.copy_text,
this.callbackGame,
this.pay,
});
Expand Down Expand Up @@ -115,6 +120,9 @@ class InlineKeyboardButton {
this.switchInlineQueryChosenChat,
);

/// CopyText constructor
InlineKeyboardButton.copyText(this.text, this.copy_text);

/// CallbackGame constructor
InlineKeyboardButton.callbackGame(this.text, this.callbackGame);

Expand All @@ -135,6 +143,7 @@ class InlineKeyboardButton {
SwitchInlineQueryChosenChat.fromJson,
json['switch_inline_query_chosen_chat'],
),
copy_text: callIfNotNull(CopyTextButton.fromJson, json['copy_text']),
callbackGame: callIfNotNull(CallbackGame.fromJson, json['callback_game']),
pay: json['pay'],
);
Expand Down Expand Up @@ -172,6 +181,7 @@ class InlineKeyboardButton {
'switch_inline_query': switchInlineQuery,
'switch_inline_query_current_chat': switchInlineQueryCurrentChat,
'switch_inline_query_chosen_chat': switchInlineQueryChosenChat,
'copy_text': copy_text,
'callback_game': callbackGame,
'pay': pay,
}..removeWhere((_, v) => v == null);
Expand Down
2 changes: 2 additions & 0 deletions lib/src/entities/telegram/transaction_partner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ abstract class TransactionPartner {
return TransactionPartnerFragment.fromJson(json);
case 'telegram_ads':
return TransactionPartnerTelegramAds.fromJson(json);
case 'telegram_api':
return TransactionPartnerTelegramApi.fromJson(json);
case 'other':
return TransactionPartnerOther.fromJson(json);
default:
Expand Down
Loading

0 comments on commit ca1164e

Please sign in to comment.