Update main.py
Browse files
main.py
CHANGED
|
@@ -86,33 +86,43 @@ user_credits_db = load_db()
|
|
| 86 |
|
| 87 |
def get_user_credits(chat_id):
|
| 88 |
str_chat_id = str(chat_id)
|
| 89 |
-
today_str = datetime.date.today().isoformat()
|
| 90 |
|
| 91 |
if str_chat_id not in user_credits_db:
|
| 92 |
-
# کاربر جدید پیشفرض رایگان است
|
| 93 |
-
user_credits_db[str_chat_id] = {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
user_data = user_credits_db[str_chat_id]
|
| 96 |
-
is_premium = user_data.get("is_premium", False)
|
| 97 |
|
| 98 |
-
#
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
|
|
|
| 116 |
return user_data
|
| 117 |
|
| 118 |
# --- تابع تبدیل اعداد فارسی/عربی به انگلیسی ---
|
|
@@ -130,13 +140,13 @@ app = Flask(__name__)
|
|
| 130 |
|
| 131 |
@app.route('/')
|
| 132 |
def home():
|
| 133 |
-
return "ربات یکپارچه آلفا (متصل به دیتاست + سیستم اشتراکی
|
| 134 |
|
| 135 |
def run_flask():
|
| 136 |
app.run(host="0.0.0.0", port=7860)
|
| 137 |
|
| 138 |
|
| 139 |
-
# --- ساختار کیبورد آپدیت شده
|
| 140 |
MAIN_KEYPAD_DICT = {
|
| 141 |
"rows": [
|
| 142 |
{
|
|
@@ -165,6 +175,11 @@ MAIN_KEYPAD_DICT = {
|
|
| 165 |
{
|
| 166 |
"buttons": [
|
| 167 |
{"id": "account_btn", "type": "Simple", "button_text": "حساب کاربری 👤"},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
{"id": "cancel_btn", "type": "Simple", "button_text": "برگشت♻️"}
|
| 169 |
]
|
| 170 |
}
|
|
@@ -354,7 +369,7 @@ async def process_gemini(client, chat_id, prompt, file_bytes=None, file_name=Non
|
|
| 354 |
str_chat_id = str(chat_id)
|
| 355 |
creds = get_user_credits(str_chat_id)
|
| 356 |
if creds["chat"] <= 0:
|
| 357 |
-
return await send_with_keyboard(client, chat_id, "❌ اعتبار پیامهای چت شما
|
| 358 |
|
| 359 |
if not GEMINI_KEYS: return await send_with_keyboard(client, chat_id, "❌ کلیدهای API جیمینای تنظیم نشدهاند.", False)
|
| 360 |
|
|
@@ -451,7 +466,7 @@ async def process_image(client, chat_id, prompt):
|
|
| 451 |
str_chat_id = str(chat_id)
|
| 452 |
creds = get_user_credits(str_chat_id)
|
| 453 |
if creds["image"] <= 0:
|
| 454 |
-
return await send_with_keyboard(client, chat_id, "❌ اعتبار ساخت عکس
|
| 455 |
|
| 456 |
if not HF_TOKENS: return await send_with_keyboard(client, chat_id, "❌ توکنهای هاگینگ فیس تنظیم نشدهاند.", False)
|
| 457 |
|
|
@@ -527,7 +542,7 @@ async def process_image_edit(client, chat_id, image_bytes, prompt):
|
|
| 527 |
str_chat_id = str(chat_id)
|
| 528 |
creds = get_user_credits(str_chat_id)
|
| 529 |
if creds["edit_image"] <= 0:
|
| 530 |
-
return await send_with_keyboard(client, chat_id, "❌ اعتبار ویرایش عکس
|
| 531 |
|
| 532 |
if not HF_TOKENS:
|
| 533 |
return await send_with_keyboard(client, chat_id, "❌ توکنهای هاگینگ فیس تنظیم نشدهاند.", False)
|
|
@@ -585,7 +600,7 @@ async def process_tts(client, chat_id, user_text, speaker_id, speaker_name):
|
|
| 585 |
str_chat_id = str(chat_id)
|
| 586 |
creds = get_user_credits(str_chat_id)
|
| 587 |
if creds["tts"] <= 0:
|
| 588 |
-
return await send_with_keyboard(client, chat_id, "❌ اعتبار تبدیل متن به صدای شما تمام شده است.", False)
|
| 589 |
|
| 590 |
try:
|
| 591 |
proc_msg = await send_with_keyboard(client, chat_id, f"⏳ در حال ساخت صدا با «{speaker_name}»...\n(لطفاً صبور باشید)", False)
|
|
@@ -636,7 +651,7 @@ async def process_podcast(client, chat_id, prompt):
|
|
| 636 |
str_chat_id = str(chat_id)
|
| 637 |
creds = get_user_credits(str_chat_id)
|
| 638 |
if creds["podcast"] <= 0:
|
| 639 |
-
return await send_with_keyboard(client, chat_id, "❌ اعتبار
|
| 640 |
|
| 641 |
proc_msg = await send_with_keyboard(client, chat_id, "📻 در حال بررسی موضوع و نگارش سناریوی پادکست توسط هوش مصنوعی...\n(لطفاً صبور باشید)", False)
|
| 642 |
available_speakers = []
|
|
@@ -726,7 +741,7 @@ async def process_stt(client, chat_id, audio_bytes, file_name):
|
|
| 726 |
str_chat_id = str(chat_id)
|
| 727 |
creds = get_user_credits(str_chat_id)
|
| 728 |
if creds["stt"] <= 0:
|
| 729 |
-
return await send_with_keyboard(client, chat_id, "❌ اعتبار تبدیل صدا به متن شما تمام شده است.", False)
|
| 730 |
|
| 731 |
if not GEMINI_KEYS: return await send_with_keyboard(client, chat_id, "❌ کلیدهای جیمینای تنظیم نشدهاند.", False)
|
| 732 |
|
|
@@ -773,7 +788,7 @@ async def process_file_analysis(client, chat_id, file_bytes, file_name, prompt):
|
|
| 773 |
str_chat_id = str(chat_id)
|
| 774 |
creds = get_user_credits(str_chat_id)
|
| 775 |
if creds["file"] <= 0:
|
| 776 |
-
return await send_with_keyboard(client, chat_id, "❌ اعتبار تحلیل فایل
|
| 777 |
|
| 778 |
if not GEMINI_KEYS: return await send_with_keyboard(client, chat_id, "❌ کلید جیمینای تنظیم نیست.", False)
|
| 779 |
|
|
@@ -867,12 +882,12 @@ else:
|
|
| 867 |
if chat_id not in user_states:
|
| 868 |
user_states[chat_id] = {"mode": None, "text": "", "history": [], "file_bytes": None, "file_name": None, "is_admin": False}
|
| 869 |
|
| 870 |
-
# 🛠 ---
|
| 871 |
if user_text_str.startswith("/admin_login"):
|
| 872 |
parts = user_text_str.split()
|
| 873 |
if len(parts) == 2 and parts[1] == ADMIN_PASSWORD:
|
| 874 |
user_states[chat_id]["is_admin"] = True
|
| 875 |
-
await send_with_keyboard(client, chat_id, "✅
|
| 876 |
else:
|
| 877 |
await send_with_keyboard(client, chat_id, "❌ رمز عبور اشتباه است.", False)
|
| 878 |
return
|
|
@@ -886,9 +901,22 @@ else:
|
|
| 886 |
user_credits_db[target_id] = {"is_premium": False}
|
| 887 |
|
| 888 |
user_credits_db[target_id]["is_premium"] = True
|
| 889 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 890 |
save_db(user_credits_db)
|
| 891 |
-
await send_with_keyboard(client, chat_id, f"✅ ا
|
| 892 |
else:
|
| 893 |
await send_with_keyboard(client, chat_id, "⚠️ فرمت صحیح: `/upgrade ID`", False)
|
| 894 |
return
|
|
@@ -899,9 +927,17 @@ else:
|
|
| 899 |
target_id = parts[1]
|
| 900 |
if target_id in user_credits_db:
|
| 901 |
user_credits_db[target_id]["is_premium"] = False
|
| 902 |
-
user_credits_db[target_id]["
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 903 |
save_db(user_credits_db)
|
| 904 |
-
await send_with_keyboard(client, chat_id, f"✅ اشتراک کاربر `{target_id}` لغو
|
| 905 |
return
|
| 906 |
|
| 907 |
# تشخیص فایل
|
|
@@ -931,43 +967,64 @@ else:
|
|
| 931 |
await send_with_keyboard(client, chat_id, "سلام! به ربات هوشمند آلفا خوش آمدید 🤖\n\nلطفاً برای شروع، از کیبورد پایین یکی از بخشها را انتخاب کنید:", True)
|
| 932 |
return
|
| 933 |
|
| 934 |
-
# --- حساب کاربری
|
| 935 |
if user_text_str in ["/account", "حساب کاربری 👤"]:
|
| 936 |
creds = get_user_credits(chat_id)
|
| 937 |
is_prem = creds.get("is_premium", False)
|
| 938 |
-
status_text = "🌟 نسخه پرو (اشتراک ویژه)" if is_prem else "🥉 نسخه رایگان (آزمایشی)"
|
| 939 |
|
| 940 |
-
|
| 941 |
-
|
| 942 |
-
|
| 943 |
-
|
| 944 |
-
|
| 945 |
-
|
| 946 |
-
|
| 947 |
-
|
| 948 |
-
شماره کارت: `6104338667771394`
|
| 949 |
-
|
| 950 |
-
پس از واریز، رسید خود را به همراه **شناسه یکتا** (که در بالا نوشته شده) به پشتیبانی زیر ارسال کنید تا اشتراکتان فعال شود:
|
| 951 |
-
🆔 پشتیبانی: @H_a_m_e_d100
|
| 952 |
-
"""
|
| 953 |
|
| 954 |
account_profile = f"""👤 **اطلاعات حساب کاربری شما**
|
| 955 |
|
| 956 |
🔹 **شناسه یکتا:** `{chat_id}`
|
| 957 |
🔹 **وضعیت اشتراک:** {status_text}
|
| 958 |
|
| 959 |
-
📊 **سهمیه
|
| 960 |
- 💬 چت هوشمند: {creds['chat']} پیام
|
| 961 |
- 🎨 ساخت عکس: {creds['image']} تصویر
|
| 962 |
- 🪄 ویرایش عکس پیشرفته: {creds['edit_image']} تصویر
|
| 963 |
- 🎙 ساخت پادکست: {creds['podcast']} برنامه
|
| 964 |
- 🗣 تبدیل متن به صدا: {creds['tts']} فایل
|
| 965 |
- 📁 تحلیل فایل: {creds['file']} فایل
|
| 966 |
-
- 📝 تبدیل صدا به متن: {creds['stt']} فایل
|
| 967 |
-
{upgrade_text}"""
|
| 968 |
await send_with_keyboard(client, chat_id, account_profile, True)
|
| 969 |
return
|
| 970 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 971 |
if user_text_str in ["/chat", "💬 چت", "چت با هوش مصنوعی 🤖"]:
|
| 972 |
user_states[chat_id]["mode"] = "chat"
|
| 973 |
user_states[chat_id]["history"] = []
|
|
|
|
| 86 |
|
| 87 |
def get_user_credits(chat_id):
|
| 88 |
str_chat_id = str(chat_id)
|
|
|
|
| 89 |
|
| 90 |
if str_chat_id not in user_credits_db:
|
| 91 |
+
# کاربر جدید پیشفرض یک بسته رایگان کوچیک برای تست میگیره
|
| 92 |
+
user_credits_db[str_chat_id] = {
|
| 93 |
+
"is_premium": False,
|
| 94 |
+
"expire_date": None,
|
| 95 |
+
"chat": 20, # چت رایگان
|
| 96 |
+
"image": 5, # عکس رایگان
|
| 97 |
+
"edit_image": 1, # ویرایش رایگان
|
| 98 |
+
"podcast": 1, # پادکست رایگان
|
| 99 |
+
"tts": 5, # تبدیل متن به صدا رایگان
|
| 100 |
+
"file": 1, # تحلیل فایل رایگان
|
| 101 |
+
"stt": 5 # تبدیل صدا به متن رایگان
|
| 102 |
+
}
|
| 103 |
+
save_db(user_credits_db)
|
| 104 |
|
| 105 |
user_data = user_credits_db[str_chat_id]
|
|
|
|
| 106 |
|
| 107 |
+
# بررسی انقضای اشتراک ماهانه
|
| 108 |
+
if user_data.get("is_premium") and user_data.get("expire_date"):
|
| 109 |
+
try:
|
| 110 |
+
expire_date = datetime.datetime.fromisoformat(user_data["expire_date"])
|
| 111 |
+
if datetime.datetime.now() > expire_date:
|
| 112 |
+
user_data["is_premium"] = False
|
| 113 |
+
user_data["expire_date"] = None
|
| 114 |
+
# صفر کردن اعتبارهای ویژه پس از اتمام یک ماه
|
| 115 |
+
user_data["chat"] = 0
|
| 116 |
+
user_data["image"] = 0
|
| 117 |
+
user_data["edit_image"] = 0
|
| 118 |
+
user_data["podcast"] = 0
|
| 119 |
+
user_data["tts"] = 0
|
| 120 |
+
user_data["file"] = 0
|
| 121 |
+
user_data["stt"] = 0
|
| 122 |
+
save_db(user_credits_db)
|
| 123 |
+
except Exception:
|
| 124 |
+
pass
|
| 125 |
+
|
| 126 |
return user_data
|
| 127 |
|
| 128 |
# --- تابع تبدیل اعداد فارسی/عربی به انگلیسی ---
|
|
|
|
| 140 |
|
| 141 |
@app.route('/')
|
| 142 |
def home():
|
| 143 |
+
return "ربات یکپارچه آلفا (متصل به دیتاست + سیستم اشتراکی تجاری + پادکست + ویرایش عکس) روشن است! 🚀"
|
| 144 |
|
| 145 |
def run_flask():
|
| 146 |
app.run(host="0.0.0.0", port=7860)
|
| 147 |
|
| 148 |
|
| 149 |
+
# --- ساختار کیبورد آپدیت شده ---
|
| 150 |
MAIN_KEYPAD_DICT = {
|
| 151 |
"rows": [
|
| 152 |
{
|
|
|
|
| 175 |
{
|
| 176 |
"buttons": [
|
| 177 |
{"id": "account_btn", "type": "Simple", "button_text": "حساب کاربری 👤"},
|
| 178 |
+
{"id": "buy_btn", "type": "Simple", "button_text": "خرید اشتراک 💎"}
|
| 179 |
+
]
|
| 180 |
+
},
|
| 181 |
+
{
|
| 182 |
+
"buttons": [
|
| 183 |
{"id": "cancel_btn", "type": "Simple", "button_text": "برگشت♻️"}
|
| 184 |
]
|
| 185 |
}
|
|
|
|
| 369 |
str_chat_id = str(chat_id)
|
| 370 |
creds = get_user_credits(str_chat_id)
|
| 371 |
if creds["chat"] <= 0:
|
| 372 |
+
return await send_with_keyboard(client, chat_id, "❌ اعتبار پیامهای چت شما تمام شده است. لطفاً از منوی اصلی وارد بخش «خرید اشتراک 💎» شوید.", False)
|
| 373 |
|
| 374 |
if not GEMINI_KEYS: return await send_with_keyboard(client, chat_id, "❌ کلیدهای API جیمینای تنظیم نشدهاند.", False)
|
| 375 |
|
|
|
|
| 466 |
str_chat_id = str(chat_id)
|
| 467 |
creds = get_user_credits(str_chat_id)
|
| 468 |
if creds["image"] <= 0:
|
| 469 |
+
return await send_with_keyboard(client, chat_id, "❌ اعتبار ساخت عکس شما تمام شده است. لطفاً از منوی اصلی وارد بخش «خرید اشتراک 💎» شوید.", False)
|
| 470 |
|
| 471 |
if not HF_TOKENS: return await send_with_keyboard(client, chat_id, "❌ توکنهای هاگینگ فیس تنظیم نشدهاند.", False)
|
| 472 |
|
|
|
|
| 542 |
str_chat_id = str(chat_id)
|
| 543 |
creds = get_user_credits(str_chat_id)
|
| 544 |
if creds["edit_image"] <= 0:
|
| 545 |
+
return await send_with_keyboard(client, chat_id, "❌ اعتبار ویرایش عکس شما تمام شده است. لطفاً از منوی اصلی وارد بخش «خرید اشتراک 💎» شوید.", False)
|
| 546 |
|
| 547 |
if not HF_TOKENS:
|
| 548 |
return await send_with_keyboard(client, chat_id, "❌ توکنهای هاگینگ فیس تنظیم نشدهاند.", False)
|
|
|
|
| 600 |
str_chat_id = str(chat_id)
|
| 601 |
creds = get_user_credits(str_chat_id)
|
| 602 |
if creds["tts"] <= 0:
|
| 603 |
+
return await send_with_keyboard(client, chat_id, "❌ اعتبار تبدیل متن به صدای شما تمام شده است. لطفاً از منوی اصلی وارد بخش «خرید اشتراک 💎» شوید.", False)
|
| 604 |
|
| 605 |
try:
|
| 606 |
proc_msg = await send_with_keyboard(client, chat_id, f"⏳ در حال ساخت صدا با «{speaker_name}»...\n(لطفاً صبور باشید)", False)
|
|
|
|
| 651 |
str_chat_id = str(chat_id)
|
| 652 |
creds = get_user_credits(str_chat_id)
|
| 653 |
if creds["podcast"] <= 0:
|
| 654 |
+
return await send_with_keyboard(client, chat_id, "❌ اعتبار پادکست شما تمام شده است. لطفاً از منوی اصلی وارد بخش «خرید اشتراک 💎» شوید.", False)
|
| 655 |
|
| 656 |
proc_msg = await send_with_keyboard(client, chat_id, "📻 در حال بررسی موضوع و نگارش سناریوی پادکست توسط هوش مصنوعی...\n(لطفاً صبور باشید)", False)
|
| 657 |
available_speakers = []
|
|
|
|
| 741 |
str_chat_id = str(chat_id)
|
| 742 |
creds = get_user_credits(str_chat_id)
|
| 743 |
if creds["stt"] <= 0:
|
| 744 |
+
return await send_with_keyboard(client, chat_id, "❌ اعتبار تبدیل صدا به متن شما تمام شده است. لطفاً از منوی اصلی وارد بخش «خرید اشتراک 💎» شوید.", False)
|
| 745 |
|
| 746 |
if not GEMINI_KEYS: return await send_with_keyboard(client, chat_id, "❌ کلیدهای جیمینای تنظیم نشدهاند.", False)
|
| 747 |
|
|
|
|
| 788 |
str_chat_id = str(chat_id)
|
| 789 |
creds = get_user_credits(str_chat_id)
|
| 790 |
if creds["file"] <= 0:
|
| 791 |
+
return await send_with_keyboard(client, chat_id, "❌ اعتبار تحلیل فایل شما تمام شده است. لطفاً از منوی اصلی وارد بخش «خرید اشتراک 💎» شوید.", False)
|
| 792 |
|
| 793 |
if not GEMINI_KEYS: return await send_with_keyboard(client, chat_id, "❌ کلید جیمینای تنظیم نیست.", False)
|
| 794 |
|
|
|
|
| 882 |
if chat_id not in user_states:
|
| 883 |
user_states[chat_id] = {"mode": None, "text": "", "history": [], "file_bytes": None, "file_name": None, "is_admin": False}
|
| 884 |
|
| 885 |
+
# 🛠 --- سیستم پنل مدیریت (Admin) --- 🛠
|
| 886 |
if user_text_str.startswith("/admin_login"):
|
| 887 |
parts = user_text_str.split()
|
| 888 |
if len(parts) == 2 and parts[1] == ADMIN_PASSWORD:
|
| 889 |
user_states[chat_id]["is_admin"] = True
|
| 890 |
+
await send_with_keyboard(client, chat_id, "✅ ورود موفقیتآمیز به پنل مدیریت.\n\nبرای ویژه کردن کاربر:\n`/upgrade <ID>`\nبرای لغو اشتراک:\n`/downgrade <ID>`", False)
|
| 891 |
else:
|
| 892 |
await send_with_keyboard(client, chat_id, "❌ رمز عبور اشتباه است.", False)
|
| 893 |
return
|
|
|
|
| 901 |
user_credits_db[target_id] = {"is_premium": False}
|
| 902 |
|
| 903 |
user_credits_db[target_id]["is_premium"] = True
|
| 904 |
+
|
| 905 |
+
# تنظیم تاریخ انقضا برای ۳۰ روز آینده
|
| 906 |
+
expire_time = datetime.datetime.now() + datetime.timedelta(days=30)
|
| 907 |
+
user_credits_db[target_id]["expire_date"] = expire_time.isoformat()
|
| 908 |
+
|
| 909 |
+
# شارژ اعتبار ماهانه
|
| 910 |
+
user_credits_db[target_id]["chat"] = 1000
|
| 911 |
+
user_credits_db[target_id]["image"] = 100
|
| 912 |
+
user_credits_db[target_id]["edit_image"] = 50
|
| 913 |
+
user_credits_db[target_id]["podcast"] = 100
|
| 914 |
+
user_credits_db[target_id]["tts"] = 500
|
| 915 |
+
user_credits_db[target_id]["file"] = 50
|
| 916 |
+
user_credits_db[target_id]["stt"] = 100
|
| 917 |
+
|
| 918 |
save_db(user_credits_db)
|
| 919 |
+
await send_with_keyboard(client, chat_id, f"✅ حساب کاربر `{target_id}` به مدت ۳۰ روز شارژ شد و به پرو ارتقا یافت.", False)
|
| 920 |
else:
|
| 921 |
await send_with_keyboard(client, chat_id, "⚠️ فرمت صحیح: `/upgrade ID`", False)
|
| 922 |
return
|
|
|
|
| 927 |
target_id = parts[1]
|
| 928 |
if target_id in user_credits_db:
|
| 929 |
user_credits_db[target_id]["is_premium"] = False
|
| 930 |
+
user_credits_db[target_id]["expire_date"] = None
|
| 931 |
+
# صفر کردن اعتبار
|
| 932 |
+
user_credits_db[target_id]["chat"] = 0
|
| 933 |
+
user_credits_db[target_id]["image"] = 0
|
| 934 |
+
user_credits_db[target_id]["edit_image"] = 0
|
| 935 |
+
user_credits_db[target_id]["podcast"] = 0
|
| 936 |
+
user_credits_db[target_id]["tts"] = 0
|
| 937 |
+
user_credits_db[target_id]["file"] = 0
|
| 938 |
+
user_credits_db[target_id]["stt"] = 0
|
| 939 |
save_db(user_credits_db)
|
| 940 |
+
await send_with_keyboard(client, chat_id, f"✅ اشتراک کاربر `{target_id}` لغو شد.", False)
|
| 941 |
return
|
| 942 |
|
| 943 |
# تشخیص فایل
|
|
|
|
| 967 |
await send_with_keyboard(client, chat_id, "سلام! به ربات هوشمند آلفا خوش آمدید 🤖\n\nلطفاً برای شروع، از کیبورد پایین یکی از بخشها را انتخاب کنید:", True)
|
| 968 |
return
|
| 969 |
|
| 970 |
+
# --- حساب کاربری (فقط نمایش اطلاعات) ---
|
| 971 |
if user_text_str in ["/account", "حساب کاربری 👤"]:
|
| 972 |
creds = get_user_credits(chat_id)
|
| 973 |
is_prem = creds.get("is_premium", False)
|
|
|
|
| 974 |
|
| 975 |
+
if is_prem:
|
| 976 |
+
expire_txt = "نامشخص"
|
| 977 |
+
if creds.get("expire_date"):
|
| 978 |
+
exp_d = datetime.datetime.fromisoformat(creds["expire_date"])
|
| 979 |
+
expire_txt = exp_d.strftime("%Y-%m-%d %H:%M")
|
| 980 |
+
status_text = f"🌟 نسخه پرو (معتبر تا {expire_txt})"
|
| 981 |
+
else:
|
| 982 |
+
status_text = "🥉 نسخه رایگان (آزمایشی)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 983 |
|
| 984 |
account_profile = f"""👤 **اطلاعات حساب کاربری شما**
|
| 985 |
|
| 986 |
🔹 **شناسه یکتا:** `{chat_id}`
|
| 987 |
🔹 **وضعیت اشتراک:** {status_text}
|
| 988 |
|
| 989 |
+
📊 **سهمیه فعلی شما:**
|
| 990 |
- 💬 چت هوشمند: {creds['chat']} پیام
|
| 991 |
- 🎨 ساخت عکس: {creds['image']} تصویر
|
| 992 |
- 🪄 ویرایش عکس پیشرفته: {creds['edit_image']} تصویر
|
| 993 |
- 🎙 ساخت پادکست: {creds['podcast']} برنامه
|
| 994 |
- 🗣 تبدیل متن به صدا: {creds['tts']} فایل
|
| 995 |
- 📁 تحلیل فایل: {creds['file']} فایل
|
| 996 |
+
- 📝 تبدیل صدا به متن: {creds['stt']} فایل"""
|
|
|
|
| 997 |
await send_with_keyboard(client, chat_id, account_profile, True)
|
| 998 |
return
|
| 999 |
|
| 1000 |
+
# --- دکمه جدید: خرید اشتراک ---
|
| 1001 |
+
if user_text_str in ["/buy", "خرید اشتراک 💎"]:
|
| 1002 |
+
buy_text = f"""💎 **خرید اشتراک ویژه آلفا پرو (یک ماهه)**
|
| 1003 |
+
|
| 1004 |
+
با تهیه اشتراک ویژه، محدودیتها را کنار بزنید و از نهایت قدرت هوش مصنوعی لذت ببرید! 🚀
|
| 1005 |
+
|
| 1006 |
+
🎁 **بسته طلایی یکماهه شامل:**
|
| 1007 |
+
🗣 ۵۰۰ فایل تبدیل متن به صدا (با کیفیت طبیعی)
|
| 1008 |
+
🎙 ۱۰۰ برنامه ساخت پادکست کامل
|
| 1009 |
+
🪄 ۵۰ عکس ویرایش حرفهای (Flux.2)
|
| 1010 |
+
🎨 ۱۰۰ تصویرسازی فوقپیشرفته
|
| 1011 |
+
📁 ۵۰ تحلیل فایل و سند
|
| 1012 |
+
💬 چت هوشمند (۱۰۰۰ پیام)
|
| 1013 |
+
📝 ۱۰۰ فایل تبدیل صدا به متن
|
| 1014 |
+
|
| 1015 |
+
💳 **هزینه اشتراک یک ماهه:** ۱۹۹,۰۰۰ تومان
|
| 1016 |
+
|
| 1017 |
+
💳 **شماره کارت جهت واریز:**
|
| 1018 |
+
`6104338667771394`
|
| 1019 |
+
|
| 1020 |
+
✅ **نحوه فعالسازی:**
|
| 1021 |
+
پس از واریز مبلغ، لطفاً رسید پرداختی را به همراه **شناسه یکتای خود** (`{chat_id}`) به آیدی پشتیبانی زیر ارسال کنید تا اشتراک شما فورا فعال گردد:
|
| 1022 |
+
|
| 1023 |
+
👨💻 **ارتباط با پشتیبانی:**
|
| 1024 |
+
🆔 @H_a_m_e_d100"""
|
| 1025 |
+
await send_with_keyboard(client, chat_id, buy_text, True)
|
| 1026 |
+
return
|
| 1027 |
+
|
| 1028 |
if user_text_str in ["/chat", "💬 چت", "چت با هوش مصنوعی 🤖"]:
|
| 1029 |
user_states[chat_id]["mode"] = "chat"
|
| 1030 |
user_states[chat_id]["history"] = []
|