match request update
This commit is contained in:
@@ -23,6 +23,7 @@ class Bot {
|
|||||||
this.playerService = new PlayerService(logger);
|
this.playerService = new PlayerService(logger);
|
||||||
this.serverRegistrationService = new ServerRegistrationService(supabase, logger);
|
this.serverRegistrationService = new ServerRegistrationService(supabase, logger);
|
||||||
this.subscriptionCommands = new SubscriptionCommands(supabase, logger);
|
this.subscriptionCommands = new SubscriptionCommands(supabase, logger);
|
||||||
|
this.notificationService = new NotificationService(this, supabase);
|
||||||
|
|
||||||
// Initialize command handlers
|
// Initialize command handlers
|
||||||
this.commandHandler = new CommandHandler(
|
this.commandHandler = new CommandHandler(
|
||||||
@@ -36,6 +37,12 @@ class Bot {
|
|||||||
// Setup event handlers
|
// Setup event handlers
|
||||||
this.client.on('ready', () => {
|
this.client.on('ready', () => {
|
||||||
this.logger.info(`Logged in as ${this.client.user.tag}`);
|
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));
|
this.client.on('interactionCreate', this.handleInteraction.bind(this));
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
// src/services/NotificationService.js
|
// src/services/NotificationService.js
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const { createMatchRequestEmbed } = require('../utils/embedBuilders');
|
const { createMatchRequestEmbed } = require('../utils/EmbedBuilders');
|
||||||
const { createMatchActionRow } = require('../utils/componentBuilders');
|
const { createMatchActionRow } = require('../utils/componentBuilders');
|
||||||
|
|
||||||
class NotificationService {
|
class NotificationService {
|
||||||
@@ -57,7 +56,7 @@ class NotificationService {
|
|||||||
try {
|
try {
|
||||||
const channel = await this.bot.client.channels.fetch(subscription.channel_id);
|
const channel = await this.bot.client.channels.fetch(subscription.channel_id);
|
||||||
const embed = createMatchRequestEmbed(matchData);
|
const embed = createMatchRequestEmbed(matchData);
|
||||||
const actionRow = createMatchActionRow(matchData.game_id);
|
const actionRow = createMatchActionRow(matchData.game_name);
|
||||||
|
|
||||||
await channel.send({
|
await channel.send({
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
|
|||||||
@@ -15,19 +15,19 @@ const GAME_URLS = {
|
|||||||
function createMatchActionRow(gameName) {
|
function createMatchActionRow(gameName) {
|
||||||
const matchhubUrl = GAME_URLS[gameName] || "https://www.vrbattles.gg/games";
|
const matchhubUrl = GAME_URLS[gameName] || "https://www.vrbattles.gg/games";
|
||||||
|
|
||||||
return new ActionRowBuilder()
|
return new ActionRowBuilder().addComponents(
|
||||||
.addComponents(
|
new ButtonBuilder()
|
||||||
new ButtonBuilder()
|
.setLabel('🎮 View Matchhub')
|
||||||
.setLabel('View Matchhub')
|
.setStyle(ButtonStyle.Link)
|
||||||
.setStyle(ButtonStyle.Link)
|
.setURL(matchhubUrl),
|
||||||
.setURL(matchhubUrl),
|
new ButtonBuilder()
|
||||||
new ButtonBuilder()
|
.setLabel('🟡 Join VRBattles Discord')
|
||||||
.setLabel('Join VRBattles Discord')
|
.setStyle(ButtonStyle.Link)
|
||||||
.setStyle(ButtonStyle.Link)
|
.setURL('https://discord.gg/j3DKVATPGQ')
|
||||||
.setURL('https://discord.gg/j3DKVATPGQ')
|
);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
createMatchActionRow
|
createMatchActionRow,
|
||||||
|
GAME_URLS
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user