1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-26 23:14:38 +01:00

Add support for invokeWithBusinessConnection

This commit is contained in:
Daniil Gentili 2024-07-02 15:57:46 +02:00
parent 62b06f1bf0
commit b4e0a7823a
4 changed files with 13 additions and 1 deletions

View File

@ -565,6 +565,11 @@ final class Connection
'invokeWithTakeout', 'invokeWithTakeout',
['takeout_id' => $message->takeoutId, 'query' => $body], ['takeout_id' => $message->takeoutId, 'query' => $body],
); );
} elseif ($message->businessConnectionId !== null) {
$body = $this->API->getTL()->serializeMethod(
'invokeWithBusinessConnection',
['connection_id' => $message->businessConnectionId, 'query' => $body],
);
} }
} else { } else {
$body['_'] = $message->constructor; $body['_'] = $message->constructor;

View File

@ -124,6 +124,7 @@ class MTProtoOutgoingMessage extends MTProtoMessage
*/ */
public readonly ?int $floodWaitLimit = null, public readonly ?int $floodWaitLimit = null,
public readonly ?int $takeoutId = null, public readonly ?int $takeoutId = null,
public readonly ?string $businessConnectionId = null,
private ?DeferredFuture $resultDeferred = null, private ?DeferredFuture $resultDeferred = null,
public readonly ?Cancellation $cancellation = null public readonly ?Cancellation $cancellation = null
) { ) {

View File

@ -176,7 +176,8 @@ trait CallHandler
floodWaitLimit: $args['floodWaitLimit'] ?? null, floodWaitLimit: $args['floodWaitLimit'] ?? null,
resultDeferred: $response, resultDeferred: $response,
cancellation: $cancellation, cancellation: $cancellation,
takeoutId: $args['takeoutId'] ?? null takeoutId: $args['takeoutId'] ?? null,
businessConnectionId: $args['businessConnectionId'] ?? null,
); );
if ($queueId !== null) { if ($queueId !== null) {
$this->callQueue[$queueId] = $message; $this->callQueue[$queueId] = $message;

View File

@ -388,6 +388,11 @@ final class Blacklist {
$signature []= "?int \$takeoutId = null"; $signature []= "?int \$takeoutId = null";
} }
if (\in_array($method, ['messages.sendMessage', 'messages.editMessage', 'messages.sendMedia', 'messages.sendMultiMedia', 'messages.setTyping'], true)) {
$contents .= " * @param ?string \$businessConnectionId Business connection ID, received through an updateBotBusinessConnect update.\n";
$signature []= "?string \$businessConnectionId = null";
}
return [$contents, $signature]; return [$contents, $signature];
} }
/** /**