H
H
Haket0012021-07-19 23:40:39
PHP
Haket001, 2021-07-19 23:40:39

How to fix this error in telegram bot in PHP?

Here is the code that sends the request data to join the telegram bot, but when the admin presses the "/joinaccpt" button, the bot hangs

case $btns['jnsend']: {
            if (getInput($id) != 'dojoinnext4')
              break;
            setInput($id, 'dojoinnext5');
            if (getUserData($id, 'joind'))
              break;
            setUserData($id, 'joind', '1');
            $joind = [
              getInputData($id, 'dojoinnext1'),
              getInputData($id, 'dojoinnext2'),
            ];
            $result = [
              ' <b>Вы подали заявку на вступление</b>',
            ];
            $keybd = [false, [
              [
                ['text' => $btns['back']],
              ],
            ]];
            botSend([
              ' <b>Заявка на вступление</b>',
              '',
              ' От: <b>'.userLogin($id, true).'</b>',
              ' Откуда узнал: <b>'.$joind[0].'</b>',
              '⭐️ Опыт: <b>'.$joind[1].'</b>',
              ' Пригласил: <b>'.getUserReferalName($id, true, true).'</b>',
              ' Дата: <b>'.date('d.m.Y</b> в <b>H:i:s').'</b>',
            ], chatAdmin(), [true, [
              [
                ['text' => $btns['joinaccpt'], 'callback_data' => '/joinaccpt'.$id],
                ['text' => $btns['joindecl'], 'callback_data' => '/joindecl'.$id],
              ],
            ]]);
            break;
          }
        }

-------------------------------------------------- -----------
case chatAdmin(): {
      $flag = false;
      switch ($cmd[0]) {
        case '/joinaccpt': {
          $t = $cmd[1];
          botSend([
            '⚡️ <b>Ваша заявка на вступление одобрена</b>',
          ], $t, [true, [
            [
              ['text' => $btns['profile'], 'callback_data' => '/start'],
            ],
            [
              ['text' => $btns['stglchat'], 'url' => linkChat()],
              ['text' => $btns['stglpays'], 'url' => linkPays()],
            ],
          ]]);
          $referal = getUserReferal($t);
          if ($referal) {
            addUserRefs($referal);
            botSend([
              ' У вас появился новый реферал - <b>'.userLogin($t).'</b>',
            ], $referal);
          }
          $joind = [
            getInputData($t, 'dojoinnext1'),
            getInputData($t, 'dojoinnext2'),
          ];
          botSend([
            ' <b>Одобрение заявки</b>',
            '',
            ' Откуда узнал: <b>'.$joind[0].'</b>',
            '⭐️ Опыт: <b>'.$joind[1].'</b>',
            ' Пригласил: <b>'.getUserReferalName($t, true, true).'</b>',
            '',
            ' Подал: <b>'.userLogin($t, true).'</b>',
            ' Дата: <b>'.date('d.m.Y</b> в <b>H:i:s').'</b>',
            '❤️ Принял: <b>'.userLogin($id, true, true).'</b>',
          ], chatAlerts());
          botDelete($mid, $chat);
          $flag = true;
          break;
        }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vitaly_74, 2021-07-20
@vitaly_74

if it hangs, then there is a loop somewhere, see for or while in the code. and so go to freelance.habr.ru

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question