-
Notifications
You must be signed in to change notification settings - Fork 673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance Update Class to Support Command Extraction from "callback_query" #1135
base: 3.x
Are you sure you want to change the base?
Changes from all commits
2899b43
cdf4d30
49aeec3
b9d3a31
56337f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
namespace Telegram\Bot\Commands; | ||
|
||
use Illuminate\Support\Collection; | ||
use Mockery\Exception; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrong import |
||
use Telegram\Bot\Answers\Answerable; | ||
use Telegram\Bot\Api; | ||
use Telegram\Bot\Objects\MessageEntity; | ||
|
@@ -165,6 +166,7 @@ | |
return []; | ||
} | ||
|
||
|
||
// Generate the regex needed to search for this pattern | ||
[$pattern, $arguments] = $this->makeRegexPattern(); | ||
|
||
|
@@ -206,7 +208,7 @@ | |
$commandOffsets = $this->allCommandOffsets(); | ||
|
||
if ($commandOffsets->isEmpty()) { | ||
return $this->getUpdate()->getMessage()->text ?? ''; | ||
return $this->getUpdate()->getText() ?? ''; | ||
} | ||
|
||
//Extract the current offset for this command and, if it exists, the offset of the NEXT bot_command entity | ||
|
@@ -228,7 +230,7 @@ | |
private function cutTextBetween(Collection $splice): string | ||
{ | ||
return mb_substr( | ||
$this->getUpdate()->getMessage()->text ?? '', | ||
$this->getUpdate()->getText() ?? '', | ||
$splice->first(), | ||
$splice->last() - $splice->first() | ||
); | ||
|
@@ -237,7 +239,7 @@ | |
private function cutTextFrom(Collection $splice): string | ||
{ | ||
return mb_substr( | ||
$this->getUpdate()->getMessage()->text ?? '', | ||
$this->getUpdate()->getText() ?? '', | ||
$splice->first() | ||
); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,11 +136,6 @@ | |
* @method static \Telegram\Bot\Objects\WebhookInfo getWebhookInfo() | ||
* @method static \Telegram\Bot\Objects\Update getWebhookUpdate(bool $shouldDispatchEvents = true, ?\Psr\Http\Message\RequestInterface $request = null) | ||
* @method static bool removeWebhook() | ||
* @method static \Telegram\Bot\Objects\ForumTopic createForumTopic(array $params) | ||
* @method static bool editForumTopic(array $params) | ||
* @method static bool closeForumTopic(array $params) | ||
* @method static bool reopenForumTopic(array $params) | ||
* @method static bool deleteForumTopic(array $params) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are these removed? |
||
* | ||
* @see \Telegram\Bot\Commands\CommandBus | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
namespace Telegram\Bot\Methods; | ||
|
||
use Illuminate\Support\Arr; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this removed? It's in use. |
||
use Telegram\Bot\Actions; | ||
use Telegram\Bot\Exceptions\TelegramSDKException; | ||
use Telegram\Bot\Objects\Message as MessageObject; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this change