diff --git a/src/routes/webhook.js b/src/routes/webhook.js index 7a6f9c4..9fc7690 100644 --- a/src/routes/webhook.js +++ b/src/routes/webhook.js @@ -52,7 +52,7 @@ export const webhookRoutes = (fastify, _, done) => { // Example processing: log the video IDs of new videos const entry = feed.entry[0]; if(!entry) return reply.code(200).send(); - const [{users: user, sites: site}] = await db.select().from(users).leftJoin(sites, eq(users.id, sites.user_id)).where(eq(users.channel_id, "UC" + feed["yt:channelId"][0])); + const [{users: user, sites: site}] = await db.select().from(users).leftJoin(sites, eq(users.id, sites.user_id)).where(eq(users.channel_id, entry["yt:channelId"][0])); if (!user || !site) throw new Error("User not found"); if (user.tokens < 3) throw new Error("Not enough tokens");