diff --git a/callbacks.py b/callbacks.py index 4b82768..b96b24c 100644 --- a/callbacks.py +++ b/callbacks.py @@ -76,3 +76,7 @@ async def file_cb(room: MatrixRoom, event: RoomMessageFile) -> None: with open(os.path.join(directory, filename), 'wb') as f: f.write(response.body) + +async def invite_cb(room: MatrixRoom, event: InviteEvent) -> None: + import utils + await utils.get_client().join(room_id=room.room_id) diff --git a/lilypond.py b/lilypond.py index 0054081..7680d18 100644 --- a/lilypond.py +++ b/lilypond.py @@ -17,7 +17,7 @@ def render(user: str, source: str, png: bool = True) -> str: tmp.write(bytes(fmt, encoding="utf8")) tmp.close() if png: - subprocess.run(["lilypond", "-d", "preview", "--png", tmp.name], cwd="/tmp") + subprocess.run(["lilypond", "-d", "preview", "--png", "-dresolution=500", tmp.name], cwd="/tmp") return tmp.name + ".preview.png" subprocess.run(["lilypond", "-d", "preview", "--svg", tmp.name], cwd="/tmp") diff --git a/main.py b/main.py index 4d296ea..49d91c4 100644 --- a/main.py +++ b/main.py @@ -43,6 +43,7 @@ async def main() -> None: utils.set_client(client) client.add_event_callback(callbacks.msg_cb, RoomMessageText) client.add_event_callback(callbacks.file_cb, RoomMessageFile) + client.add_event_callback(callbacks.invite_cb, InviteEvent) await client.sync_forever(timeout=10000, full_state=True)