Yous135774 commited on
Commit
a3a5e34
·
verified ·
1 Parent(s): 7323534

Update bot.py

Browse files
Files changed (1) hide show
  1. bot.py +0 -43
bot.py CHANGED
@@ -1325,49 +1325,6 @@ async def settings_cmd(interaction: discord.Interaction):
1325
 
1326
 
1327
  # ================================
1328
- # 📝 16. Translation & Paraphrasing Tools
1329
- # ================================
1330
- async def text_ai_helper(prompt_text):
1331
- current_api_key = ai_engine.get_valid_key()
1332
- if not current_api_key: return "❌ لا توجد مفاتيح متاحة حالياً، يرجى الانتظار."
1333
-
1334
- genai.configure(api_key=current_api_key)
1335
- try:
1336
- model = genai.GenerativeModel("gemini-2.5-flash")
1337
- response = await asyncio.wait_for(
1338
- asyncio.to_thread(model.generate_content, prompt_text),
1339
- timeout=15.0
1340
- )
1341
- return response.text.strip() if response.text else "❌ فشلت العملية."
1342
- except Exception as e:
1343
- ai_engine.report_dead_key(current_api_key)
1344
- return f"⚠️ حدث خطأ أثناء الاتصال. تم تبديل المفتاح، حاول مجدداً."
1345
-
1346
- @bot.tree.command(name="translate", description="ترجمة احترافية للنصوص مع دعم تعدد اللغات")
1347
- @app_commands.describe(text="النص المراد ترجمته", target_lang="اللغة الهدف (الافتراضي: العربية)", source_lang="لغة المصدر (الافتراضي: اكتشاف تلقائي)")
1348
- async def translate_cmd(interaction: discord.Interaction, text: str, target_lang: str = "العربية", source_lang: str = "اكتشاف تلقائي"):
1349
- await interaction.response.defer(ephemeral=False)
1350
-
1351
- prompt = (
1352
- f"You are a highly skilled professional translator specializing in Manga, Manhwa, and Comics.\n"
1353
- f"Your task is to translate the following text from [{source_lang}] to [{target_lang}].\n\n"
1354
- f"STRICT RULES:\n"
1355
- f"1. Preserve the exact tone, emotion, and context of the scene (e.g., shouting, whispering, thoughts).\n"
1356
- f"2. Adapt idioms, cultural references, and slang to sound completely natural and eloquent in {target_lang}.\n"
1357
- f"3. Maintain formatting if there are any specific tags.\n"
1358
- f"4. OUTPUT ONLY THE TRANSLATED TEXT. DO NOT add any notes, explanations, or introductions.\n\n"
1359
- f"Original Text:\n{text}"
1360
- )
1361
-
1362
- result = await text_ai_helper(prompt)
1363
-
1364
- embed = discord.Embed(title="🌐 المترجم الاحترافي", color=0x2ecc71)
1365
- embed.add_field(name=f"النص الأصلي ({source_lang}):", value=f"
1366
- http://googleusercontent.com/immersive_entry_chip/0
1367
- http://googleusercontent.com/immersive_entry_chip/1
1368
- http://googleusercontent.com/immersive_entry_chip/2
1369
- http://googleusercontent.com/immersive_entry_chip/3
1370
- # ================================
1371
  # 🎫 19. Ticket & Support System
1372
  # ================================
1373
  class TicketControlView(discord.ui.View):
 
1325
 
1326
 
1327
  # ================================
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1328
  # 🎫 19. Ticket & Support System
1329
  # ================================
1330
  class TicketControlView(discord.ui.View):