Messages listener in prosody

Is there a thread in the prosody that listens to the messages?

You can enable your module under muc component and add
module:hook("muc-broadcast-message", handleBroadcastMessage);

1 Like

thanks damencho :+1:t2: :slightly_smiling_face:

Thank you. I can get the message information. But I’m only listening to groupChat type messages and can’t catch private messages.

1 Like

Thank you. I can get the message information. But I’m only listening to groupChat type messages and can’t catch private messages.

local stanza = event.stanza;
local displayName = stanza:get_child_text('nick', 'http://jabber.org..ocol/nick');
local body = stanza:get_child_text('body');
local from = stanza.attr.from;
local to = stanza.attr.to;
local type = stanza.attr.type;

This is how I get the event information.