Update main.py
Browse files
main.py
CHANGED
@@ -16,12 +16,14 @@ logging.basicConfig(level=logging.INFO)
|
|
16 |
|
17 |
WELCOME_TEXT = """
|
18 |
Hey! {first_name}
|
|
|
19 |
Saya adalah bot untuk mengunduh video PornoHub di telegram.
|
20 |
|
21 |
- Jangan share video ke group (mending private bot aman)
|
22 |
|
23 |
- Command: /hubsearch boobs
|
24 |
- Command: /hubdl link xnxx
|
|
|
25 |
|
26 |
Powered by @xtdevs
|
27 |
"""
|
@@ -68,6 +70,21 @@ def set_user_update_in_db(user_id: int, first_name: str, username: str):
|
|
68 |
return None
|
69 |
return response.json()
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
@client.on_message(
|
72 |
filters.incoming
|
73 |
& filters.private,
|
@@ -100,7 +117,6 @@ async def must_join_channel(bot: Client, msg: Message):
|
|
100 |
except ChatAdminRequired:
|
101 |
pass
|
102 |
|
103 |
-
|
104 |
async def check_membership(channel_id, bot, msg):
|
105 |
try:
|
106 |
user_id = msg.from_user.id if msg.from_user else 0
|
@@ -179,8 +195,13 @@ async def searchhub(client: Client, message: Message):
|
|
179 |
return await message.reply_text("please search for pornohub.")
|
180 |
pro = await message.reply_text("Processing.....")
|
181 |
if query in not_allowed:
|
182 |
-
return await pro.edit_text("I don't understand, can you help me?")
|
|
|
|
|
|
|
|
|
183 |
try:
|
|
|
184 |
response = await api.x_search(query=query)
|
185 |
if response is None:
|
186 |
return await pro.edit_text("nothing found gay")
|
@@ -203,7 +224,7 @@ async def searchhub(client: Client, message: Message):
|
|
203 |
caption=f"β’ Powered by {client.me.mention}",
|
204 |
thumb=thumb,
|
205 |
has_spoiler=True,
|
206 |
-
protect_content=
|
207 |
progress=progress,
|
208 |
progress_args=(
|
209 |
pro,
|
@@ -230,7 +251,12 @@ async def porno_download(client: Client, message: Message):
|
|
230 |
if not link.startswith("https://www.xnxx.com/"):
|
231 |
return await message.reply_text("invalid link.")
|
232 |
pro = await message.reply_text("Processing.....")
|
|
|
|
|
|
|
|
|
233 |
try:
|
|
|
234 |
file_path, thumb, _ = await api.x_download(url=link, is_stream=True)
|
235 |
upload_text = f"**β¬οΈ π΄ππ
ππΊπ½πππ video ...**"
|
236 |
await pro.edit_text(upload_text)
|
@@ -250,7 +276,7 @@ async def porno_download(client: Client, message: Message):
|
|
250 |
caption=f"β’ Powered by {client.me.mention}",
|
251 |
thumb=thumb,
|
252 |
has_spoiler=True,
|
253 |
-
protect_content=
|
254 |
progress=progress,
|
255 |
progress_args=(
|
256 |
pro,
|
@@ -264,4 +290,13 @@ async def porno_download(client: Client, message: Message):
|
|
264 |
except Exception as e:
|
265 |
await pro.edit_text(str(e))
|
266 |
|
267 |
-
client.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
WELCOME_TEXT = """
|
18 |
Hey! {first_name}
|
19 |
+
|
20 |
Saya adalah bot untuk mengunduh video PornoHub di telegram.
|
21 |
|
22 |
- Jangan share video ke group (mending private bot aman)
|
23 |
|
24 |
- Command: /hubsearch boobs
|
25 |
- Command: /hubdl link xnxx
|
26 |
+
- Command: /freemode
|
27 |
|
28 |
Powered by @xtdevs
|
29 |
"""
|
|
|
70 |
return None
|
71 |
return response.json()
|
72 |
|
73 |
+
def toggle_free_mode(user_id):
|
74 |
+
try:
|
75 |
+
response = requests.post(f"https://private-akeno.randydev.my.id/api/v2/akenohub/freemode?user_id={user_id}")
|
76 |
+
return response.json()
|
77 |
+
except requests.RequestException as e:
|
78 |
+
return {"message": f"Error toggling free mode: {str(e)}", "free_mode_enabled": False}
|
79 |
+
|
80 |
+
def check_expiration(user_id):
|
81 |
+
try:
|
82 |
+
response = requests.get(f"https://private-akeno.randydev.my.id/api/v2/akenohub/check?user_id={user_id}")
|
83 |
+
response.raise_for_status()
|
84 |
+
return response.json()
|
85 |
+
except requests.RequestException as e:
|
86 |
+
return {"expired": True, "free_mode": False, "message": f"Error checking expiration: {str(e)}"}
|
87 |
+
|
88 |
@client.on_message(
|
89 |
filters.incoming
|
90 |
& filters.private,
|
|
|
117 |
except ChatAdminRequired:
|
118 |
pass
|
119 |
|
|
|
120 |
async def check_membership(channel_id, bot, msg):
|
121 |
try:
|
122 |
user_id = msg.from_user.id if msg.from_user else 0
|
|
|
195 |
return await message.reply_text("please search for pornohub.")
|
196 |
pro = await message.reply_text("Processing.....")
|
197 |
if query in not_allowed:
|
198 |
+
return await pro.edit_text("I don't understand, can you help me?")
|
199 |
+
user_status = check_expiration(user_id)
|
200 |
+
if user_status["expired"] and not user_status["free_mode"]:
|
201 |
+
await pro.edit_text("Your session has expired, please renew or activate free mode.")
|
202 |
+
return
|
203 |
try:
|
204 |
+
protect_content = not user_status["free_mode"]
|
205 |
response = await api.x_search(query=query)
|
206 |
if response is None:
|
207 |
return await pro.edit_text("nothing found gay")
|
|
|
224 |
caption=f"β’ Powered by {client.me.mention}",
|
225 |
thumb=thumb,
|
226 |
has_spoiler=True,
|
227 |
+
protect_content=protect_content,
|
228 |
progress=progress,
|
229 |
progress_args=(
|
230 |
pro,
|
|
|
251 |
if not link.startswith("https://www.xnxx.com/"):
|
252 |
return await message.reply_text("invalid link.")
|
253 |
pro = await message.reply_text("Processing.....")
|
254 |
+
user_status = check_expiration(user_id)
|
255 |
+
if user_status["expired"] and not user_status["free_mode"]:
|
256 |
+
await pro.edit_text("Your session has expired, please renew or activate free mode.")
|
257 |
+
return
|
258 |
try:
|
259 |
+
protect_content = not user_status["free_mode"]
|
260 |
file_path, thumb, _ = await api.x_download(url=link, is_stream=True)
|
261 |
upload_text = f"**β¬οΈ π΄ππ
ππΊπ½πππ video ...**"
|
262 |
await pro.edit_text(upload_text)
|
|
|
276 |
caption=f"β’ Powered by {client.me.mention}",
|
277 |
thumb=thumb,
|
278 |
has_spoiler=True,
|
279 |
+
protect_content=protect_content,
|
280 |
progress=progress,
|
281 |
progress_args=(
|
282 |
pro,
|
|
|
290 |
except Exception as e:
|
291 |
await pro.edit_text(str(e))
|
292 |
|
293 |
+
@client.on_message(filters.command("freemode"))
|
294 |
+
async def freemode_handler(client, message):
|
295 |
+
user_id = message.from_user.id
|
296 |
+
free_mode_status = toggle_free_mode(user_id)
|
297 |
+
if free_mode_status.get("free_mode_enabled"):
|
298 |
+
await message.reply(f"Free mode activated for user {user_id}.")
|
299 |
+
elif "wait" in free_mode_status["message"]:
|
300 |
+
await message.reply(f"{free_mode_status['message']}")
|
301 |
+
else:
|
302 |
+
await message.reply(f"Free mode deactivated for user {user_id}.")
|