feat: less crude but still raw, also for join
This commit is contained in:
parent
d039f313c6
commit
870a4faa9b
1 changed files with 13 additions and 9 deletions
|
@ -86,8 +86,11 @@ class AppService:
|
||||||
},
|
},
|
||||||
params={"user_id": mxid} if mxid else {},
|
params={"user_id": mxid} if mxid else {},
|
||||||
) as res:
|
) as res:
|
||||||
doc = await res.json()
|
if res.ok:
|
||||||
self.logger.debug("joined room %s with %s : %s", room, mxid, doc)
|
self.logger.debug("joined room %s with %s : %s", room, mxid, await res.json())
|
||||||
|
else:
|
||||||
|
self.logger.error("failed sending message: %s", await res.text())
|
||||||
|
raise ValueError()
|
||||||
|
|
||||||
async def leave_room(self):
|
async def leave_room(self):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
@ -103,13 +106,14 @@ class AppService:
|
||||||
params={"user_id": mxid} if mxid else {},
|
params={"user_id": mxid} if mxid else {},
|
||||||
json=mx_message(text),
|
json=mx_message(text),
|
||||||
) as res:
|
) as res:
|
||||||
|
if res.ok:
|
||||||
doc = await res.json()
|
doc = await res.json()
|
||||||
if "event_id" in doc:
|
|
||||||
self.logger.debug("sent message %s to %s as %s : %s", text, room, mxid, doc)
|
self.logger.debug("sent message %s to %s as %s : %s", text, room, mxid, doc)
|
||||||
return doc["event_id"]
|
return doc["event_id"]
|
||||||
else:
|
else:
|
||||||
self.logger.error("failed sending message: %s", doc)
|
text = await res.text()
|
||||||
raise ValueError(doc)
|
self.logger.error("failed sending message: %s", text)
|
||||||
|
raise ValueError()
|
||||||
|
|
||||||
async def redact_message(self):
|
async def redact_message(self):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
Loading…
Reference in a new issue