mirror of
https://github.com/danog/MadelineProto.git
synced 2025-01-22 21:31:28 +01:00
Transform all Peer constructors to integers
This commit is contained in:
parent
831e2b5ae4
commit
f3403a5a1c
@ -101,6 +101,8 @@ Want to add your own open-source project to this list? [Click here!](https://doc
|
||||
* [Plugins](https://docs.madelineproto.xyz/docs/PLUGINS.html)
|
||||
* [Cron](https://docs.madelineproto.xyz/docs/UPDATES.html#cron)
|
||||
* [Persisting data and IPC](https://docs.madelineproto.xyz/docs/UPDATES.html#persisting-data-and-ipc)
|
||||
* [Built-in ORM](https://docs.madelineproto.xyz/docs/UPDATES.html#built-in-orm)
|
||||
* [IPC](https://docs.madelineproto.xyz/docs/UPDATES.html#ipc)
|
||||
* [Restarting](https://docs.madelineproto.xyz/docs/UPDATES.html#restarting)
|
||||
* [Self-restart on webhosts](https://docs.madelineproto.xyz/docs/UPDATES.html#self-restart-on-webhosts)
|
||||
* [Multi-account](https://docs.madelineproto.xyz/docs/UPDATES.html#multiaccount)
|
||||
|
2
docs
2
docs
@ -1 +1 @@
|
||||
Subproject commit 236caa60f4a1cb53b6758b5a9bb52a5211fad30b
|
||||
Subproject commit 6c0727bb47ad6c8f830dd22d64dcb851ea31bf07
|
@ -23,6 +23,8 @@ use Traversable;
|
||||
/**
|
||||
* DB array interface.
|
||||
*
|
||||
* @psalm-type TOrmConfig=array{serializer?: SerializerType, enableCache?: bool, cacheTtl?: int, table?: string}
|
||||
*
|
||||
* @template TKey as array-key
|
||||
* @template TValue
|
||||
*
|
||||
|
@ -27,7 +27,7 @@ use function Amp\Future\await;
|
||||
*
|
||||
* You will have to define a `$dbProperties` static array property, with a list of properties you want to store to a database.
|
||||
*
|
||||
* @psalm-type TOrmConfig=array{serializer?: SerializerType, enableCache?: bool, cacheTtl?: int}
|
||||
* @psalm-import-type TOrmConfig from DbArray
|
||||
* @property array<string, TOrmConfig> $dbProperties
|
||||
*/
|
||||
trait DbPropertiesTrait
|
||||
|
@ -231,9 +231,9 @@ trait PeerHandler
|
||||
case 'messageService':
|
||||
if (!isset($id['from_id']) // No other option
|
||||
// It's a channel/chat, 100% what we need
|
||||
|| $id['peer_id']['_'] !== 'peerUser'
|
||||
|| $id['peer_id'] < 0
|
||||
// It is a user, and it's not ourselves
|
||||
|| $id['peer_id']['user_id'] !== $this->authorization['user']['id']
|
||||
|| $id['peer_id'] !== $this->authorization['user']['id']
|
||||
) {
|
||||
return $this->getIdInternal($id['peer_id']);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ use danog\MadelineProto\Lang;
|
||||
use danog\MadelineProto\Logger;
|
||||
use danog\MadelineProto\MTProto;
|
||||
use danog\MadelineProto\MTProto\MTProtoOutgoingMessage;
|
||||
use danog\MadelineProto\MTProtoTools\DialogId;
|
||||
use danog\MadelineProto\SecurityException;
|
||||
use danog\MadelineProto\Settings\TLSchema;
|
||||
use danog\MadelineProto\TL\Types\Button;
|
||||
@ -1056,6 +1057,12 @@ final class TL implements TLInterface
|
||||
$x['reply_markup']['rows'][$key]['buttons'][$bkey] = new Types\Button($this->API, $x, $button);
|
||||
}
|
||||
}
|
||||
} elseif ($x['_'] === 'peerUser') {
|
||||
$x = $x['user_id'];
|
||||
} elseif ($x['_'] === 'peerChat') {
|
||||
$x = -$x['chat_id'];
|
||||
} elseif ($x['_'] === 'peerChannel') {
|
||||
$x = DialogId::toSupergroupOrChannel($x['channel_id']);
|
||||
}
|
||||
unset($x['flags'], $x['flags2']);
|
||||
return $x;
|
||||
|
@ -63,9 +63,9 @@ final class Button extends IpcCapable implements JsonSerializable, ArrayAccess
|
||||
parent::__construct($API);
|
||||
if (!isset($message['from_id']) // No other option
|
||||
// It's a channel/chat, 100% what we need
|
||||
|| $message['peer_id']['_'] !== 'peerUser'
|
||||
|| $message['peer_id'] < 0
|
||||
// It is a user, and it's not ourselves
|
||||
|| $message['peer_id']['user_id'] !== $API->authorization['user']['id']
|
||||
|| $message['peer_id'] !== $API->authorization['user']['id']
|
||||
) {
|
||||
$this->peer = $message['peer_id'];
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user