fix: use base url to compose URLs

This commit is contained in:
əlemi 2024-01-29 18:57:15 +01:00
parent 5710a71651
commit eac41d01e6
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -79,7 +79,7 @@ class AppService:
async def join_room(self, room: str, mxid: str | None = None): async def join_room(self, room: str, mxid: str | None = None):
async with self._client.request( async with self._client.request(
method="POST", method="POST",
url=f"/join/{room}", url=f"{self.base_url}/_matrix/client/r0/join/{room}",
headers={ headers={
"Authorization": f"Bearer {self.as_token}", "Authorization": f"Bearer {self.as_token}",
"Content-Type": "application/json", "Content-Type": "application/json",
@ -95,7 +95,7 @@ class AppService:
async def send_message(self, room: str, text: str, mxid: str | None = None) -> str: async def send_message(self, room: str, text: str, mxid: str | None = None) -> str:
async with self._client.request( async with self._client.request(
method="PUT", method="PUT",
url=f"/rooms/{room}/send/m.room.message/{uuid.uuid4()}", url=f"{self.base_url}/_matrix/client/r0/rooms/{room}/send/m.room.message/{uuid.uuid4()}",
headers={ headers={
"Authorization": f"Bearer {self.as_token}", "Authorization": f"Bearer {self.as_token}",
"Content-Type": "application/json", "Content-Type": "application/json",