telegrambot / devanswerbot Goto Github PK
View Code? Open in Web Editor NEWExample TelegramBot/API usage
Example TelegramBot/API usage
php 7.1 + api lib 2.3.13
этот код этого репозитория невыполняется.
Либо выдает исключение Syntax error либо тупо пых жалуется что sendMessage() нет такого метода у \TelegramBot\Api\Client
На основании примера, пытаюсь вывести меню, не получается.
$keyboard = new \TelegramBot\Api\Types\ReplyKeyboardMarkup(array(array("one", "two", "three")), true); // true for one-time keyboard
$bot->command('key', function ($message) use ($bot) {
$bot->sendMessage($message->getChat()->getId(),"Выберите пункт меню",null,false,null,$keyboard);
});
Что не так делаю?
Your API is awesome, congratulations! I just need more examples to explore its entire potential. For example, the method "on" seems to be very promising and time saver when we have to deal with interaction. Otherwise, its usage is a little complex. Digging and testing, I figure out how to check simple verifications using the second parameter. The first I have no ideal what it is for. Check my example:
$bot->on(function ($message) use ($bot) {
$bot->sendMessage($message->getChat()->getId(), '?!');
},function ($message) use ($bot) {
if ($message->getText()=="b"){
$bot->sendMessage($message->getChat()->getId(), 'OK!');
}
else
{
$bot->sendMessage($message->getChat()->getId(), 'Incorrect!');
}
});
When is send the word b, triggers the OK message, else, Incorrect message. But all the actions were set up on the second parameter.
Can you give me a simple example to check if the message was sent, example, a registration process. First /register then the Bot asks for e-mail, then the bot validates it, if OK confirms, if it's not, ask again.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.