Add invite message class.
This commit is contained in:
parent
7be29e2b3f
commit
8b21e9957d
2 changed files with 19 additions and 5 deletions
|
@ -478,6 +478,21 @@ class MatrixPartMessage(MatrixGenericMessage):
|
|||
)
|
||||
|
||||
|
||||
class MatrixInviteMessage(MatrixGenericMessage):
|
||||
def __init__(self, client, room_id, user_id):
|
||||
self.room_id = room_id
|
||||
|
||||
data = {"room_id": self.room_id,
|
||||
"user_id": user_id}
|
||||
|
||||
MatrixGenericMessage.__init__(
|
||||
self,
|
||||
MessageType.INVITE,
|
||||
client.room_invite,
|
||||
data
|
||||
)
|
||||
|
||||
|
||||
class MatrixUser:
|
||||
def __init__(self, name, display_name):
|
||||
self.name = name # type: str
|
||||
|
|
|
@ -31,7 +31,8 @@ from matrix.api import (
|
|||
MatrixRedactMessage,
|
||||
MatrixBacklogMessage,
|
||||
MatrixJoinMessage,
|
||||
MatrixPartMessage
|
||||
MatrixPartMessage,
|
||||
MatrixInviteMessage
|
||||
)
|
||||
from matrix.utils import key_from_value, tags_from_line_data
|
||||
from matrix.plugin_options import DebugType
|
||||
|
@ -264,10 +265,8 @@ def matrix_command_invite_cb(data, buffer, command):
|
|||
_, invitee = split_args
|
||||
room_id = key_from_value(server.buffers, buf)
|
||||
|
||||
message = MatrixMessage(
|
||||
server,
|
||||
OPTIONS,
|
||||
MessageType.INVITE,
|
||||
message = MatrixInviteMessage(
|
||||
server.client,
|
||||
room_id=room_id,
|
||||
user_id=invitee
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue