Skip to content

Commit

Permalink
[TelegramBridge] Add detectParameters() (#1998)
Browse files Browse the repository at this point in the history
  • Loading branch information
VerifiedJoseph authored Feb 28, 2021
1 parent a5f2175 commit c294a65
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bridges/TelegramBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Expand Down

0 comments on commit c294a65

Please sign in to comment.