Spaces:
Configuration error
Configuration error
Update app.py
Browse files42 unmodified lines4344454647484950515253545561 unmodified lines11711811912012112212312412512612712812913013113242 unmodified lines"MTQ4NjA5Nzg0NDM4ODQ5NTQ1Mw.G6gyXL.nxOQaSyLNNQzntpVsbHJcaH3THdnu-H3qHQqBs"])async def start_bot(token, channel_id):clean_token = token.strip()intents = discord.Intents.default()intents.message_content = Trueintents.voice_states = Truebot = commands.Bot(command_prefix="!", self_bot=True, intents=intents)bot.is_reconnecting = Falseasync def handle_streaming():61 unmodified linesexcept:pass# محاولة الاتصال الذكي وتخطي التعليق والحجبtry:await bot.login(clean_token)await bot.connect()except Exception as e:try:print(f'🔄 {bot.user.name if bot.user else "حساب"} يجرّب البروكسي البديل لتخطي الحجب...')await bot.connect(proxy="http://45.72.63.14:80")except Exception as ex:print(f'❌ خطأ نهائي في اتصال توكن [{clean_token[:15]}...]: {ex}')# 🌐 تشغيل سيرفر ويب وهمي لمنع Hugging Face من إغلاق الـ Spaceasync def keep_alive():42 unmodified lines43444546474849505152535455565758596061 unmodified lines12212312412512612712812913013113213313413513642 unmodified lines"MTQ4NjA5Nzg0NDM4ODQ5NTQ1Mw.G6gyXL.nxOQaSyLNNQzntpVsbHJcaH3THdnu-H3qHQqBs"])async def start_bot(token, channel_id, use_proxy=False):clean_token = token.strip()intents = discord.Intents.default()intents.message_content = Trueintents.voice_states = True# تحديد البروكسي عند بناء البوت إذا تطلب الأمر لتفادي الخطأbot_kwargs = {"command_prefix": "!", "self_bot": True, "intents": intents}if use_proxy:bot_kwargs["proxy"] = "http://45.72.63.14:80"bot = commands.Bot(**bot_kwargs)bot.is_reconnecting = Falseasync def handle_streaming():61 unmodified linesexcept:passtry:await bot.login(clean_token)await bot.connect()except Exception as e:if not use_proxy:print(f'🔄 خطأ في الاتصال العادي للتوكن [{clean_token[:15]}...]. جاري التحويل للبروكسي البديل...')await start_bot(token, channel_id, use_proxy=True)else:print(f'❌ خطأ نهائي في اتصال توكن [{clean_token[:15]}...]: {e}')# 🌐 تشغيل سيرفر ويب وهمي لمنع Hugging Face من إغلاق الـ Spaceasync def keep_alive():
app.py+12-8