plugins/pubsub2room.lua

changeset 142
211fa13c7ca2
parent 141
be0754cc0ede
child 145
565c0c43b063
equal deleted inserted replaced
141:be0754cc0ede 142:211fa13c7ca2
50 local config = bot.config.pubsub2room; 50 local config = bot.config.pubsub2room;
51 bot.stream:hook("pubsub/event", function(event) 51 bot.stream:hook("pubsub/event", function(event)
52 local conf = config[event.from .. "#" .. event.node]; 52 local conf = config[event.from .. "#" .. event.node];
53 if not conf then return end 53 if not conf then return end
54 local room = bot.rooms[conf.room]; 54 local room = bot.rooms[conf.room];
55 local data = st.stanza(""):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

mercurial