QianBaoWithdrawService.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. <?php
  2. namespace App\Services;
  3. use App\Constants\StepStatus;
  4. use App\Models\Bank;
  5. use App\Models\Config;
  6. use App\Models\PaymentOrder;
  7. use App\Models\Wallet;
  8. use Illuminate\Support\Facades\Cache;
  9. use Telegram\Bot\Api;
  10. use Telegram\Bot\Exceptions\TelegramSDKException;
  11. class QianBaoWithdrawService
  12. {
  13. /**
  14. * @param Api $telegram
  15. * @param $data
  16. * @param $chatId
  17. * @param $firstName
  18. * @param $messageId
  19. * @throws TelegramSDKException
  20. */
  21. public static function init(Api $telegram, $data, $chatId, $firstName, $messageId): void
  22. {
  23. //点击钱宝提现按钮
  24. if ($data === "withdraw@@qb_show_channel") {
  25. $res = QianBaoWithdrawService::chooseType($chatId, $messageId);
  26. $telegram->editMessageText($res);
  27. }
  28. $pattern = "/^withdraw@@qb_choose_.*$/";
  29. if (preg_match($pattern, $data)) {
  30. $type = preg_replace('/^withdraw@@qb_choose_/', '', $data);
  31. $res = QianBaoWithdrawService::showBanks($chatId, $messageId, $type);
  32. $telegram->editMessageText($res);
  33. }
  34. //选择银行卡号
  35. $pattern = "/^withdrawAddress@@choose_qb_\d+$/";
  36. if (preg_match($pattern, $data)) {
  37. $id = preg_replace('/^withdrawAddress@@choose_qb_/', '', $data);
  38. $res = QianBaoWithdrawService::chooseBank($chatId, $id);
  39. $telegram->deleteMessage([
  40. 'chat_id' => $chatId,
  41. 'message_id' => $messageId,
  42. ]);
  43. $telegram->sendMessage($res);
  44. }
  45. //确认提现信息
  46. if ($data === "withdraw@@qb_confirm") {
  47. $res = QianBaoWithdrawService::confirm($chatId, $messageId);
  48. $telegram->editMessageText($res);
  49. }
  50. if ($data === "withdraw@@qb_apply") {
  51. $res = QianBaoWithdrawService::qbApply($chatId, $messageId);
  52. $telegram->editMessageText($res);
  53. }
  54. //钱宝账单
  55. $pattern = "/^withdraw@@bank_bill_\d+$/";
  56. if (preg_match($pattern, $data)) {
  57. $page = preg_replace('/^withdraw@@bank_bill_/', '', $data);
  58. if (empty($page) || $page < 1) $page = 1;
  59. $page = intval($page);
  60. $res = QianBaoWithdrawService::bill($chatId, $firstName, $messageId, $page);
  61. $telegram->editMessageText($res);
  62. }
  63. //银行卡管理
  64. $pattern = "/^withdraw@@management_.*$/";
  65. if (preg_match($pattern, $data)) {
  66. $channel = preg_replace('/^withdraw@@management_/', '', $data);
  67. $res = QianBaoWithdrawService::banks($chatId, $messageId, $channel);
  68. $telegram->editMessageText($res);
  69. }
  70. //添加银行卡
  71. // $pattern = "/^withdraw@@bank_add.*$/";
  72. // if (preg_match($pattern, $data)) {
  73. // $channel = preg_replace('/^withdraw@@bank_add/', '', $data);
  74. // $res = QianBaoWithdrawService::chooseChannel($chatId, $messageId,$channel);
  75. // $telegram->editMessageText($res);
  76. // }
  77. //银行卡详情
  78. $pattern = "/^withdrawAddress@@bank_detail\d+$/";
  79. if (preg_match($pattern, $data)) {
  80. $id = preg_replace('/^withdrawAddress@@bank_detail/', '', $data);
  81. $res = static::bankDetails($chatId, $messageId, $id);
  82. $telegram->editMessageText($res);
  83. }
  84. $pattern = "/^withdraw@@bank_del_\d+$/";
  85. if (preg_match($pattern, $data)) {
  86. $id = preg_replace('/^withdraw@@bank_del_/', '', $data);
  87. $res = static::bankDelete($chatId, $messageId, $id);
  88. $telegram->editMessageText($res);
  89. }
  90. $pattern = "/^withdrawAddress@@bank_choose_channel_.*$/";
  91. if (preg_match($pattern, $data)) {
  92. $channel = preg_replace('/^withdrawAddress@@bank_choose_channel_/', '', $data);
  93. $res = static::chooseChannel($chatId, $messageId, $channel);
  94. $telegram->editMessageText($res);
  95. }
  96. }
  97. public static function onMessage($chatId, $text, $messageId, $stepStatus): null|array
  98. {
  99. return match ($stepStatus) {
  100. StepStatus::QB_INPUT_ALIAS => QianBaoWithdrawService::inputAliAs($chatId, $text, $messageId),
  101. StepStatus::INPUT_WITHDRAW_QB_MONEY => QianBaoWithdrawService::inputQbAmount($chatId, $text, $messageId),
  102. StepStatus::QB_INPUT_BANK_NAME => QianBaoWithdrawService::inputBankName($chatId, $text, $messageId),
  103. StepStatus::QB_INPUT_CARD_NO => QianBaoWithdrawService::inputCardNo($chatId, $text, $messageId),
  104. StepStatus::QB_INPUT_ACCOUNT => QianBaoWithdrawService::inputAccount($chatId, $text, $messageId),
  105. default => null,
  106. };
  107. }
  108. private static function chooseType($chatId, $messageId)
  109. {
  110. $keyboard = [
  111. [
  112. ['text' => lang("USDT"), 'callback_data' => "withdraw@@apply"],
  113. ],
  114. [
  115. ['text' => lang("银行卡"), 'callback_data' => "withdraw@@qb_choose_bank"],
  116. ],
  117. [
  118. ['text' => lang("支付宝"), 'callback_data' => "withdraw@@qb_choose_aliPay"],
  119. ],
  120. [
  121. ['text' => lang("数字人民币"), 'callback_data' => "withdraw@@qb_choose_digital_RMB"],
  122. ],
  123. [
  124. ['text' => lang("返回"), 'callback_data' => "topUp@@home"],
  125. ],
  126. ];
  127. // $keyboard[] = [
  128. // ['text' => "提现账户管理", 'callback_data' => "withdraw@@banks"],
  129. // ];
  130. return [
  131. 'chat_id' => $chatId,
  132. 'text' => lang("请选择提现方式"),
  133. 'message_id' => $messageId,
  134. 'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
  135. ];
  136. }
  137. private static function showBanks($chatId, $messageId, $type)
  138. {
  139. $channel = '';
  140. $card = "";
  141. $text = "";
  142. switch ($type) {
  143. case "bank":
  144. $card = lang("银行卡");
  145. $text = lang("请选择提现的银行卡");
  146. $channel = 'DF001';
  147. break;
  148. case "aliPay":
  149. $card = lang("支付宝");
  150. $text = lang("请选择提现的支付宝");
  151. $channel = "DF002";
  152. break;
  153. case "digital_RMB":
  154. $card = lang("数字人民币");
  155. $text = lang("请选择提现的账户");
  156. $channel = "DF005";
  157. break;
  158. }
  159. $list = Bank::where('member_id',$chatId)->where('channel', $channel)->get();
  160. $keyboard = [];
  161. foreach ($list as $item) {
  162. $keyboard[] = [['text' => $item->getAlias(), 'callback_data' => "withdrawAddress@@choose_qb_{$item->getId()}"]];
  163. }
  164. $keyboard[] = [
  165. ['text' => "{$card}" . lang("管理"), 'callback_data' => "withdraw@@management_{$channel}"],
  166. ['text' => lang("返回"), 'callback_data' => "withdraw@@qb_show_channel"]];
  167. return [
  168. 'chat_id' => $chatId,
  169. 'text' => $text,
  170. 'message_id' => $messageId,
  171. 'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
  172. ];
  173. }
  174. //钱宝账单
  175. private static function bill($chatId, $firstName, $messageId, $page = 1, $limit = 5)
  176. {
  177. $list = PaymentOrder::where('member_id', $chatId)
  178. ->where('type', 2)
  179. ->orderByDesc('created_at')
  180. ->forPage($page, $limit)
  181. ->get();
  182. $count = PaymentOrder::where('member_id', $chatId)
  183. ->where('type', 2)
  184. ->count();
  185. $text = "👤 {$firstName}({$chatId}) " . lang('钱宝提现记录') . "\n\n";
  186. foreach ($list as $item) {
  187. $amount = floatval($item->amount);
  188. $amount = $item->type == 2 ? "➖ {$amount}" : "➕ $amount";
  189. $text .= "-------------------------------------\n";
  190. $text .= "{$amount} \n";
  191. $text .= lang("订单号") . ":{$item->order_no}\n";
  192. $text .= lang('银行') . ":{$item->bank_name}\n";
  193. $text .= lang("姓名") . ":{$item->account}\n";
  194. $text .= lang("卡号") . ":{$item->card_no}\n";
  195. $status = [lang('待处理'), lang('处理中'), lang('成功'), lang('失败')];
  196. $text .= lang("状态") . ":{$status[$item->status]}\n";
  197. if ($item->remark) {
  198. $text .= lang("说明") . ":{$item->remark}\n";
  199. }
  200. $text .= lang('日期') . ":{$item->created_at}\n";
  201. }
  202. if ($page > 1) {
  203. $keyboard[] = [
  204. ['text' => lang("👆上一页"), 'callback_data' => "withdraw@@bank_bill_" . ($page - 1)]
  205. ];
  206. }
  207. $allPage = ceil($count / $limit);
  208. if ($allPage > $page) {
  209. if ($page > 1) {
  210. $keyboard[count($keyboard) - 1][] = ['text' => lang("👇下一页"), 'callback_data' => "withdraw@@bank_bill_" . ($page + 1)];
  211. } else {
  212. $keyboard[] = [
  213. ['text' => lang("👇下一页"), 'callback_data' => "withdraw@@bank_bill_" . ($page + 1)]
  214. ];
  215. }
  216. }
  217. $keyboard[] = [
  218. ['text' => lang("返回"), 'callback_data' => "topUp@@home"]
  219. ];
  220. return [
  221. 'chat_id' => $chatId,
  222. 'text' => $text,
  223. 'message_id' => $messageId,
  224. 'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
  225. ];
  226. }
  227. //1.钱宝提现
  228. private static function qbApply($chatId, $messageId)
  229. {
  230. $three_payment_switch = Config::where('field', 'three_payment_switch')->first()->val;
  231. if ($three_payment_switch != 1) {
  232. $res = WalletService::getBalance($chatId);
  233. $res['message_id'] = $messageId;
  234. return $res;
  235. }
  236. $wallet = Wallet::where('member_id', $chatId)->first();
  237. $temp = floatval($wallet->available_balance);
  238. $text = lang("请发送提现金额") . "\n";
  239. $text .= "💰 " . lang("当前余额") . "{$temp} RMB\n";
  240. // Cache::put(get_step_key($chatId), StepStatus::INPUT_WITHDRAW_QB_MONEY);
  241. return [
  242. 'chat_id' => $chatId,
  243. 'text' => $text,
  244. 'message_id' => $messageId,
  245. ];
  246. }
  247. //2.选择银行卡号
  248. private static function chooseBank($chatId, $id)
  249. {
  250. Cache::put(get_step_key($chatId), StepStatus::INPUT_WITHDRAW_QB_MONEY);
  251. Cache::put("{$chatId}_QB_BANK_ID", $id);
  252. return [
  253. 'chat_id' => $chatId,
  254. 'text' => lang("请输入提现的金额"),
  255. ];
  256. }
  257. //3.输入钱宝提现金额
  258. private static function inputQbAmount($chatId, $amount, $messageId)
  259. {
  260. if (!preg_match('/^\d+(\.\d{1,2})?$/', $amount)) {
  261. return [
  262. 'chat_id' => $chatId,
  263. 'text' => lang('金额输入不正确,请发送提现数字'),
  264. 'reply_to_message_id' => $messageId
  265. ];
  266. }
  267. $amount = floatval($amount);
  268. $wallet = Wallet::where('member_id', $chatId)->first();
  269. $temp = floatval($wallet->available_balance);
  270. if ($amount > $temp) {
  271. return [
  272. 'chat_id' => $chatId,
  273. 'text' => lang("可用余额不足,请重试"),
  274. 'reply_to_message_id' => $messageId
  275. ];
  276. }
  277. if ($amount < 100) {
  278. return [
  279. 'chat_id' => $chatId,
  280. 'text' => lang("提现不能少于100 RMB,请重试"),
  281. 'reply_to_message_id' => $messageId
  282. ];
  283. }
  284. if ($amount > 49999) {
  285. return [
  286. 'chat_id' => $chatId,
  287. 'text' => lang("最多提现 49999 RMB,请重试"),
  288. 'reply_to_message_id' => $messageId
  289. ];
  290. }
  291. $bankId = Cache::get("{$chatId}_QB_BANK_ID");
  292. $bank = Bank::where('id', $bankId)->first();
  293. $text = "";
  294. switch ($bank->getChannel()) {
  295. case "DF001":
  296. $text = lang('银行卡提现确认') . "\n";
  297. $text .= lang('开户行') . ":{$bank->getBankName()}\n";
  298. $text .= lang('姓名') . ":{$bank->getAccount()}\n";
  299. $text .= lang('提现账号') . ":{$bank->getCardNo()}\n";
  300. $text .= lang('提现金额') . ":{$amount}\n";
  301. break;
  302. case "DF002":
  303. $text = lang("支付宝提现确认") . "\n";
  304. $text .= lang('姓名') . ":{$bank->getAccount()}\n";
  305. $text .= lang('提现账号') . ":{$bank->getCardNo()}\n";
  306. $text .= lang('提现金额') . ":{$amount}\n";
  307. break;
  308. case "DF005":
  309. $text = lang('数字人民币提现确认') . "\n";
  310. $text .= lang('姓名') . ":{$bank->getAccount()}\n";
  311. $text .= lang('提现账号') . ":{$bank->getCardNo()}\n";
  312. $text .= lang('提现金额') . ":{$amount}\n";
  313. break;
  314. }
  315. $keyboard = [
  316. [
  317. ['text' => lang("确认"), 'callback_data' => 'withdraw@@qb_confirm']
  318. ],
  319. [
  320. ['text' => '❌取消', 'callback_data' => "message@@close"]
  321. ]];
  322. Cache::put("{$chatId}_WITHDRAW_QB_MONEY", $amount);
  323. return [
  324. 'chat_id' => $chatId,
  325. 'text' => $text,
  326. // 'reply_to_message_id' => $messageId,
  327. 'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
  328. ];
  329. }
  330. private static function confirm($chatId, $messageId)
  331. {
  332. $id = Cache::get("{$chatId}_QB_BANK_ID");
  333. $bank = Bank::where('id', $id)->first();
  334. $amount = Cache::get("{$chatId}_WITHDRAW_QB_MONEY");
  335. $res = PaymentOrderService::createPayout($chatId, $amount, $bank->getChannel(), $bank->getBankName(), $bank->getAccount(), $bank->getCardNo());
  336. $res['message_id'] = $messageId;
  337. return $res;
  338. }
  339. //银行卡管理
  340. private static function banks($chatId, $messageId, $channel = ""): array
  341. {
  342. $text = '';
  343. switch ($channel) {
  344. case "DF001":
  345. $text = lang("银行卡列表") . "\n";
  346. break;
  347. case "DF002":
  348. $text = lang('支付宝账户列表') . "\n";
  349. break;
  350. case "DF005":
  351. $text = lang('数字人民币账户列表') . "\n";
  352. break;
  353. }
  354. $list = Bank::where('member_id', $chatId)
  355. ->where("channel", $channel)
  356. ->get();
  357. $keyboard = [];
  358. foreach ($list as $item) {
  359. $keyboard[] = [['text' => $item->getAlias(), 'callback_data' => "withdrawAddress@@bank_detail{$item->getId()}"]];
  360. }
  361. if (count($list) < 5) {
  362. $keyboard[] = [
  363. ['text' => lang("➕ 添加"), 'callback_data' => "withdrawAddress@@bank_choose_channel_{$channel}"],
  364. ['text' => lang("↩️返回"), 'callback_data' => "topUp@@home"]
  365. ];
  366. } else {
  367. $keyboard[] = [['text' => lang("↩️返回"), 'callback_data' => "topUp@@home"]];
  368. }
  369. return [
  370. 'chat_id' => $chatId,
  371. 'text' => $text,
  372. 'message_id' => $messageId,
  373. 'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
  374. ];
  375. }
  376. //银行卡详情
  377. private static function bankDetails($chatId, $messageId, $id)
  378. {
  379. $bank = Bank::where('id', $id)
  380. ->where('member_id', $chatId)->first();
  381. switch ($bank->getChannel()) {
  382. case "DF001":
  383. $text = "*" . lang('银行卡管理') . "*\n\n";
  384. $text .= lang('姓名') . ":{$bank->getAccount()}\n";
  385. $text .= lang('银行') . ":{$bank->getAccount()}\n";
  386. $text .= lang('卡号') . ":{$bank->getCardNo()}\n";
  387. break;
  388. case "DF002":
  389. $text = "*" . lang('支付宝管理') . "*\n\n";
  390. $text .= lang('姓名') . ":{$bank->getAccount()}\n";
  391. $text .= lang('银行') . ":{$bank->getBankName()}\n";
  392. $text .= lang('账号') . ":{$bank->getCardNo()}\n";
  393. break;
  394. default:
  395. $text = "*" . lang('银行卡管理') . "*\n\n";
  396. $text .= lang('姓名') . ":{$bank->getAccount()}\n";
  397. $text .= lang('银行') . ":{$bank->getBankName()}\n";
  398. $text .= lang('卡号') . ":{$bank->getCardNo()}\n";
  399. break;
  400. }
  401. $keyboard = [
  402. [
  403. ['text' => lang('❌删除'), 'callback_data' => "withdraw@@bank_del_{$id}"],
  404. ['text' => lang('↩️返回列表'), 'callback_data' => "withdraw@@management_{$bank->getChannel()}"]
  405. ],
  406. ];
  407. return [
  408. 'chat_id' => $chatId,
  409. 'parse_mode' => 'MarkdownV2',
  410. 'text' => $text,
  411. 'reply_markup' => json_encode(['inline_keyboard' => $keyboard]),
  412. 'message_id' => $messageId
  413. ];
  414. }
  415. //删除银行卡
  416. private static function bankDelete($chatId, $messageId, $id): array
  417. {
  418. $channel = Bank::where('id', $id)
  419. ->where('member_id', $chatId)->first()->getChannel();
  420. Bank::where('id', $id)->where('member_id', $chatId)->delete();
  421. return static::banks($chatId, $messageId, $channel);
  422. }
  423. //选择通道
  424. private static function chooseChannel($chatId, $messageId, $channel)
  425. {
  426. Cache::put("{$chatId}_QB_WITHDRAW_CHANNEL", $channel);
  427. switch ($channel) {
  428. case "DF001"://银行卡
  429. Cache::put(get_step_key($chatId), StepStatus::QB_INPUT_BANK_NAME);
  430. return [
  431. 'chat_id' => $chatId,
  432. 'text' => lang("请输入开户银行卡开户名称"),
  433. 'message_id' => $messageId,
  434. ];
  435. case "DF002"://支付宝
  436. Cache::put("{$chatId}_QB_WITHDRAW_BANK_NAME", '支付宝');
  437. Cache::put(get_step_key($chatId), StepStatus::QB_INPUT_CARD_NO);
  438. return [
  439. 'chat_id' => $chatId,
  440. 'text' => lang("请输入支付宝账号"),
  441. 'message_id' => $messageId,
  442. ];
  443. case "DF005"://数字人民币
  444. Cache::put("{$chatId}_QB_WITHDRAW_BANK_NAME", '数字人民币');
  445. Cache::put(get_step_key($chatId), StepStatus::QB_INPUT_CARD_NO);
  446. return [
  447. 'chat_id' => $chatId,
  448. 'text' => lang("请输入数字人民币账号"),
  449. 'message_id' => $messageId,
  450. ];
  451. default:
  452. return [
  453. 'chat_id' => $chatId,
  454. 'text' => lang("选择通道错误"),
  455. 'message_id' => $messageId,
  456. ];
  457. }
  458. }
  459. //输入银行名称
  460. private static function inputBankName($chatId, $bankName, $messageId): array
  461. {
  462. Cache::put("{$chatId}_QB_WITHDRAW_BANK_NAME", $bankName);
  463. Cache::put(get_step_key($chatId), StepStatus::QB_INPUT_CARD_NO);
  464. return [
  465. 'chat_id' => $chatId,
  466. 'text' => lang("请输入银行卡号"),
  467. 'message_id' => $messageId,
  468. ];
  469. }
  470. //输入卡号
  471. private static function inputCardNo($chatId, $cardNo, $messageId): array
  472. {
  473. $channel = Cache::get("{$chatId}_QB_WITHDRAW_CHANNEL");
  474. if ($channel === 'DF001' && !preg_match('/^\d+$/', $cardNo)) {
  475. return [
  476. 'chat_id' => $chatId,
  477. 'text' => lang("输入的银行卡号有误,请重新输入"),
  478. 'reply_to_message_id' => $messageId,
  479. ];
  480. }
  481. Cache::put("{$chatId}_QB_WITHDRAW_CARD_NO", $cardNo);
  482. Cache::put(get_step_key($chatId), StepStatus::QB_INPUT_ACCOUNT);
  483. return [
  484. 'chat_id' => $chatId,
  485. 'text' =>lang("请输入姓名"),
  486. 'message_id' => $messageId,
  487. ];
  488. }
  489. //输入姓名
  490. private static function inputAccount($chatId, $account, $messageId): array
  491. {
  492. Cache::put("{$chatId}_QB_ACCOUNT", $account);
  493. Cache::put(get_step_key($chatId), StepStatus::QB_INPUT_ALIAS);
  494. $channel = Cache::get("{$chatId}_QB_WITHDRAW_CHANNEL");
  495. $text = lang("请输入别名");
  496. switch ($channel) {
  497. case "DF005":
  498. case "DF001":
  499. $text = lang('请输入账号别名');
  500. break;
  501. }
  502. return [
  503. 'chat_id' => $chatId,
  504. 'text' => $text,
  505. 'message_id' => $messageId,
  506. ];
  507. }
  508. //输入别名,并保存到数据库
  509. private static function inputAliAs($chatId, $alias, $messageId): array
  510. {
  511. $channel = Cache::get("{$chatId}_QB_WITHDRAW_CHANNEL");
  512. $cardNo = Cache::get("{$chatId}_QB_WITHDRAW_CARD_NO");
  513. $bankName = Cache::get("{$chatId}_QB_WITHDRAW_BANK_NAME");
  514. $account = Cache::get("{$chatId}_QB_ACCOUNT");
  515. Bank::create([
  516. 'member_id' => $chatId,
  517. 'account' => $account,
  518. 'channel' => $channel,
  519. 'card_no' => $cardNo,
  520. 'bank_name' => $bankName,
  521. 'alias' => $alias
  522. ]);
  523. Cache::delete(get_step_key($chatId));
  524. return static::banks($chatId, $messageId, $channel);
  525. }
  526. }