php-telegram-bot / laravel Goto Github PK
View Code? Open in Web Editor NEWLaravel package for PHP Telegram Bot Library
License: Other
Laravel package for PHP Telegram Bot Library
License: Other
Support laravel 6.0?
I have created new Laravel 8 project. Nothing changed. Laravel is fresh. And run command:
composer require php-telegram-bot/laravel
it returns error like this:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires php-telegram-bot/laravel ^0.0.1 -> satisfiable by php-telegram-bot/laravel[0.0.1].
- php-telegram-bot/laravel 0.0.1 requires illuminate/database 5.* -> found illuminate/database[v5.0.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require.
Problem 2
- symfony/deprecation-contracts v3.1.1 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
- fakerphp/faker v1.19.0 requires symfony/deprecation-contracts ^2.2 || ^3.0 -> satisfiable by symfony/deprecation-contracts[v3.1.1].
- fakerphp/faker is locked to version v1.19.0 and an update of this package was not requested.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require php-telegram-bot/laravel:*" to figure out if any version is installable, or "composer require php-telegram-bot/laravel:^2.1" if you know which you need.
I cannot override this class, which means this repository is useless. Bot only on commands. What century is this? I need to handle messages and menu navigation as a regex
Hi there,
its been a while and there are no example on how to used it? Maybe We can get one example of working command? Thanks?
Hello, I have been using the package for some time, and now I want to add more bots, like I want to create new controller for another bot which will have its own commands and stuff, any idea?
Need to sync migrations or delete all migrations and use sql file from core repo.
I am developing locally to do PR so in the future. But I can not install the package due to dependency conflict. An update to php-telegram-bot/core is required.
Sorry for bad English.
Problem 1
- php-telegram-bot/laravel dev-dev requires longman/telegram-bot ^0.60 -> satisfiable by longman/telegram-bot[0.60.0].
- Installation request for php-telegram-bot/laravel dev-dev -> satisfiable by php-telegram-bot/laravel[dev-dev].
- Conclusion: remove monolog/monolog 2.0.0
- Conclusion: don't install monolog/monolog 2.0.0
- longman/telegram-bot 0.60.0 requires monolog/monolog ^1.24 -> satisfiable by monolog/monolog[1.24.0, 1.25.0, 1.25.1, 1.x-dev].
- Can only install one of: monolog/monolog[1.24.0, 2.0.0].
- Can only install one of: monolog/monolog[1.25.0, 2.0.0].
- Can only install one of: monolog/monolog[1.25.1, 2.0.0].
- Can only install one of: monolog/monolog[1.x-dev, 2.0.0].
- Installation request for monolog/monolog (locked at 2.0.0) -> satisfiable by monolog/monolog[2.0.0].
composer require php-telegram-bot/laravel
Print Errors:
Problem 1
- Root composer.json requires php-telegram-bot/laravel ^0.0.1 -> satisfiable by php-telegram-bot/laravel[0.0.1].
- php-telegram-bot/laravel 0.0.1 requires illuminate/database 5.* -> found illuminate/database[v5.0.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require.
This repo may be install on new version Laravel 9 ?
I'm using php 8 to work with laravel 8. And I'm getting this error while installing:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- longman/telegram-bot 0.53.0 requires php ^5.5|^7.0 -> your php version (8.0.7) does not satisfy that requirement.
- php-telegram-bot/laravel 0.0.1 requires longman/telegram-bot ^0.53.0 -> satisfiable by longman/telegram-bot[0.53.0].
- Root composer.json requires php-telegram-bot/laravel ^0.0.1 -> satisfiable by php-telegram-bot/laravel[0.0.1].
Installation failed, deleting ./composer.json.
Hi I try install package but I get this errors. Its fresh install only laravel and this package
This my composer.json
"require": {
"php": "^7.3|^8.0",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.54",
"laravel/sanctum": "^2.11",
"laravel/tinker": "^2.5",
"longman/telegram-bot": "^0.74.0",
"php-telegram-bot/laravel": "^1.0"
},
Problem 1
- php-telegram-bot/laravel[1.1.0, ..., 1.1.1] require illuminate/database ^6.0 -> found illuminate/database[v6.0.0, ..., 6.x-dev] but these were not loaded, likely because it conflicts with another require.
- Root composer.json requires php-telegram-bot/laravel ^1.1 -> satisfiable by php-telegram-bot/laravel[1.1.0, 1.1.1].
I successful handled commands but I cannot receive generic message (like "hello!")
would need to receive them too
is it possible?
Laravel 10 requires illuminate/support 10
composer.org has only published version 2.0.3
https://packagist.org/packages/php-telegram-bot/laravel#v2.0.3
in which it only supports illuminate/support 7,8,9
which makes a conflict when installing. Can you publish 2.0.4 with illuminate/support 10 included?
Hello,
I am getting this error sometimes, I don't know what the problem is, I searched and saw some people was having the problem and some had reported it was due to blocked telegram in some countries but since my server was in germany and I also could make some requests and it only failed sometimes, for example I was not able to run /debug command and it always failed, but when I ran all the codes in debug command from an other route (not as a command) it worked fine! anyways to solve the problem I had to add the following code to Request.php file in send function before self::execute and it solved my problem but since I have edited core files I thought it would be good to report the problem Im having. I have been using the library on my laravel project for more than a year and didn't have this problem until yesterday and I haven't updated anything on my server. the code I added:
\Longman\TelegramBot\Request::setClient(new Client([ 'base_uri' => 'https://api.telegram.org', ]));
Hello,
when i use this script (version 1.1.1) and use the following code i get a DB error
Do i need to create users in the DB first or how does it works?
use PhpTelegramBot\Laravel\PhpTelegramBotContract;
class TelegramWebhookController extends Controller
{
public function HandleWebhook(PhpTelegramBotContract $telegramBot)
{
$telegramBot->handle();
}
2020-01-11 19:43:46] local.ERROR: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'first_name' in 'field list' {"exception":"[object]
(Longman\\TelegramBot\\Exception\\TelegramException(code: 0): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'first_name' in 'field list' at
/home/{USER}/domains/{DOMAIN}/laravel/vendor/longman/telegram-bot/src/DB.php:498)
i'm using laravel 6.10
Here are my settings
(
[version:protected] => 0.60.0
[api_key:protected] => *****
[bot_username:protected] => *****
[bot_id:protected] => *****
[input:protected] =>
[commands_paths:protected] => Array
(
[0] => /home/{user}/domains/{domain}/laravel/vendor/longman/telegram-bot/src/Commands/SystemCommands
)
[update:protected] =>
[upload_path:protected] =>
[download_path:protected] =>
[mysql_enabled:protected] => 1
[pdo:protected] => PDO Object
(
)
[commands_config:protected] => Array
(
)
[admins_list:protected] => Array
(
)
[last_command_response:protected] =>
[run_commands:protected] =>
[getupdates_without_database:protected] =>
[last_update_id:protected] =>
)
class DashboardController extends Controller
{
$results = DB::selectChats([
'groups' => true,
'supergroups' => true,
'channels' => true,
'users' => true,
'text' => null
]);
dd($results); //false
}
dd($results); //false
Hey! There is a problem i was found at TelegramFetchCommand.php
while (true) {
$response = rescue(fn() => $bot->handleGetUpdates($options));
if ($response !== null && ! $response->isOk()) {
$this->error($response->getDescription());
}
}
setting timeout option doesn't delay while response will be ok . It means if you lost connection with db for some time, you got error log cycling.
Seems this package has not been updated in a while.
It time make an update guys.
its not this artisan file how can i test this project ???
Hi there,
Will support this project, however wondering how can I implement the commands etc..Maybe we can have example too for the laravel program.
Need to get more info on where we need to add TOKENBOT etc...
Thanks..
I've get confused when bot was silent on webhook method. DB updates correct. But bot don't answer on any command. So I desided to test on update method and got the same =( DB updating with correct recieving data from telegram, but don't answer. So I add Request::sendMessage
to handleGetUpdates()
in my controller to check if there any connect problems with telegram on my side:
public function handleGetUpdates(PhpTelegramBotContract $telegram)
{
try {
\Longman\TelegramBot\Request::initialize($telegram);
\Longman\TelegramBot\Request::sendMessage(["chat_id" => "MY_TG_ID", "text" => "123"]);
return $telegram->handleGetUpdates();
} catch (TelegramException $e) {
TelegramLog::error($e->getMessage());
}
}
But bot breakes the silence)
So I thing there is some problems with Command factory, but I can't find where. Can somebody help me with this?
Hi. I'm getting this error in Lumen:
Argument 1 passed to PhpTelegramBot\Laravel\PhpTelegramBotServiceProvider::PhpTelegramBot\Laravel{closure}() must be an instance of Illuminate\Contracts\Foundation\Application, instance of Laravel\Lumen\Application given, called in /vendor/illuminate/container/Container.php on line 776 in /vendor/php-telegram-bot/laravel/src/Laravel/PhpTelegramBotServiceProvider.php:55
Cannot run migrations of a fresh database:
bash-5.1# php artisan migrate
Migrating: 2018_04_18_193554_create_botan_shortener_table
Migrated: 2018_04_18_193554_create_botan_shortener_table (73.51ms)
Migrating: 2018_04_18_193554_create_callback_query_table
Illuminate\Database\QueryException
SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation "user_id" already exists (SQL: create index "user_id" on "callback_query" ("user_id"))
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:703
699▕ // If an exception occurs when attempting to run a query, we'll format the error
700▕ // message to include the bindings with SQL, which will make this exception a
701▕ // lot more helpful to the developer instead of just the database's errors.
702▕ catch (Exception $e) {
➜ 703▕ throw new QueryException(
704▕ $query, $this->prepareBindings($bindings), $e
705▕ );
706▕ }
707▕ }
+9 vendor frames
10 modules/Bot/database/migrations/2018_04_18_193554_create_callback_query_table.php:22
Illuminate\Support\Facades\Facade::__callStatic("create")
+22 vendor frames
33 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
Usage of ->index('user_id')
function causes this issue. Index should have an unique name or is better to omit index name in this function call. Also there are a lot of ->index('chat_id')
usages that also will cause the same trouble.
Hello, I have been using the package for some time, and now I want to add more bots, like I want to create new console command for another bot which will have its own fetch loop, any idea?
When the packege will be updated for Laravel 9 and php 8.1 ?
Or how to install the package in Laravel 9 now ?
I have created a project with Laravel 6.6.0 and require the library with command composer require php-telegram-bot/laravel
. The error occurs.
$ composer require php-telegram-bot/laravel
Using version ^1.1 for php-telegram-bot/laravel
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for monolog/monolog (locked at 2.0.1) -> satisfiable by monolog/monolog[2.0.1].
- php-telegram-bot/laravel 1.1.0 requires longman/telegram-bot ^0.60 -> satisfiable by longman/telegram-bot[0.60.0].
- php-telegram-bot/laravel 1.1.1 requires longman/telegram-bot ^0.60 -> satisfiable by longman/telegram-bot[0.60.0].
- Conclusion: don't install longman/telegram-bot 0.60.0
- Installation request for php-telegram-bot/laravel ^1.1 -> satisfiable by php-telegram-bot/laravel[1.1.0, 1.1.1].
Installation failed, reverting ./composer.json to its original content.
Hello, i have a fresh setup of laravel 10 and php-telegram-bot/laravel
In .env i provided api_key and username.
In web.php i tried to use this:
use PhpTelegramBot\Laravel\PhpTelegramBotContract;
Route::post('/webhook', function (PhpTelegramBotContract $telegramBot) {
return $telegramBot->handle();
});
But i have an error.
ReflectionException: Class "PhpTelegramBot\Laravel\PhpTelegramBotContract" does not exist in file D:\OpenServer\domains\aml-bot\vendor\laravel\framework\src\Illuminate\Routing\ResolvesRouteDependencies.php on line 81
In previous version (laravel 9 and php-telegram-bot/laravel v 2.0.3) i don`t have such errors. Please, help me.
How to work with this? There is no instruction here on how the received data is processed during :fetch. How can I test the bot locally? What format are the requests? How to link a bot to a controller? How to use the created commands?
We should test a clean setup with this package and bring everything up to date.
The readme should explain the needed steps and additionally the optional steps and should explicitly mark them as optional including an explanation why you could need it in special circumstances.
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.