Files
matrix/hookshot/proxmox.js
Jared Vititoe 0e275d725e refactor: replace old bot code with Matrix infra configs and scripts
- Remove obsolete Python bot (Wordle, commands, callbacks, welcome)
- Add hookshot/ — all 11 webhook transformation functions + deploy.sh
- Add cinny/ — config.json and dev-update.sh (nightly dev branch build)
- Add landing/ — matrix.lotusguild.org landing page HTML
- Add systemd/ — livekit-server, draupnir, cinny cron unit files
- Add draupnir/ — production config (access token redacted)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 10:36:51 -04:00

18 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 = ['<b>' + emoji + ' ' + title + '</b>'];
if (node) { lines.push('\uD83D\uDDA5\uFE0F Node: ' + node); htmlParts.push('\uD83D\uDDA5\uFE0F Node: <b>' + node + '</b>'); }
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('<br>'), msgtype: 'm.notice' };