From 725e47d21c00fd11c9e9a465269e29259e0c3af6 Mon Sep 17 00:00:00 2001 From: Mahdi Date: Wed, 26 Jul 2023 13:37:57 +0330 Subject: [PATCH] Fix some bugs - Run composer cx-fix --- src/EventHandler/Message.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/EventHandler/Message.php b/src/EventHandler/Message.php index c7b685737..50cd010de 100644 --- a/src/EventHandler/Message.php +++ b/src/EventHandler/Message.php @@ -199,7 +199,7 @@ abstract class Message extends AbstractMessage )['reactions'], fn (array $r): bool => $r['my'] ); - $this->reactions = \array_map(fn (array $r) => $r['reaction']['emoticon'] ?? $r['reaction']['document_id'], $myReactions); + $this->reactions += \array_map(fn (array $r) => $r['reaction']['emoticon'] ?? $r['reaction']['document_id'], $myReactions); return $this->reactions; } @@ -218,8 +218,8 @@ abstract class Message extends AbstractMessage 'peer' => $this->chatId, 'msg_id' => $this->id, 'reaction' => match (\is_int($reaction)) { - true => ['_' => 'reactionCustomEmoji', 'document_id' => $reaction], - default => ['_' => 'reactionEmoji', 'emoticon' => $reaction] + true => [['_' => 'reactionCustomEmoji', 'document_id' => $reaction]], + default => [['_' => 'reactionEmoji', 'emoticon' => $reaction]] }, 'big' => $big, 'add_to_recent' => $addToRecent @@ -237,8 +237,8 @@ abstract class Message extends AbstractMessage public function delReaction(int|string $reaction): ?Update { $this->getReactions(); - if ($index = \array_search($reaction, $this->reactions)) { - unset($this->reactions[$index]); + if (($key = \array_search($reaction, $this->reactions)) !== false) { + unset($this->reactions[$key]); $r = \array_map(fn ($reactions) => \is_int($reactions) ? ['_' => 'reactionCustomEmoji', 'document_id' => $reactions] : ['_' => 'reactionEmoji', 'emoticon' => $reactions], $this->reactions); $r[]= ['_' => 'reactionEmpty']; $result = $this->getClient()->methodCallAsyncRead(