A Vue.js application for tracking Discord event attendance and managing DKP (Dragon Kill Points) for gaming guilds using Firebase Realtime Database.
- Event Management: Create and manage events with customizable DKP rewards
- Player Tracking: Automatic player registration and DKP accumulation
- Discord Integration: Firebase REST API integration for Discord bots
- Real-time Updates: Live attendance tracking and leaderboards
- Responsive Design: Beautiful, modern UI that works on all devices
-
Firebase Setup:
- The app is configured to use Firebase Realtime Database at:
https://dkptracker-6121c-default-rtdb.firebaseio.com/
- No additional setup required - the database structure will be created automatically
- The app is configured to use Firebase Realtime Database at:
-
Database Structure: The app will automatically create these collections:
events/
- Event informationplayers/
- Player profiles and DKP totalsattendances/
- Attendance records linking events and players
-
Discord Bot Integration:
- Use the Firebase REST API directly in your Discord bot
- Send requests to Firebase when users click "attend" in Discord
Your Discord bot can interact directly with Firebase using the REST API:
POST to: https://dkptracker-6121c-default-rtdb.firebaseio.com/attendances.json
{
"event_id": "event-key-from-firebase",
"player_id": "player-key-from-firebase",
"dkp_awarded": 10,
"created_at": "2024-01-01T00:00:00.000Z"
}
GET: https://dkptracker-6121c-default-rtdb.firebaseio.com/events.json
POST/PATCH: https://dkptracker-6121c-default-rtdb.firebaseio.com/players.json
const { SlashCommandBuilder } = require('discord.js');
const FIREBASE_URL = 'https://dkptracker-6121c-default-rtdb.firebaseio.com';
async function recordAttendance(eventId, discordUser) {
try {
// Get or create player
const playersResponse = await fetch(`${FIREBASE_URL}/players.json`);
const players = await playersResponse.json();
let playerId = null;
let playerData = null;
if (players) {
const existingPlayer = Object.entries(players).find(([key, player]) =>
player.discord_id === discordUser.id
);
if (existingPlayer) {
playerId = existingPlayer[0];
playerData = existingPlayer[1];
}
}
if (!playerId) {
// Create new player
const newPlayerResponse = await fetch(`${FIREBASE_URL}/players.json`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
discord_id: discordUser.id,
username: discordUser.username,
total_dkp: 0,
created_at: new Date().toISOString()
})
});
const result = await newPlayerResponse.json();
playerId = result.name;
playerData = { total_dkp: 0 };
}
// Get event details
const eventResponse = await fetch(`${FIREBASE_URL}/events/${eventId}.json`);
const event = await eventResponse.json();
if (!event) throw new Error('Event not found');
// Record attendance
await fetch(`${FIREBASE_URL}/attendances.json`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
event_id: eventId,
player_id: playerId,
dkp_awarded: event.dkp_reward,
created_at: new Date().toISOString()
})
});
// Update player DKP
const newTotalDkp = playerData.total_dkp + event.dkp_reward;
await fetch(`${FIREBASE_URL}/players/${playerId}.json`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ total_dkp: newTotalDkp })
});
return {
success: true,
dkp_awarded: event.dkp_reward,
new_total_dkp: newTotalDkp
};
} catch (error) {
console.error('Error recording attendance:', error);
return { success: false, error: error.message };
}
}
client.on('interactionCreate', async interaction => {
if (interaction.isButton() && interaction.customId.startsWith('attend_')) {
const eventId = interaction.customId.replace('attend_', '');
const result = await recordAttendance(eventId, interaction.user);
if (result.success) {
await interaction.reply({
content: `✅ Attendance recorded!\n🏆 DKP Awarded: ${result.dkp_awarded}\n📊 Total DKP: ${result.new_total_dkp}`,
ephemeral: true
});
} else {
await interaction.reply({
content: `❌ Error: ${result.error}`,
ephemeral: true
});
}
}
});
- Frontend: Vue 3 + Vite
- Database: Firebase Realtime Database
- Styling: Tailwind CSS
- Icons: Lucide Vue
- Backend: Firebase REST API
npm run dev
The app can be deployed to any static hosting service. The Firebase database is already configured and ready to use.