diff --git a/main.py b/main.py index 95b33a4..fe28bf2 100644 --- a/main.py +++ b/main.py @@ -366,6 +366,17 @@ async def message_callback(room: nio.MatrixRoom, event: nio.RoomMessageText) -> for part in event.body.split(" "): if part.startswith("r/"): new_body = new_body.replace(part, f"{part}") + if event.body.count("{pkg|") > 0: + for part in event.body.split(" "): + if part.startswith("{pkg|") and part.endswith("}"): + pkg = part.split('|')[1].rstrip('}') + new_body = new_body.replace(part, "" + pkg + "") + if event.body.count("{aur|") > 0: + for part in event.body.split(" "): + if part.startswith("{aur|") and part.endswith("}"): + pkg = part.split('|')[1].rstrip('}') + new_body = new_body.replace(part, "" + pkg + "") + # If anything was changed processing the message, edit it if not new_body == orig_body: await edit_message(room.room_id, event, new_body)