Skip to content

Commit 46f10bf

Browse files
committed
update ListenCommand for development mode and adjust nutgram dependency
1 parent 6c3ab43 commit 46f10bf

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"require": {
3131
"php": "^8.2",
3232
"nunomaduro/termwind": "^1.0|^2.0",
33-
"nutgram/nutgram": "dev-single-polling-update"
33+
"nutgram/nutgram": "^4.20"
3434
},
3535
"require-dev": {
3636
"illuminate/testing": "^9.0|^10.0|^11.0|^12.0",

src/Console/ListenCommand.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,21 @@
88

99
class ListenCommand extends Command
1010
{
11-
protected $signature = 'nutgram:listen';
11+
protected $signature = 'nutgram:listen {--pollingTimeout=1}';
1212

1313
protected $description = 'Start the bot for development and reloads after every update.';
1414

1515
public function handle(): void
1616
{
17+
$this->warn('This running mode is very inefficient and only suitable for development purposes. DO NOT USE IN PRODUCTION!');
1718
$this->info('Listening...');
19+
20+
$pollingTimeout = $this->option('pollingTimeout') ?: 1;
21+
config()?->set('nutgram.config.polling.timeout', $pollingTimeout);
1822
while (true) {
23+
if (function_exists('opcache_reset')) {
24+
opcache_reset();
25+
}
1926
app()->forgetInstance(Nutgram::class);
2027
$bot = app(Nutgram::class);
2128
$bot->setRunningMode(SingleUpdate::class);

0 commit comments

Comments
 (0)