Agnivesh10M commited on
Commit
3f8659c
·
verified ·
1 Parent(s): caa3da8

Update bot.py

Browse files
Files changed (1) hide show
  1. bot.py +646 -128
bot.py CHANGED
@@ -1,17 +1,22 @@
1
  import asyncio
 
 
2
  from pyrogram import Client, filters
3
- from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton
4
  from pyrogram.errors import FloodWait, UserIsBlocked, InputUserDeactivated
5
  from config import API_ID, API_HASH, BOT_TOKEN, ADMINS, OWNER_HANDLE, SUPPORT_GROUP
6
  from db import db
7
 
8
  try:
9
- from TechVJ.start import batch_temp
10
  except ImportError:
11
- try:
12
- from start import batch_temp
13
- except ImportError:
14
- batch_temp = None
 
 
 
15
 
16
  class Bot(Client):
17
  def __init__(self):
@@ -21,9 +26,9 @@ class Bot(Client):
21
  api_hash=API_HASH,
22
  bot_token=BOT_TOKEN,
23
  plugins=dict(root="TechVJ"),
24
- workers=8,
25
- max_concurrent_transmissions=6,
26
- sleep_threshold=10
27
  )
28
 
29
  async def start(self):
@@ -43,145 +48,646 @@ def is_admin(user_id: int) -> bool:
43
  return int(user_id) in [int(x) for x in ADMINS]
44
  return int(user_id) == int(ADMINS)
45
 
46
- @bot.on_message(filters.command("start") & filters.private)
47
- async def start_command(client: Client, message: Message):
48
- user_id = message.from_user.id
49
- name = message.from_user.first_name
50
- db.add_user(user_id, name)
51
- admin_badge = "\n👑 **(आप इस बॉट के ओनर हैं - लाइफटाइम एक्सेस)**\n" if is_admin(user_id) else ""
52
-
53
- text = (
54
- f"👋 नमस्ते **{name}**!{admin_badge}\n\n"
55
- f"यह **SACHIN SHARMA** सेव रेस्ट्रिक्टेड कंटेंट VIP बॉट है।\n"
56
- f"🔹 प्लान देखने के लिए: `/plans`\n"
57
- f"🔹 स्टेटस चेक: `/myplan`\n"
58
- f"🔹 अकाउंट जोड़ें: `/login`\n"
59
- f"🔹 डायरेक्ट क्लोन: `/clone`\n"
60
- f"🔹 फोरम टॉपिक क्लोन: `/topicclone`\n"
61
- f"🔹 सभी कमांड्स और गाइड: `/howtouse`"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  )
63
- buttons = InlineKeyboardMarkup([
64
- [InlineKeyboardButton("💬 सपोर्ट ग्रुप", url=SUPPORT_GROUP)],
65
- [InlineKeyboardButton("👤 ओनर से संपर्क करें", url=f"https://t.me/{OWNER_HANDLE.replace('@', '')}")]
 
 
 
 
66
  ])
67
- await message.reply_text(text, reply_markup=buttons, disable_web_page_preview=True)
68
 
69
- @bot.on_message(filters.command(["howtouse", "help"]) & filters.private)
70
- async def how_to_use_command(client: Client, message: Message):
71
- guide = (
72
- "📚 **उपलब्ध सभी कमांड्स की सूची:**\n"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  "━━━━━━━━━━━━━━━━━━━━\n"
74
- "1. `/start` - बॉट शुरू करें\n"
75
- "2. `/clone` - डायरेक्ट चैनल/ग्रुप/बॉट चैट क्लोनिंग\n"
76
- "3. `/topicclone` - फोरम टॉपिक्स ऑटो-क्रिएशन क्लोनिंग\n"
77
- "4. `/single` - केवल एक फ़ाइल डाउनलोड करने के लिए\n"
78
- "5. `/skip` - टारगेट की जगह सीधे बॉट चैट में पाने के लिए\n"
79
- "6. `/cancel` - चालू टास्क रोकने के लिए\n"
80
- "7. `/resume` - रुके हुए टास्क को वहीं से शुरू करने के लिए\n"
81
- "8. `/login` - अपना टेलीग्राम अकाउंट कनेक्ट करें\n"
82
- "9. `/logout` - अकाउंट लॉगआउट करें\n"
83
- "10. `/plans` - वीआईपी प्लान्स व कीमतें\n"
84
- "11. `/pay` - भुगतान का तरीका व QR कोड\n"
85
- "12. `/myplan` - अपने एक्टिव प्लान की वैधता\n"
86
- "13. `/howtouse` - यह सहायता मेन्यू\n"
87
- "14. `/channelhelp` - चैनल/ग्रुप ID प्राप्त करने की विधि\n"
88
- "15. `/speedhelp` - हाई स्पीड ट्रांसफर टिप्स\n"
89
- "16. `/lang` - भाषा सेटिंग (हिंदी/English)\n"
90
- "17. `/id` - चैट और यूज़र ID देखने के लिए\n"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  "━━━━━━━━━━━━━━━━━━━━\n"
92
- f"सपोर्ट: {OWNER_HANDLE}"
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  )
94
- await message.reply_text(guide)
95
 
96
- @bot.on_message(filters.command("pay") & filters.private)
97
- async def pay_command(client: Client, message: Message):
98
- config = db.get_plan_config()
99
- await message.reply_text(
100
- f"💳 **VIP सब्सक्रिप्शन भुगतान:**\n━━━━━━━━━━━━━━━━━━━━\n"
101
- f"कीमत: ₹{config['plan_price']} ({config['plan_days']} दिन)\n\n"
102
- f"भुगतान UPI या QR कोड से करने के लिए तुरंत एडमिन से संपर्क करें:\n"
103
- f"👉 **{OWNER_HANDLE}**\n\nस्क्रीनशॉट भेजने के बाद 2 मिनट में आपका प्लान एक्टिव कर दिया जाएगा।"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  )
105
 
106
- @bot.on_message(filters.command("channelhelp") & filters.private)
107
- async def channel_help_command(client: Client, message: Message):
108
- await message.reply_text(
109
- "📢 **चैनल/ग्रुप ID निकालने का आसान तरीका:**\n"
110
- "1. अपने चैनल/ग्रुप के किसी भी मैसेज को इस बॉट में फॉरवर्ड करें।\n"
111
- "2. उस मैसेज पर रिप्लाई करके `/id` लिखें। बॉट आपको सही ID बता देगा।"
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  )
113
 
114
- @bot.on_message(filters.command("speedhelp") & filters.private)
115
- async def speed_help_command(client: Client, message: Message):
 
 
 
 
 
 
 
 
 
116
  await message.reply_text(
117
- "⚡ **स्पीड ऑप्टिमाइजेशन टिप्स:**\n"
118
- "• बॉट 8-12 MB/s की अनुकूलित MTProto स्पीड पर चलता है।\n"
119
- "• बड़े वीडियो के लिए वॉटरमार्क लगाने पर कुछ सेकंड की FFmpeg एन्कोडिंग लगती है।"
120
  )
121
 
122
- @bot.on_message(filters.command("lang") & filters.private)
123
- async def lang_command(client: Client, message: Message):
124
- await message.reply_text("🌐 वर्तमान भाषा **हिंदी** सेट है।")
125
-
126
  @bot.on_message(filters.command("plans") & filters.private)
127
- async def show_plans(client: Client, message: Message):
128
- config = db.get_plan_config()
129
- text = (
130
- f"💎 **VIP UNLIMITED CLONER PLAN** 💎\n"
131
- f"━━━━━━━━━━━━━━━━━━━━\n"
132
- f"💰 **कीमत:** ₹{config['plan_price']}\n"
133
- f"⏱️ **वैधता:** {config['plan_days']} दिन\n"
134
- f"📦 **लिमिट:** अनलिमिटेड फाइल्स\n"
135
- f"⚡ **स्पीड:** 8-12+ MB/s सुपरफास्ट ट्रांसफर\n"
136
- f"🌈 **वॉटरमार्क:** 5-कलर रनिंग टेक्स्ट सपोर्ट\n"
137
- f"━━━━━━━━━━━━━━━━━━━━\n"
138
- f"👉 प्लान एक्टिवेट कराने के लिए संपर्क करें: {OWNER_HANDLE}"
139
- )
140
- await message.reply_text(text)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
 
142
  @bot.on_message(filters.command(["myplan", "info"]) & filters.private)
143
- async def my_plan(client: Client, message: Message):
144
  user_id = message.from_user.id
 
145
  if is_admin(user_id):
146
- return await message.reply_text("👑 आप इस बॉट के **ओनर/एडमिन** हैं (लाइफटाइम अनलिमिटेड VIP एक्सेस)।")
 
147
 
148
  user = db.get_user(user_id)
149
  if not user or not user.get("plan_expiry"):
150
- return await message.reply_text("❌ आपके पास कोई एक्टिव प्लान नहीं है।\nप्लान देखने के लिए /plans दबाएँ।")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
 
152
- expiry = user["plan_expiry"][:19].replace("T", " ")
153
- await message.reply_text(f"👤 **प्लान स्टेटस:** VIP Member ✅\n⏳ **वैधता:** `{expiry} UTC`")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
 
155
  # ----------------- ADMIN COMMANDS ----------------- #
156
- @bot.on_message(filters.command(["users"]) & filters.private)
157
- async def users_list_admin(client: Client, message: Message):
 
158
  if not is_admin(message.from_user.id):
159
  return
160
- users = db.get_all_users()
161
- await message.reply_text(f"👥 डेटाबेस में कुल **{len(users)}** यूज़र्स पंजीकृत हैं।")
162
 
163
- @bot.on_message(filters.command(["setprice", "setplan"]) & filters.private)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  async def set_price_admin(client: Client, message: Message):
165
  if not is_admin(message.from_user.id):
166
  return
167
- try:
168
- parts = message.text.split()
169
- price, days = parts[1], parts[2]
170
- db.set_plan_config(price, days)
171
- await message.reply_text(f"✅ **नया प्लान सेट:** ₹{price} ({days} दिन)")
172
- except Exception:
173
- await message.reply_text("❌ फॉर्मेट: `/setprice 149 15` (कीमत दिन)")
 
 
 
 
 
174
 
175
  @bot.on_message(filters.command("adduser") & filters.private)
176
  async def add_user_admin(client: Client, message: Message):
177
  if not is_admin(message.from_user.id):
178
  return
 
 
 
179
  try:
180
- parts = message.text.split()
181
  target_id = int(parts[1])
182
- days = int(parts[2]) if len(parts) > 2 else int(db.get_plan_config()['plan_days'])
183
  db.add_vip_user(target_id, days)
184
- await message.reply_text(f"✅ यूजर `{target_id}` को {days} दिन का VIP दिया गया।")
 
 
 
 
 
 
 
185
  except Exception as e:
186
  await message.reply_text(f"Error: {e}")
187
 
@@ -189,19 +695,28 @@ async def add_user_admin(client: Client, message: Message):
189
  async def remove_user_admin(client: Client, message: Message):
190
  if not is_admin(message.from_user.id):
191
  return
 
 
 
192
  try:
193
- parts = message.text.split()
194
  target_id = int(parts[1])
195
  db.remove_vip_user(target_id)
196
 
197
- # ⚡ LIVE KILL SWITCH: यदि यूजर का कोई टास्क चल रहा है तो तुरंत टर्मिनेट करें
198
- if batch_temp:
 
199
  batch_temp.IS_BATCH[target_id] = True
200
- if target_id in batch_temp.RUNNING_TASKS:
201
- batch_temp.RUNNING_TASKS[target_id].cancel()
202
- batch_temp.RUNNING_TASKS.pop(target_id, None)
203
 
204
- await message.reply_text(f"🚫 यूजर `{target_id}` का VIP एक्सेस हटा दिया गया और चल रहा टास्क तुरंत किल कर दिया गया।")
 
 
 
 
 
 
 
205
  except Exception as e:
206
  await message.reply_text(f"Error: {e}")
207
 
@@ -210,19 +725,22 @@ async def broadcast_command(client: Client, message: Message):
210
  if not is_admin(message.from_user.id):
211
  return
212
  if not message.reply_to_message:
213
- return await message.reply_text("⚠️ मैसेज पर रिप्लाई करके `/broadcast` लिखें।")
214
 
215
- users = db.get_all_users()
216
- b_msg = await message.reply_text(f"📢 ब्रॉडकास्ट शुरू: `{len(users)}` यूज़र्स...")
217
- success, failed = 0, 0
218
- for u in users:
219
- try:
220
- await message.reply_to_message.copy(u["user_id"])
221
- success += 1
222
- except Exception:
223
- failed += 1
224
- await asyncio.sleep(0.05)
225
- await b_msg.edit_text(f"✅ ब्रॉडकास्ट पूरा!\nसफल: {success} | असफल: {failed}")
 
 
 
226
 
227
  if __name__ == "__main__":
228
  bot.run()
 
1
  import asyncio
2
+ import time
3
+ from datetime import datetime, timezone
4
  from pyrogram import Client, filters
5
+ from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery
6
  from pyrogram.errors import FloodWait, UserIsBlocked, InputUserDeactivated
7
  from config import API_ID, API_HASH, BOT_TOKEN, ADMINS, OWNER_HANDLE, SUPPORT_GROUP
8
  from db import db
9
 
10
  try:
11
+ import pyromod
12
  except ImportError:
13
+ pass
14
+
15
+ PAYMENT_IMG_URL = "https://files.catbox.moe/vnrhxg.jpg"
16
+ TUTORIAL_VIDEO_URL = "https://t.me/srcbysachin/19"
17
+ PHONEPE_LINK = "https://phon.pe/4fjyavab"
18
+
19
+ PENDING_BROADCASTS = {}
20
 
21
  class Bot(Client):
22
  def __init__(self):
 
26
  api_hash=API_HASH,
27
  bot_token=BOT_TOKEN,
28
  plugins=dict(root="TechVJ"),
29
+ workers=150,
30
+ max_concurrent_transmissions=32,
31
+ sleep_threshold=5
32
  )
33
 
34
  async def start(self):
 
48
  return int(user_id) in [int(x) for x in ADMINS]
49
  return int(user_id) == int(ADMINS)
50
 
51
+ def get_lang_prompt_markup():
52
+ return InlineKeyboardMarkup([
53
+ [
54
+ InlineKeyboardButton("🇮🇳 हिंदी", callback_data="setlang_hi"),
55
+ InlineKeyboardButton("🇬🇧 English", callback_data="setlang_en")
56
+ ]
57
+ ])
58
+
59
+ def get_start_panel(name: str, is_adm: bool = False, lang: str = "hi"):
60
+ if lang == "en":
61
+ admin_tag = "\n👑 **(You are the Bot Owner - Lifetime Access)**\n" if is_adm else ""
62
+ text = (
63
+ f"👋 **Welcome to Save Restricted Content Bot!**{admin_tag}\n"
64
+ "━━━━━━━━━━━━━━━━━━━━\n\n"
65
+ "Clone or forward files from any **private or public** Telegram channel/group — "
66
+ "even if forwarding is restricted.\n\n"
67
+ "⚡ **Features:**\n"
68
+ "✅ Dedicated 1 GB RAM per user\n"
69
+ "✅ Auto-create Forum Topics in target groups (`/topicclone`)\n"
70
+ "✅ Direct clone for channels/chats (`/clone`)\n"
71
+ "✅ 2GB+ files · Clean filename without message ID\n"
72
+ "✅ 5-Color Scrolling Video Watermark\n"
73
+ "✅ Multi-stream Fast Download/Upload Engine\n\n"
74
+ "━━━━━━━━━━━━━━━━━━━━\n"
75
+ "Select an option from the menu below:"
76
+ )
77
+ buttons = InlineKeyboardMarkup([
78
+ [
79
+ InlineKeyboardButton("💎 VIP Plans & Pricing", callback_data="nav_plans"),
80
+ InlineKeyboardButton("💳 How to Pay?", callback_data="nav_payment")
81
+ ],
82
+ [
83
+ InlineKeyboardButton("📖 User Guide & Video", callback_data="nav_howtouse"),
84
+ InlineKeyboardButton("📢 Channel / Topic Guide", callback_data="nav_channelhelp")
85
+ ],
86
+ [
87
+ InlineKeyboardButton("⚡ Speed Guide", callback_data="nav_speedhelp"),
88
+ InlineKeyboardButton("📊 My Status", callback_data="nav_myplan")
89
+ ],
90
+ [
91
+ InlineKeyboardButton("🌐 Change Language", callback_data="nav_lang"),
92
+ InlineKeyboardButton("💬 Support Group", url=SUPPORT_GROUP)
93
+ ],
94
+ [
95
+ InlineKeyboardButton("👤 Contact Owner", url=f"https://t.me/{OWNER_HANDLE.replace('@', '')}")
96
+ ]
97
+ ])
98
+ else:
99
+ admin_tag = "\n👑 **(आप इस बॉट के ओनर हैं - लाइफटाइम एक्सेस)**\n" if is_adm else ""
100
+ text = (
101
+ f"👋 **Welcome to Save Restricted Content Bot!**{admin_tag}\n"
102
+ "━━━━━━━━━━━━━━━━━━━━\n\n"
103
+ "किसी भी **प्राइवेट या पब्लिक** टेलीग्राम चैनल/ग्रुप से फ़ाइलें क्लोन करें — "
104
+ "चाहे **फॉरवर्डिंग बंद (Restricted)** हो तब भी!\n\n"
105
+ "⚡ **मुख्य विशेषताएं:**\n"
106
+ "✅ Dedicated 1 GB RAM per user\n"
107
+ "✅ फ़ोरम ग्रुप्स के लिए ऑटोमैटिक टॉपिक क्रिएशन (`/topicclone`)\n"
108
+ "✅ सामान्य चैनल/ग्रुप के लिए डायरेक्ट क्लोनर (`/clone`)\n"
109
+ "✅ 2GB+ फाइल्स · बिना ID वाला साफ़ फ़ाइल नाम\n"
110
+ "✅ 5-रंगों का स्क्रोलिंग वीडियो वॉटरमार्क\n"
111
+ "✅ मल्टी-स्ट्रीम सुपरफास्ट इंजन\n\n"
112
+ "━━━━━━━━━━━━━━━━━━━━\n"
113
+ "नीचे दिए गए मेन्यू में से विकल्प चुनें:"
114
+ )
115
+ buttons = InlineKeyboardMarkup([
116
+ [
117
+ InlineKeyboardButton("💎 VIP प्लान्स & कीमतें", callback_data="nav_plans"),
118
+ InlineKeyboardButton("💳 पेमेंट कैसे करें?", callback_data="nav_payment")
119
+ ],
120
+ [
121
+ InlineKeyboardButton("📖 बॉट कैसे चलाएं (गाइड & वीडियो)", callback_data="nav_howtouse"),
122
+ InlineKeyboardButton("📢 चैनल व टॉपिक ग्रुप गाइड", callback_data="nav_channelhelp")
123
+ ],
124
+ [
125
+ InlineKeyboardButton("⚡ स्पीड गाइड", callback_data="nav_speedhelp"),
126
+ InlineKeyboardButton("📊 मेरा स्टेटस", callback_data="nav_myplan")
127
+ ],
128
+ [
129
+ InlineKeyboardButton("🌐 भाषा बदलें (Language)", callback_data="nav_lang"),
130
+ InlineKeyboardButton("💬 सपोर्ट ग्रुप", url=SUPPORT_GROUP)
131
+ ],
132
+ [
133
+ InlineKeyboardButton("👤 ओनर से संपर्क करें", url=f"https://t.me/{OWNER_HANDLE.replace('@', '')}")
134
+ ]
135
+ ])
136
+ return text, buttons
137
+
138
+ def get_back_button(lang: str = "hi"):
139
+ btn_text = "🔙 Back to Main Menu" if lang == "en" else "🔙 मुख्य मेन्यू पर लौटें"
140
+ return InlineKeyboardMarkup([
141
+ [InlineKeyboardButton(btn_text, callback_data="nav_home")]
142
+ ])
143
+
144
+ def get_plans_text(lang: str = "hi"):
145
+ plans = db.get_all_plans()
146
+ if lang == "en":
147
+ return (
148
+ "💎 **Our VIP Membership Plans** 💎\n"
149
+ "━━━━━━━━━━━━━━━━━━━━\n"
150
+ f"🔹 **1 Day (Trial Plan):** ₹{plans.get('1day', '20')}\n"
151
+ f"🔹 **5 Days (Super Saver):** ₹{plans.get('5days', '50')}\n"
152
+ f"🔹 **15 Days (Best Value):** ₹{plans.get('15days', '120')}\n"
153
+ f"🔹 **30 Days (Monthly Unlimited):** ₹{plans.get('30days', '199')}\n\n"
154
+ "🔥 **Features Included in All Plans:**\n"
155
+ "• Unlimited files, videos & PDFs transfer\n"
156
+ "• Smart Auto-Topic creation in target groups\n"
157
+ "• Custom captions, thumbnails & scrolling watermarks\n"
158
+ "• 2GB+ file support with high-speed MTProto pipeline\n"
159
+ "━━━━━━━━━━━━━━━━━━━━\n"
160
+ "Click **'💳 How to Pay'** below to activate."
161
+ )
162
+ return (
163
+ "💎 **हमारे VIP मेम्बरशिप प्लान्स** 💎\n"
164
+ "━━━━━━━━━━━━━━━━━━━━\n"
165
+ f"🔹 **1 दिन (ट्रायल प्लान):** ₹{plans.get('1day', '20')}\n"
166
+ f"🔹 **5 दिन (सुपर सेवर):** ₹{plans.get('5days', '50')}\n"
167
+ f"🔹 **15 दिन (बेस्ट वैल्यू):** ₹{plans.get('15days', '120')}\n"
168
+ f"🔹 **30 दिन (मंथली अनलिमिटेड):** ₹{plans.get('30days', '199')}\n\n"
169
+ "🔥 **सभी प्लान्स में शामिल:**\n"
170
+ "• अनलिमिटेड फाइल्स, वीडियो व PDFs ट्रांसफर\n"
171
+ "• ऑटोमैटिक टॉपिक क्रिएशन (Smart Topics Engine)\n"
172
+ "• कस्टम कैप्शन, थंबनेल व स्क्रोलिंग वॉटरमार्क\n"
173
+ "• 2GB+ फ़ाइल सपोर्ट व हाई-स्पीड MTProto इंजन\n"
174
+ "━━━━━━━━━━━━━━━━━━━━\n"
175
+ "पेमेंट करने के लिए नीचे **'💳 पेमेंट कैसे करें'** बटन दबाएँ।"
176
  )
177
+
178
+ def get_plans_buttons(lang: str = "hi"):
179
+ pay_txt = "💳 How to Pay?" if lang == "en" else "💳 पेमेंट कैसे करें?"
180
+ back_txt = "🔙 Back to Main Menu" if lang == "en" else "🔙 मुख्य मेन्यू पर लौटें"
181
+ return InlineKeyboardMarkup([
182
+ [InlineKeyboardButton(pay_txt, callback_data="nav_payment")],
183
+ [InlineKeyboardButton(back_txt, callback_data="nav_home")]
184
  ])
 
185
 
186
+ def get_payment_caption(lang: str = "hi"):
187
+ plans = db.get_all_plans()
188
+ if lang == "en":
189
+ return (
190
+ "💳 **VIP Plan Payment Guide (PhonePe Gift Card)**\n"
191
+ "━━━━━━━━━━━━━━━━━━━━\n"
192
+ "We strictly accept payments via **PhonePe Gift Card**.\n\n"
193
+ f"💰 **Plan Prices:** ₹{plans.get('1day', '20')} (1D) | ₹{plans.get('5days', '50')} (5D) | ₹{plans.get('15days', '120')} (15D) | ₹{plans.get('30days', '199')} (30D)\n\n"
194
+ "📌 **Simple Payment Steps:**\n"
195
+ "1️⃣ Click the link below to open PhonePe directly:\n"
196
+ f"👉 [Click here to buy PhonePe Gift Card]({PHONEPE_LINK})\n\n"
197
+ "2️⃣ In PhonePe, select **'Buy New Gift Card'**.\n"
198
+ "3️⃣ Enter the exact amount for your chosen plan & complete the payment.\n"
199
+ "4️⃣ After payment, you will receive a **16-digit Card Number** & a **6-digit PIN**.\n"
200
+ f"5️⃣ Copy and send the Card Number & PIN to Admin {OWNER_HANDLE}.\n\n"
201
+ "⚡ Your VIP Plan will be activated within 2 minutes!"
202
+ )
203
+ return (
204
+ "💳 **VIP प्लान पेमेंट प्रक्रिया (PhonePe Gift Card)**\n"
205
  "━━━━━━━━━━━━━━━━━━━━\n"
206
+ "हमारा बॉट केवल **PhonePe Gift Card** द्वारा पेमेंट स्वीकार करता है।\n\n"
207
+ f"💰 **प्लान राशि:** ₹{plans.get('1day', '20')} (1D) | ₹{plans.get('5days', '50')} (5D) | ₹{plans.get('15days', '120')} (15D) | ₹{plans.get('30days', '199')} (30D)\n\n"
208
+ "📌 **आसान पेमेंट स्टेप्स:**\n"
209
+ "1️⃣ नीचे दिए गए लिंक पर क्लिक करें (सीधे PhonePe खुलेगा):\n"
210
+ f"👉 [यहा�� क्लिक करके PhonePe गिफ्ट कार्ड खरीदें]({PHONEPE_LINK})\n\n"
211
+ "2️⃣ PhonePe में **'Buy New Gift Card'** चुनें।\n"
212
+ "3️⃣ अपने चुने हुए प्लान की सही राशि दर्ज करके पेमेंट पूरा करें।\n"
213
+ "4️⃣ पेमेंट के बाद आपको **16 अंकों का कार्ड नंबर** और **6 अंकों का पिन** मिलेगा।\n"
214
+ f"5️⃣ वह कार्ड नंबर और पिन कॉपी करके एडमिन {OWNER_HANDLE} को भेजें।\n\n"
215
+ "⚡ आपका VIP प्लान 2 मिनट के अंदर एक्टिवेट कर दिया जाएगा!"
216
+ )
217
+
218
+ def get_payment_buttons(lang: str = "hi"):
219
+ link_txt = "🚀 Open PhonePe Gift Card" if lang == "en" else "🚀 PhonePe Gift Card खोलें"
220
+ send_txt = "👤 Send Code to Admin" if lang == "en" else "👤 कोड एडमिन को भेजें"
221
+ back_txt = "🔙 Back to Main Menu" if lang == "en" else "🔙 मुख्य मेन्यू पर लौटें"
222
+ return InlineKeyboardMarkup([
223
+ [InlineKeyboardButton(link_txt, url=PHONEPE_LINK)],
224
+ [InlineKeyboardButton(send_txt, url=f"https://t.me/{OWNER_HANDLE.replace('@', '')}")],
225
+ [InlineKeyboardButton(back_txt, callback_data="nav_home")]
226
+ ])
227
+
228
+ def get_howtouse_text(lang: str = "hi"):
229
+ if lang == "en":
230
+ return (
231
+ "📖 **How to Use the Bot (Step-by-Step Guide):**\n"
232
+ "━━━━━━━━━━━━━━━━━━━━\n"
233
+ "1️⃣ **Step 1 — Connect Account:**\n"
234
+ "• Send `/login` and provide your phone number (`+91XXXXXXXXXX`).\n"
235
+ "• Enter the OTP code received on Telegram.\n\n"
236
+ "2️⃣ **Step 2 — Start Transfer:**\n"
237
+ "• Send `/clone` for direct channel/chat cloning.\n"
238
+ "• Send `/topicclone` for forum groups (auto-creates topics).\n"
239
+ "• Provide Start Link and End Link (or `/single` for 1 file).\n"
240
+ "• Provide destination channel/group ID (or `/skip` to get in bot DM).\n\n"
241
+ "3️⃣ **Step 3 — Customization & Start:**\n"
242
+ "• Edit caption, set thumbnail, or set running watermark, then click **Confirm & Start**!\n\n"
243
+ "🔄 **Resume Task:** Send `/resume` to continue a stopped task.\n"
244
+ "🛑 **Cancel Task:** Send `/cancel` to stop immediately.\n\n"
245
+ "🎥 **Video Guide:**\n"
246
+ f"👉 [Click here to watch video tutorial]({TUTORIAL_VIDEO_URL})"
247
+ )
248
+ return (
249
+ "📖 **बॉट इस्तेमाल करने के आसान स्टेप्स:**\n"
250
  "━━━━━━━━━━━━━━━━━━━━\n"
251
+ "1️⃣ **स्टेप 1 — लॉगिन करें:**\n"
252
+ "• `/login` भेजें और कंट्री कोड के साथ नंबर डालें (`+91XXXXXXXXXX`)।\n"
253
+ "• टेलीग्राम से आया हुआ OTP दर्ज करें।\n\n"
254
+ "2️⃣ **स्टेप 2 — टास्क शुरू करें:**\n"
255
+ "• सामान्य चैनल/चैट के लिए `/clone` भेजें।\n"
256
+ "• टॉपिक वाले ग्रुप्स के लिए `/topicclone` भेजें।\n"
257
+ "• स्टार्ट लिंक और एंड लिंक भेजें (सिंगल पोस्ट के लिए `/single` लिखें)।\n"
258
+ "• टारगेट चैनल/ग्रुप ID भेजें (सीधे बॉट में पाने के लिए `/skip` लिखें)।\n\n"
259
+ "3️⃣ **स्टेप 3 — सेटिंग्स & स्टार्ट:**\n"
260
+ "• कैप्शन बदलें, थंबनेल लगाएं या रनिंग वॉटरमार्क सेट करें और **Confirm & Start** दबाएँ!\n\n"
261
+ "🔄 **ऑटो-रिज्यूम:** बीच में रुकने पर `/resume` भेजें।\n"
262
+ "🛑 **रोकने के लिए:** कभी भी `/cancel` भेजें।\n\n"
263
+ "🎥 **वीडियो ट्यूटोरियल देखें:**\n"
264
+ f"👉 [यहाँ क्लिक करके पूरा वीडियो गाइड देखें]({TUTORIAL_VIDEO_URL})"
265
  )
 
266
 
267
+ def get_howtouse_buttons(lang: str = "hi"):
268
+ vid_txt = "🎥 Watch Tutorial Video" if lang == "en" else "🎥 वीडियो ट्यूटोरियल देखें"
269
+ chan_txt = "📢 Channel & Topic Guide" if lang == "en" else "📢 चैनल व टॉपिक ग्रुप गाइड"
270
+ back_txt = "🔙 Back to Main Menu" if lang == "en" else "🔙 मुख्य मेन्यू पर लौटें"
271
+ return InlineKeyboardMarkup([
272
+ [InlineKeyboardButton(vid_txt, url=TUTORIAL_VIDEO_URL)],
273
+ [InlineKeyboardButton(chan_txt, callback_data="nav_channelhelp")],
274
+ [InlineKeyboardButton(back_txt, callback_data="nav_home")]
275
+ ])
276
+
277
+ def get_channelhelp_text(lang: str = "hi"):
278
+ if lang == "en":
279
+ return (
280
+ "📢 **Channel & Topic Group Upload Guidelines**\n"
281
+ "━━━━━━━━━━━━━━━━━━━━\n"
282
+ "🔹 **1. Uploading to a Channel:**\n"
283
+ "• Make our bot & your logged-in account **Admin** with Post Messages rights.\n"
284
+ "• Send channel username (`@MyChannel`) or private ID (`-100xxxx`).\n\n"
285
+ "🔹 **2. Uploading Topic-Wise Content:**\n"
286
+ "⚠️ **Rule:** Topic content CANNOT be uploaded to a Channel!\n"
287
+ "• Use a **Group** with **Topics (Forums)** turned ON.\n"
288
+ "• Grant the bot & account **'Manage Topics'** admin rights.\n"
289
+ "• Use `/topicclone` to auto-create topics using original names!\n\n"
290
+ "💡 **Find ID:** Forward any message here and send `/id`."
291
+ )
292
+ return (
293
+ "📢 **चैनल एवं टॉपिक ग्रुप अपलोड नियम व गाइड**\n"
294
+ "━━━━━━━━━━━━━━━━━━━━\n"
295
+ "🔹 **1. सामान्य चैनल में अपलोड करने के लिए:**\n"
296
+ "• चैनल में बॉट और अपने लॉगिन अकाउंट को **एडमिन** बनाएं।\n"
297
+ "• चैनल का यूज़रनेम (`@MyChannel`) या प्राइवेट ID (`-100xxxx`) डालें।\n\n"
298
+ "🔹 **2. टॉपिक-वाइज़ (Topic Content) अपलोड करने के नियम:**\n"
299
+ "⚠️ **नियम:** टॉपिक वाली फाइलें **चैनल (Channel)** में अपलोड नहीं हो सकतीं!\n"
300
+ "• इसके लिए एक **ग्रुप** दें जिसमें **Topics (Forums)** ON हो।\n"
301
+ "• बॉट और अकाउंट दोनों को उस ग्रुप में **'Manage Topics'** एडमिन परमिशन दें।\n"
302
+ "• `/topicclone` कमांड का इस्तेमाल करें, बॉट पुराने नाम से नया टॉपिक खुद बना देगा!\n\n"
303
+ "💡 **चैनल/ग्रुप ID निकालने के लिए:** कोई भी मैसेज बॉट में फॉरवर्ड करके `/id` भेजें।"
304
  )
305
 
306
+ def get_speedhelp_text(lang: str = "hi"):
307
+ if lang == "en":
308
+ return (
309
+ "⚡ **Speed & Performance Guide**\n"
310
+ "━━━━━━━━━━━━━━━━━━━━\n"
311
+ "Our bot runs on a **High-Throughput MTProto Pipeline Engine** with direct DC routing.\n\n"
312
+ "💡 **Key Speed Factors:**\n"
313
+ "1. **Direct DC Routing:** Files download faster when requested directly from their native Data Center.\n"
314
+ "2. **Rate Limits:** If Telegram temporarily throttles a session, logging out and in (`/logout` then `/login`) resets the socket connection.\n"
315
+ "3. **Zero Bottleneck:** The server network pipe handles 10-15 MB/s easily."
316
+ )
317
+ return (
318
+ "⚡ **स्पीड एवं परफॉर्मेंस गाइड**\n"
319
+ "━━━━━━━━━━━━━━━━━━━━\n"
320
+ "हमारा बॉट **डायरेक्ट DC राउटिंग** और मल्टी-स्ट्रीम MTProto पाइपलाइन इंजन पर चलता है।\n\n"
321
+ "💡 **स्पीड से जुड़ी मुख्य बातें:**\n"
322
+ "1. **डायरेक्ट डेटा सेंटर कनेक्टिविटी:** फाइलें सीधे उनके मूल डेटा सेंटर से बिना रीडायरेक्ट लेटेंसी के डाउनलोड होती हैं।\n"
323
+ "2. **अस्थायी टेलीग्राम थ्रॉटल:** यदि किसी नंबर पर बहुत अधिक फाइलें ट्रांसफर होने से टेलीग्राम स्पीड दबा देता है, तो `/logout` करके दोबारा `/login` करने से सॉकेट रीसेट हो जाता है।\n"
324
+ "3. **सर्वर स्पीड:** हमारे सर्वर की बैंडविड्थ 10-15 MB/s आराम से हैंडल करती है।"
325
  )
326
 
327
+ @bot.on_message(filters.command("start") & filters.private)
328
+ async def start_command(client: Client, message: Message):
329
+ user_id = message.from_user.id
330
+ name = message.from_user.first_name
331
+ db.add_user(user_id, name)
332
+ lang = db.get_lang(user_id)
333
+ text, buttons = get_start_panel(name, is_admin(user_id), lang)
334
+ await message.reply_text(text, reply_markup=buttons, disable_web_page_preview=True)
335
+
336
+ @bot.on_message(filters.command(["lang", "language"]) & filters.private)
337
+ async def lang_cmd(client: Client, message: Message):
338
  await message.reply_text(
339
+ "🌐 **Choose Your Preferred Language / अपनी पसंदीदा भाषा चुनें:**",
340
+ reply_markup=get_lang_prompt_markup()
 
341
  )
342
 
 
 
 
 
343
  @bot.on_message(filters.command("plans") & filters.private)
344
+ async def show_plans_cmd(client: Client, message: Message):
345
+ lang = db.get_lang(message.from_user.id)
346
+ await message.reply_text(get_plans_text(lang), reply_markup=get_plans_buttons(lang))
347
+
348
+ @bot.on_message(filters.command(["howtouse", "help"]) & filters.private)
349
+ async def howtouse_cmd(client: Client, message: Message):
350
+ lang = db.get_lang(message.from_user.id)
351
+ await message.reply_text(get_howtouse_text(lang), reply_markup=get_howtouse_buttons(lang), disable_web_page_preview=True)
352
+
353
+ @bot.on_message(filters.command(["channelhelp"]) & filters.private)
354
+ async def channelhelp_cmd(client: Client, message: Message):
355
+ lang = db.get_lang(message.from_user.id)
356
+ await message.reply_text(get_channelhelp_text(lang), reply_markup=get_back_button(lang))
357
+
358
+ @bot.on_message(filters.command(["speedhelp", "slowspeed"]) & filters.private)
359
+ async def speedhelp_cmd(client: Client, message: Message):
360
+ lang = db.get_lang(message.from_user.id)
361
+ await message.reply_text(get_speedhelp_text(lang), reply_markup=get_back_button(lang))
362
+
363
+ @bot.on_message(filters.command(["pay", "buy", "payment"]) & filters.private)
364
+ async def payment_cmd(client: Client, message: Message):
365
+ lang = db.get_lang(message.from_user.id)
366
+ try:
367
+ await message.reply_photo(
368
+ photo=PAYMENT_IMG_URL,
369
+ caption=get_payment_caption(lang),
370
+ reply_markup=get_payment_buttons(lang)
371
+ )
372
+ except Exception:
373
+ await message.reply_text(get_payment_caption(lang), reply_markup=get_payment_buttons(lang))
374
 
375
  @bot.on_message(filters.command(["myplan", "info"]) & filters.private)
376
+ async def my_plan_cmd(client: Client, message: Message):
377
  user_id = message.from_user.id
378
+ lang = db.get_lang(user_id)
379
  if is_admin(user_id):
380
+ txt = "👑 You are the **Bot Owner** (Lifetime VIP Access)." if lang == "en" else "👑 आप इस बॉट के **ओनर/एडमिन** हैं (लाइफटाइम अनलिमिटेड VIP एक्सेस)।"
381
+ return await message.reply_text(txt, reply_markup=get_back_button(lang))
382
 
383
  user = db.get_user(user_id)
384
  if not user or not user.get("plan_expiry"):
385
+ txt = "❌ **No active VIP Plan found.**\nCheck /plans for options." if lang == "en" else "❌ **आपके पास कोई एक्टिव VIP प्लान नहीं है।**\nप्लान्स और कीमतें देखने के लिए /plans दबाएँ।"
386
+ return await message.reply_text(txt, reply_markup=get_plans_buttons(lang))
387
+
388
+ try:
389
+ exp = datetime.fromisoformat(user["plan_expiry"].replace("Z", "+00:00"))
390
+ if datetime.now(timezone.utc) > exp:
391
+ txt = "⚠️ **Your VIP Plan has expired.** Please renew." if lang == "en" else "⚠️ **आपका VIP प्लान समाप्त हो चुका है।** कृपया नया प्लान रिन्यू करें।"
392
+ return await message.reply_text(txt, reply_markup=get_plans_buttons(lang))
393
+ expiry_str = exp.strftime("%Y-%m-%d %H:%M:%S UTC")
394
+ except Exception:
395
+ expiry_str = user["plan_expiry"][:19].replace("T", " ") + " UTC"
396
+
397
+ if lang == "en":
398
+ status_text = (
399
+ f"👤 **Your Subscription Info:**\n\n"
400
+ f"🆔 **User ID:** `{user_id}`\n"
401
+ f"📊 **Status:** VIP Member ✅\n"
402
+ f"⏳ **Expiry Date:** `{expiry_str}`\n\n"
403
+ f"Support: {OWNER_HANDLE}"
404
+ )
405
+ else:
406
+ status_text = (
407
+ f"👤 **आपकी प्लान जानकारी:**\n\n"
408
+ f"🆔 **User ID:** `{user_id}`\n"
409
+ f"📊 **स्टेटस:** VIP Member ✅\n"
410
+ f"⏳ **एक्सपायरी डेट:** `{expiry_str}`\n\n"
411
+ f"सपोर्ट: {OWNER_HANDLE}"
412
+ )
413
+ await message.reply_text(status_text, reply_markup=get_back_button(lang))
414
+
415
+ @bot.on_callback_query()
416
+ async def bot_callback_router(client: Client, query: CallbackQuery):
417
+ data = query.data
418
+ user_id = query.from_user.id
419
+ name = query.from_user.first_name
420
+ lang = db.get_lang(user_id)
421
+
422
+ if data.startswith("setlang_"):
423
+ new_lang = data.split("_")[1]
424
+ db.set_lang(user_id, new_lang)
425
+ confirm_txt = "✅ **Language changed to English!**" if new_lang == "en" else "✅ **भाषा बदलकर हिंदी कर दी गई है!**"
426
+ await query.answer(confirm_txt)
427
+ text, buttons = get_start_panel(name, is_admin(user_id), new_lang)
428
+ try:
429
+ await query.message.edit_text(text, reply_markup=buttons, disable_web_page_preview=True)
430
+ except Exception:
431
+ pass
432
+ return
433
+
434
+ elif data == "nav_lang":
435
+ await query.message.edit_text(
436
+ "🌐 **Choose Your Preferred Language / अपनी पसंदीदा भाषा चुनें:**",
437
+ reply_markup=get_lang_prompt_markup()
438
+ )
439
+ return
440
+
441
+ elif data.startswith("bc_"):
442
+ if not is_admin(user_id):
443
+ return await query.answer("❌ केवल एडमिन के लिए!", show_alert=True)
444
+
445
+ should_pin = (data == "bc_pin")
446
+ msg_id_to_copy = PENDING_BROADCASTS.get(user_id)
447
+ if not msg_id_to_copy:
448
+ return await query.message.edit_text("⚠️ ब्रॉडकास्ट सेशन समाप्त हो गया। दोबारा `/broadcast` करें।")
449
+
450
+ await query.message.edit_text("⏳ **ब्रॉडकास्ट शुरू हो रह�� है... कृपया इंतज़ार करें।**")
451
+ users = db.get_all_users()
452
+ total_users = len(users)
453
 
454
+ success, blocked, failed = 0, 0, 0
455
+ for u in users:
456
+ u_id = u["user_id"]
457
+ try:
458
+ sent = await client.copy_message(chat_id=u_id, from_chat_id=user_id, message_id=msg_id_to_copy)
459
+ if should_pin:
460
+ try:
461
+ await sent.pin(both_sides=True)
462
+ except Exception:
463
+ pass
464
+ success += 1
465
+ except FloodWait as f:
466
+ await asyncio.sleep(f.value)
467
+ try:
468
+ sent = await client.copy_message(chat_id=u_id, from_chat_id=user_id, message_id=msg_id_to_copy)
469
+ if should_pin:
470
+ try:
471
+ await sent.pin(both_sides=True)
472
+ except Exception:
473
+ pass
474
+ success += 1
475
+ except Exception:
476
+ failed += 1
477
+ except (UserIsBlocked, InputUserDeactivated):
478
+ blocked += 1
479
+ except Exception:
480
+ failed += 1
481
+ await asyncio.sleep(0.05)
482
+
483
+ PENDING_BROADCASTS.pop(user_id, None)
484
+ pin_status_str = "हाँ (पिन किया गया ✅)" if should_pin else "नहीं (सामान्य ⏩)"
485
+ return await query.message.edit_text(
486
+ f"✅ **ब्रॉडकास्ट पूरा हुआ!**\n━━━━━━━━━━━━━━━━━━━━\n"
487
+ f"👥 कुल यूज़र्स: `{total_users}`\n"
488
+ f"✔️ सफल: `{success}`\n"
489
+ f"🚫 बॉट ब्लॉक किया: `{blocked}`\n"
490
+ f"❌ असफल: `{failed}`\n"
491
+ f"📌 पिन स्टेटस: {pin_status_str}"
492
+ )
493
+
494
+ elif data == "nav_home":
495
+ text, buttons = get_start_panel(name, is_admin(user_id), lang)
496
+ try:
497
+ if query.message.photo:
498
+ await query.message.delete()
499
+ await client.send_message(user_id, text, reply_markup=buttons, disable_web_page_preview=True)
500
+ else:
501
+ await query.message.edit_text(text, reply_markup=buttons, disable_web_page_preview=True)
502
+ except Exception:
503
+ pass
504
+
505
+ elif data == "nav_plans":
506
+ try:
507
+ if query.message.photo:
508
+ await query.message.delete()
509
+ await client.send_message(user_id, get_plans_text(lang), reply_markup=get_plans_buttons(lang))
510
+ else:
511
+ await query.message.edit_text(get_plans_text(lang), reply_markup=get_plans_buttons(lang))
512
+ except Exception:
513
+ pass
514
+
515
+ elif data == "nav_payment":
516
+ try:
517
+ await query.message.delete()
518
+ await client.send_photo(
519
+ user_id,
520
+ photo=PAYMENT_IMG_URL,
521
+ caption=get_payment_caption(lang),
522
+ reply_markup=get_payment_buttons(lang)
523
+ )
524
+ except Exception:
525
+ await client.send_message(user_id, get_payment_caption(lang), reply_markup=get_payment_buttons(lang))
526
+
527
+ elif data == "nav_howtouse":
528
+ try:
529
+ if query.message.photo:
530
+ await query.message.delete()
531
+ await client.send_message(user_id, get_howtouse_text(lang), reply_markup=get_howtouse_buttons(lang), disable_web_page_preview=True)
532
+ else:
533
+ await query.message.edit_text(get_howtouse_text(lang), reply_markup=get_howtouse_buttons(lang), disable_web_page_preview=True)
534
+ except Exception:
535
+ pass
536
+
537
+ elif data == "nav_channelhelp":
538
+ try:
539
+ if query.message.photo:
540
+ await query.message.delete()
541
+ await client.send_message(user_id, get_channelhelp_text(lang), reply_markup=get_back_button(lang))
542
+ else:
543
+ await query.message.edit_text(get_channelhelp_text(lang), reply_markup=get_back_button(lang))
544
+ except Exception:
545
+ pass
546
+
547
+ elif data == "nav_speedhelp":
548
+ try:
549
+ if query.message.photo:
550
+ await query.message.delete()
551
+ await client.send_message(user_id, get_speedhelp_text(lang), reply_markup=get_back_button(lang))
552
+ else:
553
+ await query.message.edit_text(get_speedhelp_text(lang), reply_markup=get_back_button(lang))
554
+ except Exception:
555
+ pass
556
+
557
+ elif data == "nav_myplan":
558
+ if is_admin(user_id):
559
+ status_text = "👑 You are the **Bot Owner** (Lifetime VIP Access)." if lang == "en" else "👑 आप इस बॉट के **ओनर/एडमि��** हैं (लाइफटाइम अनलिमिटेड VIP एक्सेस)।"
560
+ else:
561
+ user = db.get_user(user_id)
562
+ if not user or not user.get("plan_expiry"):
563
+ status_text = "❌ **No active VIP Plan found.**\nCheck /plans for options." if lang == "en" else "❌ **आपके पास कोई एक्टिव VIP प्लान नहीं है।**\nप्लान्स और कीमतें देखने के लिए /plans दबाएँ।"
564
+ else:
565
+ try:
566
+ exp = datetime.fromisoformat(user["plan_expiry"].replace("Z", "+00:00"))
567
+ if datetime.now(timezone.utc) > exp:
568
+ status_text = "⚠️ **Your VIP Plan has expired.** Please renew." if lang == "en" else "⚠️ **आपका VIP प्लान समाप्त हो चुका है।** कृपया नया प्लान रिन्यू करें।"
569
+ else:
570
+ expiry_str = exp.strftime("%Y-%m-%d %H:%M:%S UTC")
571
+ if lang == "en":
572
+ status_text = (
573
+ f"👤 **Your Subscription Info:**\n\n"
574
+ f"🆔 **User ID:** `{user_id}`\n"
575
+ f"📊 **Status:** VIP Member ✅\n"
576
+ f"⏳ **Expiry Date:** `{expiry_str}`"
577
+ )
578
+ else:
579
+ status_text = (
580
+ f"👤 **आपकी प्लान जानकारी:**\n\n"
581
+ f"🆔 **User ID:** `{user_id}`\n"
582
+ f"📊 **स्टेटस:** VIP Member ✅\n"
583
+ f"⏳ **एक्सपायरी डेट:** `{expiry_str}`"
584
+ )
585
+ except Exception:
586
+ status_text = f"🆔 **User ID:** `{user_id}`\n⏳ **Expiry:** `{user.get('plan_expiry')}`"
587
+
588
+ try:
589
+ if query.message.photo:
590
+ await query.message.delete()
591
+ await client.send_message(user_id, status_text, reply_markup=get_back_button(lang))
592
+ else:
593
+ await query.message.edit_text(status_text, reply_markup=get_back_button(lang))
594
+ except Exception:
595
+ pass
596
+
597
+ else:
598
+ await query.continue_propagation()
599
 
600
  # ----------------- ADMIN COMMANDS ----------------- #
601
+
602
+ @bot.on_message(filters.command("users") & filters.private)
603
+ async def list_users_admin(client: Client, message: Message):
604
  if not is_admin(message.from_user.id):
605
  return
 
 
606
 
607
+ all_users = db.get_all_users()
608
+ if not all_users:
609
+ return await message.reply_text("❌ डेटाबेस में कोई यूज़र नहीं मिला।")
610
+
611
+ vip_list = []
612
+ free_list = []
613
+ now = datetime.now(timezone.utc)
614
+
615
+ for u in all_users:
616
+ uid = u["user_id"]
617
+ uname = u.get("name") or "User"
618
+ exp_str = u.get("plan_expiry")
619
+
620
+ is_vip = False
621
+ exp_display = "Active"
622
+
623
+ if exp_str:
624
+ try:
625
+ exp = datetime.fromisoformat(exp_str.replace("Z", "+00:00"))
626
+ if exp > now:
627
+ is_vip = True
628
+ exp_display = exp.strftime("%d-%b-%Y %H:%M")
629
+ except Exception:
630
+ pass
631
+
632
+ if is_vip:
633
+ vip_list.append(f"• `{uid}` | {uname} | ⏳ {exp_display}")
634
+ else:
635
+ free_list.append(f"• `{uid}` | {uname}")
636
+
637
+ out = (
638
+ f"👥 **कुल यूज़र्स संख्या:** `{len(all_users)}`\n"
639
+ "━━━━━━━━━━━━━━━━━━━━\n\n"
640
+ f"💎 **एक्टिव VIP मेंबर्स ({len(vip_list)}):**\n"
641
+ )
642
+ if vip_list:
643
+ out += "\n".join(vip_list[:50]) + ("\n...(अधिक)" if len(vip_list) > 50 else "")
644
+ else:
645
+ out += "कोई एक्टिव VIP यूजर नहीं है।"
646
+
647
+ out += f"\n\n👤 **फ्री मेंबर्स ({len(free_list)}):**\n"
648
+ if free_list:
649
+ out += "\n".join(free_list[:50]) + ("\n...(अधिक)" if len(free_list) > 50 else "")
650
+ else:
651
+ out += "कोई फ्री यूजर नहीं है।"
652
+
653
+ await message.reply_text(out)
654
+
655
+ @bot.on_message(filters.command("setprice") & filters.private)
656
  async def set_price_admin(client: Client, message: Message):
657
  if not is_admin(message.from_user.id):
658
  return
659
+ parts = message.text.split()
660
+ if len(parts) != 3:
661
+ return await message.reply_text(
662
+ "❌ गलत फॉर्मेट!\nउपयोग: `/setprice <plan> <price>`\nउपलब्ध प्लान्स: `1day`, `5days`, `15days`, `30days`\nउदाहरण: `/setprice 1day 20`"
663
+ )
664
+ plan_key = parts[1].lower()
665
+ price = parts[2]
666
+ if plan_key not in ["1day", "5days", "15days", "30days"]:
667
+ return await message.reply_text("❌ मान्य प्लान नाम: `1day`, `5days`, `15days`, `30days`")
668
+
669
+ db.set_plan_price(plan_key, price)
670
+ await message.reply_text(f"✅ **सफलता:** प्लान `{plan_key}` की कीमत ₹{price} सेट कर दी गई है।")
671
 
672
  @bot.on_message(filters.command("adduser") & filters.private)
673
  async def add_user_admin(client: Client, message: Message):
674
  if not is_admin(message.from_user.id):
675
  return
676
+ parts = message.text.split()
677
+ if len(parts) < 2:
678
+ return await message.reply_text("❌ गलत फॉर्मेट!\nउदाहरण: `/adduser 123456789 30` (ID दिन)")
679
  try:
 
680
  target_id = int(parts[1])
681
+ days = int(parts[2]) if len(parts) > 2 else 30
682
  db.add_vip_user(target_id, days)
683
+ await message.reply_text(f"✅ यूजर `{target_id}` को **{days} दिन** के लिए VIP एक्सेस दे दिया गया है।")
684
+ try:
685
+ await client.send_message(
686
+ target_id,
687
+ f"🎉 **बधाई हो!** आपका VIP सब्सक्रिप्शन एक्टिवेट कर दिया गया है ({days} दिन के लिए)।\nअब आप `/clone` या `/topicclone` का उपयोग कर सकते हैं।"
688
+ )
689
+ except Exception:
690
+ pass
691
  except Exception as e:
692
  await message.reply_text(f"Error: {e}")
693
 
 
695
  async def remove_user_admin(client: Client, message: Message):
696
  if not is_admin(message.from_user.id):
697
  return
698
+ parts = message.text.split()
699
+ if len(parts) != 2:
700
+ return await message.reply_text("❌ गलत फॉर्मेट!\nउदाहरण: `/removeuser 123456789`")
701
  try:
 
702
  target_id = int(parts[1])
703
  db.remove_vip_user(target_id)
704
 
705
+ # मेमोरी से तुरंत टास्क रोकने का ट्रिगर
706
+ try:
707
+ from TechVJ.start import batch_temp
708
  batch_temp.IS_BATCH[target_id] = True
709
+ except Exception:
710
+ pass
 
711
 
712
+ await message.reply_text(f"🚫 यूजर `{target_id}` का VIP एक्सेस हटा दिया गया है और उसका चल रहा टास्क तुरंत किल कर दिया गया है।")
713
+ try:
714
+ await client.send_message(
715
+ target_id,
716
+ "🚫 **आपका VIP एक्सेस एडमिन द्वारा समाप्त कर दिया गया है और आपका चालू टास्क रोक दिया गया है।**"
717
+ )
718
+ except Exception:
719
+ pass
720
  except Exception as e:
721
  await message.reply_text(f"Error: {e}")
722
 
 
725
  if not is_admin(message.from_user.id):
726
  return
727
  if not message.reply_to_message:
728
+ return await message.reply_text("⚠️ **इस्तेमाल का तरीका:** जिस मैसेज को सभी को भेजना है, उस पर रिप्लाई करके `/broadcast` लिखें।")
729
 
730
+ admin_id = message.from_user.id
731
+ PENDING_BROADCASTS[admin_id] = message.reply_to_message.id
732
+
733
+ pin_ask_buttons = InlineKeyboardMarkup([
734
+ [
735
+ InlineKeyboardButton("📌 हाँ, सभी के लिए पिन करें", callback_data="bc_pin"),
736
+ InlineKeyboardButton("⏩ नहीं, सामान्य भेजें", callback_data="bc_nopin")
737
+ ]
738
+ ])
739
+
740
+ await message.reply_text(
741
+ "📢 **ब्रॉडकास्ट पुष्टिकरण:**\n\nक्या आप चाहते हैं कि यह मैसेज सभी यूज़र्स के इनबॉक्स में **पिन (Pin)** भी हो जाए?",
742
+ reply_markup=pin_ask_buttons
743
+ )
744
 
745
  if __name__ == "__main__":
746
  bot.run()