In Telegram there are some bots capable of performing what are known as "inline actions". An example of some built-in inline bots are
@pic, but sending gifs is just one of many potential ways to use an inline bot. For instance,
@VorpalRobot rolls dice for DnD, Pathfinder, and other tabletop games.
Answering Inline Queries
Inline queries are like any other event and can be listened for using the
UpdateHandler and it's
On annotation, or the
As you can see here, the
OnInlineQuery annotation can be used directly to handle inline queries. It's preferred over just using the
On annotation for a couple reasons:
- Methods annotated with
InlineQueryHandler::Contextrather than a plain
Update. This includes direct access to the query and more.
Regexas an optional parameter. If included this will be used to match the received query and the generated
Regex::MatchDatawill be passed to the context.