Fix stream checker error by correctly passing Supabase client

Modify listener registration in bot.js to ensure the Supabase client is correctly passed to the stream checker, resolving the "supabase.from is not a function" error by addressing argument handling for the 'ready' event.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: aed2e46d-25bb-4b73-81a1-bb9e8437c261
Replit-Commit-Checkpoint-Type: intermediate_checkpoint
Replit-Commit-Event-Id: 15e978ac-af85-4dc5-a34f-c363c14b4cba
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3bdfff67-975a-46ad-9845-fbb6b4a4c4b5/aed2e46d-25bb-4b73-81a1-bb9e8437c261/3tJ1Z1J
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
sirpiglr 2025-12-13 09:42:47 +00:00
parent 7843bd3f72
commit 9b1b8852d0

View file

@ -844,7 +844,17 @@ for (const file of generalListenerFiles) {
if (fs.existsSync(filePath)) {
const listener = require(filePath);
if ("name" in listener && "execute" in listener) {
client.on(listener.name, (...args) => listener.execute(...args, client, supabase));
// For 'ready' event: no args are passed, so call execute(client, supabase) directly
// For other events (messageCreate, etc.): args are passed, then client/supabase
if (listener.name === 'ready') {
if (listener.once) {
client.once(listener.name, () => listener.execute(client, supabase));
} else {
client.on(listener.name, () => listener.execute(client, supabase));
}
} else {
client.on(listener.name, (...args) => listener.execute(...args, client, supabase));
}
console.log(`Loaded listener: ${file}`);
}
}