Closed sanjarani closed 8 years ago
First problem solved.
I did made my command filename in lower case :
OK, Second problem Solved.
KeyboardCommand.php
in examples/Commands/
was Checked and this is the solution :
first of all, use dependencies for reply_markup:
use Longman\TelegramBot\Entities\ReplyKeyboardMarkup; use Longman\TelegramBot\Entities\ReplyKeyboardHide; use Longman\TelegramBot\Entities\ForceReply;
and then, prepare a variable named $keyboards
:
$keyboards = array();
And next step is styling custom keyboard using an array named $keyboard:
$keyboard[] = ['7','8','9']; $keyboard[] = ['4','5','6']; $keyboard[] = ['1','2','3']; $keyboard[] = [' ','0',' '];
In next step, you have to pass $keyboard array to $keyboard_s_ and unset
$keyboard :
$keyboards[] = $keyboard; unset($keyboard);
Now initiate ReplyKeyboardMarkup
:
$reply_keyboard_markup = new ReplyKeyboardMarkup( [ 'keyboard' => $keyboards[0] , 'resize_keyboard' => true, 'one_time_keyboard' => false, 'selective' => false ] );
And at last simply add this to send parameters using :
$data['reply_markup'] = $reply_keyboard_markup;
This is very cool script and just need more documentations.
Well Done...
Thanks, for trying it! It would be great if you could start write a wiki page with this recipe to build custom commands!
Your welcome... I'll do it... Please correct me if I did understand something wrong.
I've seen the page good job! Thanks again! On 2 Dec 2015 18:12, "Kiyarash Sanjarani Vahed" notifications@github.com wrote:
Your welcome... I'll do it... Please correct me if I did understand something wrong.
— Reply to this email directly or view it on GitHub https://github.com/akalongman/php-telegram-bot/issues/58#issuecomment-161367984 .
Hi; Thanks for this cool script. :+1:
I wish that I could find more detailed documentation for your script.
I started to use your script recently and everything seems nice BUT need to know : How can I write my own commands? I did create a class named
testCommand
in commands folder but this way didn't work.Would you please help me to create my own
command
andcustom keyboard
?_Thanks in Advance_