Download modules/fun.py from ABO3MR/df: direct link, hf CLI and curl.
- Browser
- Download file 31.3 kB
-
https://huggingface.co/spaces/ABO3MR/df/resolve/main/modules/fun.py
- Command line
-
hf download hf://spaces/ABO3MR/df/modules/fun.py
-
curl -L -o fun.py https://huggingface.co/spaces/ABO3MR/df/resolve/main/modules/fun.py
31.3 kB
| """التسلية والتحشيش والخدمات الشاملة: | |
| - 30+ لقب تحشيش وقوائمها ومسحها (التاج، الملوك، الملكات، الثولان، الجلاب، المطايه، الصخول، البقرات، الزواحف، اللوكيه، الاغبياء، الطليان، الطامسين، العسل، الكيك، قلبي، الهطوف، البثرين، الحمير، الكلاب، الكلبات، العتوين، العتويات، اللحوج، اللحجيات، الخرفان، الخفيفين، الخفيفات) | |
| - شنو رايك بهذا/بهاي، انطي هديه، بوسه/بوسني، صيحه، رزله، حضن، كف، قول | |
| - زوجني، تتزوجني، ثنائي اليوم، اسمي، معرفي، تفاعلي/تفاعله، جهاتي/جهاته، نبذه، الوقت، نداء، نزلني | |
| - البوت السحري، معنى اسم، حساب العمر، قوقل، قصص/ثريد، مقالات، زخرفة (16 شكل)، ترجمة (عربي/انقليزي)، أبراج، غنيلي.""" | |
| import random | |
| import hashlib | |
| from datetime import datetime | |
| from urllib.parse import quote_plus | |
| from telegram import InlineKeyboardButton, InlineKeyboardMarkup | |
| from telegram.ext import CallbackQueryHandler | |
| from core.router import exact, prefix, norm | |
| from core import content | |
| from core import ranks as R | |
| from core.store import ( | |
| settings, ranks_db, stats, users_db, | |
| get_counter, activity_label, find_user_by_username, | |
| ) | |
| from modules.toggles import tg_on | |
| from strings_ar import S | |
| def _name(u): | |
| return u.first_name if u else "" | |
| def _fun_ok(update): | |
| return tg_on(update.effective_chat.id, "fun") | |
| def _pct(update, what): | |
| t = update.message.reply_to_message.from_user if update.message.reply_to_message else update.effective_user | |
| h = int(hashlib.md5(f"{what}{t.id}".encode()).hexdigest(), 16) % 101 | |
| return t, h | |
| def _mk_pct(what, emoji): | |
| async def h(update, ctx, arg=""): | |
| if not _fun_ok(update): | |
| await update.message.reply_text(S["feature_off"]) | |
| return | |
| t, p = _pct(update, what) | |
| await update.message.reply_text(S["percent"].format(what=what, name=_name(t), pct=p, emoji=emoji)) | |
| return h | |
| for w, e in ( | |
| ("نسبه الحب", "❤️"), ("نسبه الغباء", "🤪"), ("نسبه الانوثه", "💅"), | |
| ("نسبه الرجوله", "💪"), ("نسبه الذكاء", "🧠"), ("نسبه الكدب", "🤥"), | |
| ("نسبه الجمال", "🌟"), ("نسبه الحظ", "🍀"), ("نسبه الصدق", "😇"), | |
| ("نسبه الكره", "😤"), ("نسبه العصبيه", "🔥"), | |
| ): | |
| exact(w)(_mk_pct(w, e)) | |
| exact("نسبه الرجولة", "نسبه رجولته")(_mk_pct("نسبه الرجوله", "💪")) | |
| exact("نسبه انوثتها")(_mk_pct("نسبه الانوثه", "💅")) | |
| async def toheb(update, ctx, arg=""): | |
| if not _fun_ok(update): | |
| await update.message.reply_text(S["feature_off"]) | |
| return | |
| t = update.message.reply_to_message.from_user if update.message.reply_to_message else None | |
| if not t: | |
| await update.message.reply_text(S["need_reply"]) | |
| return | |
| a = update.effective_user | |
| pct = int(hashlib.md5(f"love{a.id}{t.id}".encode()).hexdigest(), 16) % 101 | |
| await update.message.reply_text(S["toheb"].format(a=a.first_name, b=t.first_name, pct=pct)) | |
| # ---------- قوائم رتب التحشيش ومسحها ---------- | |
| FUN_PLURALS = { | |
| "قائمه التاج": ("تاج", "التاج 👑"), | |
| "الملوك": ("ملك", "الملوك 👑"), | |
| "الملكات": ("ملكه", "الملكات 👸"), | |
| "الطامسين": ("طامس", "الطامسين 🫥"), | |
| "الثولان": ("اثول", "الثولان 🤪"), | |
| "الجلاب": ("جلب", "الجلاب 🐕"), | |
| "المطايه": ("مطي", "المطايه 🐴"), | |
| "الصخول": ("صخل", "الصخول 🐐"), | |
| "البقرات": ("بقره", "البقرات 🐄"), | |
| "الزواحف": ("زاحف", "الزواحف 🦎"), | |
| "اللوكيه": ("لوكي", "اللوكيه 😅"), | |
| "الاغبياء": ("غبي", "الاغبياء 🤡"), | |
| "العسل": ("عسل", "العسل 🍯"), | |
| "الكيك": ("كيك", "الكيك 🍰"), | |
| "الطليان": ("طلي", "الطليان 🐑"), | |
| "قائمه كلبي": ("بكلبي", "القلوب ❤️"), | |
| "قائمه القلوب": ("قلبي", "القلوب ❤️"), | |
| "قائمه ازواجي": ("زوجي", "الأزواج 💍"), | |
| "قائمه زوجاتي": ("زوجتي", "الزوجات 💍"), | |
| "قائمه الوتك": ("وتكه", "الوتك ✨"), | |
| "قائمه القرده": ("قرد", "القردة 🐒"), | |
| "الهطوف": ("هطف", "الهطوف 😹"), | |
| "البثرين": ("بثر", "البثرين 😂"), | |
| "الحمير": ("حمار", "الحمير 🐴"), | |
| "الكلاب": ("كلب", "الكلاب 🐕"), | |
| "الكلبات": ("كلبه", "الكلبات 🐕"), | |
| "العتوين": ("عتوي", "العتوين 🐈"), | |
| "العتويات": ("عتويه", "العتويات 🐈"), | |
| "اللحوج": ("لحجي", "اللحوج 🤠"), | |
| "اللحجيات": ("لحجيه", "اللحجيات 🤠"), | |
| "الخرفان": ("خروف", "الخرفان 🐑"), | |
| "الخفيفين": ("خفيف", "الخفيفين 🪶"), | |
| "الخفيفات": ("خفيفه", "الخفيفات 🪶"), | |
| } | |
| def _mk_fun_list(rk, title): | |
| async def h(update, ctx, arg=""): | |
| chat = update.effective_chat | |
| fun = ranks_db.get(chat.id, "f", {}) | |
| uids = [int(u) for u, r in fun.items() if norm(r) == norm(rk)] | |
| if not uids: | |
| await update.message.reply_text(f"✧︙لا يوجد أحد في قائمة {title} حالياً.") | |
| return | |
| names = [] | |
| for i in uids: | |
| try: | |
| m = await chat.get_member(i) | |
| names.append(m.user.first_name) | |
| except Exception: | |
| names.append(str(i)) | |
| await update.message.reply_text(f"✧︙قائمة {title} ({len(names)}):\n" + "\n".join("• " + n for n in names)) | |
| return h | |
| def _mk_fun_clear(rk, title): | |
| async def h(update, ctx, arg=""): | |
| if await R.effective_level(update) < R.level("مدير"): | |
| await update.message.reply_text(S["need_rank"]) | |
| return | |
| chat = update.effective_chat.id | |
| fun = ranks_db.get(chat, "f", {}) | |
| new_fun = {u: r for u, r in fun.items() if norm(r) != norm(rk)} | |
| ranks_db.set(chat, "f", new_fun) | |
| await update.message.reply_text(f"✧︙تم مسح قائمة {title} ✅") | |
| return h | |
| for _pl_cmd, (_rk, _title) in FUN_PLURALS.items(): | |
| exact(_pl_cmd)(_mk_fun_list(_rk, _title)) | |
| exact("مسح " + _pl_cmd)(_mk_fun_clear(_rk, _title)) | |
| async def fun_ranks_all(update, ctx, arg=""): | |
| fun = ranks_db.get(update.effective_chat.id, "f", {}) | |
| if not fun: | |
| await update.message.reply_text("✧︙لا توجد رتب تسلية مسجلة حالياً.") | |
| return | |
| lines = ["🎭 رتب التسلية في المجموعه:"] | |
| for u, r in list(fun.items())[:30]: | |
| lines.append(f"• `{u}` ← {r}") | |
| await update.message.reply_text("\n".join(lines), parse_mode="Markdown") | |
| async def clear_all_fun_ranks(update, ctx, arg=""): | |
| if await R.effective_level(update) < R.level("مدير"): | |
| await update.message.reply_text(S["need_rank"]) | |
| return | |
| ranks_db.set(update.effective_chat.id, "f", {}) | |
| await update.message.reply_text("✧︙تم مسح جميع رتب التسلية ✅") | |
| async def lift_in_heart(update, ctx, arg=""): | |
| r = update.message.reply_to_message | |
| if not r or not r.from_user: | |
| await update.message.reply_text(S["need_reply"]) | |
| return | |
| d = ranks_db.get(update.effective_chat.id, "f", {}) | |
| d[str(r.from_user.id)] = "بكلبي" | |
| ranks_db.set(update.effective_chat.id, "f", d) | |
| await update.message.reply_text(f"❤️ تم رفع {r.from_user.first_name} بقلبك!") | |
| async def drop_from_heart(update, ctx, arg=""): | |
| r = update.message.reply_to_message | |
| if not r or not r.from_user: | |
| await update.message.reply_text(S["need_reply"]) | |
| return | |
| d = ranks_db.get(update.effective_chat.id, "f", {}) | |
| d.pop(str(r.from_user.id), None) | |
| ranks_db.set(update.effective_chat.id, "f", d) | |
| await update.message.reply_text(f"💔 تم تنزيل {r.from_user.first_name} من قلبك!") | |
| # ---------- أوامر التحشيش بالرد ---------- | |
| OPINIONS = [ | |
| "🔥 شخص فخم وذوقه عالي جداً!", | |
| "😂 طيب ودمه خفيف ومنوّر الجروب!", | |
| "👑 شخصية هيبة وكل الجروب بيحبه!", | |
| "✨ رايق وهادي وملوش في المشاكل!", | |
| "⚡ مجنون شوية بس عسل الصراحة!", | |
| ] | |
| async def opinion_cmd(update, ctx, arg=""): | |
| if not _fun_ok(update): | |
| return | |
| t = update.message.reply_to_message.from_user if update.message.reply_to_message else update.effective_user | |
| await update.message.reply_text(f"💬 رأيي في {t.first_name}: {random.choice(OPINIONS)}") | |
| async def ahdiya(update, ctx, arg=""): | |
| if not _fun_ok(update): | |
| await update.message.reply_text(S["feature_off"]) | |
| return | |
| t = update.message.reply_to_message.from_user if update.message.reply_to_message else None | |
| l = content.lines("ahdiya.txt") | |
| gift = random.choice(l) if l else "وردة 🌹" | |
| to = f" إلى {_name(t)}" if t else "" | |
| await update.message.reply_text(f"🎁 {update.effective_user.first_name} أهدى{to}: {gift}") | |
| async def boss_p(update, ctx, arg): | |
| if _fun_ok(update): | |
| await update.message.reply_text(f"😘 {update.effective_user.first_name} بعت بوسة لـ {arg} 💋") | |
| async def boss_e(update, ctx, arg=""): | |
| if not _fun_ok(update): | |
| return | |
| t = update.message.reply_to_message.from_user if update.message.reply_to_message else update.effective_user | |
| await update.message.reply_text(f"😘 {update.effective_user.first_name} بعت بوسة لـ {t.first_name} 💋") | |
| async def hug(update, ctx, arg=""): | |
| if not _fun_ok(update): | |
| return | |
| t = update.message.reply_to_message.from_user if update.message.reply_to_message else None | |
| if not t: | |
| await update.message.reply_text(S["need_reply"]) | |
| return | |
| await update.message.reply_text(f"🫂 {update.effective_user.first_name} حضن {t.first_name} بقوة ❤️") | |
| async def slap(update, ctx, arg=""): | |
| if not _fun_ok(update): | |
| return | |
| t = update.message.reply_to_message.from_user if update.message.reply_to_message else None | |
| if not t: | |
| await update.message.reply_text(S["need_reply"]) | |
| return | |
| await update.message.reply_text(f"👋 {update.effective_user.first_name} ادّى {t.first_name} كف طيّر نضارته 😂") | |
| async def call_out(update, ctx, arg=""): | |
| if not _fun_ok(update): | |
| return | |
| t = update.message.reply_to_message.from_user if update.message.reply_to_message else None | |
| if not t: | |
| await update.message.reply_text(S["need_reply"]) | |
| return | |
| await update.message.reply_text(f"📢 يا {t.first_name}!! {update.effective_user.first_name} بينادي عليك تعال بسرعة!") | |
| async def roast_light(update, ctx, arg=""): | |
| if not _fun_ok(update): | |
| return | |
| t = update.message.reply_to_message.from_user if update.message.reply_to_message else None | |
| if not t: | |
| await update.message.reply_text(S["need_reply"]) | |
| return | |
| await update.message.reply_text(f"😂 يا {t.first_name} اهدى شوية وخليك عاقل عشان محدش يزعلك!") | |
| async def say_cmd(update, ctx, arg): | |
| if _fun_ok(update) and arg: | |
| await update.message.reply_text(arg) | |
| # ---------- زوجني / تتزوجني / ثنائي اليوم / اسمي / معرفي / تفاعلي / نبذه / نداء / نزلني ---------- | |
| async def marry_random(update, ctx, arg=""): | |
| if not tg_on(update.effective_chat.id, "marryme"): | |
| await update.message.reply_text(S["feature_off"]) | |
| return | |
| u_map = users_db.get(update.effective_chat.id, "u", {}) | |
| others = [v for k, v in u_map.items() if int(k) != update.effective_user.id] | |
| if not others: | |
| await update.message.reply_text("💍 مفيش أعضاء متفاعلين كفاية نختارلك منهم حالياً 😅") | |
| return | |
| pick = random.choice(others) | |
| await update.message.reply_text(f"💍 مبروك! تم اختيار {pick.get('first') or pick.get('name')} شريك حياتك اليوم 😂❤️") | |
| async def couple_today(update, ctx, arg=""): | |
| if not tg_on(update.effective_chat.id, "couple"): | |
| await update.message.reply_text(S["feature_off"]) | |
| return | |
| u_map = list(users_db.get(update.effective_chat.id, "u", {}).values()) | |
| if len(u_map) < 2: | |
| await update.message.reply_text("💑 محتاجين عضوين متفاعلين على الأقل!") | |
| return | |
| a, b = random.sample(u_map, 2) | |
| pct = random.randint(65, 100) | |
| await update.message.reply_text(f"💑 ثنائي اليوم في المجموعه:\n❤️ {a.get('first')} + {b.get('first')}\n💘 نسبة الانسجام: {pct}%") | |
| async def my_name(update, ctx, arg=""): | |
| if not tg_on(update.effective_chat.id, "myname"): | |
| return | |
| await update.message.reply_text(f"✧︙اسمك: {update.effective_user.full_name}") | |
| async def my_user(update, ctx, arg=""): | |
| u = update.effective_user | |
| await update.message.reply_text(f"✧︙معرفك: @{u.username}" if u.username else "✧︙ليس لديك معرف (username).") | |
| async def my_act(update, ctx, arg=""): | |
| n = get_counter(update.effective_chat.id, update.effective_user.id, "msgs") | |
| await update.message.reply_text(f"🔥 تفاعلك: {activity_label(n)} ({n} رسالة)") | |
| async def his_act_e(update, ctx, arg=""): | |
| await his_act_p(update, ctx, "") | |
| async def his_act_p(update, ctx, arg): | |
| r = update.message.reply_to_message | |
| if r and r.from_user: | |
| uid, nm = r.from_user.id, r.from_user.first_name | |
| else: | |
| info = find_user_by_username(update.effective_chat.id, arg) | |
| if not info: | |
| await update.message.reply_text(S["need_reply"]) | |
| return | |
| uid, nm = info["id"], info.get("first") or info.get("name") | |
| n = get_counter(update.effective_chat.id, uid, "msgs") | |
| await update.message.reply_text(f"🔥 تفاعل {nm}: {activity_label(n)} ({n} رسالة)") | |
| async def my_invites(update, ctx, arg=""): | |
| n = get_counter(update.effective_chat.id, update.effective_user.id, "invites") | |
| await update.message.reply_text(f"👥 عدد الأعضاء الذين أضفتهم: {n}") | |
| async def his_invites(update, ctx, arg=""): | |
| r = update.message.reply_to_message | |
| if not r or not r.from_user: | |
| await update.message.reply_text(S["need_reply"]) | |
| return | |
| n = get_counter(update.effective_chat.id, r.from_user.id, "invites") | |
| await update.message.reply_text(f"👥 عدد إضافات {r.from_user.first_name}: {n}") | |
| async def about_me(update, ctx, arg=""): | |
| u = update.effective_user | |
| chat = update.effective_chat.id | |
| msgs = get_counter(chat, u.id, "msgs") | |
| pts = get_counter(chat, u.id, "pts") | |
| await update.message.reply_text( | |
| f"📋 نبذة عن {u.first_name}:\n" | |
| f"✧︙الرتبة: {R.get_custom_rank_label(chat, u.id)}\n" | |
| f"✧︙الرسائل: {msgs} | النقاط: {pts}\n" | |
| f"✧︙التفاعل: {activity_label(msgs)}" | |
| ) | |
| async def who_am_i(update, ctx, arg=""): | |
| await about_me(update, ctx, arg) | |
| async def my_pos(update, ctx, arg=""): | |
| d = stats.get(update.effective_chat.id, "msgs", {}) | |
| if not d: | |
| await update.message.reply_text(S["top_empty"]) | |
| return | |
| ordered = sorted(d.items(), key=lambda x: -x[1]) | |
| uid = str(update.effective_user.id) | |
| for idx, (k, v) in enumerate(ordered, 1): | |
| if k == uid: | |
| await update.message.reply_text(f"📍 موقعك في المتفاعلين: المركز #{idx} من {len(ordered)} ({v} رسالة) 🔥") | |
| return | |
| await update.message.reply_text("📍 لم تُسجّل لك رسائل بعد.") | |
| async def nida_cmd(update, ctx, arg=""): | |
| if not tg_on(update.effective_chat.id, "mention"): | |
| await update.message.reply_text(S["feature_off"]) | |
| return | |
| u_map = list(users_db.get(update.effective_chat.id, "u", {}).values()) | |
| if not u_map: | |
| await update.message.reply_text("📢 لا يوجد أعضاء مسجلون حالياً.") | |
| return | |
| pick = random.choice(u_map) | |
| uname = ("@" + pick["user"]) if pick.get("user") else pick.get("first", "عضو") | |
| await update.message.reply_text(f"📢 نداء عشوائي إلى: {uname} — تعال شاركنا في الدردشة! ✨") | |
| async def demote_me(update, ctx, arg=""): | |
| if not tg_on(update.effective_chat.id, "demoteme"): | |
| await update.message.reply_text(S["feature_off"]) | |
| return | |
| R.set_rank(update.effective_chat.id, update.effective_user.id, "عضو") | |
| await update.message.reply_text("✧︙تم تنزيل رتبتك في البوت إلى (عضو) ✅") | |
| async def time_alias(update, ctx, arg=""): | |
| await update.message.reply_text("🕒 الوقت الآن: " + datetime.now().strftime("%I:%M %p")) | |
| async def del_acc_link(update, ctx, arg=""): | |
| await update.message.reply_text("⚠️ رابط حذف حساب تليجرام الرسمي:\nhttps://my.telegram.org/auth?to=delete") | |
| async def his_avatar(update, ctx, arg=""): | |
| r = update.message.reply_to_message | |
| if not r or not r.from_user: | |
| await update.message.reply_text(S["need_reply"]) | |
| return | |
| ph = await ctx.bot.get_user_profile_photos(r.from_user.id, limit=1) | |
| if ph.total_count: | |
| await update.message.reply_photo(ph.photos[0][-1].file_id) | |
| else: | |
| await update.message.reply_text("✧︙لا توجد صورة بروفايل.") | |
| async def his_title(update, ctx, arg=""): | |
| r = update.message.reply_to_message | |
| if not r or not r.from_user: | |
| await update.message.reply_text(S["need_reply"]) | |
| return | |
| fun = ranks_db.get(update.effective_chat.id, "f", {}).get(str(r.from_user.id)) | |
| await update.message.reply_text(f"✧︙لقب {r.from_user.first_name}: {fun or 'لا يوجد لقب'}") | |
| # ---------- البوت السحري + معنى اسم + العمر + قوقل + قصص/ثريد/مقالات ---------- | |
| MAGIC_ANS = [ | |
| "🔮 أكيد طبعاً وبنسبة 100% ✅", "🔮 كل المؤشرات بتقول أيوه ✨", | |
| "🔮 غالباً أيوه، توكل على الله 👍", "🔮 اسألني تاني بعد شوية ⏳", | |
| "🔮 مش واضح دلوقتي، استنى وشوف 🤔", "🔮 مظنش الصراحة 😅", | |
| "🔮 لأ خالص، شوف غيرها ❌", "🔮 ممكن جداً لو اجتهدت 💪", | |
| ] | |
| async def magic_p(update, ctx, arg): | |
| if _fun_ok(update): | |
| await update.message.reply_text(random.choice(MAGIC_ANS)) | |
| async def magic_e(update, ctx, arg=""): | |
| if _fun_ok(update): | |
| await update.message.reply_text("🔮 اسألني سؤال! مثال: البوت السحري هنجح السنة دي؟") | |
| async def name_meaning(update, ctx, arg): | |
| q = norm(arg.strip()) | |
| if not q: | |
| await update.message.reply_text("✧︙اكتب: معنى + الاسم") | |
| return | |
| for line in content.lines("meanings.txt"): | |
| if ":" in line: | |
| k, v = line.split(":", 1) | |
| if norm(k.strip()) == q: | |
| await update.message.reply_text(f"✨ معنى اسم ({k.strip()}):\n{v.strip()}") | |
| return | |
| await update.message.reply_text(f"✧︙الاسم ({arg.strip()}) غير مسجل في القاموس حالياً.") | |
| async def calc_age(update, ctx, arg): | |
| try: | |
| val = int(arg.strip()) | |
| except Exception: | |
| await update.message.reply_text("✧︙اكتب سنة ميلادك أو عمرك، مثال: العمر 2002") | |
| return | |
| now_year = datetime.now().year | |
| if 1920 <= val <= now_year: | |
| age, birth = now_year - val, val | |
| elif 1 <= val <= 110: | |
| age, birth = val, now_year - val | |
| else: | |
| await update.message.reply_text("✧︙اكتب سنة ميلاد صحيحة.") | |
| return | |
| await update.message.reply_text(f"🎂 سنة الميلاد: {birth}\n✧︙العمر: {age} سنة (~{age*12:,} شهر / ~{age*365:,} يوم)") | |
| async def google_link(update, ctx, arg): | |
| if not arg.strip(): | |
| return | |
| url = f"https://www.google.com/search?q={quote_plus(arg.strip())}" | |
| kb = InlineKeyboardMarkup([[InlineKeyboardButton(f"🔍 بحث: {arg.strip()[:30]}", url=url)]]) | |
| await update.message.reply_text(f"🌐 رابط البحث في جوجل:", reply_markup=kb) | |
| async def rate_avatar(update, ctx, arg=""): | |
| if _fun_ok(update): | |
| await update.message.reply_text(random.choice(["🔥 أفتارك فخم 10/10!", "😍 ذوقك عالي 9/10!", "👑 هيبة وفخامة 10/10!", "🌟 أطلق صورة في الجروب!"])) | |
| async def shabih(update, ctx, arg=""): | |
| if _fun_ok(update): | |
| l = content.lines("shabih.txt") | |
| await update.message.reply_text(f"شبيهك: {random.choice(l)}" if l else S["no_content"]) | |
| async def tawafuq(update, ctx, arg=""): | |
| if not _fun_ok(update): | |
| return | |
| t = update.message.reply_to_message.from_user if update.message.reply_to_message else None | |
| if not t: | |
| await update.message.reply_text(S["need_reply"]) | |
| return | |
| a = update.effective_user | |
| pct = int(hashlib.md5(f"tawafuq{min(a.id, t.id)}{max(a.id, t.id)}".encode()).hexdigest(), 16) % 101 | |
| await update.message.reply_text(S["tawafuq"].format(a=a.first_name, b=t.first_name, pct=pct)) | |
| async def oqoba(update, ctx, arg=""): | |
| if _fun_ok(update): | |
| t = update.message.reply_to_message.from_user if update.message.reply_to_message else update.effective_user | |
| l = content.lines("oqobat.txt") | |
| await update.message.reply_text(S["oqoba"].format(name=t.first_name, o=random.choice(l)) if l else S["no_content"]) | |
| async def bios(update, ctx, arg=""): | |
| l = content.lines("bios.txt") | |
| await update.message.reply_text(random.choice(l) if l else S["no_content"]) | |
| async def joke(update, ctx, arg=""): | |
| l = content.lines("jokes.txt") | |
| await update.message.reply_text(random.choice(l) if l else S["no_content"]) | |
| async def wisdom(update, ctx, arg=""): | |
| l = content.lines("hekma.txt") | |
| await update.message.reply_text(random.choice(l) if l else S["no_content"]) | |
| async def dua(update, ctx, arg=""): | |
| l = content.lines("adiya.txt") | |
| await update.message.reply_text(random.choice(l) if l else S["no_content"]) | |
| async def azkar(update, ctx, arg=""): | |
| l = content.lines("azkar.txt") | |
| await update.message.reply_text(random.choice(l) if l else S["azkar_none"]) | |
| async def poems(update, ctx, arg=""): | |
| l = content.lines("quotes.txt") | |
| await update.message.reply_text(random.choice(l) if l else S["no_content"]) | |
| async def stories(update, ctx, arg=""): | |
| l = content.lines("stories.txt") | |
| await update.message.reply_text(random.choice(l) if l else S["no_content"]) | |
| async def maqalat(update, ctx, arg=""): | |
| l = content.lines("maqalat.txt") | |
| await update.message.reply_text(random.choice(l) if l else S["no_content"]) | |
| async def ghanili(update, ctx, arg=""): | |
| if not tg_on(update.effective_chat.id, "ghanili"): | |
| await update.message.reply_text(S["feature_off"]) | |
| return | |
| l = content.lines("ghanili.txt") | |
| await update.message.reply_text("🎶 " + random.choice(l) if l else S["no_content"]) | |
| # ---------- الأبراج ---------- | |
| BRAJ = ["الحمل", "الثور", "الجوزاء", "السرطان", "الأسد", "العذراء", "الميزان", "العقرب", "القوس", "الجدي", "الدلو", "الحوت"] | |
| async def abraj(update, ctx, arg=""): | |
| if not tg_on(update.effective_chat.id, "abraj"): | |
| await update.message.reply_text(S["feature_off"]) | |
| return | |
| rows = [[InlineKeyboardButton(b, callback_data=f"brj:{i}", style="primary") for i, b in enumerate(BRAJ[r:r + 3], r)] for r in range(0, 12, 3)] | |
| await update.message.reply_text("✧︙اختار برجك:", reply_markup=InlineKeyboardMarkup(rows)) | |
| # دعم كتابة اسم البرج مباشرة (مثل: الحمل، الأسد، العقرب...) | |
| for _bi, _bname in enumerate(BRAJ): | |
| def _mk_brj(idx, nm): | |
| async def _h(update, ctx, arg=""): | |
| if not tg_on(update.effective_chat.id, "abraj"): | |
| return | |
| lines = content.lines("abraj.txt") | |
| txt = lines[idx] if idx < len(lines) else "يومك حلو إن شاء الله ✨" | |
| await update.message.reply_text(f"♈︙برج {nm}:\n{txt}") | |
| return _h | |
| exact(_bname, "برج " + _bname)(_mk_brj(_bi, _bname)) | |
| async def brj_cb(update, ctx): | |
| q = update.callback_query | |
| await q.answer() | |
| i = int(q.data.split(":")[1]) | |
| lines = content.lines("abraj.txt") | |
| text = lines[i] if i < len(lines) else "يومك حلو إن شاء الله ✨" | |
| await q.edit_message_text(f"♈︙ برج {BRAJ[i]}:\n{text}") | |
| async def fakeban(update, ctx, arg=""): | |
| if not tg_on(update.effective_chat.id, "fakeban"): | |
| await update.message.reply_text(S["feature_off"]) | |
| return | |
| t = update.message.reply_to_message.from_user if update.message.reply_to_message else update.effective_user | |
| await update.message.reply_text(S["fakeban"].format(name=_name(t))) | |
| # ---------- زخرفة + ترجمة ---------- | |
| DECOR = {"ا": "آ", "ب": "بـ", "ت": "تـ", "ن": "نـ", "ي": "يـ", "م": "مـ", "ك": "كـ", "ل": "لـ", "س": "سـ", "ع": "عـ"} | |
| def _zhrf_styles(t): | |
| spaced = " ".join(t) | |
| return [ | |
| "".join(DECOR.get(c, c) for c in t), "༺ " + t + " ༻", "『 " + spaced + " 』", | |
| " " + t + " ", "⌁ " + t + " ⌁", "ـ".join(t), "⋆ " + spaced + " ⋆", | |
| "✧︙" + t + "︙✧", "⌁〔 " + t + " 〕⌁", "◈ " + " ◈ ".join(t.split()) + " ◈", | |
| "⟬ " + t + " ⟭", "•°• " + spaced + " •°•", "⪼ " + t + " ⪻", | |
| "✦。 " + t + " 。✦", "╰─ " + t + " ─╯", "꧁ " + t + " ꧂", | |
| ] | |
| async def zakhraf(update, ctx, arg): | |
| if not arg: | |
| await update.message.reply_text(S["zakhraf_usage"]) | |
| return | |
| await update.message.reply_text("\n\n".join(f"{i+1}- {s}" for i, s in enumerate(_zhrf_styles(arg)))) | |
| async def _do_translate(update, text, target=None): | |
| if not text: | |
| await update.message.reply_text("✧︙اكتب النص بعد أمر الترجمة أو رد على رسالة.") | |
| return | |
| try: | |
| from deep_translator import GoogleTranslator | |
| if not target: | |
| ar = any("" <= c <= "ۿ" for c in text) | |
| target = "en" if ar else "ar" | |
| out = GoogleTranslator(source="auto", target=target).translate(text) | |
| await update.message.reply_text(out) | |
| except Exception: | |
| await update.message.reply_text("✧︙تعذّرت الترجمة حالياً.") | |
| async def tr_ar(update, ctx, arg): | |
| await _do_translate(update, arg or (update.message.reply_to_message.text if update.message.reply_to_message else ""), "ar") | |
| async def tr_en(update, ctx, arg): | |
| await _do_translate(update, arg or (update.message.reply_to_message.text if update.message.reply_to_message else ""), "en") | |
| async def translate(update, ctx, arg): | |
| await _do_translate(update, arg or (update.message.reply_to_message.text if update.message.reply_to_message else ""), None) | |
| # ---------- زواج ---------- | |
| async def marry(update, ctx, arg=""): | |
| if not _fun_ok(update): | |
| return | |
| chat, r, a = update.effective_chat.id, update.message.reply_to_message, update.effective_user | |
| mar = settings.get(chat, "marry", {}) | |
| if not r or r.from_user.id == a.id or str(a.id) in mar or str(r.from_user.id) in mar: | |
| await update.message.reply_text(S["marry_no"]) | |
| return | |
| b = r.from_user | |
| mar[str(a.id)] = {"p": b.id, "n": b.first_name} | |
| mar[str(b.id)] = {"p": a.id, "n": a.first_name} | |
| settings.set(chat, "marry", mar) | |
| await update.message.reply_text(S["marry_ok"].format(a=a.first_name, b=b.first_name)) | |
| async def divorce(update, ctx, arg=""): | |
| chat, a = update.effective_chat.id, update.effective_user | |
| mar = settings.get(chat, "marry", {}) | |
| me = mar.pop(str(a.id), None) | |
| if not me: | |
| await update.message.reply_text(S["no_partner"]) | |
| return | |
| mar.pop(str(me["p"]), None) | |
| settings.set(chat, "marry", mar) | |
| await update.message.reply_text(S["divorce_ok"].format(a=a.first_name, b=me["n"])) | |
| async def partner(update, ctx, arg=""): | |
| me = settings.get(update.effective_chat.id, "marry", {}).get(str(update.effective_user.id)) | |
| await update.message.reply_text(S["partner_is"].format(role="شريكك", name=me["n"]) if me else S["no_partner"]) | |
| HANDLERS = [CallbackQueryHandler(brj_cb, pattern=r"^brj:")] | |