Spaces:
Runtime error
Runtime error
Update server.ts
Browse files45 unmodified lines46474849505152534 unmodified lines585960616263646566676869707172737475767778798081828345 unmodified linesconst isAdmin = (cleanAdminId && (uid === cleanAdminId || (uname && uname === cleanAdminId)));const isManager = (cleanManagerId && (uid === cleanManagerId || (uname && uname === cleanManagerId)));return { isAdmin, isManager, isEither: isAdmin || isManager };};// Use a custom URL if provided, otherwise fallback to SHARED_APP_URL or APP_URLconst appUrl = process.env.CUSTOM_APP_URL || process.env.SHARED_APP_URL || process.env.APP_URL || '';4 unmodified lineshasSupabaseKey: !!supabaseServiceKey,isServiceKey: !!process.env.SUPABASE_SERVICE_ROLE_KEY,appUrl: appUrl// --- MODIFICATION HUGGING FACE (REMPLACE LA LIGNE 60) ---const bot = new Telegraf(botToken);// On ne bloque pas le démarrage si Telegram n'est pas joignable immédiatementlet botUsername = 'Bot';bot.telegram.getMe().then(me => {botUsername = me.username;console.log(`✅ Bot en ligne : @${botUsername}`);}).catch(err => {console.log('⚠️ Note: Connexion initiale Telegram impossible (normal sur HF), attente du Webhook...');});const bot = new Telegraf(botToken);let botUsername = '';bot.telegram.getMe().then(me => {botUsername = me.username;console.log(`Bot username initialized: @${botUsername}`);}).catch(err => {console.error('Failed to get bot username:', err);});// Set bot descriptions (visible before clicking Start)45 unmodified lines4647484950515253544 unmodified lines596061626364656667686970717273747545 unmodified linesconst isAdmin = (cleanAdminId && (uid === cleanAdminId || (uname && uname === cleanAdminId)));const isManager = (cleanManagerId && (uid === cleanManagerId || (uname && uname === cleanManagerId)));return { isAdmin, isManager, isEither: isAdmin || isManager };};// Use a custom URL if provided, otherwise fallback to SHARED_APP_URL or APP_URLconst appUrl = process.env.CUSTOM_APP_URL || process.env.SHARED_APP_URL || process.env.APP_URL || '';4 unmodified lineshasSupabaseKey: !!supabaseServiceKey,isServiceKey: !!process.env.SUPABASE_SERVICE_ROLE_KEY,appUrl: appUrl}); // <--- C'est cette parenthèse qui manquait !// --- MODIFICATION HUGGING FACE ---const bot = new Telegraf(botToken);let botUsername = 'Bot';bot.telegram.getMe().then(me => {botUsername = me.username;console.log(`✅ Bot en ligne : @${botUsername}`);}).catch(err => {console.log('⚠️ Note: Connexion initiale Telegram impossible, attente du Webhook...');});// Set bot descriptions (visible before clicking Start)
server.ts+5-13