Code Monkey home page Code Monkey logo

devanswerbot's People

Contributors

igusev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

devanswerbot's Issues

Не работает

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);
});   

Что не так делаю?

Using Client, method on

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.