Closed NZ62AN closed 3 years ago
That code uses novagram v2, so you have to install it using composer by doing composer require skrtdev/novagram v2.x-dev
ok thanks, but what use to my host?
Download v2.x-dev from https://php-download.com/package/skrtdev/novagram#all-versions and upload it in your host
thanks, i downloaded it , please say me what folders upload to host (attached file)?
how to use crud with Novagram?
thanks, i downloaded it , please say me what folders upload to host (attached file)?
I just added phar for v2, replace phar code with:
if (!file_exists('novagram2.phar')) {
copy('https://gaetano.eu.org/novagram/phar2.phar', 'novagram2.phar');
}
required_once 'novagram2.phar';
Im sorry, but dont work
@NZ62AN What do you mean with don’t work?
thsi errors:
[17-Aug-2021 20:39:06 UTC] [2021-08-17T20:39:06.938729+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 20:39:06 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /home/kisalir/public_html/mybots/learnbot/examples/userbot.php:20 Stack trace:
@NZ62AN Send code
<?php if (file_exists('vendor')) { require 'vendor/autoload.php'; } else{ if (!file_exists('novagram2.phar')) { copy('https://gaetano.eu.org/novagram/phar2.phar', 'novagram2.phar'); } require_once 'novagram2.phar';
}
use skrtdev\NovaGram\Bot; use skrtdev\Telegram{CallbackQuery, Message};
$Bot = new Bot('My api token bot');
$Bot->onCommand('start', function (Message $message) { // handles start command $user = $message->from; $inline []= [button('This is a single button in a row ', 'single_button')]; $inline []= [button('This is the first button of this row', 'first_row_button'), button('This is the second button of this row', 'second_row_button')]; $inline []= [button('This is an url button', 'https://novagram.ga', true)]; // this true means it is an url $message->reply("Hi {$user->getMention()}, this is a demo bot for inline keyboards", ['reply_markup' => ['inline_keyboard' => $inline]]); });
$Bot->onCallbackData('single_button', function(CallbackQuery $callback_query){ $message = $callback_query->message; $message->editText('This is single button\'s content, click /start to go back'); });
$Bot->onCallbackData('first_row_button', function(CallbackQuery $callback_query){ $message = $callback_query->message; $message->editText('This is first row button\'s content, click /start to go back'); });
$Bot->onCallbackData('second_row_button', function(CallbackQuery $callback_query){ $message = $callback_query->message; $message->editText('This is second row button\'s content, very boring, but this is just an example.'.PHP_EOL.'Click /start to go back'); });
$Bot->onCallbackQuery(fn(CallbackQuery $callback_query) => $callback_query->answer()); // answer all the callback queries
$Bot->start();
file codes: inline_keyboard.php in examples
I want use Novagram to my bot so need inline keyboars and crud databse my bot code is: <?php
/*** */ error_reporting(0); date_default_timezone_set('Asia/Tehran'); ##########################[ Database ]########################### $connect = mysqli_connect('localhost','userdb','passdb', 'dbname');// Do not touch $connect->set_charset('utf8_persian_ci');// Do not touch $connect->query('SET NAMES utf8');// Do not touch $admin = 'my chat_id'; ##########################[ Function ]########################### function meti($method,$datas=[]){ $url = 'https://api.telegram.org/bot#API_TOKEN/'.$method; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); curl_setopt($ch,CURLOPT_POSTFIELDS,$datas); $res = curl_exec($ch); if(curl_error($ch)){ var_dump(curl_error($ch)); }else{ return json_decode($res); } } ##########################[ Variable ]########################## $update = json_decode(file_get_contents('php://input')); if(isset($update->message)){ $text = $update->message->text; $chat_id = $update->message->chat->id; $from_id = $update->message->from->id; $message_id = $update->message->message_id; } if(isset($update->callback_query)){ $data = $update->callback_query->data; $chat_id = $update->callback_query->message->chat->id; $from_id = $update->callback_query->from->id; $callback_id = $update->callback_query->id; $message_id = $update->callback_query->message->message_id; } $user = mysqli_fetch_assoc(mysqli_query($connect,"SELECT * FROM user WHERE id = '$from_id'")); $join = meti('getChatMember',['chat_id'=>#CHANNEL_ID,'user_id'=>$from_id])->result->status; ##########################[ Keyboard ]###########################
$home = json_encode(['remove_keyboard'=>true]);
$panel = json_encode(['resize_keyboard'=>true,'keyboard'=>[
[['text'=>"🔖 ساخت تمرین"]],
[['text'=>"📝افزودن سوال"],['text'=>"🖌 افزودن جواب"]],
[['text'=>"➖ حذف تمرین"]],
[['text'=>"📋 جواب های کاربر"]]
]]);
$back = json_encode(['resize_keyboard'=>true,'keyboard'=>[
[['text'=>"⬅️"]]
]]);
$butback = json_encode(['resize_keyboard'=>true,'keyboard'=>[
[['text'=>"بازگشت️"]]
]]);
$buttype = json_encode(['resize_keyboard'=>true,'keyboard'=>[
[['text'=>"دکمه"],['text'=>"متن"]]
]]);
##########################[ Start Bot ]###########################
if($text == "/start" or $text == "بازگشت"){
$connect->query("UPDATE user SET step = 'none' WHERE id = '$from_id'");
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"hi",'reply_markup'=>$home]);
}
##########################[ Start Quiz ]##########################
elseif(pregmatch("/^\/start\s+quiz(\d+)$/i",$text,$mtc)){
if($join != "member" && $join != "creator" && $join != "administrator"){
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"فقط افرادی که در کانال حضور دارن میتوانن در ازمون شرکت کنن"]);
}else{
if(is_numeric($mtc[1])){
$question = mysqli_fetch_assoc(mysqli_query($connect,"SELECT FROM question WHERE code = '$mtc[1]' LIMIT 0,1"));
$quiz = mysqli_fetch_assoc(mysqli_query($connect,"SELECT FROM quiz WHERE code = '$mtc[1]'"));$timequ = $quiz['time'] + 259200;
if($question == true && time() <= $timequ){
$record = mysqli_fetch_assoc(mysqli_query($connect,"SELECT FROM records WHERE quiz = '$mtc[1]' AND id = '$from_id'"));
if($record['id'] != true){
if($question['type'] == 'دکمه'){
$result = mysqli_query($connect, "SELECT FROM answer WHERE code = '{$question['number']}'");
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_array($result)){
$Ke[] = ['text'=>$row['text'],'callback_data'=>"ask-{$row['number']}"];
}
$Ke=array_chunk($Ke,2);
$prodoct = json_encode(['inline_keyboard'=> $Ke]);
$connect->query("UPDATE user SET text = '$mtc[1]',quiz = '0' WHERE id = '$from_id'");
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"{$question['text']}",'reply_markup'=>$prodoct]);
}else{
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"اطلاعات این تمرین تکمیل نشده است",'reply_markup'=>$home]);
}
}else{
if($user['id'] != true){
$connect->query("INSERT INTO user (id, step ,text,quiz) VALUES ('$from_id', 'resave', 'none' , '0')");
}
$connect->query("UPDATE user SET step = 'resave',text = '$mtc[1]',quiz = '0' WHERE id = '$from_id'");
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"{$question['text']}\n\nلطفا جواب خود را برای ما تایپ کنید ❗️",'reply_markup'=>$butback]);
}
}else{
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"شما از قبل به این تمرین جواب داده اید",'reply_markup'=>$home]);
}
}else{
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"چنین تمرینی در ربات یافت نشد \nو یا مهلت این تمرین به اتمام رسیده است",'reply_markup'=>$home]);
}
}
}
}
##########################[ Answer ]########################
elseif(preg_match('/^ask-(.)$/',$data,$match)){
$number = $user['quiz'] + 1;
$answer = mysqli_fetch_assoc(mysqli_query($connect,"SELECT FROM answer WHERE number = '$match[1]'"));
$connect->query("UPDATE user SET step = 'none',quiz = '$number' WHERE id = '$from_id'");
$question2 = mysqli_fetch_assoc(mysqli_query($connect,"SELECT FROM question WHERE code = '{$user['text']}' LIMIT {$user['quiz']},1"));
$connect->query("INSERT INTO records
(id
, quiz
, question
, answer
, time
) VALUES ('$from_id','{$user['text']}','{$question2['text']}','{$answer['text']}','".time()."')");
$question = mysqli_fetch_assoc(mysqli_query($connect,"SELECT FROM question WHERE code = '{$user['text']}' LIMIT $number,1"));
if($question['text'] == true){
if($question['type'] == 'دکمه'){
$result = mysqli_query($connect, "SELECT FROM answer WHERE code = '{$question['number']}'");
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_array($result)){
$Ke[] = ['text'=>$row['text'],'callback_data'=>"ask-{$row['number']}"];
}
$Ke=array_chunk($Ke,2);
$prodoct = json_encode(['inline_keyboard'=> $Ke]);
meti('editmessagetext',['chat_id'=>$chat_id,'message_id'=>$message_id,'text'=>"{$question['text']}",'reply_markup'=>$prodoct]);
}else{
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"اطلاعات این تمرین تکمیل نشده است",'reply_markup'=>$home]);
}
}else{
meti('deletemessage',['chat_id'=>$chat_id,'message_id'=>$message_id]);
$connect->query("UPDATE user SET step = 'resave' WHERE id = '$from_id'");
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"{$question['text']}\n\nلطفا جواب خود را برای ما تایپ کنید ❗️",'reply_markup'=>$butback]);
}
}else{
meti('deletemessage',['chat_id'=>$chat_id,'message_id'=>$message_id]);
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"با تشکر از جواب های شما",'reply_markup'=>$home]);
}
}
elseif($user['step'] == 'resave'){
$number = $user['quiz'] + 1;
$question2 = mysqli_fetch_assoc(mysqli_query($connect,"SELECT FROM question WHERE code = '{$user['text']}' LIMIT {$user['quiz']},1"));
$stmt = $connect->prepare("INSERT INTO records (id,quiz,question,answer,time) VALUES (?,?,?,?,?)");
$stmt->bind_param('sssss', $from_id ,$user['text'] ,$question2['text'] ,$text, time());
$stmt->execute();
$connect->query("UPDATE user SET step = 'none',quiz = '$number' WHERE id = '$from_id'");
$question = mysqli_fetch_assoc(mysqli_query($connect,"SELECT FROM question WHERE code = '{$user['text']}' LIMIT $number,1"));
if($question['text'] == true){
if($question['type'] == 'دکمه'){
$result = mysqli_query($connect, "SELECT FROM answer WHERE code = '{$question['number']}'");
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_array($result)){
$Ke[] = ['text'=>$row['text'],'callback_data'=>"ask-{$row['number']}"];
}
$Ke=array_chunk($Ke,2);
$prodoct = json_encode(['inline_keyboard'=> $Ke]);
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"{$question['text']}",'reply_markup'=>$prodoct]);
}else{
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"اطلاعات این تمرین تکمیل نشده است",'reply_markup'=>$home]);
}
}else{
meti('deletemessage',['chat_id'=>$chat_id,'message_id'=>$message_id]);
$connect->query("UPDATE user SET step = 'resave' WHERE id = '$from_id'");
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"{$question['text']}\n\nلطفا جواب خود را برای ما تایپ کنید ❗️",'reply_markup'=>$butback]);
}
}else{
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"با تشکر از جواب های شما",'reply_markup'=>$home]);
}
}
##########################[ Admin Panel ]#######################
elseif($text == "پنل" or $text == "⬅️"){
if($from_id == $admin){
$connect->query("UPDATE user SET step = 'none' WHERE id = '$from_id'");
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"ادمین عزیز به پنل مدیریت خود خوش آمدید✅\n\nطراحی و توسعه توسط توربو تیم ، نسخه 1.2\n\nلطفا از دکمه های زیر برای دستور دادن به ربات اقدام کنید👇🏻",'reply_markup'=>$panel]);
}
}
elseif($text == "🖌 افزودن جواب" or $text == "🔖 ساخت تمرین" or $text == '📝افزودن سوال' or $text == "➖ حذف تمرین" or $text == "📋 جواب های کاربر"){
if($from_id == $admin){
switch($text){
case '🔖 ساخت تمرین' :
$connect->query("UPDATE user SET step = 'newquiz' WHERE id = '$from_id'");
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"لطفا اسم تمرین خودتون رو وارد کنید",'reply_markup'=>$back]);
break;
case '📝افزودن سوال' :
$result = mysqli_query($connect, "SELECT FROM quiz");
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_array($result)){
$Ke[] = ['text'=>$row['name']];
}
$Ke=array_chunk($Ke,2);$Ke[] = [['text'=>"⬅️"]];
$prodoct = json_encode(['keyboard'=> $Ke ,'resize_keyboard'=>true]);
$connect->query("UPDATE user SET step = 'newquestion' WHERE id = '$from_id'");
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"یکی از تمرین های زیر را برای اضافه کردن سوال انتخاب کنید👇🏻",'reply_markup'=>$prodoct]);
}else{
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"برای ثبت سوال ها شما باید اول یک تمرین ایجاد کنید ❗️",'reply_markup'=>$panel]);
}
break;
case '🖌 افزودن جواب' :
$result = mysqli_query($connect, "SELECT FROM question WHERE type ='دکمه'");
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_array($result)){
$Ke[] = ['text'=>$row['text']];
}
$Ke=array_chunk($Ke,2);$Ke[] = [['text'=>"⬅️"]];
$prodoct = json_encode(['keyboard'=> $Ke ,'resize_keyboard'=>true]);
$connect->query("UPDATE user SET step = 'newanswer' WHERE id = '$from_id'");
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"یکی از سوال زیر را انتخاب کنید 👇🏻",'reply_markup'=>$prodoct]);
}else{
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"برای ثبت جواب ها شما باید اول یک سوال ایجاد کنید ❗️",'reply_markup'=>$panel]);
}
break;
case '➖ حذف تمرین' :
$connect->query("UPDATE user SET step = 'delete' WHERE id = '$from_id'");
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"لطفا شماره تمرین را برای حذف کردن آن ارسال کنید",'reply_markup'=>$back]);
break;
case '📋 جواب های کاربر' :
$connect->query("UPDATE user SET step = 'status' WHERE id = '$from_id'");
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"لطفا یوزر ایدی و شناسه تمرین را برای ما ماننده نمونه زیر ارسال کنید\n\nuserid-quiz \n477628584-1634886180",'reply_markup'=>$back]);
break;
}
}
}
elseif($user['step'] == "newquestionask" or $user['step'] == "newquiz" or $user['step'] == "newquestion" or $user['step'] == "newanswer" or $user['step'] == "newanswer2" or $user['step'] == "button" or $user['step'] == "delete" or $user['step'] == "status"){
switch($user['step']){
case 'newquiz' :
$rand = rand(0000000,9999999) + time();$connect->query("UPDATE user SET step = 'none',quiz = '$rand' WHERE id = '$from_id'");
$connect->query("INSERT INTO quiz
(code
, name
,time
) VALUES ('$rand','$text','".time()."')");
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"تمرین شما با کد $rand
ثبت شد ✅\n\nاکنون شما میتوانید از بخش ( افزودن سوال ) سوال های خودتون رو ارسال کنید",'parse_mode'=>"html",'reply_markup'=>$panel]);
break;
case 'newquestion' :
$quiz = mysqli_fetch_assoc(mysqli_query($connect,"SELECT FROM quiz WHERE name = '$text'"));
if($quiz == true){
$connect->query("UPDATE user SET step = 'newquestionask',quiz = '{$quiz['code']}' WHERE id = '$from_id'");
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"لطفا متن سوال خودون رو برای تمرین ( $text ) ارسال کنید",'reply_markup'=>$back]);
}
break;
case 'newquestionask' :
$connect->query("UPDATE user SET step = 'button',text = '$text' WHERE id = '$from_id'");
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"سوال شما با موفقیت ذخیره شد و اکنون نوع جواب های این سوال را انتخاب کنید 👇🏻",'reply_markup'=>$buttype]);
break;
case 'button' :
if(preg_match('/^(متن|دکمه)$/',$text)){
$rand = rand(0000000,9999999);$connect->query("UPDATE user SET step = 'answer',quiz = '$rand' WHERE id = '$from_id'");
$connect->query("INSERT INTO question
(code
,number
, text
, type
) VALUES ('{$user['quiz']}','$rand','{$user['text']}','$text')");
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"سوال شما با موفقیت به تمرین شماره ( {$user['quiz']} ) با نوع جواب $text اضافه شد و از هم اکنون میتوانید برای این سوال جواب اضافه کنید ✅",'reply_to_message_id'=>$message_id,'reply_markup'=>$panel]);
}
break;
case 'newanswer' :
$quiz = mysqli_fetch_assoc(mysqli_query($connect,"SELECT FROM question WHERE text = '$text'"));
if($quiz == true){
$connect->query("UPDATE user SET step = 'newanswer2',text = '{$quiz['code']}' WHERE id = '$from_id'");
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"لطفا متن جواب خودتون رو برای ما ارسال کنید",'reply_markup'=>$back]);
}
break;
case 'newanswer2' :
$connect->query("UPDATE user SET step = 'newanswer2' WHERE id = '$from_id'");$rand = rand(0000000,9999999);
$connect->query("INSERT INTO answer
(code
, number
, text
) VALUES ('{$user['quiz']}','$rand','$text')");
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"جواب شما با موفقیت ثبت شد و در صورتی جواب دیگری میخوایید ذخیره کنید آنرا برای ما ارسال کنید ✅\n\nدر غیر اینصورت روی دکمه زیر کلیک کنید👇🏻",'reply_markup'=>$back]);
break;
case 'delete' :
if(is_numeric($text)){
$connect->query("UPDATE user SET step = 'none' WHERE id = '$from_id'");
$connect->query("DELETE FROM question
WHERE code = '$text'");
$connect->query("DELETE FROM records
WHERE quiz = '$text'");
$connect->query("DELETE FROM quiz
WHERE code = '$text'");
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"تمامی سوال ها و جواب ها و جواب کاربران به تمرین به شماره ( $text ) با موفقیت حذف شدن ✅",'reply_markup'=>$panel]);
}
break;
case 'status' :
$explode = explode("-",$text);
$connect->query("UPDATE user SET step = 'none' WHERE id = '$from_id'");
$result = mysqli_query($connect, "SELECT * FROM records WHERE quiz = '$explode[1]' AND id = '$explode[0]'");
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_array($result)){
$Ke .="📋 سوال : {$row['question']}\n📝 جواب : {$row['answer']}"."\n\n";
}
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"جواب های کاربر <a href=\"tg://user?id=$explode[0]\">$explode[0] برای تمرین به شماره $explode[1]
👇🏻 \n\n$Ke",'parse_mode'=>"html",'reply_markup'=>$panel]);
}else{
meti('sendmessage',['chat_id'=>$chat_id,'text'=>"چنین کاربری هیچ جوابی به پرسش ها نداده است",'reply_markup'=>$panel]);
}
break;
}
}
##########################[ Insert Data ]######################## $users = mysqli_fetch_assoc(mysqli_query($connect,"SELECT * FROM user WHERE id = '$from_id'")); if($users["id"] != true){ $connect->query("INSERT INTO user (id, step ,text,quiz) VALUES ('$from_id', 'none', 'none' , '0')"); } ?>
For now use v1.x, as v2 is still not out
I run project with composer in phpStorm: create-project skrtdev/novagram composer v2.x-dev -sdev --no-install --keep-vcs --no-progress --no-interaction --ansi Creating a "skrtdev/novagram" project at "./composer" Installing skrtdev/novagram (v2.x-dev 6e1871a92b6233976633f1d7e4a86943f5db2c55) Failed to download skrtdev/novagram from source: git was not found in your PATH, skipping source download Now trying to download from dist - Downloading skrtdev/novagram (v2.x-dev 6e1871a) - Installing skrtdev/novagram (v2.x-dev 6e1871a): Extracting archive Created project in C:\Users\Nezam\PhpstormProjects\untitled\composer Project was successfully created by Composer.
For now use v1.x, as v2 is still not out
very good, thank you.
@NZ62AN Nothing
when use code in https://php-download.com/package/skrtdev/novagram/file/examples/inline_keyboard.php for inline_keyboard dont work and get some errors:
https://php-download.com/package/skrtdev/novagram/file/examples/inline_keyboard.php
[17-Aug-2021 15:41:09 UTC] [2021-08-17T15:41:09.107956+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 15:41:09 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /..../examples/userbot.php:19 Stack trace:
0 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(126): {closure}(Object(skrtdev\Telegram\Message), Array)
1 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(111): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message), Array)
2 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(90): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
3 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/Dispatcher.php(61): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
4 phar:///..../examples/novagram.ph in /..../examples/userbot.php on line 19
[17-Aug-2021 15:41:09 UTC] [2021-08-17T15:41:09.126017+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 15:41:09 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /..../examples/userbot.php:19 Stack trace:
0 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(126): {closure}(Object(skrtdev\Telegram\Message), Array)
1 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(111): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message), Array)
2 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(90): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
3 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/Dispatcher.php(61): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
4 phar:///..../examples/novagram.ph in /..../examples/userbot.php on line 19
[17-Aug-2021 15:41:11 UTC] [2021-08-17T15:41:11.141791+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 15:41:11 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /..../examples/userbot.php:19 Stack trace:
0 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(126): {closure}(Object(skrtdev\Telegram\Message), Array)
1 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(111): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message), Array)
2 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(90): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
3 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/Dispatcher.php(61): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
4 phar:///..../examples/novagram.ph in /..../examples/userbot.php on line 19
[17-Aug-2021 15:41:15 UTC] [2021-08-17T15:41:15.162884+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 15:41:15 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /..../examples/userbot.php:19 Stack trace:
0 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(126): {closure}(Object(skrtdev\Telegram\Message), Array)
1 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(111): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message), Array)
2 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(90): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
3 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/Dispatcher.php(61): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
4 phar:///..../examples/novagram.ph in /..../examples/userbot.php on line 19
[17-Aug-2021 15:41:23 UTC] [2021-08-17T15:41:23.180468+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 15:41:23 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /..../examples/userbot.php:19 Stack trace:
0 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(126): {closure}(Object(skrtdev\Telegram\Message), Array)
1 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(111): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message), Array)
2 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(90): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
3 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/Dispatcher.php(61): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
4 phar:///..../examples/novagram.ph in /..../examples/userbot.php on line 19
[17-Aug-2021 15:41:39 UTC] [2021-08-17T15:41:39.206354+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 15:41:39 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /..../examples/userbot.php:19 Stack trace:
0 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(126): {closure}(Object(skrtdev\Telegram\Message), Array)
1 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(111): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message), Array)
2 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(90): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
3 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/Dispatcher.php(61): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
4 phar:///..../examples/novagram.ph in /..../examples/userbot.php on line 19
[17-Aug-2021 15:42:11 UTC] [2021-08-17T15:42:11.227988+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 15:42:11 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /..../examples/userbot.php:19 Stack trace:
0 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(126): {closure}(Object(skrtdev\Telegram\Message), Array)
1 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(111): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message), Array)
2 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(90): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
3 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/Dispatcher.php(61): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
4 phar:///..../examples/novagram.ph in /..../examples/userbot.php on line 19
[17-Aug-2021 15:43:11 UTC] [2021-08-17T15:43:11.254602+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 15:43:11 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /..../examples/userbot.php:19 Stack trace:
0 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(126): {closure}(Object(skrtdev\Telegram\Message), Array)
1 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(111): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message), Array)
2 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(90): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
3 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/Dispatcher.php(61): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
4 phar:///..../examples/novagram.ph in /..../examples/userbot.php on line 19
[17-Aug-2021 15:44:11 UTC] [2021-08-17T15:44:11.290434+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 15:44:11 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /..../examples/userbot.php:19 Stack trace:
0 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(126): {closure}(Object(skrtdev\Telegram\Message), Array)
1 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(111): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message), Array)
2 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(90): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
3 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/Dispatcher.php(61): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
4 phar:///..../examples/novagram.ph in /..../examples/userbot.php on line 19
[17-Aug-2021 15:45:11 UTC] [2021-08-17T15:45:11.486068+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 15:45:11 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /..../examples/userbot.php:19 Stack trace:
0 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(126): {closure}(Object(skrtdev\Telegram\Message), Array)
1 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(111): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message), Array)
2 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(90): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
3 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/Dispatcher.php(61): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
4 phar:///..../examples/novagram.ph in /..../examples/userbot.php on line 19
[17-Aug-2021 15:46:11 UTC] [2021-08-17T15:46:11.552991+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 15:46:11 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /..../examples/userbot.php:19 Stack trace:
0 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(126): {closure}(Object(skrtdev\Telegram\Message), Array)
1 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(111): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message), Array)
2 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(90): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
3 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/Dispatcher.php(61): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
4 phar:///..../examples/novagram.ph in /..../examples/userbot.php on line 19
[17-Aug-2021 15:47:11 UTC] [2021-08-17T15:47:11.580028+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 15:47:11 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /..../examples/userbot.php:19 Stack trace:
0 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(126): {closure}(Object(skrtdev\Telegram\Message), Array)
1 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(111): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message), Array)
2 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(90): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
3 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/Dispatcher.php(61): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
4 phar:///..../examples/novagram.ph in /..../examples/userbot.php on line 19
[17-Aug-2021 15:48:11 UTC] [2021-08-17T15:48:11.608953+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 15:48:11 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /..../examples/userbot.php:19 Stack trace:
0 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(126): {closure}(Object(skrtdev\Telegram\Message), Array)
1 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(111): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message), Array)
2 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(90): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
3 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/Dispatcher.php(61): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
4 phar:///..../examples/novagram.ph in /..../examples/userbot.php on line 19
[17-Aug-2021 15:49:11 UTC] [2021-08-17T15:49:11.637823+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 15:49:11 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /..../examples/userbot.php:19 Stack trace:
0 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(126): {closure}(Object(skrtdev\Telegram\Message), Array)
1 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(111): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message), Array)
2 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(90): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
3 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/Dispatcher.php(61): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
4 phar:///..../examples/novagram.ph in /..../examples/userbot.php on line 19
[17-Aug-2021 15:50:11 UTC] [2021-08-17T15:50:11.802932+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 15:50:11 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /..../examples/userbot.php:19 Stack trace:
0 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(126): {closure}(Object(skrtdev\Telegram\Message), Array)
1 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(111): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message), Array)
2 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(90): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
3 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/Dispatcher.php(61): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
4 phar:///..../examples/novagram.ph in /..../examples/userbot.php on line 19
[17-Aug-2021 15:51:11 UTC] [2021-08-17T15:51:11.834456+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 15:51:11 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /..../examples/userbot.php:19 Stack trace:
0 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(126): {closure}(Object(skrtdev\Telegram\Message), Array)
1 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(111): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message), Array)
2 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(90): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
3 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/Dispatcher.php(61): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
4 phar:///..../examples/novagram.ph in /..../examples/userbot.php on line 19
[17-Aug-2021 15:52:11 UTC] [2021-08-17T15:52:11.881324+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 15:52:11 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /..../examples/userbot.php:19 Stack trace:
0 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(126): {closure}(Object(skrtdev\Telegram\Message), Array)
1 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(111): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message), Array)
2 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(90): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
3 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/Dispatcher.php(61): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
4 phar:///..../examples/novagram.ph in /..../examples/userbot.php on line 19
[17-Aug-2021 15:53:11 UTC] [2021-08-17T15:53:11.916809+00:00] NovaGram.WARNING: Error handler is not set. Check docs at https://docs.novagram.ga/errors_handling.html [] [] [17-Aug-2021 15:53:11 UTC] PHP Fatal error: Uncaught Error: Call to undefined function button() in /..../examples/userbot.php:19 Stack trace:
0 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(126): {closure}(Object(skrtdev\Telegram\Message), Array)
1 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(111): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message), Array)
2 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/HandlersTrait.php(90): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
3 phar:///..../examples/novagram.phar/skrtdev/novagram/src/NovaGram/Dispatcher.php(61): skrtdev\NovaGram\Bot->skrtdev\NovaGram{closure}(Object(skrtdev\Telegram\Message))
4 phar:///..../examples/novagram.ph in /..../examples/userbot.php on line 19
and $Bot->onCallbackQuery(fn(CallbackQuery $callback_query) => $callback_query->answer()); // answer all the callback queries
has syntax error in attached file