match request update

This commit is contained in:
VinceC
2024-11-28 04:59:46 -06:00
parent 26a5edeb4f
commit 119891730d
3 changed files with 21 additions and 15 deletions

View File

@@ -23,6 +23,7 @@ class Bot {
this.playerService = new PlayerService(logger);
this.serverRegistrationService = new ServerRegistrationService(supabase, logger);
this.subscriptionCommands = new SubscriptionCommands(supabase, logger);
this.notificationService = new NotificationService(this, supabase);
// Initialize command handlers
this.commandHandler = new CommandHandler(
@@ -36,6 +37,12 @@ class Bot {
// Setup event handlers
this.client.on('ready', () => {
this.logger.info(`Logged in as ${this.client.user.tag}`);
// Start notification service after bot is ready
this.notificationService.start().then(() => {
this.logger.info('Notification service started successfully');
}).catch(error => {
this.logger.error('Failed to start notification service:', error);
});
});
this.client.on('interactionCreate', this.handleInteraction.bind(this));

View File

@@ -1,7 +1,6 @@
// src/services/NotificationService.js
const express = require('express');
const { createMatchRequestEmbed } = require('../utils/embedBuilders');
const { createMatchRequestEmbed } = require('../utils/EmbedBuilders');
const { createMatchActionRow } = require('../utils/componentBuilders');
class NotificationService {
@@ -57,7 +56,7 @@ class NotificationService {
try {
const channel = await this.bot.client.channels.fetch(subscription.channel_id);
const embed = createMatchRequestEmbed(matchData);
const actionRow = createMatchActionRow(matchData.game_id);
const actionRow = createMatchActionRow(matchData.game_name);
await channel.send({
embeds: [embed],

View File

@@ -15,19 +15,19 @@ const GAME_URLS = {
function createMatchActionRow(gameName) {
const matchhubUrl = GAME_URLS[gameName] || "https://www.vrbattles.gg/games";
return new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setLabel('View Matchhub')
.setStyle(ButtonStyle.Link)
.setURL(matchhubUrl),
new ButtonBuilder()
.setLabel('Join VRBattles Discord')
.setStyle(ButtonStyle.Link)
.setURL('https://discord.gg/j3DKVATPGQ')
);
return new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setLabel('🎮 View Matchhub')
.setStyle(ButtonStyle.Link)
.setURL(matchhubUrl),
new ButtonBuilder()
.setLabel('🟡 Join VRBattles Discord')
.setStyle(ButtonStyle.Link)
.setURL('https://discord.gg/j3DKVATPGQ')
);
}
module.exports = {
createMatchActionRow
createMatchActionRow,
GAME_URLS
};