Yang ingn diskusi silahkan langsung gasken di kolom komentar blog atau youtube saya,@orangJaringan
Core ini mendukung multi user bot alias bisa menggunakan banyak token dalam 1 core.
if (isset($_GET['id_bot'])) {
$the_id_bot = $_GET['id_bot'];
// Dapatkan informasi token berdasarkan id_bot
$token = _get_token_info_by_idBot($the_id_bot);
$usernamebot = Has_username_token($the_id_bot);
echo $usernamebot;
} else {
// Tindakan yang ingin Anda lakukan jika parameter tidak ada atau tidak lengkap
// Default BOT
$token = 'tokenya';
$usernamebot = 'botUsernamenya';
}
//Deklarasi Fungsi FrameBot
$BotEngine = new FrameBot($token, $usernamebot);
$BotEngine->on('callback', function ($command) use ($the_id_bot, $token, $usernamebot) {
$message = Bot::message();
$enkod = json_encode($message);
$id = $message['from']['id'];
$usernamepelanggan = $message['from']['username'];
$namatele = $message['from']['first_name'];
$chatidtele = $message["message"]['chat']['id'];
$message_idtele = $message["message"]["message_id"];
$from_id = $message['from']['id'];
$from_is_bot = $message['from']['is_bot'];
$from_first_name = $message['from']['first_name'];
$from_last_name = $message['from']['last_name'];
$from_username = $message['from']['username'];
$from_language_code = $message['from']['language_code'];
$message_id = $message_idtele;
// Respon Kode disini
});
$BotEngine->cmd('*', function () use ($the_id_bot, $token, $usernamebot){
$message = Bot::message();
$enkod = json_encode($message);
$id = $message['from']['id'];
$usernamepelanggan = $message['from']['username'];
$namatele = $message['from']['first_name'];
$message_id = $message['message_id'];
$from_id = $message['from']['id'];
$from_is_bot = $message['from']['is_bot'];
$from_first_name = $message['from']['first_name'];
$from_last_name = $message['from']['last_name'];
$from_username = $message['from']['username'];
$from_language_code = $message['from']['language_code'];
$chat_id = $message['chat']['id'];
$chat_first_name = $message['chat']['first_name'];
$chat_last_name = $message['chat']['last_name'];
$chat_username = $message['chat']['username'];
$chat_type = $message['chat']['type'];
$date_nya = $message['date'];
$pesan_text = $message['text'];
$user_id = $id;
Bot::sendChatAction('typing');
// Respon Kode disini
});
$BotEngine->run();
Semoga bermanfaat
Follow Sosmed saya untuk diskusi 🙏