Skip to content

Commit

Permalink
🐞 Merge #298: Televerse v1.26.3
Browse files Browse the repository at this point in the history
  • Loading branch information
HeySreelal authored Oct 2, 2024
2 parents 7dba365 + 6daebe3 commit db6753a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.26.3

- 🐞 Fix: Webhook Bots crashed when an invalid body was present in the request.

# 1.26.2

- Added way too many internal changes.
Expand Down
15 changes: 12 additions & 3 deletions lib/src/televerse/fetch/webhook.dart
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,18 @@ class Webhook extends Fetcher {
utf8.decoder,
)
.join();
final update = Update.fromJson(jsonDecode(body));
addUpdate(update);
_sendResponse(request, 200, {'ok': true, 'result': update.toRawJson()});
try {
final update = Update.fromJson(jsonDecode(body));
addUpdate(update);
_sendResponse(request, 200, {'ok': true, 'result': update.toRawJson()});
} catch (err) {
final response = {
'ok': false,
'error_code': 400,
'description': "Bad Request: Invalid Body present in the request.",
};
_sendResponse(request, 400, response);
}
}

/// Sends a response to the client.
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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.2
version: 1.26.3
homepage: https://televerse.xooniverse.com
repository: https://github.com/xooniverse/televerse
topics:
Expand Down

0 comments on commit db6753a

Please sign in to comment.