init.lua

changeset 15
22e6c003a83a
parent 14
3df63aaba9e3
child 16
ae69cea97598
equal deleted inserted replaced
14:3df63aaba9e3 15:22e6c003a83a
28 local replied; 28 local replied;
29 local bot = self; 29 local bot = self;
30 function event:reply(reply) 30 function event:reply(reply)
31 if replied then return false; end 31 if replied then return false; end
32 replied = true; 32 replied = true;
33 return bot:send_message(stanza.attr.from, reply); 33 return bot:send_message(stanza.attr.from, stanza.attr.type, reply);
34 end 34 end
35 end 35 end
36 local ret; 36 local ret;
37 if stanza.name == "iq" and (stanza.attr.type == "get" or stanza.attr.type == "set") then 37 if stanza.name == "iq" and (stanza.attr.type == "get" or stanza.attr.type == "set") then
38 local xmlns = stanza.tags[1] and stanza.tags[1].attr.xmlns; 38 local xmlns = stanza.tags[1] and stanza.tags[1].attr.xmlns;
65 65
66 function riddim_mt:hook(name, ...) 66 function riddim_mt:hook(name, ...)
67 return self.stream:hook("bot/"..name, ...); 67 return self.stream:hook("bot/"..name, ...);
68 end 68 end
69 69
70 function riddim_mt:send_message(to, text, formatted_text) 70 function riddim_mt:send_message(to, type, text)
71 self:send(st.message({ to = to, type = "chat" }):tag("body"):text(text)); 71 self:send(st.message({ to = to, type = type }):tag("body"):text(text));
72 end 72 end
73 73
74 function riddim_mt:add_plugin(name) 74 function riddim_mt:add_plugin(name)
75 if not self.plugins[name] then 75 if not self.plugins[name] then
76 self.plugins[name] = require("riddim.plugins."..name); 76 self.plugins[name] = require("riddim.plugins."..name);

mercurial