Skip to content

Commit

Permalink
Texts and small fixes for setcommands command
Browse files Browse the repository at this point in the history
  • Loading branch information
luzrain committed Sep 25, 2023
1 parent 9abb164 commit 449ec02
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/TelegramBot/Command/ButtonSetCommandsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

if ($commands === []) {
$io->warning('Could not find publish commands');
$io->warning('Could not find any commands to publish');

return Command::SUCCESS;
}
Expand All @@ -67,7 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return Command::FAILURE;
}

$io->success('Bot\'s menu button set');
$io->success('Bot\'s menu button has been set');

return Command::SUCCESS;
}
Expand Down
9 changes: 3 additions & 6 deletions src/TelegramBot/CommandMetadataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,16 @@ public function __construct(
}

/**
* @return list<OnCommand>
* @return \Generator<OnCommand>
*/
public function gelMetadataList(): array
public function gelMetadataList(): \Generator
{
$list = [];
foreach ($this->controllersMap as ['controller' => $controller]) {
$command = $this->instantiateAttribute($controller);
if ($command !== null) {
$list[] = $command;
yield $command;
}
}

return $list;
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/TelegramBot/LongPollingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
final class LongPollingService
{
private const LIMIT = 50;

private int $timeout = 15;
private int $offset = 0;

Expand Down
3 changes: 2 additions & 1 deletion tests/CommandMetadataProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ final class CommandMetadataProviderTest extends KernelTestCase
{
public function testCommandsMetadata(): void
{
/** @var CommandMetadataProvider $commandMetadataProvider */
$commandMetadataProvider = self::getContainer()->get('telegram_bot.command_metadata_provider');
$list = $commandMetadataProvider->gelMetadataList();
$list = iterator_to_array($commandMetadataProvider->gelMetadataList());

$this->assertCount(4, $list);
$this->assertObjectInArray(new OnCommand('/start', '', false, 0), $list);
Expand Down

0 comments on commit 449ec02

Please sign in to comment.