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 clientId = process.env.DISCORD_CLIENT_ID;
|
||||
const botToken = process.env.DISCORD_BOT_TOKEN?.trim();
|
||||
const clientId = process.env.DISCORD_CLIENT_ID?.trim();
|
||||
|
||||
console.log(
|
||||
"[Discord] Config check - botToken set:",
|
||||
!!botToken,
|
||||
"clientId set:",
|
||||
!!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) {
|
||||
return res.status(500).json({
|
||||
error: "Discord bot token or client ID not configured",
|
||||
});
|
||||
}
|
||||
|
||||
// Validate token format - Discord bot tokens are typically long strings
|
||||
// They don't always have dots, but should be reasonably long
|
||||
if (!botToken || botToken.trim().length < 20) {
|
||||
// Validate token format
|
||||
if (botToken.length < 20) {
|
||||
console.warn(
|
||||
"[Discord] Bot token appears invalid - length:",
|
||||
botToken.length,
|
||||
|
|
|
|||
Loading…
Reference in a new issue