ChannelService.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App\Services;
  3. use App\Models\Room;
  4. class ChannelService
  5. {
  6. public static function createRoomNotice($roomId): ?array
  7. {
  8. $chatId = app(TelegramChannelService::class)->roomNoticeTarget();
  9. if ($chatId === null) {
  10. return null;
  11. }
  12. $username = config('services.telegram.username');
  13. $room = Room::where('room_id', $roomId)->first();
  14. $text = "新房间通知\n";
  15. $text .= "‼️如果还未关注,请先关注 @{$username} 后再加入房间\n";
  16. $text .= "\n";
  17. $text .= "游戏:{$room->game_name} {$room->rounds}局\n";
  18. $text .= "底分:{$room->base_score} USDT\n";
  19. $text .= "人数:{$room->participants}人\n";
  20. // $text .= "游戏介绍:{$room->introduction}\n";
  21. $text .= "-------------------\n";
  22. $text .= "‼️1.开始游戏前,非房主请点击准备,房主等待大家准备后,点击开始游戏。\n";
  23. $text .= "‼️2.游戏结束后,请务必上传双方和第三方的战绩截图。如出现争议,平台将以三方截图为依据进行审核,以确保比赛的公平与公正\n";
  24. $keyboard = [[
  25. ['text' => "加入房间", 'callback_data' => "channelJoin@@{$roomId}"]
  26. ]];
  27. return [
  28. 'chat_id' => $chatId,
  29. 'text' => $text,
  30. 'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
  31. ];
  32. }
  33. }