i can't figure out how can i count inlineKeyboardButton clicks the same as @ChannelButtonsBot or @likebot. How can i make the bot increase by 1 on first click and decrease by 1 on the second click. and of course it needs to know when a new user clicks so it can go above 1. basically the same as the bots i have mentioned.
This is the code i have written. This is specific for Channels:
$ctext = $update->channel_post->text;
$channel_mid = $channel->message_id;
$channel_chatid = $update->channel_post->chat->id;
$data = $update->callback_query->data;
$chat_id2 = $update->callback_query->message->chat->id;
$message_idc = $update->callback_query->message->message_id;
bot(editMessageText,[
'chat_id' => $channel_chatid,
'message_id'=>$channel_mid,
'text' => $ctext,
'reply_markup'=>json_encode([
'inline_keyboard'=>[
[['text'=>'Clicks'. $number,'callback_data'=>"clicks"]],
]
])
]);
if($data == "clicks"){
$number++;
bot(editMessageReplyMarkup,[
'chat_id' => $chat_id2,
'message_id'=>$message_idc,
'reply_markup'=>json_encode([
'inline_keyboard'=>[
[['text'=>'Clicks'. $number,'callback_data'=>"clicks"]],
]
])
]);
}