mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 06:18:58 +01:00
cs-fix
This commit is contained in:
parent
9c3c52ce23
commit
296d9500ac
@ -5,9 +5,9 @@ Features:
|
|||||||
|
|
||||||
Fixes:
|
Fixes:
|
||||||
- Fixed simple filters with service messages.
|
- Fixed simple filters with service messages.
|
||||||
- Fixed IDE typehinting for `getEventHandler`
|
- Fixed IDE typehinting for `getEventHandler`.
|
||||||
- Fixed startAndLoopMulti
|
- Fixed startAndLoopMulti
|
||||||
- Tweaked the default drop timeout on media DCs to avoid timeout errors on slow networks
|
- Tweaked the default drop timeout on media DCs to avoid timeout errors on slow networks.
|
||||||
- Now the admin list only contains user report peers.
|
- Now the admin list only contains user report peers.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
2
docs
2
docs
@ -1 +1 @@
|
|||||||
Subproject commit 36fed16a6e3260dc30b0c116d56fe392de71f84b
|
Subproject commit beaafe9ef45ee1cc080a48fa565c4b63c7c64aa6
|
@ -28,7 +28,6 @@ use danog\MadelineProto\EventHandler\Filter\FilterCommand;
|
|||||||
use danog\MadelineProto\EventHandler\Filter\FilterRegex;
|
use danog\MadelineProto\EventHandler\Filter\FilterRegex;
|
||||||
use danog\MadelineProto\EventHandler\Filter\FilterText;
|
use danog\MadelineProto\EventHandler\Filter\FilterText;
|
||||||
use danog\MadelineProto\EventHandler\Message;
|
use danog\MadelineProto\EventHandler\Message;
|
||||||
use danog\MadelineProto\EventHandler\Message\Service\DialogMessagePinned;
|
|
||||||
use danog\MadelineProto\EventHandler\Message\Service\DialogPhotoChanged;
|
use danog\MadelineProto\EventHandler\Message\Service\DialogPhotoChanged;
|
||||||
use danog\MadelineProto\EventHandler\SimpleFilter\FromAdmin;
|
use danog\MadelineProto\EventHandler\SimpleFilter\FromAdmin;
|
||||||
use danog\MadelineProto\EventHandler\SimpleFilter\Incoming;
|
use danog\MadelineProto\EventHandler\SimpleFilter\Incoming;
|
||||||
@ -182,7 +181,6 @@ class MyEventHandler extends SimpleEventHandler
|
|||||||
$message->reply('hello');
|
$message->reply('hello');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the dialog photo of a chat or channel changes.
|
* Called when the dialog photo of a chat or channel changes.
|
||||||
*/
|
*/
|
||||||
@ -190,10 +188,9 @@ class MyEventHandler extends SimpleEventHandler
|
|||||||
public function logPhotoChanged(Incoming&DialogPhotoChanged $message): void
|
public function logPhotoChanged(Incoming&DialogPhotoChanged $message): void
|
||||||
{
|
{
|
||||||
if ($message->photo) {
|
if ($message->photo) {
|
||||||
$message->reply("Nice :D");
|
$message->reply("Nice! Here's a download link for the photo: ".$message->photo->getDownloadLink());
|
||||||
} else {
|
|
||||||
$message->reply("Aww, why did you delete the group photo? :(");
|
|
||||||
}
|
}
|
||||||
|
// The group photo was deleted
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
use danog\MadelineProto\API;
|
use danog\MadelineProto\API;
|
||||||
use danog\MadelineProto\EventHandler;
|
use danog\MadelineProto\EventHandler;
|
||||||
use danog\MadelineProto\Logger;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Various ways to load MadelineProto
|
* Various ways to load MadelineProto
|
||||||
|
@ -91,12 +91,13 @@ abstract class Filter
|
|||||||
HasSticker::class => new FilterSticker,
|
HasSticker::class => new FilterSticker,
|
||||||
HasVideo::class => new FilterVideo,
|
HasVideo::class => new FilterVideo,
|
||||||
HasVoice::class => new FilterVoice,
|
HasVoice::class => new FilterVoice,
|
||||||
default => is_subclass_of($type->getName(), Update::class)
|
default => \is_subclass_of($type->getName(), Update::class)
|
||||||
? new class($type->getName()) extends Filter {
|
? new class($type->getName()) extends Filter {
|
||||||
public function __construct(private readonly string $class)
|
public function __construct(private readonly string $class)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
public function apply(Update $update): bool {
|
public function apply(Update $update): bool
|
||||||
|
{
|
||||||
return $update instanceof $this->class;
|
return $update instanceof $this->class;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -652,7 +652,7 @@ abstract class InternalDoc
|
|||||||
return \danog\MadelineProto\Tools::genVectorHash($ints);
|
return \danog\MadelineProto\Tools::genVectorHash($ints);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get admin IDs (equal to the report peers).
|
* Get admin IDs (equal to all user report peers).
|
||||||
*/
|
*/
|
||||||
public function getAdminIds(): array
|
public function getAdminIds(): array
|
||||||
{
|
{
|
||||||
@ -785,7 +785,11 @@ abstract class InternalDoc
|
|||||||
/**
|
/**
|
||||||
* Get event handler (or plugin instance).
|
* Get event handler (or plugin instance).
|
||||||
*
|
*
|
||||||
* @param ?class-string<PluginEventHandler> $class
|
* @template T as EventHandler
|
||||||
|
*
|
||||||
|
* @param class-string<T>|null $class
|
||||||
|
*
|
||||||
|
* @return T|EventHandlerProxy|__PHP_Incomplete_Class|null
|
||||||
*/
|
*/
|
||||||
public function getEventHandler(?string $class = null): \danog\MadelineProto\EventHandler|\danog\MadelineProto\Ipc\EventHandlerProxy|\__PHP_Incomplete_Class|null
|
public function getEventHandler(?string $class = null): \danog\MadelineProto\EventHandler|\danog\MadelineProto\Ipc\EventHandlerProxy|\__PHP_Incomplete_Class|null
|
||||||
{
|
{
|
||||||
@ -1089,6 +1093,13 @@ abstract class InternalDoc
|
|||||||
{
|
{
|
||||||
return $this->wrapper->getAPI()->getWebMessage($message);
|
return $this->wrapper->getAPI()->getWebMessage($message);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Check if has admins.
|
||||||
|
*/
|
||||||
|
public function hasAdmins(): bool
|
||||||
|
{
|
||||||
|
return $this->wrapper->getAPI()->hasAdmins();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Check if an event handler instance is present.
|
* Check if an event handler instance is present.
|
||||||
*/
|
*/
|
||||||
@ -1985,7 +1996,7 @@ abstract class InternalDoc
|
|||||||
/**
|
/**
|
||||||
* Wrap a Message constructor into an abstract Message object.
|
* Wrap a Message constructor into an abstract Message object.
|
||||||
*/
|
*/
|
||||||
public function wrapMessage(array $message): ?\danog\MadelineProto\EventHandler\Message
|
public function wrapMessage(array $message): ?\danog\MadelineProto\EventHandler\AbstractMessage
|
||||||
{
|
{
|
||||||
return $this->wrapper->getAPI()->wrapMessage($message);
|
return $this->wrapper->getAPI()->wrapMessage($message);
|
||||||
}
|
}
|
||||||
|
@ -1682,7 +1682,7 @@ final class MTProto implements TLCallback, LoggerGetter
|
|||||||
public function setReportPeers(int|string|array $userOrId): void
|
public function setReportPeers(int|string|array $userOrId): void
|
||||||
{
|
{
|
||||||
$this->reportDest = $this->sanitizeReportPeers($userOrId);
|
$this->reportDest = $this->sanitizeReportPeers($userOrId);
|
||||||
$this->admins = array_values(array_filter($this->reportDest, fn (int $v) => $v > 0));
|
$this->admins = \array_values(\array_filter($this->reportDest, fn (int $v) => $v > 0));
|
||||||
}
|
}
|
||||||
private ?LocalMutex $reportMutex = null;
|
private ?LocalMutex $reportMutex = null;
|
||||||
/**
|
/**
|
||||||
|
@ -336,7 +336,7 @@ trait AuthKeyHandler
|
|||||||
* Generate auth_key
|
* Generate auth_key
|
||||||
*/
|
*/
|
||||||
$this->logger->logger(
|
$this->logger->logger(
|
||||||
extension_loaded('gmp') ? 'Generating authorization key...' : 'Generating authorization key (install gmp to speed up this process)...',
|
\extension_loaded('gmp') ? 'Generating authorization key...' : 'Generating authorization key (install gmp to speed up this process)...',
|
||||||
Logger::VERBOSE
|
Logger::VERBOSE
|
||||||
);
|
);
|
||||||
$auth_key = $g_a->powMod($b, $dh_prime);
|
$auth_key = $g_a->powMod($b, $dh_prime);
|
||||||
|
@ -24,7 +24,6 @@ use Amp\DeferredFuture;
|
|||||||
use danog\MadelineProto\MTProto\Container;
|
use danog\MadelineProto\MTProto\Container;
|
||||||
use danog\MadelineProto\MTProto\MTProtoOutgoingMessage;
|
use danog\MadelineProto\MTProto\MTProtoOutgoingMessage;
|
||||||
use danog\MadelineProto\TL\Exception;
|
use danog\MadelineProto\TL\Exception;
|
||||||
use danog\MadelineProto\Tools;
|
|
||||||
use danog\MadelineProto\WrappedFuture;
|
use danog\MadelineProto\WrappedFuture;
|
||||||
use Revolt\EventLoop;
|
use Revolt\EventLoop;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user