Skip to content
Snippets Groups Projects
Verified Commit 3a73c2a0 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

[LED cheese] Join room; align cases with new regex API

parent 53849764
No related branches found
No related tags found
No related merge requests found
...@@ -65,16 +65,17 @@ network.connect() ...@@ -65,16 +65,17 @@ network.connect()
matrix = Matrix(HOMESERVER, MATRIX_ID, ACCESS_TOKEN) matrix = Matrix(HOMESERVER, MATRIX_ID, ACCESS_TOKEN)
# On which texts to react and which LEDs to turn on # On which texts to react and which LEDs to turn on
colour_re = re.compile("leuchte (.*)", re.I) cases = {"Kalle, leuchte (.*)": set_colour, "Kalle, hoer auf (.*)": allow_user}
permission_re = re.compile("hoer auf (.*)", re.I)
cases = {colour_re: set_colour, permission_re: allow_user)
if network.is_connected(): if network.is_connected():
# Join the room
matrix.join_room(ROOM_ID)
# Send message that I am there # Send message that I am there
matrix.send_room_message(ROOM_ID, "Hey! Alles cheesy, ich bin bereit zum Leuchten!") matrix.send_room_message(ROOM_ID, "Hey! Alles cheesy, ich bin bereit zum Leuchten!")
matrix.send_room_message(ROOM_ID, "Lass mir etwas Zeit, auf deine Nachrichten zu reagieren!") matrix.send_room_message(ROOM_ID, "Lass mir etwas Zeit, auf deine Nachrichten zu reagieren!")
# Wait for a message # Wait for a message
while True: while True:
matrix.react_room_messages(ROOM_ID, cases) matrix.react_room_messages(ROOM_ID, cases, regex=True)
time.sleep(10) time.sleep(10)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment