Skip to content

Commit 9e9f7ed

Browse files
committed
- Use the new Telegram API webhook IP ranges.
1 parent 6233321 commit 9e9f7ed

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
66
## [Unreleased]
77
### Added
88
### Changed
9+
- Use the new Telegram API webhook IP ranges.
910
### Deprecated
1011
### Removed
1112
### Fixed

src/BotManager.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
class BotManager
2222
{
2323
/**
24-
* @var string Telegram post servers IP range
24+
* @var array Telegram webhook servers IP ranges
25+
* @link https://core.telegram.org/bots/webhooks#the-short-version
2526
*/
26-
const TELEGRAM_IP_RANGE = '149.154.167.197-149.154.167.233';
27+
public const TELEGRAM_IP_RANGES = ['149.154.160.0/20', '91.108.4.0/22'];
2728

2829
/**
2930
* @var string The output for testing, instead of echoing
@@ -578,7 +579,7 @@ public function isValidRequest(): bool
578579
}
579580

580581
return Ip::match($ip, array_merge(
581-
[self::TELEGRAM_IP_RANGE],
582+
self::TELEGRAM_IP_RANGES,
582583
(array) $this->params->getBotParam('valid_ips', [])
583584
));
584585
}

0 commit comments

Comments
 (0)