Initial commit: Miku Discord Bot

This commit is contained in:
2025-12-07 17:15:09 +02:00
commit 8c74ad5260
206 changed files with 50125 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
<div class="section">
<h3>DM Analysis</h3>
<p>Analyze Direct Message interactions from the past 7 days.</p>
<button onclick="analyzeDMs()" id="analyze-button">Run 7-Day Analysis</button>
<div id="analysis-results" class="analysis-results">
<h4>Analysis Results</h4>
<div class="analysis-stat">
<span>Total Users Analyzed:</span>
<span id="total-users">0</span>
</div>
<div class="analysis-stat">
<span>Users with Activity:</span>
<span id="active-users">0</span>
</div>
<div class="analysis-stat">
<span>Total Messages:</span>
<span id="total-messages">0</span>
</div>
<div class="analysis-stat">
<span>Reports Generated:</span>
<span id="reports-generated">0</span>
</div>
</div>
</div>
<script>
async function analyzeDMs() {
const button = document.getElementById('analyze-button');
const results = document.getElementById('analysis-results');
// Disable button and show loading state
button.disabled = true;
button.textContent = 'Analyzing...';
try {
const response = await fetch('/api/analyze-seven-days', {
method: 'POST'
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
// Update results display
document.getElementById('total-users').textContent = data.total_users_analyzed;
document.getElementById('active-users').textContent = data.users_with_activity;
document.getElementById('total-messages').textContent = data.total_messages;
document.getElementById('reports-generated').textContent = data.reports_generated;
// Show results section
results.style.display = 'block';
showNotification('DM Analysis completed successfully!');
} catch (error) {
console.error('Error:', error);
showNotification('Error running DM analysis: ' + error.message);
} finally {
// Reset button state
button.disabled = false;
button.textContent = 'Run 7-Day Analysis';
}
}
</script>