-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
82 additions
and
20 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
nutgram: | ||
# The Telegram bot token | ||
token: '%env(string:NUTGRAM_TOKEN)%' | ||
|
||
# If true, the webhook mode validates the incoming IP range is from a Telegram server | ||
safe_mode: false | ||
|
||
# Extra or specific configuration | ||
config: [ ] | ||
|
||
# If the nutgram bundle should automatically load the routes from config/telegram.php | ||
routes: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
services: | ||
|
||
SergiX44\Nutgram\Symfony\DependencyInjection\Factory\NutgramFactory: ~ | ||
SergiX44\NutgramBundle\DependencyInjection\Factory\NutgramFactory: ~ | ||
|
||
SergiX44\Nutgram\Symfony\NutgramConfigurator: | ||
SergiX44\NutgramBundle\NutgramConfigurator: | ||
autowire: true | ||
arguments: [ '%nutgram.config%' ] | ||
|
||
SergiX44\Nutgram\Nutgram: | ||
autowire: true | ||
public: true | ||
factory: [ '@SergiX44\Nutgram\Symfony\DependencyInjection\Factory\NutgramFactory', 'createNutgram' ] | ||
factory: [ '@SergiX44\NutgramBundle\DependencyInjection\Factory\NutgramFactory', 'createNutgram' ] | ||
arguments: [ '%nutgram.config%', '@service_container' ] | ||
configurator: [ '@SergiX44\Nutgram\Symfony\NutgramConfigurator', 'configure' ] | ||
configurator: [ '@SergiX44\NutgramBundle\NutgramConfigurator', 'configure' ] | ||
|
||
SergiX44\Nutgram\Symfony\Console\: | ||
SergiX44\NutgramBundle\Console\: | ||
resource: '../src/Console/' | ||
autowire: true | ||
tags: [ 'console.command' ] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace SergiX44\NutgramBundle\Console; | ||
|
||
use Symfony\Component\Console\Attribute\AsCommand; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Style\SymfonyStyle; | ||
use Symfony\Component\HttpKernel\HttpKernel; | ||
use Symfony\Component\HttpKernel\KernelInterface; | ||
|
||
#[AsCommand( | ||
name: 'nutgram:init', | ||
description: 'Creates the route and the config file', | ||
)] | ||
class BundleInitCommand extends Command | ||
{ | ||
|
||
private KernelInterface $kernel; | ||
|
||
public function __construct(KernelInterface $kernel, string $name = null) | ||
{ | ||
parent::__construct($name); | ||
$this->kernel = $kernel; | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$io = new SymfonyStyle($input, $output); | ||
|
||
$configDir = $this->kernel->getProjectDir().'/config/'; | ||
|
||
$config = "$configDir/packages/nutgram.yaml"; | ||
if (!file_exists($config)) { | ||
copy(__DIR__.'/../../config/nutgram.yaml', $config); | ||
} | ||
|
||
$routes = "$configDir/telegram.php"; | ||
if (!file_exists($routes)) { | ||
copy(__DIR__.'/../../config/telegram.php', $routes); | ||
} | ||
|
||
$io->success('Config and routes files created!'); | ||
|
||
return Command::SUCCESS; | ||
} | ||
} |
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
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
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
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
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
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
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
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
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
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
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