Last active
June 20, 2022 16:24
-
-
Save greenplugin/09179bee606aa01b1ee00d049ab78fc4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parameters: | |
telegram.token: '%env(TELEGRAM_TOKEN)%' | |
telegram.webhook_secret: '%env(TELEGRAM_WEBHOOK_SECRET)%' | |
services: | |
GuzzleHttp\Client: | |
arguments: | |
- { timeout: 120} | |
Http\Factory\Guzzle\RequestFactory: | |
Http\Factory\Guzzle\StreamFactory: | |
Psr\Http\Message\RequestFactoryInterface: '@Http\Factory\Guzzle\RequestFactory' | |
Psr\Http\Message\StreamFactoryInterface: '@Http\Factory\Guzzle\StreamFactory' | |
Http\Adapter\Guzzle6\Client: | |
arguments: | |
- '@GuzzleHttp\Client' | |
Psr\Http\Client\ClientInterface: '@Http\Adapter\Guzzle6\Client' | |
TgBotApi\BotApiBase\BotApiNormalizer: | |
TgBotApi\BotApiBase\NormalizerInterface: '@TgBotApi\BotApiBase\BotApiNormalizer' | |
TgBotApi\BotApiBase\ApiClientInterface: | |
class: TgBotApi\BotApiBase\ApiClient | |
arguments: | |
- '@Psr\Http\Message\RequestFactoryInterface' | |
- '@Psr\Http\Message\StreamFactoryInterface' | |
- '@Psr\Http\Client\ClientInterface' | |
TgBotApi\BotApiBase\WebhookFetcherInterface: | |
class: TgBotApi\BotApiBase\WebhookFetcher | |
arguments: | |
- '@TgBotApi\BotApiBase\NormalizerInterface' | |
TgBotApi\BotApiBase\BotApiInterface: | |
class: TgBotApi\BotApiBase\BotApiComplete | |
arguments: | |
- '%telegram.token%' | |
- '@TgBotApi\BotApiBase\ApiClientInterface' | |
- '@TgBotApi\BotApiBase\NormalizerInterface' |
I think we can add another readme to repository named like README.SYMFONY.md
and add link to main readme.
How to create a new bot
$botKey = '';
$requestFactory = new Http\Factory\Guzzle\RequestFactory();
$streamFactory = new Http\Factory\Guzzle\StreamFactory();
$client = new Http\Adapter\Guzzle6\Client();
$apiClient = new \TgBotApi\BotApiBase\ApiClient($requestFactory, $streamFactory, $client);
$bot = new \TgBotApi\BotApiBase\BotApi($botKey, $apiClient, new \TgBotApi\BotApiBase\BotApiNormalizer());
$userId = '';
$bot->send(\TgBotApi\BotApiBase\Method\SendMessageMethod::create($userId, 'Hi'));
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yep, it can be simplified, I'ts old example. Please, write if you will have a time, I'll update readme.
We have a symfony flex receipe.