/1, /2,... shorthand for /photo/1, /photo/2, ...
This commit is contained in:
@@ -30,16 +30,22 @@ class GenericmessageCommand extends SystemCommand
|
||||
return Request::emptyResponse();
|
||||
}
|
||||
|
||||
preg_match('/https?:\/\/(?:mobile\.)?twitter\.com\/(\w+)\/status\/(\d+)(\/photo\/\d)?/', $text, $matches);
|
||||
preg_match('/https?:\/\/(?:mobile\.)?twitter\.com\/(\w+)\/status\/(\d+)(\S*)/', $text, $matches);
|
||||
if (count($matches) < 3) {
|
||||
return Request::emptyResponse();
|
||||
}
|
||||
$author = $matches[1];
|
||||
$tweetId = $matches[2];
|
||||
$tail = $matches[3] ?? '';
|
||||
$photoNo = '';
|
||||
if (!empty($matches[3])) {
|
||||
preg_match('/(\/\d)$/', $matches[3], $photoNoMatches);
|
||||
if (isset($photoNoMatches[1])) {
|
||||
$photoNo = '/photo' . $photoNoMatches[1];
|
||||
}
|
||||
}
|
||||
|
||||
return $this->replyToChat(
|
||||
"https://fxtwitter.com/$author/status/$tweetId$tail",
|
||||
"https://fxtwitter.com/$author/status/$tweetId$photoNo",
|
||||
[
|
||||
'reply_to_message_id' => $message->getMessageId(),
|
||||
'disable_notification' => true,
|
||||
|
||||
Reference in New Issue
Block a user