Ken 1 هفته پیش
والد
کامیت
53a816658e
1فایلهای تغییر یافته به همراه26 افزوده شده و 30 حذف شده
  1. 26 30
      app/Services/BaseService.php

+ 26 - 30
app/Services/BaseService.php

@@ -216,39 +216,35 @@ class BaseService
             }
         }
 
-        unset($item);
-        $item = $texts[0];
-        $botMsg = [
-            'chat_id' => "@{$bettingGroup}",
-            'text' => $item,
-        ];
-        if (count($keyboard) > 0) {
-            $botMsg['reply_markup'] = json_encode(['inline_keyboard' => $keyboard]);
-        }
-        if (!empty($image)) {
-            unset($botMsg['text']);
-            $botMsg['photo'] = InputFile::create($image);
-            $botMsg['caption'] = $item;
-            $botMsg['protect_content'] = true;
-            $response = self::telegram()->sendPhoto($botMsg);
-        } else {
-
-            $response = self::telegram()->sendMessage($botMsg);
-        }
-        if ($isTop) {
-            self::telegram()->pinChatMessage([
-                'chat_id' => "@{$bettingGroup}",
-                'message_id' => $response->get('message_id')
-            ]);
-        }
-        unset($item);
-
         foreach ($texts as $index => $item) {
-            if ($index == 0) continue;
-            self::telegram()->sendMessage([
+            $botMsg = [
                 'chat_id' => "@{$bettingGroup}",
                 'text' => $item,
-            ]);
+            ];
+            if ($index == 0) {
+                self::telegram()->sendMessage($botMsg);
+            } else {
+                if (count($keyboard) > 0) {
+                    $botMsg['reply_markup'] = json_encode(['inline_keyboard' => $keyboard]);
+                }
+                if (!empty($image)) {
+                    unset($botMsg['text']);
+                    $botMsg['photo'] = InputFile::create($image);
+                    $botMsg['caption'] = $item;
+                    $botMsg['protect_content'] = true;
+                    $response = self::telegram()->sendPhoto($botMsg);
+                } else {
+                    $response = self::telegram()->sendMessage($botMsg);
+                }
+                if ($isTop === true) {
+                    self::telegram()->pinChatMessage([
+                        'chat_id' => "@{$bettingGroup}",
+                        'message_id' => $response->get('message_id')
+                    ]);
+                }
+            }
+
+
         }
     }