Skip to content

Commit 651f3c5

Browse files
committed
Update type hints
1 parent f905169 commit 651f3c5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

mautrix_appservice/intent_api.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ async def download_file(self, url: str) -> bytes:
425425
async def create_room(self, alias: Optional[str] = None, is_public: bool = False,
426426
name: Optional[str] = None, topic: Optional[str] = None,
427427
is_direct: bool = False, invitees: Optional[List[str]] = None,
428-
initial_state: Optional[dict] = None) -> str:
428+
initial_state: Optional[List[dict]] = None) -> str:
429429
"""
430430
Create a new room. See also: `API reference`_
431431
@@ -526,8 +526,8 @@ async def invite(self, room_id: str, user_id: str, check_cache: bool = False
526526
if "is already in the room" in e.message:
527527
self.state_store.joined(room_id, user_id)
528528

529-
def set_room_avatar(self, room_id: str, avatar_url: str, info: Optional[dict] = None, **kwargs
530-
) -> Awaitable[dict]:
529+
def set_room_avatar(self, room_id: str, avatar_url: Optional[str], info: Optional[dict] = None,
530+
**kwargs) -> Awaitable[dict]:
531531
content = {}
532532
if avatar_url:
533533
content["url"] = avatar_url
@@ -555,6 +555,10 @@ def set_room_name(self, room_id: str, name: str, **kwargs) -> Awaitable[dict]:
555555
body = {"name": name}
556556
return self.send_state_event(room_id, "m.room.name", body, **kwargs)
557557

558+
def set_room_topic(self, room_id: str, topic: str, **kwargs) -> Awaitable[dict]:
559+
body = {"topic": topic}
560+
return self.send_state_event(room_id, "m.room.topic", body, **kwargs)
561+
558562
async def get_power_levels(self, room_id: str, ignore_cache: bool = False) -> dict:
559563
await self.ensure_joined(room_id)
560564
if not ignore_cache:
@@ -683,7 +687,7 @@ def send_sticker(self, room_id: str, url: str, info: Optional[dict] = None, text
683687
}, **kwargs)
684688

685689
def send_text(self, room_id: str, text: str, html: Optional[str] = None,
686-
msgtype: str = "m.text", relates_to: Optional[str] = None, **kwargs
690+
msgtype: str = "m.text", relates_to: Optional[dict] = None, **kwargs
687691
) -> Awaitable[dict]:
688692
if html:
689693
if not text:
@@ -836,7 +840,7 @@ def get_room_memberships(self, room_id: str) -> Awaitable[dict]:
836840
raise ValueError("Room ID not given")
837841
return self.client.request("GET", f"/rooms/{quote(room_id)}/members")
838842

839-
async def get_room_members(self, room_id: str, allowed_memberships: Tuple[str] = ("join",)
843+
async def get_room_members(self, room_id: str, allowed_memberships: Tuple[str, ...] = ("join",)
840844
) -> List[str]:
841845
memberships = await self.get_room_memberships(room_id)
842846
return [membership["state_key"] for membership in memberships["chunk"] if

0 commit comments

Comments
 (0)