1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-26 17:24:40 +01:00

Fix broadcasts

This commit is contained in:
Daniil Gentili 2023-12-07 19:09:09 +01:00
parent 49555b8fa7
commit 63f379e787

View File

@ -26,6 +26,7 @@ use Amp\Sync\LocalMutex;
use AssertionError;
use Closure;
use danog\Loop\PeriodicLoop;
use danog\MadelineProto\Broadcast\Progress;
use danog\MadelineProto\Db\DbPropertiesTrait;
use danog\MadelineProto\EventHandler\Attributes\Cron;
use danog\MadelineProto\EventHandler\Attributes\Handler;
@ -160,7 +161,7 @@ abstract class EventHandler extends AbstractAPI
$methods = [];
$handlers = [];
$has_any = false;
$basic_handler = static function (array $update, Closure $closure): void {
$basic_handler = static function (array|Progress $update, Closure $closure): void {
$closure($update);
};
foreach ((new ReflectionClass($this))->getMethods(ReflectionMethod::IS_PUBLIC) as $methodRefl) {
@ -178,7 +179,7 @@ abstract class EventHandler extends AbstractAPI
|| $method_name === 'updateNewOutgoingEncryptedMessage'
) {
$methods[$method_name] = [
static function (array $update) use ($basic_handler, $closure): void {
static function (array|Progress $update) use ($basic_handler, $closure): void {
EventLoop::queue($basic_handler, $update, $closure);
},
];