1. Go to this page and download the library: Download rubika/app library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rubika / app example snippets
use Rubika\Bot;
$bot = new Bot(9123456789);
$bot->sendMessage('u0FFeu...', 'سلام');
use Rubika\Client;
class myBot extends Client
{
function onStart(): void # # s $message) {
$message = isset($message['message']) ? $message['message'] : $message;
$msg_id = $message['message_id'];
$text = $message['text'];
$type = $message['type'];
$user_id = $message['author_object_guid'];
$this->sendMessage($user_id, 'پیامتان دریافت شد ;)');
}
}
}
new myBot(9123456789);
use Rubika\Exception\Error;
try {
$bot = new Bot(9123456789);
$bot->sendMessage('u0FFeu...', 'سلام');
} catch (Error $e) {
echo $e->getMessage();
}
// or for updates :
try {
new myBot(9206634543);
} catch (Error $e) {
echo $e->getMessage();
}
$page = Web(9123456789);
// $page = Web(9123456789, 'index.php'); you can add a custom index file
// index file:
//
// echo 'its OK ;)';
//