Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,15 +3,27 @@ from discord.ext import commands
|
|
| 3 |
from discord.ui import Select, View
|
| 4 |
import threading
|
| 5 |
import asyncio
|
|
|
|
| 6 |
|
| 7 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
intents = discord.Intents.default()
|
| 9 |
intents.message_content = True
|
| 10 |
intents.voice_states = True
|
| 11 |
|
| 12 |
bot = commands.Bot(command_prefix="!", intents=intents)
|
| 13 |
|
| 14 |
-
#
|
| 15 |
VOICE_CHANNEL_ID = 1390374574687785020
|
| 16 |
|
| 17 |
@bot.event
|
|
@@ -40,7 +52,7 @@ async def on_voice_state_update(member, before, after):
|
|
| 40 |
except:
|
| 41 |
pass
|
| 42 |
|
| 43 |
-
#
|
| 44 |
class LanguageSelect(Select):
|
| 45 |
def __init__(self):
|
| 46 |
options = [
|
|
@@ -93,7 +105,6 @@ class LanguageView(View):
|
|
| 93 |
super().__init__(timeout=None)
|
| 94 |
self.add_item(LanguageSelect())
|
| 95 |
|
| 96 |
-
# 3. أمر الشات العادي والمختصر
|
| 97 |
@bot.command(name="setup")
|
| 98 |
async def setup_rules(ctx):
|
| 99 |
try:
|
|
@@ -115,13 +126,10 @@ async def setup_rules(ctx):
|
|
| 115 |
view = LanguageView()
|
| 116 |
await ctx.send(content="@everyone", embed=embed, view=view)
|
| 117 |
|
| 118 |
-
def run_dummy_interface():
|
| 119 |
-
import gradio as gr
|
| 120 |
-
with gr.Blocks() as demo:
|
| 121 |
-
gr.Markdown("# 🤖 MAGIC BOT IS ONLINE 24/7")
|
| 122 |
-
demo.launch(server_name="0.0.0.0", server_port=7860)
|
| 123 |
-
|
| 124 |
if __name__ == "__main__":
|
| 125 |
-
|
|
|
|
| 126 |
t.start()
|
|
|
|
|
|
|
| 127 |
bot.run("MTQ5ODcyODE0NTQzMDM4NDY4MQ.GpMCDX.LU144SfR5qJgiwuHm_3JRxxo82fTTN8f5zdFAo")
|
|
|
|
| 3 |
from discord.ui import Select, View
|
| 4 |
import threading
|
| 5 |
import asyncio
|
| 6 |
+
from flask import Flask
|
| 7 |
|
| 8 |
+
# إنشاء سيرفر ويب وهمي باستخدام Flask عشان البوت ما ينامش
|
| 9 |
+
app = Flask('')
|
| 10 |
+
|
| 11 |
+
@app.route('/')
|
| 12 |
+
def home():
|
| 13 |
+
return "🤖 MAGIC BOT IS ALIVE 24/7!"
|
| 14 |
+
|
| 15 |
+
def run_web_server():
|
| 16 |
+
# تشغيل السيرفر على بورت 7860 وهو البورت المعتمد في Hugging Face
|
| 17 |
+
app.run(host='0.0.0.0', port=7860)
|
| 18 |
+
|
| 19 |
+
# إعداد صلاحيات البوت الأساسية
|
| 20 |
intents = discord.Intents.default()
|
| 21 |
intents.message_content = True
|
| 22 |
intents.voice_states = True
|
| 23 |
|
| 24 |
bot = commands.Bot(command_prefix="!", intents=intents)
|
| 25 |
|
| 26 |
+
# آي دي الروم الصوتي الحقيقي بتاع سيرفرك
|
| 27 |
VOICE_CHANNEL_ID = 1390374574687785020
|
| 28 |
|
| 29 |
@bot.event
|
|
|
|
| 52 |
except:
|
| 53 |
pass
|
| 54 |
|
| 55 |
+
# تصميم قائمة اختيار اللغة (قوانين السيرفر)
|
| 56 |
class LanguageSelect(Select):
|
| 57 |
def __init__(self):
|
| 58 |
options = [
|
|
|
|
| 105 |
super().__init__(timeout=None)
|
| 106 |
self.add_item(LanguageSelect())
|
| 107 |
|
|
|
|
| 108 |
@bot.command(name="setup")
|
| 109 |
async def setup_rules(ctx):
|
| 110 |
try:
|
|
|
|
| 126 |
view = LanguageView()
|
| 127 |
await ctx.send(content="@everyone", embed=embed, view=view)
|
| 128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
if __name__ == "__main__":
|
| 130 |
+
# تشغيل السيرفر في خلفية الكود
|
| 131 |
+
t = threading.Thread(target=run_web_server)
|
| 132 |
t.start()
|
| 133 |
+
|
| 134 |
+
# تشغيل البوت (تأكد من تحديث التوكن إذا كان ديسكورد قد ألغاه)
|
| 135 |
bot.run("MTQ5ODcyODE0NTQzMDM4NDY4MQ.GpMCDX.LU144SfR5qJgiwuHm_3JRxxo82fTTN8f5zdFAo")
|