comparison mod_muc_dicebot/mod_muc_dicebot.lua @ 4580:785389a2d2b3

mod_muc_dicebot: ignore messages without body
author Jonas Schäfer <jonas@wielicki.name>
date Sat, 29 May 2021 15:34:41 +0200
parents b305814bd930
children
comparison
equal deleted inserted replaced
4579:b305814bd930 4580:785389a2d2b3
35 return 35 return
36 end 36 end
37 37
38 local stanza = event.stanza; 38 local stanza = event.stanza;
39 local body = stanza:get_child("body"); 39 local body = stanza:get_child("body");
40 if not body then
41 return
42 end
43
40 local text = body:get_text(); 44 local text = body:get_text();
41 module:log("error", "%q %q %q", stanza, body, text); 45 module:log("error", "%q %q %q", stanza, body, text);
42 local dice = s_match(text, "^[%.!]r%s(.+)$"); 46 local dice = s_match(text, "^[%.!]r%s(.+)$");
43 if not dice or dice == "" then 47 if not dice or dice == "" then
44 return 48 return