UPSTREAM BASELINE: nextcloud/spreed v22.0.12 (без изменений)
Type checking / changes (push) Has been cancelled
Type checking / test (push) Has been cancelled
Type checking / typescript-summary (push) Has been cancelled
Node tests / changes (push) Has been cancelled
Node tests / test (push) Has been cancelled
Node tests / test-summary (push) Has been cancelled
Type checking / changes (push) Has been cancelled
Type checking / test (push) Has been cancelled
Type checking / typescript-summary (push) Has been cancelled
Node tests / changes (push) Has been cancelled
Node tests / test (push) Has been cancelled
Node tests / test-summary (push) Has been cancelled
Источник: https://github.com/nextcloud/spreed/archive/refs/tags/v22.0.12.tar.gz С этого коммита ветка официального Nextcloud Talk отрезана (решение владельца 2026-07-06). Все дальнейшие изменения — только наши; версии релизов: 22.0.12-f7.N.
This commit is contained in:
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\Talk\Events;
|
||||
|
||||
use OCP\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* @psalm-type ChatMessageParentData = array{
|
||||
* type: 'Note',
|
||||
* actor: array{
|
||||
* type: 'Person',
|
||||
* id: non-empty-string,
|
||||
* name: non-empty-string,
|
||||
* },
|
||||
* object: array{
|
||||
* type: 'Note',
|
||||
* id: numeric-string,
|
||||
* name: string,
|
||||
* content: non-empty-string,
|
||||
* mediaType: 'text/markdown'|'text/plain',
|
||||
* },
|
||||
* }
|
||||
* @psalm-type ChatMessageData = array{
|
||||
* type: 'Activity'|'Create',
|
||||
* actor: array{
|
||||
* type: 'Person',
|
||||
* id: non-empty-string,
|
||||
* name: non-empty-string,
|
||||
* talkParticipantType: numeric-string,
|
||||
* },
|
||||
* object: array{
|
||||
* type: 'Note',
|
||||
* id: numeric-string,
|
||||
* name: string,
|
||||
* content: non-empty-string,
|
||||
* mediaType: 'text/markdown'|'text/plain',
|
||||
* inReplyTo?: ChatMessageParentData,
|
||||
* threadId?: int,
|
||||
* },
|
||||
* target: array{
|
||||
* type: 'Collection',
|
||||
* id: non-empty-string,
|
||||
* name: non-empty-string,
|
||||
* },
|
||||
* }
|
||||
* @psalm-type ReactionMessageData = array{
|
||||
* type: 'Like',
|
||||
* actor: array{
|
||||
* type: 'Person',
|
||||
* id: non-empty-string,
|
||||
* name: non-empty-string,
|
||||
* talkParticipantType?: numeric-string,
|
||||
* },
|
||||
* object: array{
|
||||
* type: 'Note',
|
||||
* id: numeric-string,
|
||||
* name: string,
|
||||
* content: non-empty-string,
|
||||
* mediaType: 'text/markdown'|'text/plain',
|
||||
* inReplyTo?: ChatMessageParentData,
|
||||
* },
|
||||
* target: array{
|
||||
* type: 'Collection',
|
||||
* id: non-empty-string,
|
||||
* name: non-empty-string,
|
||||
* },
|
||||
* content: string,
|
||||
* }
|
||||
* @psalm-type UndoReactionMessageData = array{
|
||||
* type: 'Undo',
|
||||
* actor: array{
|
||||
* type: 'Person',
|
||||
* id: non-empty-string,
|
||||
* name: non-empty-string,
|
||||
* talkParticipantType?: numeric-string,
|
||||
* },
|
||||
* object: ReactionMessageData,
|
||||
* target: array{
|
||||
* type: 'Collection',
|
||||
* id: non-empty-string,
|
||||
* name: non-empty-string,
|
||||
* },
|
||||
* }
|
||||
* @psalm-type BotManagementData = array{
|
||||
* type: 'Join'|'Leave',
|
||||
* actor: array{
|
||||
* type: 'Application',
|
||||
* id: non-empty-string,
|
||||
* name: non-empty-string,
|
||||
* },
|
||||
* object: array{
|
||||
* type: 'Collection',
|
||||
* id: non-empty-string,
|
||||
* name: non-empty-string,
|
||||
* },
|
||||
* }
|
||||
* @psalm-type InvocationData = ChatMessageData|ReactionMessageData|UndoReactionMessageData|BotManagementData
|
||||
*/
|
||||
class BotInvokeEvent extends Event {
|
||||
/** @var list<string> */
|
||||
protected array $reactions = [];
|
||||
/** @var list<array{message: string, referenceId: string, reply: bool|int, thread: bool, threadTitle: ?string, silent: bool}> */
|
||||
protected array $answers = [];
|
||||
|
||||
/**
|
||||
* @param InvocationData $message
|
||||
*/
|
||||
public function __construct(
|
||||
protected string $botUrl,
|
||||
protected array $message,
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getBotUrl(): string {
|
||||
return $this->botUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return InvocationData
|
||||
*/
|
||||
public function getMessage(): array {
|
||||
return $this->message;
|
||||
}
|
||||
|
||||
public function addReaction(string $emoji): void {
|
||||
$this->reactions[] = $emoji;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
public function getReactions(): array {
|
||||
return $this->reactions;
|
||||
}
|
||||
|
||||
public function addAnswer(string $message, bool|int $reply = false, bool $silent = false, string $referenceId = '', bool $thread = false, ?string $threadTitle = null): void {
|
||||
$this->answers[] = [
|
||||
'message' => $message,
|
||||
'referenceId' => $referenceId,
|
||||
'reply' => $reply,
|
||||
'thread' => $thread,
|
||||
'threadTitle' => $threadTitle,
|
||||
'silent' => $silent,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{message: string, referenceId: string, reply: bool|int, thread: bool, threadTitle: ?string, silent: bool}>
|
||||
*/
|
||||
public function getAnswers(): array {
|
||||
return $this->answers;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user