diff --git a/src/Connection.php b/src/Connection.php index 6cd7f5313..0a00ec07e 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -565,6 +565,11 @@ final class Connection 'invokeWithTakeout', ['takeout_id' => $message->takeoutId, 'query' => $body], ); + } elseif ($message->businessConnectionId !== null) { + $body = $this->API->getTL()->serializeMethod( + 'invokeWithBusinessConnection', + ['connection_id' => $message->businessConnectionId, 'query' => $body], + ); } } else { $body['_'] = $message->constructor; diff --git a/src/MTProto/MTProtoOutgoingMessage.php b/src/MTProto/MTProtoOutgoingMessage.php index 92cd12100..47ca658a9 100644 --- a/src/MTProto/MTProtoOutgoingMessage.php +++ b/src/MTProto/MTProtoOutgoingMessage.php @@ -124,6 +124,7 @@ class MTProtoOutgoingMessage extends MTProtoMessage */ public readonly ?int $floodWaitLimit = null, public readonly ?int $takeoutId = null, + public readonly ?string $businessConnectionId = null, private ?DeferredFuture $resultDeferred = null, public readonly ?Cancellation $cancellation = null ) { diff --git a/src/MTProtoSession/CallHandler.php b/src/MTProtoSession/CallHandler.php index 0abe55a06..7194144e6 100644 --- a/src/MTProtoSession/CallHandler.php +++ b/src/MTProtoSession/CallHandler.php @@ -176,7 +176,8 @@ trait CallHandler floodWaitLimit: $args['floodWaitLimit'] ?? null, resultDeferred: $response, cancellation: $cancellation, - takeoutId: $args['takeoutId'] ?? null + takeoutId: $args['takeoutId'] ?? null, + businessConnectionId: $args['businessConnectionId'] ?? null, ); if ($queueId !== null) { $this->callQueue[$queueId] = $message; diff --git a/tools/AnnotationsBuilder.php b/tools/AnnotationsBuilder.php index 5977281cb..dd1e0b0b0 100644 --- a/tools/AnnotationsBuilder.php +++ b/tools/AnnotationsBuilder.php @@ -388,6 +388,11 @@ final class Blacklist { $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]; } /**