diff --git a/README.md b/README.md index 9169fbd..c99c3a7 100644 --- a/README.md +++ b/README.md @@ -19,16 +19,18 @@ app = AppService( as_token="YOUR-APPSERVICE-TOKEN", hs_token="YOUR-HOMESERVER-TOKEN", ) +mxid = "@_appsrv_firstuser:matrix.org" +room = "#my-epic-room:matrix.org" ``` to execute actions use AppService's helper methods: ```python -mxid = "@_appsrv_firstuser:matrix.org" -room = "#my-epic-room:matrix.org" await app.register_mxid(mxid) await app.set_nick(mxid, "First User") +await app.set_avatar(mxid, "https://cdn.alemi.dev/profile/pic/someriver.jpg") await app.invite_to_room(room, mxid) await app.join_room(room, mxid) +await app.set_presence(mxid, online=True) await app.send_message(room, "hello world!") ``` @@ -36,10 +38,10 @@ to subscribe to room events use the callback decorator: ```python from aioappsrv.matrix import Event -room = "#my-epic-room:matrix.org" @app.callback(room) async def my_cb(event: Event): - print(f"{event.sender}: {event.content['body']}") + print(f"{event.room_id}| {event.sender} : {event.content['body']}") + await app.ack_event(event.room_id, event.event_id) ``` ## state