health service and panel

This commit is contained in:
legop3
2026-01-13 20:16:11 -05:00
parent c2ca951fe8
commit e666b4c195
7 changed files with 232 additions and 20 deletions
+9 -5
View File
@@ -295,14 +295,18 @@ function resolveReplaySources(query) {
return { sources };
}
function buildReplayCaption(requester, sources = []) {
function buildReplayCaption(requester, sources = [], missingSources = []) {
const requesterLabel = requester || 'unknown';
const sourceLabel = sources.length
? `Sources: ${sources.map((source) => source.label || `${source.type}:${source.id}`).join(', ')}.`
: 'No sources.';
const missingLabel = missingSources.length
? `Missing: ${missingSources.map((source) => source.label || `${source.type}:${source.id}`).join(', ')}.`
: null;
return [
`Replay requested by ${requesterLabel}.`,
sourceLabel,
missingLabel,
buildDriverCaption(),
]
.filter(Boolean)
@@ -313,9 +317,9 @@ async function sendReplayToChannel(channelId, requester, sources = []) {
if (!channelId) {
throw new Error('Replay channel not configured');
}
const buffer = await buildReplayVideo({ sources });
const { buffer, usedSources, missingSources } = await buildReplayVideo({ sources });
const attachment = new AttachmentBuilder(buffer, { name: 'replay.mp4' });
const caption = buildReplayCaption(requester, sources);
const caption = buildReplayCaption(requester, usedSources, missingSources);
await sendToChannel(channelId, caption, { files: [attachment] }, { parse: [] });
}
@@ -351,9 +355,9 @@ async function handleReplayCommand(message, query) {
const requester =
message.member?.nickname || message.author?.globalName || message.author?.username || 'Discord';
try {
const buffer = await buildReplayVideo({ sources });
const { buffer, usedSources, missingSources } = await buildReplayVideo({ sources });
const attachment = new AttachmentBuilder(buffer, { name: 'replay.mp4' });
const caption = buildReplayCaption(requester, sources);
const caption = buildReplayCaption(requester, usedSources, missingSources);
await message.reply({
content: sanitizeMentions(caption),
files: [attachment],