S
S
seandyer72992021-03-07 17:29:36
Bots
seandyer7299, 2021-03-07 17:29:36

Stupid with inline button in php telegram bot, how to fix?

Faced a problem, moving to the basket when you click on the second inline button. When pressed, it gives out the user of the bot and the word basket, in the message to the bot, I tried to change the parameter to callback_data, the button hangs in endless loading. Please tell me how to decide what, when you click on the second button, throws the bot into the basket.
PHP version 7.2
Here is the code itself

}
            
 
        
            $info = get_props($item,$id_chat);
        
            $buttons_inline['inline_keyboard'][0][0]['text'] = " ". "Добавить в корзину".$append;
            $buttons_inline['inline_keyboard'][0][0]['callback_data'] = "/add_basket:".$item.':'.$message_id;
            $buttons_inline['inline_keyboard'][1][0]['text'] = "������ ". "Открыть корзину";
            $buttons_inline['inline_keyboard'][1][0]['callback_data'] = " Корзина";
            $markup = json_encode($buttons_inline,true);
            $content = array(
                'chat_id' => $id_chat,
                'message_id'=>$message_id,
                'reply_markup' => $markup,
                #'text' => $info,
                'caption' => $info,
                'parse_mode'=>'HTML',
                'resize_keyboard'=>true,
                'one_time_keyboard' => false,
            );
        
            $x = file_get_contents($url.'/editmessageCaption?'.http_build_query($content));
        
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Max Medar, 2017-12-21
@carec

Why a plugin? There is a simple function to write.
Something like this:

$ids = get_posts(array(
    'fields'          => 'ids',
    'posts_per_page'  => -1,
    'post_type' => 'post',
));

foreach($ids as $id) :
    wp_update_post(array(
      'ID'    =>  $id,
      'post_status'   =>  'draft'
    ));
endforeach;

https://developer.wordpress.org/reference/function...
https://developer.wordpress.org/reference/function
... more by code from the internet.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question