|
|
@@ -214,35 +214,41 @@ class BaseService
|
|
|
$texts[] = $item;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ $item = $texts[0];
|
|
|
+ $botMsg = [
|
|
|
+ 'chat_id' => "@{$bettingGroup}",
|
|
|
+ 'protect_content' => true,
|
|
|
+ ];
|
|
|
+ if (count($keyboard) > 0) {
|
|
|
+ $botMsg['reply_markup'] = json_encode(['inline_keyboard' => $keyboard]);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (!empty($image)) {
|
|
|
+ $botMsg['photo'] = InputFile::create($image);
|
|
|
+ $botMsg['caption'] = $item;
|
|
|
+ $response = self::telegram()->sendPhoto($botMsg);
|
|
|
+ } else {
|
|
|
+ $botMsg['text'] = $item;
|
|
|
+ $response = self::telegram()->sendMessage($botMsg);
|
|
|
+ }
|
|
|
+ if ($isTop === true) {
|
|
|
+ self::telegram()->pinChatMessage([
|
|
|
+ 'chat_id' => "@{$bettingGroup}",
|
|
|
+ 'message_id' => $response->get('message_id')
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ unset($item);
|
|
|
+
|
|
|
foreach ($texts as $index => $item) {
|
|
|
+ if ($index == 0) continue;
|
|
|
$botMsg = [
|
|
|
'chat_id' => "@{$bettingGroup}",
|
|
|
'text' => $item,
|
|
|
- 'index' => $index
|
|
|
];
|
|
|
-
|
|
|
- if ($index == 0 && count($keyboard) > 0) {
|
|
|
- $botMsg['reply_markup'] = json_encode(['inline_keyboard' => $keyboard]);
|
|
|
- }
|
|
|
- if ($index == 0 && !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 ($index == 0 && $isTop === true) {
|
|
|
- // 获取消息ID
|
|
|
- $messageId = $response->get('message_id');
|
|
|
- // 置顶消息
|
|
|
- self::telegram()->pinChatMessage([
|
|
|
- 'chat_id' => "@{$bettingGroup}",
|
|
|
- 'message_id' => $messageId
|
|
|
- ]);
|
|
|
- }
|
|
|
+ self::telegram()->sendMessage($botMsg);
|
|
|
}
|
|
|
}
|
|
|
|