diff --git a/bridges/TelegramBridge.php b/bridges/TelegramBridge.php index a7296b8a..152e2da0 100644 --- a/bridges/TelegramBridge.php +++ b/bridges/TelegramBridge.php @@ -21,6 +21,18 @@ class TelegramBridge extends BridgeAbstract { private $itemTitle = ''; private $backgroundImageRegex = "/background-image:url\('(.*)'\)/"; + private $detectParamsRegex = '/^https?:\/\/t.me\/(?:s\/)?([\w]+)$/'; + + public function detectParameters($url) { + $params = array(); + + if(preg_match($this->detectParamsRegex, $url, $matches) > 0) { + $params['username'] = $matches[1]; + return $params; + } + + return null; + } public function collectData() {