跳转到正文

notifications API ​

完整接口目录 · 通知用法 · 工具包下载

模块说明 ​

text
Bounded tellraw plans and sequential, journalled, no-retry dispatch.

NotificationPart ​

python
@dataclass(frozen=True)
class NotificationPart

字段(包含继承字段):

NotificationPart.text ​

python
text: str

数据类字段;声明于 notifications.NotificationPart。

NotificationPart.prefix ​

python
prefix: str

数据类字段;声明于 notifications.NotificationPart。

NotificationPart.command ​

python
command: str

数据类字段;声明于 notifications.NotificationPart。

NotificationPart.intent ​

python
intent: OperationIntent

数据类字段;声明于 notifications.NotificationPart。

NotificationPlan ​

python
@dataclass(frozen=True)
class NotificationPlan

字段(包含继承字段):

NotificationPlan.parts ​

python
parts: tuple[NotificationPart, ...]

数据类字段;声明于 notifications.NotificationPlan。

NotificationPlan.business_key ​

python
business_key: str = ''

数据类字段;声明于 notifications.NotificationPlan。

NotificationPlan.payload_digest ​

python
@property
def payload_digest(self)

SDK 说明:

text
Whole-plan identity for the caller's durable business-key binding.

This is not an operation key and is not an automatic replay guard.
Includes recipient, session, commands, ordering and fixed deadlines.

Notifications ​

python
class Notifications

SDK 说明:

text
Prepare without IO; persist plan/intents before calling send once.

320 is an operational default, NOT a measured protocol limit. Each chunk
includes selector, JSON escaping, UTF-8 and carried formatting in its budget.
Recipient names must originate from an authenticated current player roster.

Notifications.__init__ ​

python
def __init__(self, operations)

Notifications.prepare ​

python
def prepare(self, name, text, *, idempotency_key, deadline, max_command_bytes=320)

Notifications.title ​

python
def title(
    self,
    name: str,
    text: str,
    *,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

SDK 说明:

text
Prepare one titleraw title, requiring framework.command.execute.

Persist/submit via Operations or an event transaction. A receipt proves
command acknowledgement, not that a player saw the title.

Notifications.subtitle ​

python
def subtitle(
    self,
    name: str,
    text: str,
    *,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

SDK 说明:

text
Set subtitle text; it is displayed with a separately sent title.

Notifications.actionbar ​

python
def actionbar(
    self,
    name: str,
    text: str,
    *,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

Notifications.send ​

python
async def send(self, plan, *, journal, timeout=30)

SDK 说明:

text
One attempt, ordered; journal(snapshot) is an awaited durable callback.

Before any dispatch, journal must atomically bind business_key to
payload_digest and reject a different digest for an existing key. This
helper has no journal read API and does not enforce whole-plan dedup.
Persisted `submitting` means admission may be unknown. Cancellation and
journal failures propagate and never cause a resend. Reconcile original
intents/operation IDs; do not restart send to recover an interrupted run.
Success describes command receipts, not proof the player saw the text.

Notifications.operations ​

python
self.operations

公开实例属性,在 __init__ 中设置。

Neomega · 使用、开发与参考文档