Skip to content

Commit effbf5f

Browse files
committed
Allow passing event ID in batch sends
1 parent 8684e24 commit effbf5f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

mautrix/types/event/batch.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,28 @@
33
# This Source Code Form is subject to the terms of the Mozilla Public
44
# License, v. 2.0. If a copy of the MPL was not distributed with this
55
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6-
from typing import Any
6+
from typing import Any, Optional
77

88
from attr import dataclass
99
import attr
1010

11-
from ..primitive import UserID
11+
from ..primitive import UserID, EventID
1212
from ..util import SerializableAttrs
1313
from .base import BaseEvent
1414

1515

16-
@dataclass
16+
@dataclass(kw_only=True)
1717
class BatchSendEvent(BaseEvent, SerializableAttrs):
1818
"""Base event class for events sent via a batch send request."""
1919

2020
sender: UserID
2121
timestamp: int = attr.ib(metadata={"json": "origin_server_ts"})
2222
content: Any
23+
# N.B. Overriding event IDs is not allowed in standard room versions
24+
event_id: Optional[EventID] = None
2325

2426

25-
@dataclass
27+
@dataclass(kw_only=True)
2628
class BatchSendStateEvent(BatchSendEvent, SerializableAttrs):
2729
"""
2830
State events to be used as initial state events on batch send events. These never need to be

0 commit comments

Comments
 (0)