Comments (2)
@igarbera try to log income requests and see what Telegram server is sending
from laravel.
Hello!
I try to process query from callback button :
- I have webhook handler, it's finely process commands like /start. :
public function webhookHandler(PhpTelegramBotContract $telegram_bot){ $telegram_bot->handle(); }
Here is code for process /start command and display the button with a callback, its work fine:
`<?php
namespace Longman\TelegramBot\Commands\SystemCommands;
use Longman\TelegramBot\Commands\SystemCommand;
use Longman\TelegramBot\Request;
use Longman\TelegramBot\Entities\InlineKeyboard;
class StartCommand extends SystemCommand
{
protected $name = 'start';
protected $description = 'Start command';
protected $usage = '/start';
protected $version = '1.1.0';
protected $private_only = true;
public function execute()
{
$message = $this->getMessage();
$chat_id = $message->getChat()->getId();
$text = 'Start command with callback button';
$inline_keyboard = new InlineKeyboard([
['text' => 'Test callback', 'callback_data' => 'test_callback'],
]);
$data = [
'chat_id' => $chat_id,
'text' => $text,
'reply_markup' => $inline_keyboard,
];
return Request::sendMessage($data);
}
}`
- when I send query from inline button, its not processing in command like this (as in https://github.com/php-telegram-bot/example-bot/blob/master/Commands/CallbackqueryCommand.php):
`<?php
namespace Longman\TelegramBot\Commands\SystemCommands;
use Longman\TelegramBot\Commands\SystemCommand;
use Longman\TelegramBot\Request;
class TestCallbackCommand extends SystemCommand
{
protected $name = 'callbackquery';
protected $description = 'Reply to callback query';
protected $version = '1.1.1';
public function execute()
{
$callback_query = $this->getCallbackQuery();
$callback_query_id = $callback_query->getId();
$callback_data = $callback_query->getData();
$data = [
'callback_query_id' => $callback_query_id,
'text' => 'Hello World!',
'show_alert' => $callback_data === 'thumb up',
'cache_time' => 5,
];
return Request::answerCallbackQuery($data);
}
}`
So, how can i process queries from callback buttons in commands in Laravel? maybe you have some working examples?
from laravel.
Related Issues (20)
- Telegram returned an invalid response! HOT 1
- Database issues HOT 1
- When Laravel 7 ? HOT 2
- when support for laravel 8 HOT 1
- Please implement Laravel 8 support HOT 2
- I'm getting error when i install package on laravel 8 HOT 1
- Problem with install package HOT 5
- Migrations missed HOT 1
- Migrations are broken because of `->index('user_id')` HOT 1
- install for Laravel 9 HOT 4
- When the package will be updated for Laravel 9 HOT 3
- Error on instalation HOT 3
- Is there a way to receive generic messages? HOT 1
- Multiple bots HOT 1
- Update README and improve setup process
- Composer.org only has 2.0.3, incompatible with Laravel 10 HOT 2
- How to work with this?
- log cycling HOT 2
- Error Cannot declare class Longman\TelegramBot\Commands\SystemCommands\GenericmessageCommand HOT 1
- How to use this version?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel.