temporarily removed the notification service

This commit is contained in:
Xargana 2025-05-07 21:03:42 +03:00
parent 2e613573a2
commit b9ed6cd6ec
2 changed files with 36 additions and 36 deletions

View file

@ -1,6 +1,6 @@
const { Client, GatewayIntentBits, ChannelType } = require("discord.js"); const { Client, GatewayIntentBits, ChannelType } = require("discord.js");
const CommandManager = require('./CommandManager'); const CommandManager = require('./CommandManager');
const NotificationService = require('./NotificationService'); // const NotificationService = require('./NotificationService');
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
@ -31,7 +31,7 @@ class Bot {
this.setupEventHandlers(); this.setupEventHandlers();
// Initialize notification service // Initialize notification service
this.notificationService = null; // this.notificationService = null;
} }
setupTempDirectory() { setupTempDirectory() {
@ -56,13 +56,13 @@ class Bot {
await this.commandManager.registerGlobalCommands(); await this.commandManager.registerGlobalCommands();
// Initialize and start the notification service // Initialize and start the notification service
this.notificationService = new NotificationService(this.client, { // this.notificationService = new NotificationService(this.client, {
checkInterval: process.env.STATUS_CHECK_INTERVAL ? parseInt(process.env.STATUS_CHECK_INTERVAL) : 5000, // checkInterval: process.env.STATUS_CHECK_INTERVAL ? parseInt(process.env.STATUS_CHECK_INTERVAL) : 5000,
statusEndpoint: process.env.STATUS_ENDPOINT || 'https://blahaj.tr:2589/status' // statusEndpoint: process.env.STATUS_ENDPOINT || 'https://blahaj.tr:2589/status'
}); // });
await this.notificationService.initialize(); // await this.notificationService.initialize();
this.notificationService.start(); // this.notificationService.start();
// Send startup notification // Send startup notification
await this.sendStartupNotification(); await this.sendStartupNotification();
@ -108,12 +108,12 @@ class Bot {
name: "Relative Time", name: "Relative Time",
value: `<t:${Math.floor(Date.now() / 1000)}:R>`, value: `<t:${Math.floor(Date.now() / 1000)}:R>`,
inline: true inline: true
},
{
name: "Status Monitoring",
value: this.notificationService?.isRunning ? "✅ Active" : "❌ Inactive",
inline: true
} }
// {
// name: "Status Monitoring",
// value: this.notificationService?.isRunning ? "✅ Active" : "❌ Inactive",
// inline: true
// }
], ],
footer: { footer: {
text: "blahaj.tr" text: "blahaj.tr"
@ -131,14 +131,14 @@ class Bot {
} }
// Also notify in status channel if configured // Also notify in status channel if configured
if (this.notificationService?.statusChannel) { // if (this.notificationService?.statusChannel) {
try { // try {
await this.notificationService.statusChannel.send({ embeds: [startupEmbed] }); // await this.notificationService.statusChannel.send({ embeds: [startupEmbed] });
console.log(`Sent startup notification to status channel: ${this.notificationService.statusChannel.name}`); // console.log(`Sent startup notification to status channel: ${this.notificationService.statusChannel.name}`);
} catch (error) { // } catch (error) {
console.error("Failed to send startup notification to status channel:", error.message); // console.error("Failed to send startup notification to status channel:", error.message);
} // }
} // }
} }
async sendShutdownNotification(reason = "Manual shutdown", error = null) { async sendShutdownNotification(reason = "Manual shutdown", error = null) {
@ -178,9 +178,9 @@ class Bot {
} }
// Stop notification service if running // Stop notification service if running
if (this.notificationService?.isRunning) { // if (this.notificationService?.isRunning) {
this.notificationService.stop(); // this.notificationService.stop();
} // }
// Notify authorized user // Notify authorized user
try { try {
@ -192,14 +192,14 @@ class Bot {
} }
// Also notify in status channel if available // Also notify in status channel if available
if (this.notificationService?.statusChannel) { // if (this.notificationService?.statusChannel) {
try { // try {
await this.notificationService.statusChannel.send({ embeds: [shutdownEmbed] }); // await this.notificationService.statusChannel.send({ embeds: [shutdownEmbed] });
console.log(`Sent shutdown notification to status channel: ${this.notificationService.statusChannel.name}`); // console.log(`Sent shutdown notification to status channel: ${this.notificationService.statusChannel.name}`);
} catch (error) { // } catch (error) {
console.error("Failed to send shutdown notification to status channel:", error.message); // console.error("Failed to send shutdown notification to status channel:", error.message);
} // }
} // }
} }
async start() { async start() {
@ -210,9 +210,9 @@ class Bot {
async stop() { async stop() {
// Stop notification service // Stop notification service
if (this.notificationService) { // if (this.notificationService) {
this.notificationService.stop(); // this.notificationService.stop();
} // }
// Destroy the client // Destroy the client
if (this.client) { if (this.client) {
@ -221,4 +221,4 @@ class Bot {
} }
} }
module.exports = Bot; module.exports = Bot;