55 local data = st.stanza("data"):tag("id"):text(event.item.attr.id); |
55 local data = st.stanza("data"):tag("id"):text(event.item.attr.id); |
56 local entry = event.item and new_extractor(event.item.tags[1], data) |
56 local entry = event.item and new_extractor(event.item.tags[1], data) |
57 |
57 |
58 if not conf or not entry or not room then return end |
58 if not conf or not entry or not room then return end |
59 local message = conf.template:gsub("%${([^}]+)}", entry); |
59 local message = conf.template:gsub("%${([^}]+)}", entry); |
60 |
60 |
61 -- Throttle to 1 message/second so we don't flood the room |
61 -- Throttle to 1 message/second so we don't flood the room |
62 if os.time() - last_message_time > 0 then |
62 if os.time() - last_message_time > 0 then |
63 room:send_message(message); |
63 room:send_message(message); |
64 last_message_time = os.time(); |
64 last_message_time = os.time(); |
65 else |
65 else |