2.0.0 • Published 6 months ago
discord-dashboard-pro v2.0.0
Discord Dashboard Pro 🚀
The most powerful and developer-friendly Discord bot dashboard creation library.
✨ Features
- 🎨 Beautiful UI Components - Pre-built, customizable, and responsive
- 🔐 Advanced Authentication - Multi-provider support with Passport.js
- 📊 Real-time Analytics - Track and visualize bot metrics
- 🎭 Theme System - Light/dark mode and custom themes
- 🚀 Performance Optimized - Built for scale
🚀 Quick Start
npm install discord-dashboard-pro
Basic Usage (TypeScript)
import { DashboardPro } from 'discord-dashboard-pro';
const dashboard = new DashboardPro({
auth: {
discord: {
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
callbackUrl: 'http://localhost:3000/auth/callback'
}
},
server: {
port: 3000
}
});
dashboard.start();
Complete Dashboard Example
import { DashboardPro, Components } from 'discord-dashboard-pro';
// Initialize dashboard with all features
const dashboard = new DashboardPro({
auth: {
discord: {
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
callbackUrl: 'http://localhost:3000/auth/callback'
},
session: {
secret: 'your-secret-key',
duration: 24 * 60 * 60 * 1000 // 24 hours
}
},
theme: {
mode: 'dark',
primary: '#7289DA',
secondary: '#99AAB5',
accent: '#43B581'
},
storage: {
type: 'mongodb',
url: 'mongodb://localhost:27017/dashboard'
}
});
// Create server stats widget
const statsWidget = new Components.Widget({
title: 'Server Statistics',
type: 'stats',
data: {
members: await guild.memberCount(),
channels: guild.channels.size,
roles: guild.roles.size
},
refresh: 60000 // Refresh every minute
});
// Create command usage chart
const usageChart = new Components.Chart({
title: 'Command Usage',
type: 'line',
data: await analytics.getCommandStats('7d'),
options: {
responsive: true,
animation: { duration: 500 }
}
});
// Create member management form
const memberForm = new Components.Form({
title: 'Manage Member',
fields: [
{
name: 'username',
label: 'Username',
type: 'text',
required: true
},
{
name: 'role',
label: 'Role',
type: 'select',
options: guild.roles.map(role => ({
label: role.name,
value: role.id
}))
}
],
onSubmit: async (data) => {
const member = await guild.members.fetch(data.username);
await member.roles.add(data.role);
}
});
// Create automated workflows
const welcomeRule = new Components.AutomationRule({
name: 'Welcome New Members',
trigger: {
type: 'memberJoin',
config: { guildId: 'YOUR_GUILD_ID' }
},
actions: [
{
type: 'sendMessage',
config: {
channelId: 'WELCOME_CHANNEL_ID',
template: 'Welcome {{user}}! 👋'
}
},
{
type: 'assignRole',
config: {
roleId: 'MEMBER_ROLE_ID'
}
}
]
});
dashboard.automation.addRule(welcomeRule);
// Start the dashboard
dashboard.start();
📚 Advanced Features
Real-time Analytics
dashboard.analytics.track('command_used', {
command: '!ban',
user: message.author.id,
guild: message.guild.id,
success: true
});
const analyticsWidget = new Components.Widget({
title: 'Command Analytics',
type: 'analytics',
metrics: ['command_used'],
timeframe: '24h',
groupBy: 'command'
});
Custom Themes
dashboard.setTheme({
mode: 'dark',
colors: {
primary: '#7289DA',
secondary: '#99AAB5',
success: '#43B581',
danger: '#F04747',
warning: '#FAA61A',
info: '#3498DB'
},
components: {
button: {
borderRadius: '4px',
fontWeight: 'bold'
},
card: {
shadow: '0 4px 6px rgba(0, 0, 0, 0.1)'
}
}
});
🔒 Security Features
// Enable security features
dashboard.security.enableCSRF();
dashboard.security.enableRateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100
});
// Encrypt sensitive data
const encrypted = dashboard.security.encrypt(
'sensitive data',
dashboard.security.getEncryptionKey()
);
📊 Performance Monitoring
// Monitor performance
dashboard.monitoring.trackMetric('response_time', 150, {
endpoint: '/api/users'
});
// Set up alerts
dashboard.monitoring.addAlert({
metric: 'response_time',
condition: {
operator: '>',
value: 1000
},
actions: [{
type: 'notification',
config: {
channels: ['discord', 'email']
}
}]
});
🔌 Contributing
We welcome contributions! Please see our Contributing Guide for details.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.