Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,6 @@ from discord.ui import Select, View
|
|
| 4 |
import threading
|
| 5 |
from flask import Flask
|
| 6 |
|
| 7 |
-
# تشغيل سيرفر ويب خفيف جداً متوافق تماماً مع Hugging Face
|
| 8 |
app = Flask('')
|
| 9 |
|
| 10 |
@app.route('/')
|
|
@@ -12,16 +11,13 @@ def home():
|
|
| 12 |
return "🤖 MAGIC BOT IS ALIVE 24/7!"
|
| 13 |
|
| 14 |
def run_server():
|
| 15 |
-
# استخدام البورت الافتراضي الصحيح
|
| 16 |
app.run(host='0.0.0.0', port=7860)
|
| 17 |
|
| 18 |
-
# إعداد الصلاحيات الأساسية بدون فويس
|
| 19 |
intents = discord.Intents.default()
|
| 20 |
intents.message_content = True
|
| 21 |
|
| 22 |
bot = commands.Bot(command_prefix="!", intents=intents)
|
| 23 |
|
| 24 |
-
# تصميم قائمة اختيار اللغة
|
| 25 |
class LanguageSelect(Select):
|
| 26 |
def __init__(self):
|
| 27 |
options = [
|
|
@@ -31,6 +27,9 @@ class LanguageSelect(Select):
|
|
| 31 |
super().__init__(placeholder="🌍 Choose language / اختر اللغة...", min_values=1, max_values=1, custom_id="select-language", options=options)
|
| 32 |
|
| 33 |
async def callback(self, interaction: discord.Interaction):
|
|
|
|
|
|
|
|
|
|
| 34 |
if self.values[0] == "lang_arabic":
|
| 35 |
arabic_embed = discord.Embed(
|
| 36 |
title="📜 قوانين السيرفر (اللغة العربية)",
|
|
@@ -42,13 +41,13 @@ class LanguageSelect(Select):
|
|
| 42 |
"𝟓. يمنع الإعلان أو الترويج بدون إذن الإدارة.\n\n"
|
| 43 |
"𝟔. يمنع إرسال روابط أو دعوات سيرفرات أخرى للأعضاء داخل السيرفر أو عبر الرسائل الخاصة.\n\n"
|
| 44 |
"𝟕. الالتزام بتعليمات الإدارة والمشرفين.\n\n"
|
| 45 |
-
"
|
| 46 |
"𝟗. يمنع انتحال شخصية أي عضو أو إداري.\n\n"
|
| 47 |
"𝟏𝟎. مخالفة القوانين قد تؤدي إلى تحذير أو كتم أو حظر."
|
| 48 |
),
|
| 49 |
color=discord.Color.green()
|
| 50 |
)
|
| 51 |
-
await interaction.
|
| 52 |
|
| 53 |
elif self.values[0] == "lang_english":
|
| 54 |
english_embed = discord.Embed(
|
|
@@ -67,7 +66,7 @@ class LanguageSelect(Select):
|
|
| 67 |
),
|
| 68 |
color=discord.Color.blue()
|
| 69 |
)
|
| 70 |
-
await interaction.
|
| 71 |
|
| 72 |
class LanguageView(View):
|
| 73 |
def __init__(self):
|
|
@@ -77,7 +76,7 @@ class LanguageView(View):
|
|
| 77 |
@bot.event
|
| 78 |
async def on_ready():
|
| 79 |
print(f"=================================")
|
| 80 |
-
print(f"🤖 MAGIC Bot is online
|
| 81 |
print(f"=================================")
|
| 82 |
bot.add_view(LanguageView())
|
| 83 |
|
|
@@ -96,15 +95,13 @@ async def setup_rules(ctx):
|
|
| 96 |
),
|
| 97 |
color=discord.Color.from_rgb(43, 45, 49)
|
| 98 |
)
|
| 99 |
-
embed.set_thumbnail(url="https://cdn.discordapp.com/attachments/1432870042390761512/
|
| 100 |
-
embed.set_image(url="https://cdn.discordapp.com/attachments/1432870042390761512/
|
| 101 |
|
| 102 |
view = LanguageView()
|
| 103 |
await ctx.send(content="@everyone", embed=embed, view=view)
|
| 104 |
|
| 105 |
if __name__ == "__main__":
|
| 106 |
-
# تشغيل السيرفر في الخلفية
|
| 107 |
threading.Thread(target=run_server, daemon=True).start()
|
| 108 |
-
|
| 109 |
-
# ⚠️ انتبه هنا: امسح كلمة (ضع_التوكن_الجديد_هنا) واكتب التوكن بتاعك مكانها بالظبط وخلي علامات التنصيص موجودة!
|
| 110 |
bot.run("MTQ5ODcyODE0NTQzMDM4NDY4MQ.G1ly6t.DwKYP1auLYArYflsCrguctW6OW-_xMemwiymNw")
|
|
|
|
| 4 |
import threading
|
| 5 |
from flask import Flask
|
| 6 |
|
|
|
|
| 7 |
app = Flask('')
|
| 8 |
|
| 9 |
@app.route('/')
|
|
|
|
| 11 |
return "🤖 MAGIC BOT IS ALIVE 24/7!"
|
| 12 |
|
| 13 |
def run_server():
|
|
|
|
| 14 |
app.run(host='0.0.0.0', port=7860)
|
| 15 |
|
|
|
|
| 16 |
intents = discord.Intents.default()
|
| 17 |
intents.message_content = True
|
| 18 |
|
| 19 |
bot = commands.Bot(command_prefix="!", intents=intents)
|
| 20 |
|
|
|
|
| 21 |
class LanguageSelect(Select):
|
| 22 |
def __init__(self):
|
| 23 |
options = [
|
|
|
|
| 27 |
super().__init__(placeholder="🌍 Choose language / اختر اللغة...", min_values=1, max_values=1, custom_id="select-language", options=options)
|
| 28 |
|
| 29 |
async def callback(self, interaction: discord.Interaction):
|
| 30 |
+
# 🌟 سطر السحر: بيخلي البوت يثبت الاتصال مع ديسكورد فوراً عشان يمنع خطأ الـ Interaction failed
|
| 31 |
+
await interaction.response.defer(ephemeral=True)
|
| 32 |
+
|
| 33 |
if self.values[0] == "lang_arabic":
|
| 34 |
arabic_embed = discord.Embed(
|
| 35 |
title="📜 قوانين السيرفر (اللغة العربية)",
|
|
|
|
| 41 |
"𝟓. يمنع الإعلان أو الترويج بدون إذن الإدارة.\n\n"
|
| 42 |
"𝟔. يمنع إرسال روابط أو دعوات سيرفرات أخرى للأعضاء داخل السيرفر أو عبر الرسائل الخاصة.\n\n"
|
| 43 |
"𝟕. الالتزام بتعليمات الإدارة والمشرفين.\n\n"
|
| 44 |
+
"٨. استخدام القنوات المخصصة لكل موضوع.\n\n"
|
| 45 |
"𝟗. يمنع انتحال شخصية أي عضو أو إداري.\n\n"
|
| 46 |
"𝟏𝟎. مخالفة القوانين قد تؤدي إلى تحذير أو كتم أو حظر."
|
| 47 |
),
|
| 48 |
color=discord.Color.green()
|
| 49 |
)
|
| 50 |
+
await interaction.followup.send(embed=arabic_embed, ephemeral=True)
|
| 51 |
|
| 52 |
elif self.values[0] == "lang_english":
|
| 53 |
english_embed = discord.Embed(
|
|
|
|
| 66 |
),
|
| 67 |
color=discord.Color.blue()
|
| 68 |
)
|
| 69 |
+
await interaction.followup.send(embed=english_embed, ephemeral=True)
|
| 70 |
|
| 71 |
class LanguageView(View):
|
| 72 |
def __init__(self):
|
|
|
|
| 76 |
@bot.event
|
| 77 |
async def on_ready():
|
| 78 |
print(f"=================================")
|
| 79 |
+
print(f"🤖 MAGIC Bot is online")
|
| 80 |
print(f"=================================")
|
| 81 |
bot.add_view(LanguageView())
|
| 82 |
|
|
|
|
| 95 |
),
|
| 96 |
color=discord.Color.from_rgb(43, 45, 49)
|
| 97 |
)
|
| 98 |
+
embed.set_thumbnail(url="https://cdn.discordapp.com/attachments/1432870042390761512/1513686496228671498/Profile_Pic_GIF_1.png")
|
| 99 |
+
embed.set_image(url="https://cdn.discordapp.com/attachments/1432870042390761512/1513686751103684788/0dcfa1ee-62bd-45f1-9d79-b18a3867fbc8.png")
|
| 100 |
|
| 101 |
view = LanguageView()
|
| 102 |
await ctx.send(content="@everyone", embed=embed, view=view)
|
| 103 |
|
| 104 |
if __name__ == "__main__":
|
|
|
|
| 105 |
threading.Thread(target=run_server, daemon=True).start()
|
| 106 |
+
# ⚠️ حط التوكن الشغال بتاعك هنا بداخل علامات التنصيص
|
|
|
|
| 107 |
bot.run("MTQ5ODcyODE0NTQzMDM4NDY4MQ.G1ly6t.DwKYP1auLYArYflsCrguctW6OW-_xMemwiymNw")
|