supabase setup

This commit is contained in:
VinceC
2024-11-24 03:49:23 -06:00
parent c62c1f81e4
commit 3b10e77c82
3 changed files with 330 additions and 103 deletions

View File

@@ -38,9 +38,19 @@ class Bot {
this.client.on('interactionCreate', this.handleInteraction.bind(this));
}
async start(token) {
console.log("Starting bot...");
try {
// In the start method, add Supabase connection test:
async start(token) {
console.log("Starting bot...");
try {
// Test Supabase connection first
if (this.supabaseService) {
const connected = await this.supabaseService.testConnection();
if (!connected) {
console.warn('Supabase connection failed. Subscription features will be disabled.');
this.subscriptionCommands = null;
}
}
await this.client.login(token);
console.log("Login successful");
@@ -48,11 +58,11 @@ class Bot {
const port = process.env.NOTIFICATION_PORT || 3000;
await this.notificationService.start(port);
console.log(`Notification service started on port ${port}`);
} catch (error) {
} catch (error) {
console.error("Startup failed:", error);
throw error;
}
}
}
async stop() {
console.log("Stopping bot...");