Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🤖 Bot API 7.4 and Televerse 1.17.0 #250

Merged
merged 12 commits into from
May 31, 2024
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.17.0

- 🤖 Bot API 7.4 (May 28, 2024)
- Refactors and formatting improvements

# 1.16.0

- 🤖 Bot API 7.3 (May 6, 2024)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[![Pub Version](https://img.shields.io/pub/v/televerse?color=blue&logo=blue)](https://pub.dev/packages/televerse)
![GitHub](https://img.shields.io/github/license/HeySreelal/televerse?color=green)
![](https://shields.io/badge/Latest-Bot%20API%207.3-blue)
![](https://shields.io/badge/Latest-Bot%20API%207.4-blue)

<a href="https://telegram.me/TeleverseDart">
<img src="https://img.shields.io/badge/Telegram%2F@TeleverseDart-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white"/>
Expand All @@ -13,15 +13,15 @@

---

🤖 `Bot API version: Bot API 7.3 (May 6, 2024)`
🤖 `Bot API version: Bot API 7.4 (May 28, 2024)`

Televerse is a powerful, easy-to-use, and highly customizable Telegram bot framework built with Dart programming language. It provides a complete and well-structured API that enables developers to create and deploy complex Telegram bots with ease. Televerse provides a total of 0 dynamic types on its public interface, making it easy for developers to write strictly typed code.

## 🔥 Bot API 7.3 (May 6, 2024)
## 🔥 Bot API 7.4 (May 28, 2024)

In a nutshell, the updates include, InlineKeyboardMarkup support for business messages, infinite editability for live locations. Support for new poll features and to chat background changes service messages.
In a nutshell, the updates include new Payment system with [Telegram Stars](https://t.me/BotNews/90), support for message effects and expandable blockquotes.

Checkout [changelog](https://core.telegram.org/bots/api-changelog#may-6-2024) for more details! 🚀
Checkout [changelog](https://core.telegram.org/bots/api#may-28-2024) for more details! 🚀

<hr>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of '../passport.dart';
part of '../models.dart';

/// This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user.
abstract class PassportElementError {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/telegram/models/callback_game.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of 'games.dart';
part of 'models.dart';

/// A placeholder, currently holds no information. Use BotFather to set up your game.
class CallbackGame {
Expand Down
75 changes: 38 additions & 37 deletions lib/src/telegram/models/chat_full_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,109 +2,109 @@ part of 'models.dart';

/// This object represents a chat.
class ChatFullInfo extends Chat {
/// Optional. Chat photo. Returned only in getChat.
/// Optional. Chat photo.
final ChatPhoto? photo;

/// Optional. If non-empty, the list of all active chat usernames; for private chats, supergroups and channels. Returned only in getChat.
/// Optional. If non-empty, the list of all active chat usernames; for private chats, supergroups and channels.
final List<String>? activeUsernames;

/// Optional. Bio of the other party in a private chat. Returned only in getChat.
/// Optional. Bio of the other party in a private chat.
final String? bio;

/// Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. Returned only in getChat.
/// Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user.
final bool? hasPrivateForwards;

/// Optional. True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in getChat.
/// Optional. True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat.
final bool? hasRestrictedVoiceAndVideoMessages;

/// Optional. True, if users need to join the supergroup before they can send messages. Returned only in getChat.
/// Optional. True, if users need to join the supergroup before they can send messages.
final bool? joinToSendMessages;

/// Optional. True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat.
/// Optional. True, if all users directly joining the supergroup need to be approved by supergroup administrators.
final bool? joinByRequest;

/// Optional. Description, for groups, supergroups and channel chats. Returned only in getChat.
/// Optional. Description, for groups, supergroups and channel chats.
final String? description;

/// Optional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat.
/// Optional. Primary invite link, for groups, supergroups and channel chats.
final String? inviteLink;

/// Optional. The most recent pinned message (by sending date). Returned only in getChat.
/// Optional. The most recent pinned message (by sending date).
final Message? pinnedMessage;

/// Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat.
/// Optional. Default chat member permissions, for groups and supergroups.
final ChatPermissions? permissions;

/// Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat.
/// Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds.
final int? slowModeDelay;

/// Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat.
/// Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds.
final int? messageAutoDeleteTime;

/// Optional. True, if messages from the chat can't be forwarded to other chats. Returned only in getChat.
/// Optional. True, if messages from the chat can't be forwarded to other chats.
final bool? hasProtectedContent;

/// Optional. For supergroups, name of group sticker set. Returned only in getChat.
/// Optional. For supergroups, name of group sticker set.
final String? stickerSetName;

/// Optional. True, if the bot can change the group sticker set. Returned only in getChat.
/// Optional. True, if the bot can change the group sticker set.
final bool? canSetStickerSet;

/// Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat.
/// Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
final int? linkedChatId;

/// Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat.
/// Optional. For supergroups, the location to which the supergroup is connected.
final ChatLocation? location;

/// Optional. True, if non-administrators can only get the list of bots and administrators in the chat. Returned only in getChat.
/// Optional. True, if non-administrators can only get the list of bots and administrators in the chat.
final bool? hasHiddenMembers;

/// Optional. True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in getChat.
/// Optional. True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators.
final bool? hasAggressiveAntiSpamEnabled;

/// Optional. Expiration date of the emoji status of the other party in a private chat, if any. Returned only in getChat.
/// Optional. Expiration date of the emoji status of the other party in a private chat, if any.
final int? emojiStatusExpirationDate;

/// Optional. Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any. Returned only in getChat.
/// Optional. Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any.
final List<ReactionType>? availableReactions;

/// Optional. Custom emoji identifier of the emoji status of the chat or the other party in a private chat. Returned only in getChat.
/// Optional. Custom emoji identifier of the emoji status of the chat or the other party in a private chat.
final String? emojiStatusCustomEmojiId;

/// Optional. Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See [accent colors](https://core.telegram.org/bots/api#accent-colors) for more details. Returned only in getChat. Always returned in [getChat](https://core.telegram.org/bots/api#getchat)
/// Optional. Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See [accent colors](https://core.telegram.org/bots/api#accent-colors) for more details. Always returned in [getChat](https://core.telegram.org/bots/api#getchat)
final int? accentColorId;

/// Optional. Custom emoji identifier of emoji chosen by the chat for the reply header and link preview background. Returned only in getChat.
/// Optional. Custom emoji identifier of emoji chosen by the chat for the reply header and link preview background.
final String? backgroundCustomEmojiId;

/// Optional. Identifier of the accent color for the chat's profile background. See profile accent colors for more details. Returned only in getChat.
/// Optional. Identifier of the accent color for the chat's profile background. See profile accent colors for more details.
final int? profileAccentColorId;

/// Optional. Custom emoji identifier of the emoji chosen by the chat for its profile background. Returned only in getChat.
/// Optional. Custom emoji identifier of the emoji chosen by the chat for its profile background.
final String? profileBackgroundCustomEmojiId;

/// Optional. True, if new chat members will have access to old messages; available only to chat administrators. Returned only in getChat.
/// Optional. True, if new chat members will have access to old messages; available only to chat administrators.
final bool? hasVisibleHistory;

/// Optional. For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions. Returned only in getChat.
/// Optional. For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions.
final int? unrestrictBoostCount;

/// Optional. For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group. Returned only in getChat.
/// Optional. For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group.
final String? customEmojiStickerSetName;

/// Optional. For private chats with business accounts, the intro of the business. Returned only in getChat.
/// Optional. For private chats with business accounts, the intro of the business.
final BusinessIntro? businessIntro;

/// Optional. For private chats with business accounts, the location of the business. Returned only in getChat.
/// Optional. For private chats with business accounts, the location of the business.
final BusinessLocation? businessLocation;

/// Optional. For private chats with business accounts, the opening hours of the business. Returned only in getChat.
/// Optional. For private chats with business accounts, the opening hours of the business.
final BusinessOpeningHours? businessOpeningHours;

/// Optional. For private chats, the personal channel of the user. Returned only in getChat.
/// Optional. For private chats, the personal channel of the user.
final Chat? personalChat;

/// Optional. For private chats, the date of birth of the user. Returned only in getChat.
/// Optional. For private chats, the date of birth of the user.
final Birthdate? birthdate;

/// The maximum number of reactions that can be set on a message in the chat
Expand Down Expand Up @@ -261,8 +261,9 @@ class ChatFullInfo extends Chat {
'has_hidden_members': hasHiddenMembers,
'has_aggressive_anti_spam_enabled': hasAggressiveAntiSpamEnabled,
'emoji_status_expiration_date': emojiStatusExpirationDate,
'available_reactions':
availableReactions?.map((e) => e.toJson()).toList(),
'available_reactions': availableReactions?.map((e) {
return e.toJson();
}).toList(),
'emoji_status_custom_emoji_id': emojiStatusCustomEmojiId,
'accent_color_id': accentColorId,
'background_custom_emoji_id': backgroundCustomEmojiId,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/telegram/models/encrypted_credentials.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of 'passport.dart';
part of 'models.dart';

/// Describes data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes.
class EncryptedCredentials {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/telegram/models/encrypted_passport_element.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of 'passport.dart';
part of 'models.dart';

/// Describes documents or other Telegram Passport elements shared with the bot by the user.
class EncryptedPassportElement {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/telegram/models/game.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of 'games.dart';
part of 'models.dart';

/// This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
class Game {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/telegram/models/game_high_score.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of 'games.dart';
part of 'models.dart';

/// This object represents one row of the high scores table for a game.
class GameHighScore {
Expand Down
50 changes: 0 additions & 50 deletions lib/src/telegram/models/games.dart

This file was deleted.

9 changes: 9 additions & 0 deletions lib/src/telegram/models/inline_query_result_cached_gif.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class InlineQueryResultCachedGif implements InlineQueryResult {
/// Optional. Content of the message to be sent instead of the GIF animation
final InputMessageContent? inputMessageContent;

/// Optional. True, if the caption must be shown above the message media
final bool? showCaptionAboveMedia;

/// Constructs an [InlineQueryResultCachedGif] object
const InlineQueryResultCachedGif({
required this.gifFileId,
Expand All @@ -42,6 +45,7 @@ class InlineQueryResultCachedGif implements InlineQueryResult {
this.captionEntities,
this.replyMarkup,
this.inputMessageContent,
this.showCaptionAboveMedia,
});

/// Converts an [InlineQueryResultCachedGif] object to a JSON map
Expand All @@ -57,6 +61,7 @@ class InlineQueryResultCachedGif implements InlineQueryResult {
'caption_entities': captionEntities?.map((e) => e.toJson()).toList(),
'reply_markup': replyMarkup?.toJson(),
'input_message_content': inputMessageContent?.toJson(),
'show_caption_above_media': showCaptionAboveMedia,
}..removeWhere(_nullFilter);
}

Expand All @@ -83,6 +88,7 @@ class InlineQueryResultCachedGif implements InlineQueryResult {
: InputMessageContent.fromJson(
json['input_message_content'] as Map<String, dynamic>,
),
showCaptionAboveMedia: json['show_caption_above_media'],
);
}

Expand All @@ -96,6 +102,7 @@ class InlineQueryResultCachedGif implements InlineQueryResult {
List<MessageEntity>? captionEntities,
InlineKeyboardMarkup? replyMarkup,
InputMessageContent? inputMessageContent,
bool? showCaptionAboveMedia,
}) {
return InlineQueryResultCachedGif(
id: id ?? this.id,
Expand All @@ -106,6 +113,8 @@ class InlineQueryResultCachedGif implements InlineQueryResult {
captionEntities: captionEntities ?? this.captionEntities,
replyMarkup: replyMarkup ?? this.replyMarkup,
inputMessageContent: inputMessageContent ?? this.inputMessageContent,
showCaptionAboveMedia:
showCaptionAboveMedia ?? this.showCaptionAboveMedia,
);
}
}
Loading
Loading