You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Incorrect guide paragraph at https://telegram-bot-sdk.com/docs/guides/keyboards?language=laravel#reply-keyboard-markup . Correctly, row accepts parameters Keyboard::button not an array.
#1146
Open
mammothcoding opened this issue
Nov 8, 2024
· 1 comment
PHP version
7.4
irazasyed/telegram-bot-sdk version
v3.9
Laravel version (if any)
No response
Code To Reproduce the bug
$reply_markup = Keyboard::make()
->setResizeKeyboard(true)
->setOneTimeKeyboard(true)
->row([
Keyboard::button('1'),
Keyboard::button('2'),
Keyboard::button('3'),
])
->row([
Keyboard::button('4'),
Keyboard::button('5'),
Keyboard::button('6'),
])
->row([
Keyboard::button('7'),
Keyboard::button('8'),
Keyboard::button('9'),
])
->row([
Keyboard::button('0'),
]);
$response = Telegram::sendMessage([
'chat_id' => 'CHAT_ID', //substitute actual chat_id from update
'text' => 'Hello World',
'reply_markup' => $reply_markup
]);
Error stacktrace (if any)
{"error":"[object] (Telegram\Bot\Exceptions\TelegramResponseException(code: 400): Bad Request: can't parse keyboard button: KeyboardButton must be a String or an Object at /data/www/http/vendor/irazasyed/telegram-bot-sdk/src/Exceptions/TelegramResponseException.php:67)
[stacktrace]
#0 /data/www/http/vendor/irazasyed/telegram-bot-sdk/src/TelegramResponse.php(101): Telegram\Bot\Exceptions\TelegramResponseException::create(Object(Telegram\Bot\TelegramResponse))
#1 /data/www/http/vendor/irazasyed/telegram-bot-sdk/src/TelegramResponse.php(82): Telegram\Bot\TelegramResponse->makeException()
#2 /data/www/http/vendor/irazasyed/telegram-bot-sdk/src/TelegramResponse.php(52): Telegram\Bot\TelegramResponse->decodeBody()
#3 /data/www/http/vendor/irazasyed/telegram-bot-sdk/src/TelegramClient.php(130): Telegram\Bot\TelegramResponse->__construct(Object(Telegram\Bot\TelegramRequest), Object(GuzzleHttp\Psr7\Response))
#4 /data/www/http/vendor/irazasyed/telegram-bot-sdk/src/TelegramClient.php(82): Telegram\Bot\TelegramClient->getResponse(Object(Telegram\Bot\TelegramRequest), Object(GuzzleHttp\Psr7\Response))
#5 /data/www/http/vendor/irazasyed/telegram-bot-sdk/src/Traits/Http.php(347): Telegram\Bot\TelegramClient->sendRequest(Object(Telegram\Bot\TelegramRequest))
#6 /data/www/http/vendor/irazasyed/telegram-bot-sdk/src/Traits/Http.php(240): Telegram\Bot\Api->sendRequest('POST', 'sendMessage', Array)
#7 /data/www/http/vendor/irazasyed/telegram-bot-sdk/src/Methods/Message.php(44): Telegram\Bot\Api->post('sendMessage', Array)
#8 /data/www/http/app/Http/Controllers/API/TelegramAPIController.php(72): Telegram\Bot\Api->sendMessage(Array)
#9 /data/www/http/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\API\TelegramAPIController->webhooking('8146798921', 'XkpjQ5WQbiFm0NC...', Object(Illuminate\Http\Request))
#10 /data/www/http/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('webhooking', Array)
#11 /data/www/http/vendor/laravel/framework/src/Illuminate/Routing/Route.php(219): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\API\TelegramAPIController), 'webhooking')
#12 /data/www/http/vendor/laravel/framework/src/Illuminate/Routing/Route.php(176): Illuminate\Routing\Route->runController()
#13 /data/www/http/vendor/laravel/framework/src/Illuminate/Routing/Router.php(681): Illuminate\Routing\Route->run()
#14 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#15 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#16 /data/www/http/vendor/laravel/framework/src/Illuminate/Routing/Router.php(683): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#17 /data/www/http/vendor/laravel/framework/src/Illuminate/Routing/Router.php(658): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#18 /data/www/http/vendor/laravel/framework/src/Illuminate/Routing/Router.php(624): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#19 /data/www/http/vendor/laravel/framework/src/Illuminate/Routing/Router.php(613): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#20 /data/www/http/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(170): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#21 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#22 /data/www/http/app/Http/Middleware/LogExecutionTime.php(20): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#23 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\LogExecutionTime->handle(Object(Illuminate\Http\Request), Object(Closure))
#24 /data/www/http/app/Http/Middleware/Check.php(48): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#25 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\Check->handle(Object(Illuminate\Http\Request), Object(Closure))
#26 /data/www/http/vendor/fruitcake/laravel-cors/src/HandleCors.php(52): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#27 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Fruitcake\Cors\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))
#28 /data/www/http/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#29 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#30 /data/www/http/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#31 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#32 /data/www/http/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#33 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#34 /data/www/http/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(63): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#35 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#36 /data/www/http/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#37 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
#38 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#39 /data/www/http/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#40 /data/www/http/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#41 /data/www/http/public/index.php(55): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#42 {main}
[previous exception] [object] (Telegram\Bot\Exceptions\TelegramOtherException(code: 400): Bad Request: can't parse keyboard button: KeyboardButton must be a String or an Object at /data/www/http/vendor/irazasyed/telegram-bot-sdk/src/Exceptions/TelegramResponseException.php:67)
[stacktrace]
#0 /data/www/http/vendor/irazasyed/telegram-bot-sdk/src/TelegramResponse.php(101): Telegram\Bot\Exceptions\TelegramResponseException::create(Object(Telegram\Bot\TelegramResponse))
#1 /data/www/http/vendor/irazasyed/telegram-bot-sdk/src/TelegramResponse.php(82): Telegram\Bot\TelegramResponse->makeException()
#2 /data/www/http/vendor/irazasyed/telegram-bot-sdk/src/TelegramResponse.php(52): Telegram\Bot\TelegramResponse->decodeBody()
#3 /data/www/http/vendor/irazasyed/telegram-bot-sdk/src/TelegramClient.php(130): Telegram\Bot\TelegramResponse->__construct(Object(Telegram\Bot\TelegramRequest), Object(GuzzleHttp\Psr7\Response))
#4 /data/www/http/vendor/irazasyed/telegram-bot-sdk/src/TelegramClient.php(82): Telegram\Bot\TelegramClient->getResponse(Object(Telegram\Bot\TelegramRequest), Object(GuzzleHttp\Psr7\Response))
#5 /data/www/http/vendor/irazasyed/telegram-bot-sdk/src/Traits/Http.php(347): Telegram\Bot\TelegramClient->sendRequest(Object(Telegram\Bot\TelegramRequest))
#6 /data/www/http/vendor/irazasyed/telegram-bot-sdk/src/Traits/Http.php(240): Telegram\Bot\Api->sendRequest('POST', 'sendMessage', Array)
#7 /data/www/http/vendor/irazasyed/telegram-bot-sdk/src/Methods/Message.php(44): Telegram\Bot\Api->post('sendMessage', Array)
#8 /data/www/http/app/Http/Controllers/API/TelegramAPIController.php(72): Telegram\Bot\Api->sendMessage(Array)
#9 /data/www/http/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\API\TelegramAPIController->webhooking('8146798921', 'XkpjQ5WQbiFm0NC...', Object(Illuminate\Http\Request))
#10 /data/www/http/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('webhooking', Array)
#11 /data/www/http/vendor/laravel/framework/src/Illuminate/Routing/Route.php(219): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\API\TelegramAPIController), 'webhooking')
#12 /data/www/http/vendor/laravel/framework/src/Illuminate/Routing/Route.php(176): Illuminate\Routing\Route->runController()
#13 /data/www/http/vendor/laravel/framework/src/Illuminate/Routing/Router.php(681): Illuminate\Routing\Route->run()
#14 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#15 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#16 /data/www/http/vendor/laravel/framework/src/Illuminate/Routing/Router.php(683): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#17 /data/www/http/vendor/laravel/framework/src/Illuminate/Routing/Router.php(658): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#18 /data/www/http/vendor/laravel/framework/src/Illuminate/Routing/Router.php(624): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#19 /data/www/http/vendor/laravel/framework/src/Illuminate/Routing/Router.php(613): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#20 /data/www/http/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(170): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#21 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#22 /data/www/http/app/Http/Middleware/LogExecutionTime.php(20): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#23 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\LogExecutionTime->handle(Object(Illuminate\Http\Request), Object(Closure))
#24 /data/www/http/app/Http/Middleware/Check.php(48): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#25 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\Check->handle(Object(Illuminate\Http\Request), Object(Closure))
#26 /data/www/http/vendor/fruitcake/laravel-cors/src/HandleCors.php(52): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#27 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Fruitcake\Cors\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))
#28 /data/www/http/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#29 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#30 /data/www/http/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#31 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#32 /data/www/http/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#33 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#34 /data/www/http/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(63): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#35 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#36 /data/www/http/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#37 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
#38 /data/www/http/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#39 /data/www/http/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#40 /data/www/http/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#41 /data/www/http/public/index.php(55): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#42 {main}
"}
The text was updated successfully, but these errors were encountered: