var embed = (data.embeds && data.embeds[0]) || {}; var title = embed.title || 'Proxmox Notification'; var description = embed.description || ''; var fields = embed.fields || []; var fieldMap = {}; fields.forEach(function(f) { fieldMap[f.name] = f.value; }); var severity = (fieldMap['Severity'] || 'info').toLowerCase(); var node = fieldMap['Node'] || ''; var type = fieldMap['Type'] || ''; var vmid = fieldMap['VM/CT ID'] || ''; var emoji = severity === 'error' ? '🔴' : (severity === 'warning' ? '🟡' : 'ℹ️'); var lines = [emoji + ' ' + title]; var htmlParts = ['' + emoji + ' ' + title + '']; if (node) { lines.push('\uD83D\uDDA5\uFE0F Node: ' + node); htmlParts.push('\uD83D\uDDA5\uFE0F Node: ' + node + ''); } if (type) { lines.push('\uD83D\uDCCB Type: ' + type); htmlParts.push('\uD83D\uDCCB Type: ' + type); } if (vmid && vmid !== 'N/A') { lines.push('\uD83D\uDD32 VM/CT: ' + vmid); htmlParts.push('\uD83D\uDD32 VM/CT: ' + vmid); } if (description) { lines.push(description); htmlParts.push(description); } result = { version: 'v2', plain: lines.join('\n'), html: htmlParts.join('
'), msgtype: 'm.notice' };