completionId: cgen-7ed7b0861f9b41baa706d20d52c93f7e
cgen-7ed7b0861f9b41baa706d20d52c93f7e
This commit is contained in:
parent
e0ac5c3190
commit
1e5e648180
1 changed files with 17 additions and 5 deletions
|
|
@ -1274,25 +1274,37 @@ export function createServer() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const botToken = process.env.DISCORD_BOT_TOKEN;
|
const botToken = process.env.DISCORD_BOT_TOKEN?.trim();
|
||||||
const clientId = process.env.DISCORD_CLIENT_ID;
|
const clientId = process.env.DISCORD_CLIENT_ID?.trim();
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
"[Discord] Config check - botToken set:",
|
"[Discord] Config check - botToken set:",
|
||||||
!!botToken,
|
!!botToken,
|
||||||
"clientId set:",
|
"clientId set:",
|
||||||
!!clientId,
|
!!clientId,
|
||||||
|
"botToken length:",
|
||||||
|
botToken?.length,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Log first and last few chars of token for debugging (safe logging)
|
||||||
|
if (botToken) {
|
||||||
|
const first = botToken.substring(0, 5);
|
||||||
|
const last = botToken.substring(botToken.length - 5);
|
||||||
|
console.log(
|
||||||
|
"[Discord] Token preview: " + first + "..." + last,
|
||||||
|
"Total length:",
|
||||||
|
botToken.length,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!botToken || !clientId) {
|
if (!botToken || !clientId) {
|
||||||
return res.status(500).json({
|
return res.status(500).json({
|
||||||
error: "Discord bot token or client ID not configured",
|
error: "Discord bot token or client ID not configured",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate token format - Discord bot tokens are typically long strings
|
// Validate token format
|
||||||
// They don't always have dots, but should be reasonably long
|
if (botToken.length < 20) {
|
||||||
if (!botToken || botToken.trim().length < 20) {
|
|
||||||
console.warn(
|
console.warn(
|
||||||
"[Discord] Bot token appears invalid - length:",
|
"[Discord] Bot token appears invalid - length:",
|
||||||
botToken.length,
|
botToken.length,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue