File size: 10,576 Bytes
b3eb313
7ee59b3
 
6381cdf
b3eb313
 
 
43d0b09
5a02fdd
48b88b6
7ee59b3
298347d
b3eb313
2dadbc4
 
 
ce99a3f
b3eb313
 
8e8fa3c
9e157a6
48b88b6
b3eb313
48b88b6
 
4ac817e
 
9e157a6
8f760c2
4ac817e
48b88b6
b3eb313
 
7ee59b3
 
 
8e8fa3c
7ee59b3
 
471ab6f
7ee59b3
 
4ac817e
 
 
8e8fa3c
4ac817e
 
 
8e8fa3c
4ac817e
 
b3eb313
48b88b6
b3eb313
 
 
 
 
7ee59b3
b3eb313
d09a97a
 
471ab6f
 
 
 
 
 
 
 
 
 
 
e69fe51
9e157a6
 
 
 
 
cc5ddaf
9e157a6
cc5ddaf
 
9e157a6
cc5ddaf
 
 
 
 
9e157a6
cc5ddaf
9e157a6
e69fe51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43d0b09
 
 
 
 
e538542
43d0b09
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94c7f54
 
 
 
 
b3eb313
471ab6f
 
 
 
 
 
 
b3eb313
 
 
 
48b88b6
b3eb313
 
 
 
 
7ee59b3
4ac817e
7ee59b3
8e8fa3c
7ee59b3
471ab6f
 
7ee59b3
 
b3eb313
7ee59b3
8e8fa3c
7ee59b3
b3eb313
 
 
7ee59b3
f55a387
 
7ee59b3
 
 
 
65f4247
7ee59b3
 
 
63ff90e
d09a97a
9e157a6
7ee59b3
c76e2bd
 
a0ef5e4
dd1dccd
 
a0ef5e4
6784216
7ee59b3
 
4ac817e
 
 
8e8fa3c
4ac817e
 
8e8fa3c
4ac817e
 
1101551
b9bb8fa
7ee59b3
 
 
 
9e157a6
7ee59b3
 
 
 
 
 
 
 
 
 
 
 
 
a811e40
 
 
 
 
 
7ee59b3
f55a387
 
7ee59b3
 
 
 
65f4247
7ee59b3
 
 
a811e40
7ee59b3
63ff90e
7ee59b3
c76e2bd
 
7ee59b3
 
 
4ac817e
 
 
8e8fa3c
4ac817e
 
8e8fa3c
8280922
 
4ac817e
b9bb8fa
 
7ee59b3
 
 
 
9e157a6
7ee59b3
 
 
 
 
 
b3eb313
7ee59b3
 
 
 
 
b3eb313
ee08ce5
 
7dc2a9c
ee08ce5
 
9e157a6
 
 
 
 
 
 
 
459dfcf
 
12c1a70
 
 
 
 
 
 
 
 
 
 
 
 
 
459dfcf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
import logging
import time
import os
import requests
from pyrogram import Client, filters
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton
from pyrogram.types import *
from pyrogram.errors import *
from pyrogram.enums import *
import akenoai as ak
from config import API_KEY, API_ID, API_HASH, BOT_TOKEN
from scripts import progress

logging.basicConfig(
    level=logging.WARNING, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
)
logging.getLogger("pyrogram").setLevel(logging.WARNING)

WELCOME_TEXT = """
Hey! {first_name}

Saya adalah bot untuk mengunduh video PornoHub di telegram.

- Jangan share video ke group (mending private bot aman)

- Command: /hubsearch boobs
- Command: /hubdl link xnxx
- Command: /freemode
- command: /check_status

Powered by @xtdevs
"""

USER_TRACK = """
β€’ AkenoHUB

UserID: {user_id}
First Name: {first_name}
Username: @{username}
Check DB: {user_db}
"""

USER_LOGS = """
β€’ AkenoHUB

UserID: {user_id}
First Name: {first_name}
Username: @{username}

Text Log: {type_text}
"""

client = Client(
    "AkenoHub",
    api_id=API_ID,
    api_hash=API_HASH,
    bot_token=BOT_TOKEN
)

api = ak.PornoHub(key=API_KEY)

not_allowed = ["hi", "hello", "hey", "hai", "help"]

def set_user_update_in_db(user_id: int, first_name: str, username: str):
    url = "https://private-akeno.randydev.my.id/api/v2/update_in_db"
    params = {
        "user_id": user_id,
        "first_name": first_name,
        "username": username
    }
    response = requests.post(url, params=params)
    if response.status_code != 200:
        return None
    return response.json()

def toggle_free_mode(user_id):
    try:
        response = requests.post(f"https://private-akeno.randydev.my.id/api/v2/akenohub/freemode?user_id={user_id}")
        return response.json()
    except requests.RequestException as e:
        return {"message": "Error toggling free mode: ok", "free_mode_enabled": False}

def check_user_expiration(user_id: int):
    url = f"https://private-akeno.randydev.my.id/api/v2/akenohub/check?user_id={user_id}"
    try:
        response = requests.get(url)
        if response.status_code == 200:
            return response.json()
        else:
            return {"expired": True, "free_mode": False}
    except requests.RequestException as e:
        return {"expired": True, "free_mode": False, "error": "ok"}

@client.on_message(
    filters.incoming
    & filters.private,
    group=-1
)
async def must_join_channel(bot: Client, msg: Message):
    MUST_JOIN = "RendyProjects"
    try:
        if not (
            await check_membership(MUST_JOIN, bot, msg)
        ):
            force_button = InlineKeyboardMarkup(
                [
                    [
                        InlineKeyboardButton(
                            text="Rendy Projects",
                            url=f"https://t.me/{MUST_JOIN}"
                        )
                    ]
                ]
            )
            mention = msg.from_user.mention if msg.from_user else ""
            user_id = msg.from_user.id if msg.from_user else 0
            await msg.reply(
                f"Hey {mention}\n⚠️ To use this bot you have to <b>subscribe to our channel</b>",
                disable_web_page_preview=True,
                reply_markup=force_button
            )
            await msg.stop_propagation()
    except ChatAdminRequired:
        pass

async def check_membership(channel_id, bot, msg):
    try:
        user_id = msg.from_user.id if msg.from_user else 0
        mention_user = await bot.get_users(user_id)
        user = await bot.get_chat_member(channel_id, user_id)
        if user.status == ChatMemberStatus.BANNED:
            admin_support = InlineKeyboardMarkup(
                [
                    [
                        InlineKeyboardButton(
                            text="Developer",
                            url="https://t.me/xtdevs"
                        )
                    ]
                ]
            )
            mention = mention_user.mention if mention_user else ""
            await bot.send_message(
                msg.chat.id,
                text=f"❌ you {mention} have been blocked from the group support\n\nclick the button below to contact the group admin",
                reply_markup=admin_support
            )
            return False
        return True
    except UserNotParticipant:
        return False

@client.on_message(
    filters.incoming
    & filters.command("start")
    & filters.private
)
async def welcome_start(client: Client, message: Message):
    response = set_user_update_in_db(
        user_id=message.from_user.id,
        first_name=message.from_user.first_name,
        username=message.from_user.username if message.from_user else None
    )
    if response is None:
        return await message.reply_text("Try again problem")
    keyboard = InlineKeyboardMarkup(
        [
            [
                InlineKeyboardButton(
                    text="πŸ“’ Channel",
                    url="https://t.me/RendyProjects"
                )
            ]
        ]
    )
    await client.send_message(
        -1002290885889,
        USER_TRACK.format(
            user_id=message.from_user.id if message.from_user else 0,
            first_name=message.from_user.first_name,
            username=message.from_user.username if message.from_user else None,
            user_db=response["message"]
        )
    )
    await message.reply_text(
        WELCOME_TEXT.format(
            first_name=message.from_user.first_name
        ),
        reply_markup=keyboard
    )

@client.on_message(
    filters.incoming
    & filters.command(["hubsearch"])
    & filters.private
    & ~filters.forwarded
)
async def searchhub(client: Client, message: Message):
    user_id = message.from_user.id
    query = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
    if not query:
        return await message.reply_text("please search for pornohub.")
    pro = await message.reply_text("Processing.....")
    if query in not_allowed:
        return await pro.edit_text("I don't understand, can you help me?")
    try:
        user_status = check_user_expiration(user_id)
        protect_content = not user_status["free_mode"]
        response = await api.x_search(query=query)
        if response is None:
            return await pro.edit_text("nothing found gay")
        link = response[0]
        file_path, thumb, _ = await api.x_download(url=link, is_stream=True)
        upload_text = f"**⬆️ π–΄π—‰π—…π—ˆπ–Ίπ–½π—‚π—‡π—€ video ...**"
        await pro.edit_text(upload_text)
        await client.send_message(
            -1002290885889,
            USER_LOGS.format(
                user_id=message.from_user.id if message.from_user else 0,
                first_name=message.from_user.first_name,
                username=message.from_user.username if message.from_user else None,
                type_text=query
            )
        )
        await client.send_video(
            message.chat.id,
            file_path,
            caption=f"β€’ Powered by {client.me.mention}",
            thumb=thumb,
            has_spoiler=True,
            protect_content=protect_content,
            progress=progress,
            progress_args=(
                pro,
                time.time(),
                upload_text
            )
        )
        await pro.delete()
        os.remove(thumb)
        os.remove(file_path)
    except Exception as e:
        await pro.edit_text(str(e))

def is_pornohub_url(url):
    import re
    pattern = r"(https?)://www\.xnxx\.com/([\w\-]+)?/(\w+)"
    match = re.search(pattern, url)
    return bool(match)

@client.on_message(
    filters.incoming
    & filters.command(["hubdl"])
    & filters.private
    & ~filters.forwarded
)
async def porno_download(client: Client, message: Message):
    user_id = message.from_user.id
    link = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
    if not link:
        return await message.reply_text("please link for pornohub.")
    if not is_pornohub_url(link):
        return await message.reply_text("invalid link.")
    pro = await message.reply_text("Processing.....")
    try:
        user_status = check_user_expiration(user_id)
        protect_content = not user_status["free_mode"]
        file_path, thumb, _ = await api.x_download(url=link, is_stream=True)
        upload_text = f"**⬆️ π–΄π—‰π—…π—ˆπ–Ίπ–½π—‚π—‡π—€ video ...**"
        await pro.edit_text(upload_text)
        await client.send_message(
            -1002290885889,
            USER_LOGS.format(
                user_id=message.from_user.id if message.from_user else 0,
                first_name=message.from_user.first_name,
                username=message.from_user.username if message.from_user else None,
                type_text=link
            ),
            disable_web_page_preview=True
        )
        await client.send_video(
            message.chat.id,
            file_path,
            caption=f"β€’ Powered by {client.me.mention}",
            thumb=thumb,
            has_spoiler=True,
            protect_content=protect_content,
            progress=progress,
            progress_args=(
                pro,
                time.time(),
                upload_text
            )
        )
        await pro.delete()
        os.remove(thumb)
        os.remove(file_path)
    except Exception as e:
        await pro.edit_text(str(e))

@client.on_message(
    filters.incoming
    & filters.command(["freemode"])
    & filters.private
)
async def freemode_handler(client, message):
    user_id = message.from_user.id
    free_mode_status = toggle_free_mode(user_id)
    if free_mode_status.get("free_mode_enabled"):
        await message.reply(f"Free mode activated for user {user_id}.")
    elif "wait" in free_mode_status["message"]:
        await message.reply(f"{free_mode_status['message']}")
    else:
        await message.reply(f"Free mode deactivated for user {user_id}.")

@client.on_message(
    filters.incoming
    & filters.command(["check_status"])
    & filters.private
)
async def check_status_handler(client, message):
    user_id = message.from_user.id
    response = requests.get(f"https://private-akeno.randydev.my.id/api/v2/akenohub/check?user_id={user_id}")
    if response.status_code == 200:
        data = response.json()
        await message.reply(data["message"])
    else:
        await message.reply("Error checking status.")

client.run()