Spaces:
Configuration error
Configuration error
Update app.py
Browse files1 unmodified line234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515247 unmodified lines10010110210310410510616 unmodified lines1231241251261271281291 unmodified linefrom discord.ext import commandsfrom discord.ui import Select, Viewimport threadingimport asynciofrom flask import Flask# الكود الصغير (الـ 3 أسطر) لتشغيل سيرفر الويب عشان البوت يفضل صاحيapp = Flask('')@app.route('/')def home(): return "🤖 MAGIC BOT IS ONLINE 24/7"def run_server(): app.run(host='0.0.0.0', port=7860)# 1. إعداد صلاحيات البوت الأساسيةintents = discord.Intents.default()intents.message_content = Trueintents.voice_states = Truebot = commands.Bot(command_prefix="!", intents=intents)# 🆔 آي دي الروم الصوتي الحقيقي بتاع سيرفركVOICE_CHANNEL_ID = 1390374574687785020@bot.eventasync def on_ready():print(f"=================================")print(f"🤖 MAGIC Bot is online: {bot.user}")print(f"=================================")# دخول الروم الصوتي فوراً عند التشغيلchannel = bot.get_channel(VOICE_CHANNEL_ID)if channel and isinstance(channel, discord.VoiceChannel):try:await channel.connect(reconnect=True, timeout=10.0, self_deaf=True)print(f"🎤 تم دخول الروم الصوتي بنجاح: {channel.name}")except Exception as e:print(f"❌ فشل دخول الروم بسبب: {e}")@bot.eventasync def on_voice_state_update(member, before, after):if member == bot.user and after.channel is None:await asyncio.sleep(5)channel = bot.get_channel(VOICE_CHANNEL_ID)if channel:try:await channel.connect(reconnect=True, self_deaf=True)except:pass# 2. تصميم قائمة اختيار اللغة (قوانين السيرفر)class LanguageSelect(Select):def __init__(self):47 unmodified linessuper().__init__(timeout=None)self.add_item(LanguageSelect())# 3. أمر الشات العادي والمختصر@bot.command(name="setup")async def setup_rules(ctx):try:16 unmodified linesawait ctx.send(content="@everyone", embed=embed, view=view)if __name__ == "__main__":# تشغيل السيرفر في الخلفيةthreading.Thread(target=run_server, daemon=True).start()# تشغيل البوتbot.run("MTQ5ODcyODE0NTQzMDM4NDY4MQ.GpMCDX.LU144SfR5qJgiwuHm_3JRxxo82fTTN8f5zdFAo")1 unmodified line2345678910111213141516171819202147 unmodified lines697071727374757677787980818283848516 unmodified lines1021031041051061071081 unmodified linefrom discord.ext import commandsfrom discord.ui import Select, Viewimport threadingfrom flask import Flask# الكود الصغير لتشغيل سيرفر الويب عشان البوت يفضل صاحي على Hugging Faceapp = Flask('')@app.route('/')def home(): return "🤖 MAGIC BOT IS ONLINE 24/7"def run_server(): app.run(host='0.0.0.0', port=7860)# 1. إعداد صلاحيات البوت الأساسية (بدون صلاحيات الفويس)intents = discord.Intents.default()intents.message_content = Truebot = commands.Bot(command_prefix="!", intents=intents)# 2. تصميم قائمة اختيار اللغة (قوانين السيرفر)class LanguageSelect(Select):def __init__(self):47 unmodified linessuper().__init__(timeout=None)self.add_item(LanguageSelect())@bot.eventasync def on_ready():print(f"=================================")print(f"🤖 MAGIC Bot is online: {bot.user}")print(f"=================================")# 🌟 تفعيل الأزرار فوراً عند تشغيل البوت لمنع أي تعليق نهائياًbot.add_view(LanguageView())print("⚙️ تم تفعيل أزرار اللغات بنجاح وبدون تعليق!")# 3. أمر الشات لإنشاء رسالة القوانين@bot.command(name="setup")async def setup_rules(ctx):try:16 unmodified linesawait ctx.send(content="@everyone", embed=embed, view=view)if __name__ == "__main__":# تشغيل السيرفر الوهمي في الخلفيةthreading.Thread(target=run_server, daemon=True).start()# تشغيل البوتbot.run("MTQ5ODcyODE0NTQzMDM4NDY4MQ.GpMCDX.LU144SfR5qJgiwuHm_3JRxxo82fTTN8f5zdFAo")
app.py+14-35