Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 784c209

Browse files
Merge pull request #1457 from AkramiPro/develop
Fix PHP Error - Call to a member function getChat() on null
2 parents 8a985c8 + d386abf commit 784c209

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

‎src/Commands/AdminCommands/ChatsCommand.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class ChatsCommand extends AdminCommand
5353
*/
5454
public function execute(): ServerResponse
5555
{
56-
$message = $this->getMessage();
56+
$message = $this->getMessage() ?: $this->getEditedMessage() ?: $this->getChannelPost() ?: $this->getEditedChannelPost();
5757

5858
$chat_id = $message->getChat()->getId();
5959
$text = trim($message->getText(true));

‎src/Commands/AdminCommands/CleanupCommand.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ public function executeNoDb(): ServerResponse
365365
*/
366366
public function execute(): ServerResponse
367367
{
368-
$message = $this->getMessage();
368+
$message = $this->getMessage() ?: $this->getEditedMessage() ?: $this->getChannelPost() ?: $this->getEditedChannelPost();
369369
$text = $message->getText(true);
370370

371371
// Dry run?

‎src/Commands/AdminCommands/DebugCommand.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class DebugCommand extends AdminCommand
5252
public function execute(): ServerResponse
5353
{
5454
$pdo = DB::getPdo();
55-
$message = $this->getMessage();
55+
$message = $this->getMessage() ?: $this->getEditedMessage() ?: $this->getChannelPost() ?: $this->getEditedChannelPost();
5656
$chat = $message->getChat();
5757
$text = strtolower($message->getText(true));
5858

‎src/Commands/AdminCommands/SendtochannelCommand.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class SendtochannelCommand extends AdminCommand
6363
*/
6464
public function execute(): ServerResponse
6565
{
66-
$message = $this->getMessage();
66+
$message = $this->getMessage() ?: $this->getEditedMessage() ?: $this->getChannelPost() ?: $this->getEditedChannelPost();
6767
$chat_id = $message->getChat()->getId();
6868
$user_id = $message->getFrom()->getId();
6969

@@ -359,7 +359,7 @@ protected function publish(Message $message, $channel_id, $caption = null): stri
359359
*/
360360
public function executeNoDb(): ServerResponse
361361
{
362-
$message = $this->getMessage();
362+
$message = $this->getMessage() ?: $this->getEditedMessage() ?: $this->getChannelPost() ?: $this->getEditedChannelPost();
363363
$text = trim($message->getText(true));
364364

365365
if ($text === '') {

‎src/Commands/AdminCommands/WhoisCommand.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class WhoisCommand extends AdminCommand
6060
*/
6161
public function execute(): ServerResponse
6262
{
63-
$message = $this->getMessage();
63+
$message = $this->getMessage() ?: $this->getEditedMessage() ?: $this->getChannelPost() ?: $this->getEditedChannelPost();
6464

6565
$chat_id = $message->getChat()->getId();
6666
$command = $message->getCommand();

‎src/Commands/Command.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function preExecute(): ServerResponse
184184
}
185185

186186
if ($this->isPrivateOnly() && $this->removeNonPrivateMessage()) {
187-
$message = $this->getMessage();
187+
$message = $this->getMessage() ?: $this->getEditedMessage() ?: $this->getChannelPost() ?: $this->getEditedChannelPost();
188188

189189
if ($user = $message->getFrom()) {
190190
return Request::sendMessage([

‎src/Commands/SystemCommand.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function execute(): ServerResponse
5353
*/
5454
protected function executeActiveConversation(): ?ServerResponse
5555
{
56-
$message = $this->getMessage();
56+
$message = $this->getMessage() ?: $this->getEditedMessage() ?: $this->getChannelPost() ?: $this->getEditedChannelPost();
5757
if ($message === null) {
5858
return null;
5959
}
@@ -84,7 +84,7 @@ protected function executeActiveConversation(): ?ServerResponse
8484
*/
8585
protected function executeDeprecatedSystemCommand(): ?ServerResponse
8686
{
87-
$message = $this->getMessage();
87+
$message = $this->getMessage() ?: $this->getEditedMessage() ?: $this->getChannelPost() ?: $this->getEditedChannelPost();
8888
if ($message === null) {
8989
return null;
9090
}

‎src/Commands/UserCommands/StartCommand.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class StartCommand extends UserCommand
4747
*/
4848
public function execute(): ServerResponse
4949
{
50-
//$message = $this->getMessage();
50+
//$message = $this->getMessage() ?: $this->getEditedMessage() ?: $this->getChannelPost() ?: $this->getEditedChannelPost();
5151
//$chat_id = $message->getChat()->getId();
5252
//$user_id = $message->getFrom()->getId();
5353

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /