Skip to content

Commit

Permalink
🤖 Merge #287: Bot API 7.8
Browse files Browse the repository at this point in the history
  • Loading branch information
HeySreelal authored Jul 31, 2024
2 parents 40ba2d6 + db0194e commit 3234659
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 1.23.0

- 🤖 Bot API 7.8
- Added `User.hasMainWebApp`
- Support for managing pinned messages on behalf of user (Business Bots)

# 1.22.5

- Just a re-release to move the repo to [@Xooniverse](https://github.com/xooniverse)
Expand Down
16 changes: 9 additions & 7 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/xooniverse/televerse?color=green)
![](https://shields.io/badge/Latest-Bot%20API%207.7-blue)
![](https://shields.io/badge/Latest-Bot%20API%207.8-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,7 +13,7 @@

---

🤖 `Bot API version: Bot API 7.7 (July 7, 2024)`
🤖 `Bot API version: Bot API 7.8 (July 31, 2024)`

Televerse is a powerful, easy-to-use, and highly customizable Telegram bot
framework built with Dart programming language. It provides a complete and
Expand All @@ -23,13 +23,14 @@ public interface, making it easy for developers to write strictly typed code.

## 🔥 What's latest?

### 🤖 Bot API 7.7
### 🤖 Bot API 7.8

(🗓️ July 8, 2024)
(🗓️ July 31, 2024)

Simply, this change brings support for Refunds of Payment.
Simply, this change brings support for ability to manage pinned messages on behalf of a Business.
Much more updates on Mini apps.

Checkout [changelog](https://core.telegram.org/bots/api#july-7-2024) for more
Checkout [changelog](https://core.telegram.org/bots/api#july-31-2024) for more
details! 🚀

### 🎉 Support for Custom Contexts!
Expand All @@ -46,7 +47,8 @@ Televerse now lets you build even more powerful bots with custom contexts!
With the new `Bot.contextBuilder` method, you can define specialized context
constructors to create context objects with personalized behaviors and
capabilities. This update allows you to tailor your bot's responses, handle
complex workflows, and integrate additional features seamlessly.
complex workflows, and integrate additional features seamlessly.
[Read more here.](https://televerse.xooniverse.com/doc/custom-context)

<hr>

Expand Down
6 changes: 6 additions & 0 deletions lib/src/telegram/models/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class User implements WithID {
/// Optional. True, if the bot can be connected to a Telegram Business account to receive its messages. Returned only in getMe.
final bool? canConnectToBusiness;

/// Optional. True, if the bot has a main Web App. Returned only in getMe.
final bool? hasMainWebApp;

/// Constructs a [User] object
const User({
required this.id,
Expand All @@ -53,6 +56,7 @@ class User implements WithID {
this.canReadAllGroupMessages,
this.supportsInlineQueries,
this.canConnectToBusiness,
this.hasMainWebApp,
});

/// Creates a [User] object from JSON object
Expand All @@ -70,6 +74,7 @@ class User implements WithID {
canReadAllGroupMessages: json['can_read_all_group_messages'],
supportsInlineQueries: json['supports_inline_queries'],
canConnectToBusiness: json['can_connect_to_business'],
hasMainWebApp: json['has_main_web_app'],
);
}

Expand All @@ -88,6 +93,7 @@ class User implements WithID {
'can_read_all_group_messages': canReadAllGroupMessages,
'supports_inline_queries': supportsInlineQueries,
'can_connect_to_business': canConnectToBusiness,
'has_main_web_app': hasMainWebApp,
}..removeWhere(_nullFilter);
}
}
8 changes: 6 additions & 2 deletions lib/src/televerse/api/raw_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1945,11 +1945,13 @@ class RawAPI {
ID chatId,
int messageId, {
bool? disableNotification,
String? businessConnectionId,
}) async {
final params = {
"chat_id": chatId.id,
"message_id": messageId,
"disable_notification": disableNotification,
"business_connection_id": businessConnectionId,
};
final response = await _makeApiBoolCall(
APIMethod.pinChatMessage,
Expand All @@ -1961,11 +1963,13 @@ class RawAPI {
/// Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.
Future<bool> unpinChatMessage(
ID chatId,
int messageId,
) async {
int messageId, {
String? businessConnectionId,
}) async {
final params = {
"chat_id": chatId.id,
"message_id": messageId,
"business_connection_id": businessConnectionId,
};
final response = await _makeApiBoolCall(
APIMethod.unpinChatMessage,
Expand Down
7 changes: 4 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: televerse
description: Televerse lets you create your own efficient Telegram bots with ease in Dart. Supports latest Telegram Bot API - 7.7!
version: 1.22.5
homepage: https://github.com/xooniverse/televerse
description: Televerse lets you create your own efficient Telegram bots with ease in Dart. Supports latest Telegram Bot API - 7.8!
version: 1.23.0
homepage: https://televerse.xooniverse.com
repository: https://github.com/xooniverse/televerse
topics:
- telegram
- bot
Expand Down

0 comments on commit 3234659

Please sign in to comment.