refactor: remove redundant console logging from TikTok webhook handler

This commit is contained in:
2026-07-02 19:44:02 +07:00 Unverified
parent e85b8904d6
commit e3a79a55e4
-12
View File
@@ -6,7 +6,6 @@ export async function POST(req: Request) {
if (process.env.TIKTOK_WEBHOOK_SECRET) {
const { searchParams } = new URL(req.url);
if (searchParams.get("secret") !== process.env.TIKTOK_WEBHOOK_SECRET) {
console.error("[TikTok Webhook] Unauthorized request: invalid or missing secret query parameter.");
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
}
@@ -128,16 +127,6 @@ async function sendDiscordNotification(content: string, embed?: any) {
const token = process.env.DISCORD_BOT_TOKEN;
const channelId = process.env.DISCORD_CHANNEL_ID;
if (!token) {
console.error("[TikTok Webhook] Missing DISCORD_BOT_TOKEN");
return;
}
if (!channelId) {
console.error("[TikTok Webhook] Missing DISCORD_CHANNEL_ID environment variable. Please add it to your .env file.");
return;
}
try {
const res = await fetch(`https://discord.com/api/v10/channels/${channelId}/messages`, {
method: "POST",
@@ -154,7 +143,6 @@ async function sendDiscordNotification(content: string, embed?: any) {
if (!res.ok) {
console.error("[TikTok Webhook] Failed to send Discord message:", await res.text());
} else {
console.log("[TikTok Webhook] Successfully sent Discord message");
}
} catch (error) {
console.error("[TikTok Webhook] Error sending Discord message:", error);