// Notify daemon — alert on keyword mentions
// Sends a notification message when a keyword is mentioned
function notify (opts = {}) {
const keywords = opts.keywords || []
const notifyRoom = opts.notifyRoom
const pattern = keywords.map(k => k.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|')
return {
trigger: {
type: 'message',
filter: { pattern }
},
actions: [{
type: 'send-message',
roomId: notifyRoom,
text: `🔔 Keyword match from {author}: {text}`
}],
enabled: true
}
}
export { notify }