randydev commited on
Commit
21bc372
·
0 Parent(s):

fix revert back and update

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +37 -0
  2. Data.py +56 -0
  3. Dockerfile +60 -0
  4. README.md +11 -0
  5. akn/Akeno/__init__.py +11 -0
  6. akn/Akeno/admin.py +392 -0
  7. akn/Akeno/alive.py +128 -0
  8. akn/Akeno/bot/Nothing +0 -0
  9. akn/Akeno/bot/__init__.py +0 -0
  10. akn/Akeno/bot/bot.py +203 -0
  11. akn/Akeno/bot/inline.py +427 -0
  12. akn/Akeno/chatgpt +222 -0
  13. akn/Akeno/clone.py +129 -0
  14. akn/Akeno/emojipremium.py +131 -0
  15. akn/Akeno/eval.py +136 -0
  16. akn/Akeno/facebook.py +50 -0
  17. akn/Akeno/fluxai.py +85 -0
  18. akn/Akeno/gban +152 -0
  19. akn/Akeno/help.py +107 -0
  20. akn/Akeno/helper/PyroHelpers.py +65 -0
  21. akn/Akeno/helper/__init__.py +0 -0
  22. akn/Akeno/helper/data.py +11 -0
  23. akn/Akeno/helper/inline.py +94 -0
  24. akn/Akeno/helper/utility.py +81 -0
  25. akn/Akeno/id.py +110 -0
  26. akn/Akeno/info.py +85 -0
  27. akn/Akeno/invite.py +90 -0
  28. akn/Akeno/joinchat.py +109 -0
  29. akn/Akeno/limited.py +34 -0
  30. akn/Akeno/ping.py +274 -0
  31. akn/Akeno/pornohub +118 -0
  32. akn/Akeno/prefixes.py +56 -0
  33. akn/Akeno/purge.py +109 -0
  34. akn/Akeno/quote.py +116 -0
  35. akn/Akeno/sticker.py +285 -0
  36. akn/Akeno/story.py +108 -0
  37. akn/Akeno/translate.py +44 -0
  38. akn/Akeno/youtube.py +282 -0
  39. akn/AllDownloaderBot/__init__.py +0 -0
  40. akn/AllDownloaderBot/allonedl.py +87 -0
  41. akn/AllDownloaderBot/blacklistchat.py +262 -0
  42. akn/AllDownloaderBot/broadcast.py +110 -0
  43. akn/AllDownloaderBot/main.py +1262 -0
  44. akn/AllDownloaderBot/support_sites.py +21 -0
  45. akn/ApproveBot/__init__.py +0 -0
  46. akn/ApproveBot/join_request.py +428 -0
  47. akn/ApproveBot/start.py +89 -0
  48. akn/Gemini/__init__.py +0 -0
  49. akn/Gemini/gemini.py +335 -0
  50. akn/MagicFonts/__init__.py +0 -0
.gitattributes ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.ttf filter=lfs diff=lfs merge=lfs -text
37
+ *.pdf filter=lfs diff=lfs merge=lfs -text
Data.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pyrogram.types import InlineKeyboardButton
2
+
3
+ class Data:
4
+ START = """
5
+ 👋 **Hello {}!**
6
+
7
+ **Welcome {}!**
8
+
9
+ We’re glad to have you here. This bot is designed to help you generate a **String Session** easily and securely.
10
+
11
+ 🚨 **Important Notes**:
12
+ If you don’t trust this bot:
13
+ 1. **Don’t read this message**.
14
+ 2. **Block the bot** or **delete the chat**.
15
+
16
+ 🤖 **How This Bot Works**:
17
+ - This bot helps you generate a **String Session** for your Telegram account.
18
+ - **Recommendation**: Use a secondary account to generate the String Session. This avoids delays and keeps your main account secure.
19
+ """
20
+
21
+ home_buttons = [
22
+ [InlineKeyboardButton("🔥 sᴛᴀʀᴛ ɢᴇɴᴇʀᴀᴛɪɴɢ sᴇssɪᴏɴ 🔥", callback_data="generate")],
23
+ [InlineKeyboardButton(text="ᴋᴇᴍʙᴀʟɪ", callback_data="home")],
24
+ ]
25
+
26
+ generate_button = [
27
+ [InlineKeyboardButton("🔥 sᴛᴀʀᴛ ɢᴇɴᴇʀᴀᴛɪɴɢ sᴇssɪᴏɴ 🔥", callback_data="generate")]
28
+ ]
29
+
30
+ buttons = [
31
+ [InlineKeyboardButton("🔥 sᴛᴀʀᴛ ɢᴇɴᴇʀᴀᴛɪɴɢ sᴇssɪᴏɴ 🔥", callback_data="generate")],
32
+ [
33
+ InlineKeyboardButton("ᴀʙᴏᴜᴛ", callback_data="about")
34
+ ]
35
+ ]
36
+
37
+ HELP = """
38
+ **Available Commands**
39
+
40
+ /about - About this Bot
41
+ /help - This Message
42
+ /start - Start bot
43
+ /generate - Start Generating Session
44
+ """
45
+
46
+ ABOUT = """
47
+ **About This Bot**
48
+
49
+ A telegram bot to retrieve pyrograms and telethon string session by @VegetaSessionBot
50
+
51
+ Framework : [Pyrogram](docs.pyrogram.org)
52
+
53
+ Language : [Python](www.python.org)
54
+
55
+ Developer : @xpushz
56
+ """
Dockerfile ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11.11
2
+
3
+ RUN apt -qq update && \
4
+ apt -qq install -y --no-install-recommends \
5
+ ffmpeg \
6
+ curl \
7
+ git \
8
+ gnupg2 \
9
+ unzip \
10
+ wget \
11
+ xvfb \
12
+ libxi6 \
13
+ libgconf-2-4 \
14
+ libappindicator3-1 \
15
+ libxrender1 \
16
+ libxtst6 \
17
+ libnss3 \
18
+ libatk1.0-0 \
19
+ libxss1 \
20
+ fonts-liberation \
21
+ libasound2 \
22
+ libgbm-dev \
23
+ libu2f-udev \
24
+ libvulkan1 \
25
+ libgl1-mesa-dri \
26
+ xdg-utils \
27
+ python3-dev \
28
+ python3-pip \
29
+ libavformat-dev \
30
+ libavcodec-dev \
31
+ libavdevice-dev \
32
+ libavfilter-dev \
33
+ libavutil-dev \
34
+ libswscale-dev \
35
+ libswresample-dev \
36
+ neofetch && \
37
+ apt-get clean && \
38
+ rm -rf /var/lib/apt/lists/
39
+
40
+ WORKDIR /app
41
+
42
+ COPY requirements.txt .
43
+ COPY . .
44
+
45
+ RUN mkdir -p /app/.cache/akn && \
46
+ chmod -R 777 /app/.cache
47
+
48
+ RUN chown -R 1000:0 .
49
+ RUN pip3 install --upgrade pip setuptools
50
+ RUN pip3 install -r requirements.txt
51
+
52
+ RUN wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz && \
53
+ wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz.md5 && \
54
+ md5sum -c ffmpeg-git-amd64-static.tar.xz.md5 && \
55
+ tar xvf ffmpeg-git-amd64-static.tar.xz && \
56
+ mv ffmpeg-git*/ffmpeg ffmpeg-git*/ffprobe /usr/local/bin/
57
+
58
+ EXPOSE 7860
59
+
60
+ CMD ["bash", "-c", "python3 server.py & python3 -m akn"]
README.md ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Akn
3
+ emoji: 🏆
4
+ colorFrom: pink
5
+ colorTo: purple
6
+ sdk: docker
7
+ pinned: false
8
+ license: mit
9
+ ---
10
+
11
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
akn/Akeno/__init__.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pyrogram.types import Message
2
+
3
+ api_key_openai = "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"
4
+
5
+ def ReplyCheck(message: Message):
6
+ reply_id = None
7
+ if message.reply_to_message:
8
+ reply_id = message.reply_to_message.id
9
+ elif not message.from_user.is_self:
10
+ reply_id = message.id
11
+ return reply_id
akn/Akeno/admin.py ADDED
@@ -0,0 +1,392 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020-2023 TeamKillerX <https://github.com/TeamKillerX>
2
+ #
3
+ # This file is part of TeamKillerX project,
4
+ # and licensed under GNU Affero General Public License v3.
5
+ # See the GNU Affero General Public License for more details.
6
+ #
7
+ # All rights reserved. See COPYING, AUTHORS.
8
+ #
9
+
10
+ import asyncio
11
+ import time
12
+ from time import time as waktu
13
+
14
+ from pyrogram import Client
15
+ from pyrogram import Client as ren
16
+ from pyrogram import *
17
+ from pyrogram import filters
18
+ from pyrogram.errors import *
19
+ from pyrogram.types import *
20
+
21
+ from akn.utils.handler import *
22
+ from akn.Akeno.help import add_command_help
23
+ from akn.utils.logger import LOGS
24
+ from akn.utils.prefixprem import command
25
+ from config import *
26
+
27
+ admins_in_chat = {}
28
+
29
+ unmute_permissions = ChatPermissions(
30
+ can_send_messages=True,
31
+ can_send_media_messages=True,
32
+ can_send_polls=True,
33
+ can_change_info=False,
34
+ can_invite_users=True,
35
+ can_pin_messages=False,
36
+ )
37
+
38
+
39
+ async def extract_userid(message, text: str):
40
+ def is_int(text: str):
41
+ try:
42
+ int(text)
43
+ except ValueError:
44
+ return False
45
+ return True
46
+
47
+ text = text.strip()
48
+
49
+ if is_int(text):
50
+ return int(text)
51
+
52
+ entities = message.entities
53
+ app = message._client
54
+ if len(entities) < 2:
55
+ return (await app.get_users(text)).id
56
+ entity = entities[1]
57
+ if entity.type == "mention":
58
+ return (await app.get_users(text)).id
59
+ if entity.type == "text_mention":
60
+ return entity.user.id
61
+ return None
62
+
63
+
64
+ async def extract_user_and_reason(message, sender_chat=False):
65
+ args = message.text.strip().split()
66
+ text = message.text
67
+ user = None
68
+ reason = None
69
+ if message.reply_to_message:
70
+ reply = message.reply_to_message
71
+ if not reply.from_user:
72
+ if (
73
+ reply.sender_chat
74
+ and reply.sender_chat != message.chat.id
75
+ and sender_chat
76
+ ):
77
+ id_ = reply.sender_chat.id
78
+ else:
79
+ return None, None
80
+ else:
81
+ id_ = reply.from_user.id
82
+
83
+ if len(args) < 2:
84
+ reason = None
85
+ else:
86
+ reason = text.split(None, 1)[1]
87
+ return id_, reason
88
+
89
+ if len(args) == 2:
90
+ user = text.split(None, 1)[1]
91
+ return await extract_userid(message, user), None
92
+
93
+ if len(args) > 2:
94
+ user, reason = text.split(None, 2)[1:]
95
+ return await extract_userid(message, user), reason
96
+
97
+ return user, reason
98
+
99
+
100
+ async def extract_user(message):
101
+ return (await extract_user_and_reason(message))[0]
102
+
103
+
104
+ async def list_admins(client: Client, chat_id: int):
105
+ global admins_in_chat
106
+ if chat_id in admins_in_chat:
107
+ interval = time() - admins_in_chat[chat_id]["last_updated_at"]
108
+ if interval < 3600:
109
+ return admins_in_chat[chat_id]["data"]
110
+
111
+ admins_in_chat[chat_id] = {
112
+ "last_updated_at": waktu(),
113
+ "data": [
114
+ member.user.id
115
+ async for member in client.get_chat_members(
116
+ chat_id, filter=enums.ChatMembersFilter.ADMINISTRATORS
117
+ )
118
+ ],
119
+ }
120
+ return admins_in_chat[chat_id]["data"]
121
+
122
+
123
+ @Akeno(
124
+ ~filters.scheduled & command(["ban", "dban", "hban"]) & filters.me & ~filters.forwarded
125
+ )
126
+ async def member_ban_user(client: Client, message: Message):
127
+ user_id, reason = await extract_user_and_reason(message, sender_chat=True)
128
+ rd = await message.edit_text("`Processing...`")
129
+ bot = (await client.get_chat_member(message.chat.id, client.me.id)).privileges
130
+ if not bot.can_restrict_members:
131
+ return await rd.edit_text("I don't have enough permissions")
132
+ if not user_id:
133
+ return await rd.edit_text("I can't find that user.")
134
+ if user_id == client.me.id:
135
+ return await rd.edit_text("I can't ban myself.")
136
+ if user_id == 1191668125:
137
+ return await rd.edit_text("I can't ban my developer!")
138
+ if user_id in (await list_admins(client, message.chat.id)):
139
+ return await rd.edit_text("I can't ban an admin, You know the rules, so do i.")
140
+ try:
141
+ mention = (await client.get_users(user_id)).mention
142
+ except IndexError:
143
+ mention = (
144
+ message.reply_to_message.sender_chat.title
145
+ if message.reply_to_message
146
+ else "Anon"
147
+ )
148
+ msg = (
149
+ f"**Banned User:** {mention}\n"
150
+ f"**Banned By:** {message.from_user.mention if message.from_user else 'Anon'}\n"
151
+ )
152
+ if message.command[0][0] == "d":
153
+ await message.reply_to_message.delete()
154
+ elif message.command[0][0] == "h":
155
+ await client.delete_user_history(message.chat.id, user_id)
156
+ if reason:
157
+ msg += f"**Reason:** {reason}"
158
+ await message.chat.ban_member(user_id)
159
+ await rd.edit_text(msg)
160
+
161
+
162
+ @Akeno(
163
+ ~filters.scheduled & command(["unban"]) & filters.me & ~filters.forwarded
164
+ )
165
+ async def member_unban_user(client: Client, message: Message):
166
+ reply = message.reply_to_message
167
+ rd = await message.edit_text("`Processing...`")
168
+ bot = (await client.get_chat_member(message.chat.id, client.me.id)).privileges
169
+ if not bot.can_restrict_members:
170
+ return await rd.edit_text("I don't have enough permissions")
171
+ if reply and reply.sender_chat and reply.sender_chat != message.chat.id:
172
+ return await rd.edit_text("You cannot unban a channel")
173
+
174
+ if len(message.command) == 2:
175
+ user = message.text.split(None, 1)[1]
176
+ elif len(message.command) == 1 and reply:
177
+ user = message.reply_to_message.from_user.id
178
+ else:
179
+ return await rd.edit_text(
180
+ "Provide a username or reply to a user's message to unban."
181
+ )
182
+ await message.chat.unban_member(user)
183
+ umention = (await client.get_users(user)).mention
184
+ await rd.edit_text(f"Unbanned! {umention}")
185
+
186
+
187
+ @Akeno(
188
+ ~filters.scheduled & command(["pin", "unpin"]) & filters.me & ~filters.forwarded
189
+ )
190
+ async def pin_message(client: Client, message: Message):
191
+ if not message.reply_to_message:
192
+ return await message.edit_text("Reply to a message to pin/unpin it.")
193
+ rd = await message.edit_text("`Processing...`")
194
+ bot = (await client.get_chat_member(message.chat.id, client.me.id)).privileges
195
+ if not bot.can_pin_messages:
196
+ return await rd.edit_text("I don't have enough permissions")
197
+ r = message.reply_to_message
198
+ if message.command[0][0] == "u":
199
+ await r.unpin()
200
+ return await rd.edit_text(
201
+ f"**Unpinned [this]({r.link}) message.**",
202
+ disable_web_page_preview=True,
203
+ )
204
+ await r.pin(disable_notification=True)
205
+ await rd.edit_text(
206
+ f"**Pinned [this]({r.link}) message.**",
207
+ disable_web_page_preview=True,
208
+ )
209
+
210
+ @Akeno(
211
+ ~filters.scheduled & command(["mute", "dmute", "hmute"]) & filters.me & ~filters.forwarded
212
+ )
213
+ async def mute_user(client: Client, message: Message):
214
+ user_id, reason = await extract_user_and_reason(message)
215
+ rd = await message.edit_text("`Processing...`")
216
+ bot = (await client.get_chat_member(message.chat.id, client.me.id)).privileges
217
+ if not bot.can_restrict_members:
218
+ return await rd.edit_text("I don't have enough permissions")
219
+ if not user_id:
220
+ return await rd.edit_text("I can't find that user.")
221
+ if user_id == client.me.id:
222
+ return await rd.edit_text("I can't mute myself.")
223
+ if user_id == 1191668125:
224
+ return await rd.edit("I can't mute my developer!")
225
+ if user_id in (await list_admins(client, message.chat.id)):
226
+ return await rd.edit_text("I can't mute an admin, You know the rules, so do i.")
227
+ mention = (await client.get_users(user_id)).mention
228
+ msg = (
229
+ f"**Muted User:** {mention}\n"
230
+ f"**Muted By:** {message.from_user.mention if message.from_user else 'Anon'}\n"
231
+ )
232
+ if message.command[0][0] == "d":
233
+ await message.reply_to_message.delete()
234
+ elif message.command[0][0] == "h":
235
+ await client.delete_user_history(message.chat.id, user_id)
236
+ if reason:
237
+ msg += f"**Reason:** {reason}"
238
+ await message.chat.restrict_member(user_id, permissions=ChatPermissions())
239
+ await rd.edit_text(msg)
240
+
241
+ @Akeno(
242
+ ~filters.scheduled & command(["unmute"]) & filters.me & ~filters.forwarded
243
+ )
244
+ async def unmute_user(client: Client, message: Message):
245
+ user_id = await extract_user(message)
246
+ rd = await message.edit_text("`Processing...`")
247
+ bot = (await client.get_chat_member(message.chat.id, client.me.id)).privileges
248
+ if not bot.can_restrict_members:
249
+ return await rd.edit_text("I don't have enough permissions")
250
+ if not user_id:
251
+ return await rd.edit_text("I can't find that user.")
252
+ await message.chat.restrict_member(user_id, permissions=unmute_permissions)
253
+ umention = (await client.get_users(user_id)).mention
254
+ await rd.edit_text(f"Unmuted! {umention}")
255
+
256
+ @Akeno(
257
+ ~filters.scheduled & command(["kick", "dkick", "hkick"]) & filters.me & ~filters.forwarded
258
+ )
259
+ async def kick_user(client: Client, message: Message):
260
+ user_id, reason = await extract_user_and_reason(message)
261
+ rd = await message.edit_text("`Processing...`")
262
+ bot = (await client.get_chat_member(message.chat.id, client.me.id)).privileges
263
+ if not bot.can_restrict_members:
264
+ return await rd.edit_text("I don't have enough permissions")
265
+ if not user_id:
266
+ return await rd.edit_text("I can't find that user.")
267
+ if user_id == client.me.id:
268
+ return await rd.edit_text("I can't kick myself.")
269
+ if user_id == 1191668125:
270
+ return await rd.edit_text("I can't kick my developer.")
271
+ if user_id in (await list_admins(client, message.chat.id)):
272
+ return await rd.edit_text("I can't kick an admin, You know the rules, so do i.")
273
+ mention = (await client.get_users(user_id)).mention
274
+ msg = f"""
275
+ **Kicked User:** {mention}
276
+ **Kicked By:** {message.from_user.mention if message.from_user else 'Anon'}"""
277
+ if message.command[0][0] == "d":
278
+ await message.reply_to_message.delete()
279
+ elif message.command[0][0] == "h":
280
+ await client.delete_user_history(message.chat.id, user_id)
281
+ if reason:
282
+ msg += f"\n**Reason:** `{reason}`"
283
+ try:
284
+ await message.chat.ban_member(user_id)
285
+ await rd.edit_text(msg)
286
+ await asyncio.sleep(1)
287
+ await message.chat.unban_member(user_id)
288
+ except ChatAdminRequired:
289
+ return await rd.edit_text("**Maaf Anda Bukan admin**")
290
+
291
+ @Akeno(
292
+ ~filters.scheduled & command(["promote", "fullpromote"]) & filters.me & ~filters.forwarded
293
+ )
294
+ async def promotte_user(client: Client, message: Message):
295
+ user_id = await extract_user(message)
296
+ umention = (await client.get_users(user_id)).mention
297
+ rd = await message.edit_text("`Processing...`")
298
+ if not user_id:
299
+ return await rd.edit_text("I can't find that user.")
300
+ bot = (await client.get_chat_member(message.chat.id, client.me.id)).privileges
301
+ if not bot.can_promote_members:
302
+ return await rd.edit_text("I don't have enough permissions")
303
+ if message.command[0][0] == "f":
304
+ await message.chat.promote_member(
305
+ user_id,
306
+ privileges=ChatPrivileges(
307
+ can_manage_chat=True,
308
+ can_delete_messages=True,
309
+ can_manage_video_chats=True,
310
+ can_restrict_members=True,
311
+ can_change_info=True,
312
+ can_invite_users=True,
313
+ can_pin_messages=True,
314
+ can_promote_members=True,
315
+ ),
316
+ )
317
+ return await rd.edit_text(f"Fully Promoted! {umention}")
318
+
319
+ await message.chat.promote_member(
320
+ user_id,
321
+ privileges=ChatPrivileges(
322
+ can_manage_chat=True,
323
+ can_delete_messages=True,
324
+ can_manage_video_chats=True,
325
+ can_restrict_members=True,
326
+ can_change_info=True,
327
+ can_invite_users=True,
328
+ can_pin_messages=True,
329
+ can_promote_members=False,
330
+ ),
331
+ )
332
+ await rd.edit_text(f"Promoted! {umention}")
333
+
334
+ @Akeno(
335
+ ~filters.scheduled & command(["demote"]) & filters.me & ~filters.forwarded
336
+ )
337
+ async def demote_user(client: Client, message: Message):
338
+ user_id = await extract_user(message)
339
+ rd = await message.edit_text("`Processing...`")
340
+ if not user_id:
341
+ return await rd.edit_text("I can't find that user.")
342
+ if user_id == client.me.id:
343
+ return await rd.edit_text("I can't demote myself.")
344
+ await message.chat.promote_member(
345
+ user_id,
346
+ privileges=ChatPrivileges(
347
+ can_manage_chat=False,
348
+ can_delete_messages=False,
349
+ can_manage_video_chats=False,
350
+ can_restrict_members=False,
351
+ can_change_info=False,
352
+ can_invite_users=False,
353
+ can_pin_messages=False,
354
+ can_promote_members=False,
355
+ ),
356
+ )
357
+ umention = (await client.get_users(user_id)).mention
358
+ await rd.edit_text(f"Demoted! {umention}")
359
+
360
+ add_command_help(
361
+ "admin",
362
+ [
363
+ ["ban [reply/username/userid]", "Ban someone."],
364
+ ["dban [reply]", "dban a user deleting the replied to message."],
365
+ ["unban [reply/username/userid]", "Unban someone."],
366
+ ["kick [reply/username/userid]", "kick out someone from your group."],
367
+ ["dkick [reply]", "dkick a user deleting the replied to message."],
368
+ ["promote `or` .fullpromote", "Promote someonen."],
369
+ ["demote", "Demote someone."],
370
+ ["mute [reply/username/userid]", "Mute someone."],
371
+ ["dmute [reply]", "dmute a user deleting the replied to message."],
372
+ ["unmute [reply/username/userid]", "Unmute someone."],
373
+ ["pin [reply]", "to pin any message."],
374
+ ["unpin [reply]", "To unpin any message."],
375
+ ["setgpic [reply ke image]", "To set an group profile pic."],
376
+ ],
377
+ )
378
+ module = modules_help.add_module("admin", __file__)
379
+ module.add_command("ban", "Ban someone.")
380
+ module.add_command("dban", "dban a user deleting the replied to message")
381
+ module.add_command("hban", "hban a user deleting all the replied to message")
382
+ module.add_command("kick", "kick out someone from your group")
383
+ module.add_command("dkick", "dkick a user deleting the replied to message")
384
+ module.add_command("hkick", "hkick a user deleting all the replied to message")
385
+ module.add_command("promote", "Promote someonen")
386
+ module.add_command("demote", "Demote someone")
387
+ module.add_command("mute", "Mute someone")
388
+ module.add_command("dmute", "dmute a user deleting the replied to message")
389
+ module.add_command("hmute", "dmute a user deleting all the replied to message")
390
+ module.add_command("pin", "to pin any message.")
391
+ module.add_command("unpin", "To unpin any message")
392
+ module.add_command("setgpic", "To set an group profile pic.")
akn/Akeno/alive.py ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import random
3
+ import re
4
+ import asyncio
5
+ from random import choice
6
+ from pyrogram import Client, filters
7
+ from pyrogram.types import *
8
+ from akn.utils.handler import *
9
+ from akn import app
10
+ from akn.utils.prefixprem import command
11
+ from config import *
12
+ from RyuzakiLib import __version__ as ryu_version
13
+ from platform import python_version
14
+ from pyrogram.raw import functions
15
+
16
+
17
+ akeno_premium_text = """
18
+ **Status Ubot**
19
+ **User Free**: [Ultra Premium]
20
+ {custom_emoji}**dc_id:** `{dc_id}`
21
+ {custom_emoji}**python_version:** `{python}`
22
+ {custom_emoji}**ryuzakilib_version:** `{ryu}`
23
+ {custom_emoji}**app_name:** `{app_name}`
24
+ {custom_emoji}**app_version:** `{app_version}`
25
+ {custom_emoji}**system_version:** `{system_version}`
26
+ {custom_emoji}**is_premium:** `{is_premium}`
27
+ {custom_emoji}**unlimited_by:** [aknuserbot]({aknuserbot})
28
+ """
29
+
30
+ ryuzaki_text = """
31
+ **Status Ubot**
32
+ **User Free**: [PRO]
33
+ **dc_id:** `{dc_id}`
34
+ **python_version:** `{python}`
35
+ **ryuzakilib_version:** `{ryu}`
36
+ **app_name:** `{app_name}`
37
+ **app_version:** `{app_version}`
38
+ **system_version:** `{system_version}`
39
+ **is_premium:** null
40
+ **unlimited_by:** [aknuserbot]({aknuserbot})
41
+ """
42
+
43
+ CUSTOM_EMOJI_ALL = [
44
+ 5469770984670108755,
45
+ 5301067044400146520,
46
+ 5300950543412241242,
47
+ 5300928913956938544,
48
+ 5301155675345265040,
49
+ 5300957668762987048,
50
+ 5366318141771096216,
51
+ 6039606071314615141,
52
+ 5971808079811972376,
53
+ 5764623873974734153,
54
+ 6048474766463996499,
55
+ 5974226571601382719,
56
+ 6041914500272098262,
57
+ 5974083454701145202,
58
+ 5328317370647715629
59
+ ]
60
+
61
+ async def authorization(client: Client):
62
+ model = await client.invoke(
63
+ functions.account.GetAuthorizations()
64
+ )
65
+ app_name = model.authorizations[0].app_name
66
+ app_version = model.authorizations[0].app_version
67
+ system_version = model.authorizations[0].system_version
68
+ return app_name, app_version, system_version
69
+
70
+ @Akeno(
71
+ ~filters.scheduled
72
+ & command(["alivepro"])
73
+ & filters.me
74
+ & ~filters.forwarded
75
+ )
76
+ async def akenopro(client: Client, message: Message):
77
+ bot_username = app.me.username
78
+ try:
79
+ oh = await client.get_inline_bot_results(bot=bot_username, query="test")
80
+ await asyncio.gather(
81
+ client.send_inline_bot_result(
82
+ message.chat.id,
83
+ oh.query_id,
84
+ oh.results[0].id,
85
+ reply_to_message_id=message.id
86
+ )
87
+ )
88
+ except Exception as e:
89
+ await message.reply_text(f"Error : {e}")
90
+
91
+ @Akeno(
92
+ ~filters.scheduled
93
+ & command(["alive"])
94
+ & filters.me
95
+ & ~filters.forwarded
96
+ )
97
+ async def akenocmd(client: Client, message: Message):
98
+ app_name, app_version, system_version = await authorization(client)
99
+ custom_emoji_random = choice(CUSTOM_EMOJI_ALL)
100
+ custom_emoji = f"<emoji id={custom_emoji_random}>✅</emoji>"
101
+ if client.me.is_premium:
102
+ await message.reply_text(
103
+ akeno_premium_text.format(
104
+ dc_id=client.me.dc_id if client.me else 0,
105
+ custom_emoji=custom_emoji,
106
+ python=python_version(),
107
+ ryu=ryu_version,
108
+ app_name=app_name,
109
+ app_version=app_version,
110
+ system_version=system_version,
111
+ is_premium=client.me.is_premium,
112
+ aknuserbot="https://t.me/aknuserbot"
113
+ ),
114
+ disable_web_page_preview=True
115
+ )
116
+ else:
117
+ await message.reply_text(
118
+ ryuzaki_text.format(
119
+ dc_id=client.me.dc_id if client.me else 0,
120
+ python=python_version(),
121
+ ryu=ryu_version,
122
+ app_name=app_name,
123
+ app_version=app_version,
124
+ system_version=system_version,
125
+ aknuserbot="https://t.me/aknuserbot"
126
+ ),
127
+ disable_web_page_preview=True
128
+ )
akn/Akeno/bot/Nothing ADDED
File without changes
akn/Akeno/bot/__init__.py ADDED
File without changes
akn/Akeno/bot/bot.py ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import traceback
2
+ import time
3
+ import aiohttp
4
+ import platform
5
+ import asyncio
6
+ import os
7
+
8
+ from pyrogram import filters
9
+ from pyrogram.errors import MessageDeleteForbidden
10
+ from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup
11
+ from pyrogram.types import *
12
+ from pyrogram import Client
13
+
14
+ from pyrogram import *
15
+ from akn import CMD_HELP, app
16
+ from akn.Akeno.helper.data import Data
17
+ from akn.Akeno.helper.inline import paginate_help, cb_wrapper
18
+ from akn import ids as users
19
+ from config import *
20
+ import requests
21
+ from datetime import datetime as dt
22
+ from platform import python_version
23
+ from datetime import datetime as dt, timedelta
24
+ from pytz import timezone
25
+
26
+ from pyrogram import __version__ as pyro
27
+ from pyrogram.types import Message
28
+ from telethon import __version__ as tele
29
+ from psutil import cpu_percent, virtual_memory, disk_usage, boot_time
30
+ from pymongo import MongoClient
31
+
32
+ client_mongo = MongoClient(MONGO_URL)
33
+
34
+ db = client_mongo["tiktokbot"]
35
+ collection = db["users"]
36
+
37
+ def get_expired_date(user_id):
38
+ user = collection.find_one({"user_id": user_id})
39
+ if user:
40
+ return user.get("expire_date")
41
+ else:
42
+ return None
43
+
44
+ def get_ch_help(user_id):
45
+ token = collection.find_one({"user_id": user_id})
46
+ if token:
47
+ return token
48
+ else:
49
+ return None
50
+
51
+ def get_alive_logo(user_id):
52
+ token = collection.find_one({"user_id": user_id})
53
+ if token:
54
+ getvar = token.get("alive_logo")
55
+ return getvar
56
+ else:
57
+ return None
58
+
59
+ def get_asupan_database(user_id):
60
+ token = collection.find_one({"user_id": user_id})
61
+ if token:
62
+ get_supan = token.get("asupan") if token else None
63
+ return get_supan
64
+ else:
65
+ return None
66
+
67
+ def get_api_rmbg(user_id):
68
+ token = collection.find_one({"user_id": user_id})
69
+ if token:
70
+ get_rmbg = token.get("api_rmbg") if token else None
71
+ return get_rmbg
72
+ else:
73
+ return None
74
+
75
+ def get_install_peer(user_id):
76
+ user_install = collection.find_one({"user_id": user_id})
77
+ if user_install:
78
+ peer_users = user_install.get("peer_users_2")
79
+ peer_group = user_install.get("peer_group_2")
80
+ return peer_users, peer_group
81
+ else:
82
+ return None
83
+
84
+ @Client.on_callback_query()
85
+ async def _callbacks(_, callback_query: CallbackQuery):
86
+ query = callback_query.data.lower()
87
+ bot_me = await app.get_me()
88
+ if query == "helper":
89
+ buttons = paginate_help(0, CMD_HELP, "helpme")
90
+ await app.edit_inline_text(
91
+ callback_query.inline_message_id,
92
+ Data.text_help_menu,
93
+ disable_web_page_preview=True,
94
+ reply_markup=InlineKeyboardMarkup(buttons),
95
+ )
96
+ elif query == "close":
97
+ await app.edit_inline_text(callback_query.inline_message_id, "**— CLOSED**")
98
+ return
99
+ elif query == "close_help":
100
+ if callback_query.from_user.id not in users:
101
+ return
102
+ await app.edit_inline_text(
103
+ callback_query.inline_message_id,
104
+ "**— CLOSED MENU HELP**",
105
+ reply_markup=InlineKeyboardMarkup(Data.reopen),
106
+ )
107
+ return
108
+ elif query == "closed":
109
+ try:
110
+ await callback_query.message.delete()
111
+ except BaseException:
112
+ pass
113
+ try:
114
+ await callback_query.message.reply_to_message.delete()
115
+ except BaseException:
116
+ pass
117
+ elif query == "make_basic_button":
118
+ try:
119
+ bttn = paginate_help(0, CMD_HELP, "helpme")
120
+ await app.edit_inline_text(
121
+ callback_query.inline_message_id,
122
+ Data.text_help_menu,
123
+ disable_web_page_preview=True,
124
+ reply_markup=InlineKeyboardMarkup(bttn),
125
+ )
126
+ except Exception as e:
127
+ e = traceback.format_exc()
128
+ print(e, "Callbacks")
129
+
130
+ @app.on_callback_query(filters.regex("^pingCB"))
131
+ async def pingCallback(_, cb: CallbackQuery):
132
+ start_time = time.time()
133
+ async with aiohttp.ClientSession() as session:
134
+ async with session.get("https://api.telegram.org") as response:
135
+ if response.status != 200:
136
+ pass
137
+ end_time = time.time()
138
+ ping_time = round((end_time - start_time) * 1000, 3)
139
+ await cb.answer(f'Pong! {ping_time}ms')
140
+
141
+ @app.on_callback_query(filters.regex("ub_modul_(.*)"))
142
+ @cb_wrapper
143
+ async def on_plug_in_cb(_, callback_query: CallbackQuery):
144
+ modul_name = callback_query.matches[0].group(1)
145
+ user_id = callback_query.from_user.id
146
+ username = "©️ Copyright 2019-2024"
147
+ commands: dict = CMD_HELP[modul_name]
148
+ this_command = f"──「 **Help For {str(modul_name).upper()}** 」──\n\n"
149
+ for x in commands:
150
+ this_command += f" • **Command:** `.{str(x)}`\n • **Function:** `{str(commands[x])}`\n\n"
151
+ this_command += "{}".format(username)
152
+ bttn = [
153
+ [InlineKeyboardButton(text="Return", callback_data="reopen")],
154
+ ]
155
+ reply_pop_up_alert = (
156
+ this_command
157
+ if this_command is not None
158
+ else f"{module_name} No documentation has been written for the module."
159
+ )
160
+ await app.edit_inline_text(
161
+ callback_query.inline_message_id,
162
+ reply_pop_up_alert,
163
+ disable_web_page_preview=True,
164
+ reply_markup=InlineKeyboardMarkup(bttn),
165
+ )
166
+
167
+
168
+ @app.on_callback_query(filters.regex("reopen"))
169
+ @cb_wrapper
170
+ async def reopen_in_cb(_, callback_query: CallbackQuery):
171
+ buttons = paginate_help(0, CMD_HELP, "helpme")
172
+ await app.edit_inline_text(
173
+ callback_query.inline_message_id,
174
+ Data.text_help_menu,
175
+ disable_web_page_preview=True,
176
+ reply_markup=InlineKeyboardMarkup(buttons),
177
+ )
178
+
179
+
180
+ @app.on_callback_query(filters.regex("helpme_prev\((.+?)\)"))
181
+ @cb_wrapper
182
+ async def on_plug_prev_in_cb(_, callback_query: CallbackQuery):
183
+ current_page_number = int(callback_query.matches[0].group(1))
184
+ buttons = paginate_help(current_page_number - 1, CMD_HELP, "helpme")
185
+ await app.edit_inline_text(
186
+ callback_query.inline_message_id,
187
+ Data.text_help_menu,
188
+ disable_web_page_preview=True,
189
+ reply_markup=InlineKeyboardMarkup(buttons),
190
+ )
191
+
192
+
193
+ @app.on_callback_query(filters.regex("helpme_next\((.+?)\)"))
194
+ @cb_wrapper
195
+ async def on_plug_next_in_cb(_, callback_query: CallbackQuery):
196
+ current_page_number = int(callback_query.matches[0].group(1))
197
+ buttons = paginate_help(current_page_number + 1, CMD_HELP, "helpme")
198
+ await app.edit_inline_text(
199
+ callback_query.inline_message_id,
200
+ Data.text_help_menu,
201
+ disable_web_page_preview=True,
202
+ reply_markup=InlineKeyboardMarkup(buttons),
203
+ )
akn/Akeno/bot/inline.py ADDED
@@ -0,0 +1,427 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+ import requests
3
+ import json
4
+ import traceback
5
+ from sys import version as pyver
6
+ import os
7
+ import shlex
8
+ import textwrap
9
+ from typing import Tuple
10
+ import asyncio
11
+ from gc import get_objects
12
+ from datetime import datetime as dt
13
+
14
+ from pyrogram import *
15
+ from pyrogram.types import *
16
+ from pyrogram import Client, filters
17
+ from pyrogram import __version__ as pyrover
18
+ from pyrogram.enums import ParseMode
19
+ from pyrogram.types import (
20
+ InlineKeyboardButton,
21
+ InlineKeyboardMarkup,
22
+ InlineQueryResultArticle,
23
+ InputTextMessageContent,
24
+ Message,
25
+ )
26
+
27
+ from akn import CMD_HELP, StartTime, app, START_TIME
28
+ from akn.Akeno.helper.data import Data
29
+ from akn.Akeno.helper.inline import inline_wrapper, paginate_help
30
+ from akn.Akeno.bot import *
31
+ from pymongo import MongoClient
32
+ from config import MONGO_URL
33
+ from RyuzakiLib import __version__ as ryu
34
+
35
+ client_mongo = MongoClient(MONGO_URL)
36
+
37
+ db = client_mongo["tiktokbot"]
38
+ collection = db["users"]
39
+
40
+ def get_verify_id_card(user_id):
41
+ prem_filter = collection.find_one({"user_id": user_id})
42
+ if prem_filter:
43
+ return prem_filter.get("idcard")
44
+ else:
45
+ return None
46
+
47
+ def get_expired_date(user_id):
48
+ user = collection.find_one({"user_id": user_id})
49
+ if user:
50
+ return user.get("expire_date")
51
+ else:
52
+ return None
53
+
54
+ def get_via_inline_bot(user_id):
55
+ get_inline = collection.find_one({"user_id": user_id})
56
+ ping_dc = get_inline["ping_dc"] if get_inline else None
57
+ peer_users = get_inline["peer_users"] if get_inline else None
58
+ peer_group = get_inline["peer_group"] if get_inline else None
59
+ return ping_dc, peer_users, peer_group
60
+
61
+ def get_install_peer(user_id):
62
+ user_install = collection.find_one({"user_id": user_id})
63
+ if user_install:
64
+ peer_users = user_install.get("peer_users_2")
65
+ peer_group = user_install.get("peer_group_2")
66
+ peer_channel = user_install.get("peer_channel_2")
67
+ return peer_users, peer_group, peer_channel
68
+ else:
69
+ return None
70
+
71
+ def get_test_button(user_id):
72
+ token = collection.find_one({"user_id": user_id})
73
+ if token:
74
+ tiktok_text = token.get("tiktok_text")
75
+ tiktok_button = token.get("tiktok_button")
76
+ return tiktok_text, tiktok_button
77
+ else:
78
+ return None
79
+
80
+ async def get_readable_time(seconds: int) -> str:
81
+ count = 0
82
+ up_time = ""
83
+ time_list = []
84
+ time_suffix_list = ["s", "m", "Jam", "Hari"]
85
+
86
+ while count < 4:
87
+ count += 1
88
+ remainder, result = divmod(seconds, 60) if count < 3 else divmod(seconds, 24)
89
+ if seconds == 0 and remainder == 0:
90
+ break
91
+ time_list.append(int(result))
92
+ seconds = int(remainder)
93
+
94
+ for x in range(len(time_list)):
95
+ time_list[x] = str(time_list[x]) + time_suffix_list[x]
96
+ if len(time_list) == 4:
97
+ up_time += time_list.pop() + ", "
98
+
99
+ time_list.reverse()
100
+ up_time += ":".join(time_list)
101
+
102
+ return up_time
103
+
104
+ async def stats_function(message, answers):
105
+ user_id = message._client.me.id
106
+ users = 0
107
+ group = 0
108
+ async for dialog in message._client.get_dialogs():
109
+ if dialog.chat.type == enums.ChatType.PRIVATE:
110
+ users += 1
111
+ elif dialog.chat.type in (enums.ChatType.GROUP, enums.ChatType.SUPERGROUP):
112
+ group += 1
113
+ if message._client.me.id == 1191668125:
114
+ status = "[DEV]"
115
+ elif message._client.me.id == 901878554:
116
+ status = "[ADMIN]"
117
+ else:
118
+ status = "[FREE USER]"
119
+ start = dt.now()
120
+ await message._client.invoke(Ping(ping_id=0))
121
+ ping = (dt.now() - start).microseconds / 1000
122
+ uptime = await get_readable_time((time.time() - StartTime))
123
+ msg = f"""
124
+
125
+ <b>Tiktok Ubot</b>
126
+ <b>Status : {status}</b>
127
+ <b>expired_on:</b> <code>unlimited</code>
128
+ <b>full_name:</b> <code>{message._client.me.first_name}</code>
129
+ <b>premium:</b> <code>{message._client.me.is_premium}</code>
130
+ <b>dc_id:</b> <code>{message._client.me.dc_id}</code>
131
+ <b>ping_dc:</b> <code>{ping} ms</code>
132
+ <b>peer_users:</b> <code>{users} users</code>
133
+ <b>peer_group:</b> <code>{group} group</code>
134
+
135
+ """
136
+ answers.append(
137
+ InlineQueryResultArticle(
138
+ title="Alivei",
139
+ description="alive inline",
140
+ thumb_url="https://telegra.ph/file/b4cdd0843ac94d0309ba7.jpg",
141
+ input_message_content=InputTextMessageContent(
142
+ msg, parse_mode=ParseMode.HTML, disable_web_page_preview=True
143
+ ),
144
+ reply_markup=InlineKeyboardMarkup(
145
+ [[InlineKeyboardButton("Ping", callback_data="pingCB")]]
146
+ ),
147
+ )
148
+ )
149
+ return answers
150
+
151
+
152
+ async def alive_function(message: Message, answers):
153
+ uptime = await get_readable_time((time.time() - StartTime))
154
+ user_id = message._client.me.id
155
+ users = 0
156
+ group = 0
157
+ async for dialog in message._client.get_dialogs():
158
+ if dialog.chat.type == enums.ChatType.PRIVATE:
159
+ users += 1
160
+ elif dialog.chat.type in (enums.ChatType.GROUP, enums.ChatType.SUPERGROUP):
161
+ group += 1
162
+ if message._client.me.id == 1191668125:
163
+ status = "[DEV]"
164
+ elif message._client.me.id == 901878554:
165
+ status = "[ADMIN]"
166
+ else:
167
+ status = "[FREE USER]"
168
+ start = dt.now()
169
+ await message._client.invoke(Ping(ping_id=0))
170
+ ping = (dt.now() - start).microseconds / 1000
171
+ uptime = await get_readable_time((time.time() - StartTime))
172
+ msg = f"""
173
+
174
+ <b>Tiktok Ubot</b>
175
+ <b>Status : {status}</b>
176
+ <b>expired_on:</b> <code>unlimited</code>
177
+ <b>full_name:</b> <code>{message._client.me.first_name}</code>
178
+ <b>premium:</b> <code>{message._client.me.is_premium}</code>
179
+ <b>dc_id:</b> <code>{message._client.me.dc_id}</code>
180
+ <b>ping_dc:</b> <code>{ping} ms</code>
181
+ <b>peer_users:</b> <code>{users} users</code>
182
+ <b>peer_group:</b> <code>{group} group</code>
183
+ """
184
+
185
+ answers.append(
186
+ InlineQueryResultArticle(
187
+ title="Alive",
188
+ description="Check Bot's Stats",
189
+ thumb_url="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
190
+ input_message_content=InputTextMessageContent(
191
+ msg, parse_mode=ParseMode.HTML, disable_web_page_preview=True
192
+ ),
193
+ reply_markup=InlineKeyboardMarkup(
194
+ [[InlineKeyboardButton("Ping", callback_data="pingCB")]]
195
+ ),
196
+ )
197
+ )
198
+ return answers
199
+
200
+ async def ping_function(query, answers):
201
+ uptime = await get_readable_time((time.time() - StartTime))
202
+ msg = f"""
203
+ • <b>ᴜᴘᴛɪᴍᴇ:</b> <code>{str(dt.now() - START_TIME).split('.')[0]}</code>
204
+ """
205
+ answers.append(
206
+ InlineQueryResultArticle(
207
+ title="Ping",
208
+ description="ping test",
209
+ thumb_url="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
210
+ input_message_content=InputTextMessageContent(
211
+ msg, parse_mode=ParseMode.HTML, disable_web_page_preview=True
212
+ ),
213
+ reply_markup=InlineKeyboardMarkup(
214
+ [[InlineKeyboardButton("Ping", callback_data="pingCB")]]
215
+ ),
216
+ )
217
+ )
218
+ return answers
219
+
220
+
221
+ async def help_function(answers):
222
+ bttn = paginate_help(0, CMD_HELP, "helpme")
223
+ answers.append(
224
+ InlineQueryResultArticle(
225
+ title="Help Article!",
226
+ description="Check Command List & Help",
227
+ thumb_url="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
228
+ input_message_content=InputTextMessageContent(
229
+ Data.text_help_menu.format(len(CMD_HELP)), disable_web_page_preview=True
230
+ ),
231
+ reply_markup=InlineKeyboardMarkup(bttn),
232
+ )
233
+ )
234
+ return answers
235
+
236
+ @app.on_inline_query(filters.regex("bkp"))
237
+ async def inline_query_handler(client: Client, message: Message, query):
238
+ command_args = query.query.split()[1:]
239
+ if len(command_args) != 1:
240
+ return
241
+
242
+ link = command_args[0]
243
+ blacklist_url = "https://raw.githubusercontent.com/xtsea/pyKillerX/main/blacklist_channel.json"
244
+ response = requests.get(blacklist_url)
245
+ if response.status_code == 200:
246
+ blacklist_str = response.text.strip()
247
+ blacklist = json.loads(blacklist_str)
248
+ else:
249
+ print("Failed to fetch blacklist")
250
+ return
251
+
252
+ if any(link.startswith(prefix) for prefix in blacklist):
253
+ results = [
254
+ InlineQueryResultArticle(
255
+ title="Error",
256
+ input_message_content=InputTextMessageContent(
257
+ "Sorry, this command is not allowed in this channel/group."
258
+ ),
259
+ )
260
+ ]
261
+ else:
262
+ await client.copy_message(message.chat.id, from_chat_id=chat_id, message_id=message_id, caption=None)
263
+ results = []
264
+
265
+ await client.answer_inline_query(query.id, results=results, cache_time=0)
266
+
267
+
268
+
269
+ @app.on_callback_query(filters.regex("^closeuser_"))
270
+ async def closeuser(bot: Client, cb: CallbackQuery):
271
+ data = cb.data.split("_")
272
+ user_id = int(data[1])
273
+
274
+ if cb.from_user.id == user_id:
275
+ try:
276
+ await bot.delete_messages(cb.message.chat.id, message_ids=cb.inline_message_id)
277
+ except Exception as e:
278
+ print(str(e))
279
+ else:
280
+ await cb.answer("Not allowed user.", True)
281
+
282
+ @app.on_inline_query(filters.regex("test"))
283
+ @inline_wrapper
284
+ async def hello_world(client: Client, query: InlineQuery):
285
+ user_id = query.from_user.id
286
+ peer_users, peer_group, peer_channel = get_install_peer(user_id)
287
+ start = dt.now()
288
+ ping = (dt.now() - start).microseconds / 1000
289
+ tiktok_text, tiktok_button = get_test_button(user_id)
290
+ if tiktok_text and tiktok_button:
291
+ reply_markup = InlineKeyboardMarkup(
292
+ [
293
+ [
294
+ InlineKeyboardButton(
295
+ text=f"{tiktok_text}",
296
+ url=f"{tiktok_button}",
297
+ )
298
+ ]
299
+ ]
300
+ )
301
+ else:
302
+ reply_markup = InlineKeyboardMarkup(
303
+ [
304
+ [
305
+ InlineKeyboardButton(
306
+ text="OWNER",
307
+ user_id=user_id
308
+ )
309
+ ]
310
+ ]
311
+ )
312
+ user = get_verify_id_card(user_id)
313
+ if user:
314
+ expired_on = "Unlimited"
315
+ else:
316
+ expired_on = get_expired_date(user_id)
317
+ if expired_on is None:
318
+ expired_on = "Unlimited"
319
+ else:
320
+ expired_on = expired_on.strftime("%d-%m-%Y")
321
+ prem = await client.get_users(user_id)
322
+ if prem.is_premium:
323
+ msg = f"""
324
+ <b>Akeno Ubot</b>
325
+ <b>Status :</b> <i>Ultra Diamond</i>
326
+ <b>premium:</b> <code>{prem.is_premium}</code>
327
+ <b>expired_on:</b> <code>{expired_on}</code>
328
+ <b>dc_id:</b> <code>{prem.dc_id}</code>
329
+ <b>ping_dc:</b> <code>{ping}</code>
330
+ <b>peer_users:</b> <code>{peer_users}</code>
331
+ <b>peer_group:</b> <code>{peer_group}</code>
332
+ <b>peer_channel:</b> <code>{peer_channel}</code>
333
+ <b>akeno_uptime:</b> <code>{str(dt.now() - dt.now()).split('.')[0]}</code>
334
+ <b>ryuzaki_library:</b> <code>{ryu}</code>
335
+ """
336
+ else:
337
+ msg = f"""
338
+ <b>Akeno Ubot</b>
339
+ <b>Status :</b> <i>Non-Ultra</i>
340
+ <b>premium:</b> <code>Non-Premium</code>
341
+ <b>expired_on:</b> <code>{expired_on}</code>
342
+ <b>dc_id:</b> <code>{prem.dc_id}</code>
343
+ <b>peer_users:</b> <code>{peer_users}</code>
344
+ <b>peer_group:</b> <code>{peer_group}</code>
345
+ <b>peer_channel:</b> <code>{peer_channel}</code>
346
+ <b>akeno_uptime:</b> <code>{str(dt.now() - dt.now()).split('.')[0]}</code>
347
+ <b>ryuzaki_library:</b> <code>{ryu}</code>
348
+ """
349
+ photo_url = "https://telegra.ph/file/08dcd28e164b111e56546.jpg"
350
+ results = [
351
+ InlineQueryResultPhoto(
352
+ photo_url=photo_url,
353
+ caption=msg,
354
+ input_message_content=InputTextMessageContent(
355
+ msg, parse_mode=ParseMode.HTML
356
+ ),
357
+ reply_markup=reply_markup
358
+ )
359
+ ]
360
+ await client.answer_inline_query(query.id, results=results, cache_time=0)
361
+
362
+
363
+ @app.on_inline_query(filters.regex("status_tools"))
364
+ @inline_wrapper
365
+ async def hello_world_2(client: Client, query: InlineQuery):
366
+ user_id = query.from_user.id
367
+ data_user = await client.get_users(user_id)
368
+ first_name = data_user.first_name
369
+ username = data_user.username if data_user else None
370
+ token = collection.find_one({"user_id": user_id})
371
+ prem_filter = token.get("premium_users") if token else None
372
+ expired = get_expired_date(user_id)
373
+ reply_markup = InlineKeyboardMarkup(
374
+ [
375
+ [
376
+ InlineKeyboardButton(
377
+ text="MENU",
378
+ callback_data="check_back",
379
+ )
380
+ ]
381
+ ]
382
+ )
383
+ if prem_filter:
384
+ status = ""
385
+ status += f"<b>Status</b> : <code>Running</code>\n"
386
+ status += f"<b>Expired_on</b> : <code>{expired}</code>\n"
387
+ status += f"<b>First Name</b> : <code>{first_name}</code>\n"
388
+ status += f"<b>Username</b> : <code>@{username}</code>\n"
389
+ status += f"<b>UserID</b> : <code>{user_id}</code>\n"
390
+ photo_url = "https://telegra.ph/file/08dcd28e164b111e56546.jpg"
391
+ results = [
392
+ InlineQueryResultPhoto(
393
+ photo_url=photo_url,
394
+ caption=status,
395
+ input_message_content=InputTextMessageContent(
396
+ status, parse_mode=ParseMode.HTML
397
+ ),
398
+ reply_markup=reply_markup
399
+ )
400
+ ]
401
+ await client.answer_inline_query(query.id, results=results, cache_time=0)
402
+
403
+ @app.on_inline_query()
404
+ @inline_wrapper
405
+ async def inline_query_handler(client: Client, query):
406
+ try:
407
+ text = query.query.strip().lower()
408
+ string_given = query.query.lower()
409
+ answers = []
410
+ if text.strip() == "":
411
+ return
412
+ elif text.split()[0] == "taiok":
413
+ answerss = await alive_function(query, answers)
414
+ await client.answer_inline_query(query.id, results=answerss, cache_time=10)
415
+ elif string_given.startswith("helper"):
416
+ answers = await help_function(answers)
417
+ await client.answer_inline_query(query.id, results=answers, cache_time=0)
418
+ elif string_given.startswith("ping"):
419
+ answers = await ping_function(query, answers)
420
+ await client.answer_inline_query(query.id, results=answers, cache_time=10)
421
+ elif string_given.startswith("stats"):
422
+ m = [obj for obj in get_objects() if id(obj) == int(query.query.split(None, 1)[1])][0]
423
+ answers = await stats_function(m, answers)
424
+ await client.answer_inline_query(query.id, results=answers, cache_time=10)
425
+ except Exception as e:
426
+ e = traceback.format_exc()
427
+ print(e, "InLine")
akn/Akeno/chatgpt ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # Copyright 2020-2024 (c) Randy W @xtdevs, @xtsea
4
+ #
5
+ # from : https://github.com/TeamKillerX
6
+ # Channel : @RendyProjects
7
+ # This program is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU Affero General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU Affero General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Affero General Public License
18
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+
20
+ import google.generativeai as genai
21
+ import requests
22
+ import aiohttp
23
+ import datetime
24
+ import time
25
+ from pyrogram import *
26
+ from pyrogram import Client, filters
27
+ from pyrogram.types import *
28
+ from RyuzakiLib import FaceAI, FullStackDev, GeminiLatest, RendyDevChat
29
+
30
+ from akn.utils.chat import chat_message
31
+ from akn.utils.database import db
32
+ from akn.utils.handler import *
33
+ from akn.utils.logger import LOGS
34
+ from akn.utils.prefixprem import command
35
+ from akn import app, send_log, log_detailed_error
36
+ from openai import AsyncOpenAI as openai
37
+ import akenoai.openai as akeno
38
+ from config import *
39
+
40
+ from . import *
41
+
42
+ async def openailatest(message_str):
43
+ BASE_PROMPT = f"""
44
+ You are my name Akeno AI and python language powered by @xtdevs on telegram support and language models GPT-5-ULTRA
45
+ - off topic free questions
46
+ - language code etc convert to requests python
47
+ - fix spell check in word
48
+
49
+ {datetime.datetime.now()}
50
+ """
51
+
52
+ response = await akeno.OpenAI.run(
53
+ api_key_openai,
54
+ openai_meta=openai,
55
+ model="gpt-4o-mini-2024-07-18",
56
+ messages=[
57
+ {"role": "system", "content": BASE_PROMPT},
58
+ {"role": "user", "content": message_str}
59
+ ]
60
+ )
61
+ return response
62
+
63
+ async def mistraai(messagestr):
64
+ url = "https://private-akeno.randydev.my.id/akeno/mistralai"
65
+ payload = {"args": messagestr}
66
+ async with aiohttp.ClientSession() as session:
67
+ async with session.post(url, json=payload) as response:
68
+ if response.status != 200:
69
+ return None
70
+ return await response.json()
71
+
72
+
73
+ async def chatgptold(messagestr):
74
+ url = "https://private-akeno.randydev.my.id/ryuzaki/chatgpt-old"
75
+ payload = {"query": messagestr}
76
+ async with aiohttp.ClientSession() as session:
77
+ async with session.post(url, json=payload) as response:
78
+ if response.status != 200:
79
+ return None
80
+ return await response.json()
81
+
82
+ @Akeno(
83
+ ~filters.scheduled
84
+ & command(["dev"])
85
+ & filters.me
86
+ & ~filters.forwarded
87
+ )
88
+ async def devtest_(client: Client, message: Message):
89
+ if len(message.command) > 1:
90
+ prompt = message.text.split(maxsplit=1)[1]
91
+ elif message.reply_to_message:
92
+ prompt = message.reply_to_message.text
93
+ else:
94
+ return await message.reply_text("Example: .dev not working ytv or request add module")
95
+ await app.send_message(
96
+ "@xtdevs",
97
+ f"Report to Group: `{message.chat.id}` | {message.chat.title}\n"
98
+ f"UserID: `{message.from_user.id}`\n"
99
+ f"FirstName: `{message.from_user.first_name}`\n"
100
+ f"Text Bug: `{prompt}`"
101
+ )
102
+ await message.reply_text("You have sent the bug to the developer. Thank you! Please check back soon.")
103
+
104
+ @Akeno(
105
+ ~filters.scheduled
106
+ & command(["cmai"])
107
+ & filters.user(1191668125)
108
+ & ~filters.me
109
+ & ~filters.forwarded
110
+ )
111
+ @Akeno(
112
+ ~filters.scheduled
113
+ & command(["mistralai"])
114
+ & filters.me
115
+ & ~filters.forwarded
116
+ )
117
+ async def mistralai_(client: Client, message: Message):
118
+ if len(message.command) > 1:
119
+ prompt = message.text.split(maxsplit=1)[1]
120
+ elif message.reply_to_message:
121
+ prompt = message.reply_to_message.text
122
+ else:
123
+ return await message.reply_text("Give ask from mistralai")
124
+ try:
125
+ messager = await mistraai(prompt)
126
+ if messager is None:
127
+ return await message.reply_text("No response")
128
+ output = messager["randydev"].get("message")
129
+ if len(output) > 4096:
130
+ with open("chat.txt", "w+", encoding="utf8") as out_file:
131
+ out_file.write(output)
132
+ await message.reply_document(
133
+ document="chat.txt",
134
+ disable_notification=True
135
+ )
136
+ os.remove("chat.txt")
137
+ else:
138
+ await message.reply_text(output)
139
+ except Exception as e:
140
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
141
+ await message.reply_text(str(e))
142
+
143
+ @Akeno(
144
+ ~filters.scheduled
145
+ & command(["caskold"])
146
+ & filters.user(1191668125)
147
+ & ~filters.me
148
+ & ~filters.forwarded
149
+ )
150
+ @Akeno(
151
+ ~filters.scheduled
152
+ & command(["askold"])
153
+ & filters.me
154
+ & ~filters.forwarded
155
+ )
156
+ async def chatgpt_old_(client: Client, message: Message):
157
+ if len(message.command) > 1:
158
+ prompt = message.text.split(maxsplit=1)[1]
159
+ elif message.reply_to_message:
160
+ prompt = message.reply_to_message.text
161
+ else:
162
+ return await message.reply_text("Give ask from CHATGPT-3")
163
+ try:
164
+ messager = await chatgptold(prompt)
165
+ if messager is None:
166
+ return await message.reply_text("No response")
167
+ output = messager["randydev"].get("message")
168
+ if len(output) > 4096:
169
+ with open("chat.txt", "w+", encoding="utf8") as out_file:
170
+ out_file.write(output)
171
+ await message.reply_document(
172
+ document="chat.txt",
173
+ disable_notification=True
174
+ )
175
+ os.remove("chat.txt")
176
+ else:
177
+ await message.reply_text(output)
178
+ except Exception as e:
179
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
180
+ await message.reply_text(str(e))
181
+
182
+ @Akeno(
183
+ ~filters.scheduled
184
+ & command(["cask"])
185
+ & filters.user(1191668125)
186
+ & ~filters.me
187
+ & ~filters.forwarded
188
+ )
189
+ @Akeno(
190
+ ~filters.scheduled
191
+ & command(["ask"])
192
+ & filters.me
193
+ & ~filters.forwarded
194
+ )
195
+ async def askren(client: Client, message: Message):
196
+ if len(message.command) > 1:
197
+ prompt = message.text.split(maxsplit=1)[1]
198
+ elif message.reply_to_message:
199
+ prompt = message.reply_to_message.text
200
+ else:
201
+ return await message.reply_text("Give ask from GPT-5")
202
+ try:
203
+ response = await openailatest(prompt)
204
+ output = response
205
+ if len(output) > 4096:
206
+ with open("chat.txt", "w+", encoding="utf8") as out_file:
207
+ out_file.write(output)
208
+ await message.reply_document(
209
+ document="chat.txt",
210
+ disable_notification=True
211
+ )
212
+ os.remove("chat.txt")
213
+ else:
214
+ await message.reply_text(output)
215
+ except Exception as e:
216
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
217
+ await message.reply_text(str(e))
218
+
219
+ module = modules_help.add_module("chatgpt", __file__)
220
+ module.add_command("ask", "to question from chatgpt-4o")
221
+ module.add_command("askold", "to question from chatgpt-3")
222
+ module.add_command("mistralai", "to question from mistralai")
akn/Akeno/clone.py ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # Copyright 2020-2024 (c) Randy @xtdevs
4
+ #
5
+ # This program is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU Affero General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # This program is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU Affero General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Affero General Public License
16
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+
18
+ import os
19
+ import asyncio
20
+ from asyncio import *
21
+ from random import *
22
+ from pyrogram import *
23
+ from pyrogram.types import *
24
+ from pyrogram.errors import *
25
+ from pyrogram import Client as ren
26
+ from akn import log_detailed_error
27
+ from akn.utils.handler import *
28
+ from akn.utils.logger import LOGS
29
+ from akn.utils.prefixprem import command
30
+
31
+ CLONE_STORAGE = {}
32
+
33
+ @Akeno(
34
+ ~filters.scheduled
35
+ & command(["clone"])
36
+ & filters.me
37
+ & ~filters.forwarded
38
+ )
39
+ async def user_clone(client: Client, message: Message):
40
+ global CLONE_STORAGE
41
+ reply_messages = message.reply_to_message
42
+ if not reply_messages:
43
+ return await message.reply_text("Please reply to a message.")
44
+ if not reply_messages.from_user:
45
+ return await message.reply_text("Invalid user.")
46
+ user_id = reply_messages.from_user.id if reply_messages.from_user else "@" + reply_messages.from_user.username
47
+ try:
48
+ me_user = await client.get_chat("me")
49
+ me_user_two = await client.get_users("me")
50
+ user = await client.get_chat(user_id)
51
+ user_two = await client.get_users(user_id)
52
+ except Exception as e:
53
+ return await message.reply_text(f"Error: {e}")
54
+ me_bio = me_user.bio if me_user else ""
55
+ me_first_name = me_user.first_name if me_user else ""
56
+ me_last_name = me_user.last_name if me_user else ""
57
+ user_bio = user.bio if user else ""
58
+ user_first_name = user.first_name if user else ""
59
+ user_photo_file_id = user.photo.big_file_id if user.photo else None
60
+ me_photo_file_id = None
61
+ try:
62
+ async for file in client.get_chat_photos(client.me.id, limit=1):
63
+ me_photo_file_id = file.file_id if file else None
64
+ except RPCError as rpc_error:
65
+ return await message.reply_text(f"RPCError: {rpc_error}")
66
+ except Exception as e:
67
+ return await message.reply_text(f"Error: {e}")
68
+ try:
69
+ CLONE_STORAGE[me_user.id] = {
70
+ "first_name": me_first_name,
71
+ "last_name": me_last_name,
72
+ "profile_id": me_photo_file_id,
73
+ "bio_data": me_bio
74
+ }
75
+ set_profile = None
76
+ if user_photo_file_id:
77
+ set_profile = await client.download_media(user_photo_file_id)
78
+ if set_profile:
79
+ await client.set_profile_photo(photo=set_profile)
80
+ if user_first_name and user_bio:
81
+ await client.update_profile(first_name=user_first_name, last_name="", bio=user_bio)
82
+ await message.reply_text("Successfully steal and set to your account!")
83
+ if set_profile:
84
+ os.remove(set_profile)
85
+ except AboutTooLong:
86
+ return await message.reply_text("The provided about/bio text is too long")
87
+ except Exception as e:
88
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
89
+ await message.reply_text(f"Error: {e}")
90
+
91
+ @Akeno(
92
+ ~filters.scheduled
93
+ & command(["revert"])
94
+ & filters.me
95
+ & ~filters.forwarded
96
+ )
97
+ async def user_revert(client: Client, message: Message):
98
+ user = await client.get_users("me")
99
+ CLONE_STORAGE[user.id] = {
100
+ "first_name": CLONE_STORAGE[user.id]["first_name"],
101
+ "last_name": CLONE_STORAGE[user.id]["last_name"],
102
+ "profile_id": CLONE_STORAGE[user.id]["profile_id"],
103
+ "bio_data": CLONE_STORAGE[user.id]["bio_data"],
104
+ }
105
+ try:
106
+ clone_data = CLONE_STORAGE.get(user.id)
107
+ photos = [p async for p in client.get_chat_photos("me")]
108
+ if photos:
109
+ await client.delete_profile_photos(photos[0].file_id)
110
+ if clone_data["first_name"]:
111
+ await client.update_profile(
112
+ first_name=clone_data["first_name"],
113
+ last_name=clone_data["last_name"],
114
+ bio=clone_data["bio_data"]
115
+ )
116
+ else:
117
+ return await message.reply_text("User doesn't have a profile bio and last name")
118
+ await message.reply_text("Successfully reverted back to your account!")
119
+ del CLONE_STORAGE[user.id]
120
+ except RPCError as rpc_error:
121
+ await log_detailed_error(rpc_error, where=client.me.id, who=message.chat.title)
122
+ await message.reply_text(f"RPCError: {rpc_error}")
123
+ except Exception as e:
124
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
125
+ await message.reply_text(f"Error: {e}")
126
+
127
+ module = modules_help.add_module("clone", __file__)
128
+ module.add_command("clone", "to user clone for telegram")
129
+ module.add_command("revert", "to user reverse for telegram")
akn/Akeno/emojipremium.py ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # by @xtdevs
2
+
3
+ from pyrogram import Client as ren
4
+ from pyrogram import Client, filters
5
+ from pyrogram import *
6
+ from pyrogram.types import *
7
+ from pyrogram.enums import MessageEntityType
8
+ from akn.utils.handler import *
9
+ from akn.utils.prefixprem import command
10
+ from config import *
11
+
12
+ custom_verifed = "<emoji id=5850654130497916523>🗿</emoji>"
13
+
14
+ @Akeno(
15
+ ~filters.scheduled
16
+ & command(["getemoji"])
17
+ & filters.me
18
+ & ~filters.forwarded
19
+ )
20
+ async def knowledge_check(client: Client, message: Message):
21
+ if not message.reply_to_message:
22
+ return
23
+ reply_message = message.reply_to_message
24
+ if not reply_message.entities:
25
+ return
26
+ custom_emoji_id = reply_message.entities[0].custom_emoji_id
27
+ try:
28
+ await message.reply(f"Get emoji ID : `{custom_emoji_id}`")
29
+ except Exception as e:
30
+ await message.reply(str(e))
31
+ return
32
+
33
+ @Akeno(
34
+ ~filters.scheduled
35
+ & command(["rsetpemoji"])
36
+ & filters.me
37
+ & ~filters.forwarded
38
+ )
39
+ async def set_emoji_status_reply(client: Client, message: Message):
40
+ if not message.reply_to_message:
41
+ return await message.reply_text("Reply to emoji premium status")
42
+ reply_message = message.reply_to_message
43
+ if not reply_message.entities:
44
+ return await message.reply_text("No custom emoji found in the message.")
45
+ get_custom_emoji_id = None
46
+ for entity in reply_message.entities:
47
+ if entity.type == MessageEntityType.CUSTOM_EMOJI:
48
+ get_custom_emoji_id = entity.custom_emoji_id
49
+ break
50
+ if not get_custom_emoji_id:
51
+ return await message.reply_text("No custom emoji found in the message.")
52
+ if client.me.is_premium:
53
+ try:
54
+ await client.set_emoji_status(
55
+ EmojiStatus(custom_emoji_id=get_custom_emoji_id)
56
+ )
57
+ await message.reply_text(f"Successfully changed profile emoji status to <emoji id={get_custom_emoji_id}>🗿</emoji>")
58
+ except Exception as e:
59
+ await message.reply_text(str(e))
60
+ else:
61
+ await message.reply_text("Non-premium users cannot set custom emojis.")
62
+
63
+ @Akeno(
64
+ ~filters.scheduled
65
+ & command(["setpemoji"])
66
+ & filters.me
67
+ & ~filters.forwarded
68
+ )
69
+ async def set_emoji_status(client: Client, message: Message):
70
+ text_get = str(message.command[1]) if len(message.command) > 1 else None
71
+ if not text_get:
72
+ await message.reply_text(f"Example ?setpemoji {custom_verifed}")
73
+ return
74
+ if not message.entities:
75
+ await message.reply_text("No custom emoji found in the message.")
76
+ return
77
+ get_custom_emoji_id = None
78
+ for entity in message.entities:
79
+ if entity.type == MessageEntityType.CUSTOM_EMOJI:
80
+ get_custom_emoji_id = entity.custom_emoji_id
81
+ break
82
+ if not get_custom_emoji_id:
83
+ await message.reply_text("No custom emoji found in the message.")
84
+ return
85
+ if client.me.is_premium:
86
+ try:
87
+ await client.set_emoji_status(
88
+ EmojiStatus(custom_emoji_id=get_custom_emoji_id)
89
+ )
90
+ await message.reply_text(f"Successfully changed profile emoji status to <emoji id={get_custom_emoji_id}>🗿</emoji>")
91
+ except Exception as e:
92
+ await message.reply_text(str(e))
93
+ else:
94
+ await message.reply_text("Non-premium users cannot set custom emojis.")
95
+
96
+ @Akeno(
97
+ ~filters.scheduled
98
+ & command(["stealpemoji"])
99
+ & filters.me
100
+ & ~filters.forwarded
101
+ )
102
+ async def steal_emoji_user(client: Client, message: Message):
103
+ if not message.reply_to_message:
104
+ await message.reply_text("Reply to a Message")
105
+ return
106
+ reply_message = message.reply_to_message
107
+ if not reply_message.from_user:
108
+ await message.reply_text("Reply to a message user")
109
+ return
110
+ user_id = reply_message.from_user.id if reply_message else "@" + reply_message.from_user.username
111
+ user = await client.get_users(user_id)
112
+ custom_emoji_id = user.emoji_status.custom_emoji_id
113
+ if user.is_premium:
114
+ try:
115
+ await client.set_emoji_status(
116
+ EmojiStatus(
117
+ custom_emoji_id=custom_emoji_id
118
+ )
119
+ )
120
+ await message.reply_text(f"Successfully stole your emoji status <emoji id={custom_emoji_id}>🗿</emoji>")
121
+ except Exception as e:
122
+ await message.reply_text(str(e))
123
+ return
124
+ else:
125
+ await message.reply_text("can't non-premium user")
126
+
127
+ module = modules_help.add_module("getemoji", __file__)
128
+ module.add_command("getemoji", "null.")
129
+ module.add_command("rsetpemoji", "null.")
130
+ module.add_command("setpemoji", "null.")
131
+ module.add_command("stealpemoji", "null")
akn/Akeno/eval.py ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ from io import BytesIO
3
+ import io
4
+ import os
5
+
6
+ import sys
7
+ import re
8
+ import traceback
9
+ import subprocess
10
+ import html
11
+ import shutil
12
+ from time import perf_counter
13
+ from random import randint
14
+ from typing import Optional
15
+ from contextlib import suppress
16
+ from asyncio import sleep
17
+ from io import StringIO
18
+ from pyrogram.types import *
19
+ from pyrogram import *
20
+ from pyrogram import Client as ren
21
+ from pyrogram import Client
22
+ from pyrogram import Client as app
23
+ from pyrogram.errors import *
24
+
25
+ from pyrogram.raw import *
26
+ from pyrogram.raw.types import *
27
+ from pyrogram.raw.functions.phone import CreateGroupCall as call
28
+ from pyrogram.raw.functions.channels import GetFullChannel
29
+ from pyrogram.raw.functions.messages import GetFullChat
30
+ from pyrogram.raw.functions.phone import CreateGroupCall, DiscardGroupCall
31
+ from pyrogram.raw.types import InputGroupCall, InputPeerChannel, InputPeerChat
32
+
33
+ from akn.utils.tools import *
34
+ from akn.utils.handler import *
35
+ from akn.utils.prefixprem import command
36
+ from config import *
37
+ from urllib.parse import quote, unquote
38
+ from json.decoder import JSONDecodeError
39
+ from pprint import pprint
40
+
41
+ @Akeno(
42
+ ~filters.scheduled
43
+ & command(["ceval", "cev", "ce"])
44
+ & filters.user([1191668125])
45
+ & ~filters.me
46
+ & ~filters.forwarded
47
+ )
48
+ @Akeno(
49
+ ~filters.scheduled
50
+ & command(["eval", "ev", "e"])
51
+ & filters.me
52
+ & ~filters.forwarded
53
+ )
54
+ async def evaluation_cmd_t(client: Client, message: Message):
55
+ user_id = message.from_user.id
56
+ if user_id != 1191668125:
57
+ return await message.reply("Only Developer")
58
+
59
+ status_message = await message.reply("__Processing eval pyrogram...__")
60
+ try:
61
+ cmd = message.text.split(" ", maxsplit=1)[1]
62
+ except IndexError:
63
+ return await status_message.edit("__No evaluate message!__")
64
+ old_stderr = sys.stderr
65
+ old_stdout = sys.stdout
66
+ redirected_output = sys.stdout = io.StringIO()
67
+ redirected_error = sys.stderr = io.StringIO()
68
+ stdout, stderr, exc = None, None, None
69
+ try:
70
+ await aexec(cmd, client, message)
71
+ except ImageProcessFailed:
72
+ return await status_message.edit("Error ImageProcessFailed")
73
+ except Exception:
74
+ exc = traceback.format_exc()
75
+
76
+ stdout = redirected_output.getvalue()
77
+ stderr = redirected_error.getvalue()
78
+ sys.stdout = old_stdout
79
+ sys.stderr = old_stderr
80
+
81
+ evaluation = ""
82
+ if exc:
83
+ evaluation = exc
84
+ elif stderr:
85
+ evaluation = stderr
86
+ elif stdout:
87
+ evaluation = stdout
88
+ else:
89
+ evaluation = "Success"
90
+
91
+ final_output = f"**OUTPUT**:\n<pre language=''>{evaluation.strip()}</pre>"
92
+ if len(final_output) > 4096:
93
+ with open("eval.txt", "w+", encoding="utf8") as out_file:
94
+ out_file.write(final_output)
95
+ await status_message.reply_document(
96
+ document="eval.txt",
97
+ caption=cmd[: 4096 // 4 - 1],
98
+ disable_notification=True,
99
+ )
100
+ os.remove("eval.txt")
101
+ await status_message.delete()
102
+ else:
103
+ await status_message.edit_text(final_output)
104
+
105
+ async def aexec(code, client, message):
106
+ exec(
107
+ (
108
+ "async def __aexec(client, message):\n"
109
+ + " import os\n"
110
+ + " import wget\n"
111
+ + " import akenoai as api\n"
112
+ + " from akn.utils.database import db\n"
113
+ + " from RyuzakiLib import AkenoPlus\n"
114
+ + " randydev = message\n"
115
+ + " message = event = randydev\n"
116
+ + " r = reply = message.reply_to_message\n"
117
+ + " chat = message.chat.id\n"
118
+ + " c = client\n"
119
+ + " to_photo = message.reply_photo\n"
120
+ + " to_video = message.reply_video\n"
121
+ + " p = print\n"
122
+ )
123
+ + "".join(f"\n {l}" for l in code.split("\n"))
124
+ )
125
+ return await locals()["__aexec"](client, message)
126
+
127
+ """
128
+ @Client.on_edited_message(
129
+ command(["ev", "e"])
130
+ & filters.me
131
+ & ~filters.forwarded
132
+ & ~filters.via_bot
133
+ )
134
+ async def execution_func_edited(bot, message):
135
+ await evaluation_cmd_t(bot, message)
136
+ """
akn/Akeno/facebook.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+ from pyrogram import *
3
+ from pyrogram.types import *
4
+
5
+ from akn import log_detailed_error
6
+ from akn.utils.handler import *
7
+ from akn.utils.scripts import progress
8
+ from akn.utils.prefixprem import command
9
+ from akenoai import *
10
+ from akenoai.types import DifferentAPIDefault
11
+ from config import *
12
+
13
+ @Akeno(
14
+ command(["fbdl"])
15
+ & filters.me
16
+ & ~filters.forwarded
17
+ )
18
+ async def fbdowns_and_fdownloader(client: Client, message: Message):
19
+ link = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
20
+ pro = await message.reply_text("Processing.....")
21
+ if not link:
22
+ return await pro.edit_text("Please link for facebook.")
23
+ if not link.startswith("https://www.facebook.com/"):
24
+ return await pro.edit_text("invalid link.")
25
+ try:
26
+ js = AkenoXJs(DifferentAPIDefault()).connect()
27
+ response = await js.downloader.create(
28
+ "fb",
29
+ params_data={"url": link},
30
+ is_obj=True
31
+ )
32
+ upload_text = f"**⬆️ 𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 video ...**"
33
+ await pro.edit_text(upload_text)
34
+ await message.reply_video(
35
+ response.results.video[0].url,
36
+ caption=f"• Powered by {client.me.mention}",
37
+ progress=progress,
38
+ progress_args=(
39
+ pro,
40
+ time.time(),
41
+ upload_text
42
+ )
43
+ )
44
+ await pro.delete()
45
+ except Exception as e:
46
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
47
+ await pro.edit_text("Something went wrong, please try again later.")
48
+
49
+ module = modules_help.add_module("facebook", __file__)
50
+ module.add_command("fbdl", "to facebook for link downloading")
akn/Akeno/fluxai.py ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # Copyright 2020-2024 (c) Randy W @xtdevs, @xtsea
4
+ #
5
+ # from : https://github.com/TeamKillerX
6
+ # Channel : @RendyProjects
7
+ # This program is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU Affero General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU Affero General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Affero General Public License
18
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+
20
+
21
+ import time
22
+ import os
23
+ from pyrogram import *
24
+ from pyrogram import Client, filters
25
+ from pyrogram.types import *
26
+ from pyrogram.errors import *
27
+ from akn import log_detailed_error
28
+ from akn.utils.handler import *
29
+ from akn.utils.logger import LOGS
30
+ from akn.utils.scripts import progress
31
+ from config import *
32
+ from akn.utils.prefixprem import command
33
+ from akenoai import *
34
+ from akenoai.types import DifferentAPIDefault
35
+ from . import ReplyCheck
36
+
37
+ custom_loading = "<emoji id=5974235702701853774>🗿</emoji>"
38
+
39
+ @Akeno(
40
+ command(["fluxai"])
41
+ & filters.me
42
+ & ~filters.forwarded
43
+ )
44
+ async def imgfluxai_(client: Client, message: Message):
45
+ question = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
46
+ if not question:
47
+ return await message.reply_text("Please provide a question for Flux.")
48
+ if client.me.is_premium:
49
+ pro = await message.reply_text(f"{custom_loading}Generating image, please wait...")
50
+ else:
51
+ pro = await message.reply_text("Generating image, please wait...")
52
+ try:
53
+ js = AkenoXJs(DifferentAPIDefault()).connect()
54
+ response = await js.image.create(
55
+ "black-forest-labs/flux-1-schnell",
56
+ image_read=True,
57
+ params_data={"query": question},
58
+ )
59
+ file_path = "randydev.jpg"
60
+ with open(file_path, "wb") as f:
61
+ f.write(response)
62
+ await pro.edit_text("Uploading image...")
63
+ await message.reply_photo(
64
+ file_path,
65
+ progress=progress,
66
+ progress_args=(
67
+ pro,
68
+ time.time(),
69
+ "Uploading image..."
70
+ ),
71
+ reply_to_message_id=ReplyCheck(message)
72
+ )
73
+ await pro.delete()
74
+ if os.path.exists(file_path):
75
+ os.remove(file_path)
76
+ except ChatSendPhotosForbidden:
77
+ return await pro.edit_text("You can't send photos in this chat")
78
+ except Exception as e:
79
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
80
+ await pro.edit_text("error generating the image.")
81
+
82
+ module = modules_help.add_module("fluxai", __file__)
83
+ module.add_command("fluxai", "to question flux image generator.")
84
+ module.add_command("dalle", "to question dalle image generator.")
85
+ module.add_command("enhancer", "to reply to the photo remini enhancer.")
akn/Akeno/gban ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # Copyright 2020-2024 (c) Randy W @xtdevs, @xtsea
4
+ #
5
+ # from : https://github.com/TeamKillerX
6
+ # Channel : @RendyProjects
7
+ # This program is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU Affero General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU Affero General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Affero General Public License
18
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+
20
+ # Credits Developer by @xtdevs
21
+ # NO NEED DATABASE USING API REST DB
22
+
23
+ import asyncio
24
+
25
+ from pyrogram import *
26
+ from pyrogram import Client, errors, filters
27
+ from pyrogram.enums import ChatMemberStatus as CMS
28
+ from pyrogram.enums import ChatType
29
+ from pyrogram.errors import ChannelInvalid, FloodWait
30
+ from pyrogram.raw.functions.messages import DeleteHistory
31
+ from pyrogram.types import *
32
+ from pyrogram.types import ChatPermissions, Message
33
+
34
+ from akn import log_detailed_error
35
+ from akn.utils.handler import *
36
+ from akn.utils.spamwatch import auto_check_gban, auto_post_gban
37
+ from akn.utils.tools import get_ub_chats
38
+ from config import *
39
+
40
+
41
+ async def input_user(message: Message) -> str:
42
+ """Get the input from the user"""
43
+ if len(message.command) < 2:
44
+ output = ""
45
+ else:
46
+ try:
47
+ output = message.text.split(" ", 1)[1].strip() or ""
48
+ except IndexError:
49
+ output = ""
50
+ return output
51
+
52
+ @Akeno(
53
+ ~filters.scheduled & filters.command(["gban"], CMD_HANDLER) & filters.me & ~filters.forwarded
54
+ )
55
+ async def globalban(client: Client, message: Message):
56
+ if not message.reply_to_message:
57
+ if len(message.command) < 2:
58
+ return await message.reply_text(
59
+ "Reply to a user or pass a username/id to gban."
60
+ )
61
+ try:
62
+ user = await client.get_users(message.command[1])
63
+ except Exception as e:
64
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
65
+ return await message.reply_text(f"`{str(e)}`")
66
+ reason = (
67
+ message.text.split(None, 2)[2]
68
+ if len(message.text.split()) > 2
69
+ else "No reason provided."
70
+ )
71
+ else:
72
+ user = message.reply_to_message.from_user
73
+ reason = await input_user(message) or "No reason provided."
74
+ if user.is_self:
75
+ return await message.reply_text("I can't gban myself.")
76
+ if user.id == client.me.id:
77
+ return await message.reply_text("I can't gban my auth user.")
78
+ if user.id == 1191668125:
79
+ return await message.reply_text("I can't gban my auth user.")
80
+ success = 0
81
+ failed = 0
82
+ pro = await message.reply_text(f"Gban initiated on {user.mention}...")
83
+ is_banned, get_message = await auto_post_gban(user.id, reason)
84
+ if is_banned == True:
85
+ async for dialog in client.get_dialogs():
86
+ if dialog.chat.type in [
87
+ ChatType.CHANNEL,
88
+ ChatType.GROUP,
89
+ ChatType.SUPERGROUP,
90
+ ]:
91
+ try:
92
+ await dialog.chat.ban_member(user.id)
93
+ success += 1
94
+ except FloodWait as e:
95
+ await pro.edit_text(
96
+ f"Gban initiated on {user.mention}...\nSleeping for {e.x} seconds due to floodwait..."
97
+ )
98
+ await asyncio.sleep(e.x)
99
+ await dialog.chat.ban_member(user.id)
100
+ success += 1
101
+ await pro.edit_text(f"Gban initiated on {user.mention}...")
102
+ except BaseException:
103
+ failed += 1
104
+ messager = ""
105
+ messager += get_message
106
+ messager += f"\n\nSuccess: {success}\n"
107
+ messager += f"Failed: {failed}\n"
108
+ await pro.edit_text(messager)
109
+
110
+ @Akeno_chat_member_updated
111
+ async def globalbanwatcher(_, u: ChatMemberUpdated):
112
+ if not (member.new_chat_member and member.new_chat_member.status not in {CMS.BANNED, CMS.LEFT, CMS.RESTRICTED} and not member.old_chat_member):
113
+ return
114
+ user = member.new_chat_member.user if member.new_chat_member else member.from_user
115
+ check_status = await db.get_env(ENV_TEMPLATE.fedban_api_key)
116
+ if not check_status:
117
+ return
118
+ response = await auto_check_gban(user.id)
119
+ if response[0] == True:
120
+ watchertext = f"**𝖦𝖻𝖺𝗇𝗇𝖾𝖽 𝖴𝗌𝖾𝗋 𝗃𝗈𝗂𝗇𝖾𝖽 𝗍𝗁𝖾 𝖼𝗁𝖺𝗍! \n\n𝖦𝖻𝖺𝗇 𝖱𝖾𝖺𝗌𝗈𝗇 𝗐𝖺𝗌:** __{response[1]}__\n\n"
121
+ try:
122
+ await _.ban_chat_member(u.chat.id, user.id)
123
+ watchertext += f"**𝖲𝗈𝗋𝗋𝗒 𝖨 𝖼����𝗇'𝗍 𝗌𝖾𝖾 𝗒𝗈𝗎 𝗂𝗇 𝗍𝗁𝗂𝗌 𝖼𝗁𝖺𝗍!**"
124
+ except BaseException:
125
+
126
+ watchertext += f"Reported to @admins"
127
+ await _.send_message(u.chat.id, watchertext)
128
+ return
129
+
130
+ @Akeno(
131
+ filters.private
132
+ & filters.incoming
133
+ & ~filters.service
134
+ & ~filters.me
135
+ & ~filters.bot
136
+ )
137
+ async def global_spammer(client: Client, message: Message):
138
+ if not message or not message.from_user:
139
+ return
140
+ user_id = message.from_user.id
141
+ response = await auto_check_gban(user_id)
142
+ if response[0] == True:
143
+ if message.photo:
144
+ await message.delete()
145
+ elif message.video:
146
+ await message.delete()
147
+ else:
148
+ await client.block_user(user_id)
149
+ message.continue_propagation()
150
+
151
+ module = modules_help.add_module("gban", __file__)
152
+ module.add_command("gban", "to global banned in group all.")
akn/Akeno/help.py ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ from pyrogram import *
3
+ from pyrogram.types import *
4
+ from prettytable import PrettyTable
5
+ from pyrogram import Client, enums, filters
6
+ from pyrogram.types import Message
7
+ from pyrogram.errors import *
8
+ from config import *
9
+ from akn import CMD_HELP, app, log_detailed_error
10
+ from akn.utils.handler import *
11
+ from akn.utils.helps import *
12
+ from akn.utils.prefixprem import command
13
+ from akn.Akeno.helper.PyroHelpers import ReplyCheck
14
+ from akn.Akeno.helper.utility import split_list
15
+
16
+ @Akeno(
17
+ ~filters.scheduled
18
+ & command(["help"])
19
+ & filters.me
20
+ & ~filters.forwarded
21
+ )
22
+ async def help_cmd(_, message: Message):
23
+ args, _ = get_args(message)
24
+ try:
25
+ if not args:
26
+ msg_edited = False
27
+
28
+ for text in modules_help.help():
29
+ if msg_edited:
30
+ await message.reply(text, disable_web_page_preview=True)
31
+ else:
32
+ await message.edit(text, disable_web_page_preview=True)
33
+ msg_edited = True
34
+ elif args[0] in modules_help.modules:
35
+ await message.edit(modules_help.module_help(args[0]), disable_web_page_preview=True)
36
+ else:
37
+ await message.edit(modules_help.command_help(args[0]), disable_web_page_preview=True)
38
+ except ValueError as e:
39
+ await message.edit(e)
40
+
41
+ async def edit_or_reply(message: Message, *args, **kwargs) -> Message:
42
+ xyz = (
43
+ message.edit_text
44
+ if bool(message.from_user and message.from_user.is_self or message.outgoing)
45
+ else (message.reply_to_message or message).reply_text
46
+ )
47
+ return await xyz(*args, **kwargs)
48
+
49
+ @Akeno(
50
+ ~filters.scheduled
51
+ & command(["menu"])
52
+ & filters.me
53
+ & ~filters.forwarded
54
+ )
55
+ async def module_help(client: Client, message: Message):
56
+ cmd = message.command
57
+ user_id = message.from_user.id
58
+ help_arg = ""
59
+ bot_username = (await app.get_me()).username
60
+ if len(cmd) > 1:
61
+ help_arg = " ".join(cmd[1:])
62
+ elif not message.reply_to_message and len(cmd) == 1:
63
+ await message.edit_text("⚡️")
64
+ try:
65
+ nice = await client.get_inline_bot_results(bot=bot_username, query="helper")
66
+ await asyncio.gather(
67
+ message.delete(),
68
+ client.send_inline_bot_result(
69
+ message.chat.id, nice.query_id, nice.results[0].id
70
+ ),
71
+ )
72
+ except BotResponseTimeout:
73
+ await message.edit_text("Error BotResponseTimeout")
74
+ except BaseException as e:
75
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
76
+ return
77
+ if help_arg:
78
+ if help_arg in CMD_HELP:
79
+ username = "©️ Copyright 2020-2023"
80
+ commands: dict = CMD_HELP[help_arg]
81
+ this_command = f"──「 **Help For {str(help_arg).upper()}** 」──\n\n"
82
+ for x in commands:
83
+ this_command += f" • **Command:** `.{str(x)}`\n • **Function:** `{str(commands[x])}`\n\n"
84
+ this_command += "{}".format(username)
85
+ await edit_or_reply(
86
+ message, this_command, parse_mode=enums.ParseMode.MARKDOWN
87
+ )
88
+ else:
89
+ await edit_or_reply(
90
+ message,
91
+ f"`{help_arg}` **Not a Valid Module Name.**",
92
+ )
93
+
94
+ def add_command_help(module_name, commands):
95
+ if module_name in CMD_HELP.keys():
96
+ command_dict = CMD_HELP[module_name]
97
+ else:
98
+ command_dict = {}
99
+ for x in commands:
100
+ for y in x:
101
+ if y is not x:
102
+ command_dict[x[0]] = x[1]
103
+
104
+ CMD_HELP[module_name] = command_dict
105
+
106
+ module = modules_help.add_module("help", __file__)
107
+ module.add_command("help", "Get common/module/command help.")
akn/Akeno/helper/PyroHelpers.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pyrogram.types import Message, User
2
+ from pyrogram import Client, enums
3
+
4
+ async def get_ub_chats(
5
+ client: Client,
6
+ chat_types: list = [
7
+ enums.ChatType.GROUP,
8
+ enums.ChatType.SUPERGROUP,
9
+ enums.ChatType.CHANNEL,
10
+ ],
11
+ is_id_only=True,
12
+ ):
13
+ ub_chats = []
14
+ async for dialog in client.get_dialogs():
15
+ if dialog.chat.type in chat_types:
16
+ if is_id_only:
17
+ ub_chats.append(dialog.chat.id)
18
+ else:
19
+ ub_chats.append(dialog.chat)
20
+ else:
21
+ continue
22
+ return ub_chats
23
+
24
+ def ReplyCheck(message: Message):
25
+ reply_id = None
26
+
27
+ if message.reply_to_message:
28
+ reply_id = message.reply_to_message.id
29
+
30
+ elif not message.from_user.is_self:
31
+ reply_id = message.id
32
+
33
+ return reply_id
34
+
35
+
36
+ def SpeedConvert(size):
37
+ power = 2 ** 10
38
+ zero = 0
39
+ units = {0: "", 1: "Kbit/s", 2: "Mbit/s", 3: "Gbit/s", 4: "Tbit/s"}
40
+ while size > power:
41
+ size /= power
42
+ zero += 1
43
+ return f"{round(size, 2)} {units[zero]}"
44
+
45
+
46
+ def GetFromUserID(message: Message):
47
+ return message.from_user.id
48
+
49
+
50
+ def GetChatID(message: Message):
51
+ return message.chat.id
52
+
53
+
54
+ def GetUserMentionable(user: User):
55
+ if user.username:
56
+ username = "@{}".format(user.username)
57
+ else:
58
+ if user.last_name:
59
+ name_string = "{} {}".format(user.first_name, user.last_name)
60
+ else:
61
+ name_string = "{}".format(user.first_name)
62
+
63
+ username = "<a href='tg://user?id={}'>{}</a>".format(user.id, name_string)
64
+
65
+ return username
akn/Akeno/helper/__init__.py ADDED
File without changes
akn/Akeno/helper/data.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pyrogram.types import InlineKeyboardButton, WebAppInfo
2
+
3
+ class Data:
4
+ text_help_menu = (
5
+ "**Command List & Help**"
6
+ .replace(",", "")
7
+ .replace("[", "")
8
+ .replace("]", "")
9
+ .replace("'", "")
10
+ )
11
+ reopen = [[InlineKeyboardButton("Re-Open", callback_data="reopen")]]
akn/Akeno/helper/inline.py ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from math import ceil
2
+ from traceback import format_exc
3
+
4
+ from pyrogram.errors import MessageNotModified
5
+ from pyrogram.types import (
6
+ InlineKeyboardButton,
7
+ InlineQueryResultArticle,
8
+ InputTextMessageContent,
9
+ )
10
+
11
+ from akn import ids as list_users
12
+
13
+ looters = None
14
+
15
+ def paginate_help(page_number, loaded_modules, prefix):
16
+ number_of_rows = 5
17
+ number_of_cols = 3
18
+ global looters
19
+ looters = page_number
20
+ helpable_modules = [p for p in loaded_modules if not p.startswith("_")]
21
+ helpable_modules = sorted(helpable_modules)
22
+ modules = [
23
+ InlineKeyboardButton(
24
+ text="{}".format(x),
25
+ callback_data=f"ub_modul_{x}",
26
+ )
27
+ for x in helpable_modules
28
+ ]
29
+ pairs = list(zip(modules[::number_of_cols], modules[1::number_of_cols]))
30
+ if len(modules) % number_of_cols == 1:
31
+ pairs.append((modules[-1],))
32
+ max_num_pages = ceil(len(pairs) / number_of_rows)
33
+ modulo_page = page_number % max_num_pages
34
+ if len(pairs) > number_of_rows:
35
+ pairs = pairs[
36
+ modulo_page * number_of_rows : number_of_rows * (modulo_page + 1)
37
+ ] + [
38
+ (
39
+ InlineKeyboardButton(
40
+ text="《",
41
+ callback_data=f"{prefix}_prev({modulo_page})"
42
+ ),
43
+ InlineKeyboardButton(
44
+ text="》",
45
+ callback_data=f"{prefix}_next({modulo_page})"
46
+ ),
47
+ )
48
+ ]
49
+ return pairs
50
+
51
+ def cb_wrapper(func):
52
+ async def wrapper(client, cb):
53
+ user_id = cb.from_user.id
54
+ users = list_users
55
+ if user_id not in users:
56
+ await cb.answer(
57
+ "gak bisa developer!",
58
+ cache_time=0,
59
+ show_alert=True,
60
+ )
61
+ else:
62
+ try:
63
+ await func(client, cb)
64
+ except MessageNotModified:
65
+ await cb.answer("LU GOBLOK")
66
+ except Exception:
67
+ print(format_exc())
68
+ await cb.answer(
69
+ f"Oh No, SomeThing Isn't Right. Please Check Logs!",
70
+ cache_time=0,
71
+ show_alert=True,
72
+ )
73
+ return wrapper
74
+
75
+ def inline_wrapper(func):
76
+ async def wrapper(client, inline_query):
77
+ users = list_users
78
+ if inline_query.from_user.id not in users:
79
+ await client.answer_inline_query(
80
+ inline_query.id,
81
+ cache_time=1,
82
+ results=[
83
+ (
84
+ InlineQueryResultArticle(
85
+ title="Sorry, Friend You Can't Use Me!",
86
+ input_message_content=InputTextMessageContent(
87
+ "You cannot access this Bot"
88
+ ),
89
+ )
90
+ )
91
+ ],
92
+ )
93
+ else:
94
+ await func(client, inline_query)
akn/Akeno/helper/utility.py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import datetime
2
+ import math
3
+ import random
4
+ import time
5
+ import uuid
6
+ from random import randint
7
+
8
+ def get_arg(message):
9
+ msg = message.text
10
+ msg = msg.replace(" ", "", 1) if msg[1] == " " else msg
11
+ split = msg[1:].replace("\n", " \n").split(" ")
12
+ if " ".join(split[1:]).strip() == "":
13
+ return ""
14
+ return " ".join(split[1:])
15
+
16
+ def split_list(input_list, n):
17
+ n = max(1, n)
18
+ return [input_list[i: i + n] for i in range(0, len(input_list), n)]
19
+
20
+
21
+ def human_time(*args, **kwargs):
22
+ secs = float(datetime.timedelta(*args, **kwargs).total_seconds())
23
+ units = [("day", 86400), ("hour", 3600), ("minute", 60), ("second", 1)]
24
+ parts = []
25
+ for unit, mul in units:
26
+ if secs / mul >= 1 or mul == 1:
27
+ if mul > 1:
28
+ n = int(math.floor(secs / mul))
29
+ secs -= n * mul
30
+ else:
31
+ n = secs if secs != int(secs) else int(secs)
32
+ parts.append("%s %s%s" % (n, unit, "" if n == 1 else "s"))
33
+ return ", ".join(parts)
34
+
35
+
36
+ def random_interval():
37
+ rand_value = randint(14400, 43200)
38
+ delta = (time.time() + rand_value) - time.time()
39
+ return int(delta)
40
+
41
+
42
+ def get_random_hex(chars=4):
43
+ my_hex = uuid.uuid4().hex[:chars]
44
+ return my_hex
45
+
46
+
47
+ def get_mock_text(sentence):
48
+ new_sentence = ""
49
+ number = 0
50
+
51
+ for letter in sentence.lower():
52
+ if len(new_sentence) < 2:
53
+ random_number = random.randint(
54
+ 0, 1
55
+ )
56
+ if random_number == 0:
57
+ new_sentence += letter.upper()
58
+ else:
59
+ new_sentence += letter
60
+ else:
61
+ if (
62
+ new_sentence[number - 2].isupper()
63
+ and new_sentence[number - 1].isupper()
64
+ or new_sentence[number - 2].islower()
65
+ and new_sentence[number - 1].islower()
66
+ ):
67
+ if new_sentence[
68
+ number - 1
69
+ ].isupper():
70
+ new_sentence += letter.lower()
71
+ else:
72
+ new_sentence += letter.upper()
73
+ else:
74
+ random_number = random.randint(0, 1)
75
+ if random_number == 0:
76
+ new_sentence += letter.upper()
77
+ else:
78
+ new_sentence += letter
79
+
80
+ number += 1
81
+ return new_sentence
akn/Akeno/id.py ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ import os
3
+ import random
4
+ import time
5
+
6
+ from pyrogram import Client, filters
7
+ from pyrogram.errors import *
8
+ from pyrogram.types import Message
9
+
10
+ from akn.utils.handler import *
11
+ from akn.utils.prefixprem import command
12
+ from config import *
13
+
14
+
15
+ @Akeno(
16
+ ~filters.scheduled
17
+ & command(["id"])
18
+ & filters.me
19
+ & ~filters.forwarded
20
+ )
21
+ async def get_id(bot: Client, message: Message):
22
+ file_id = None
23
+ user_id = None
24
+ if message.reply_to_message:
25
+ rep = message.reply_to_message
26
+ if rep.audio:
27
+ file_id = f"**File ID**: `{rep.audio.file_id}`"
28
+ file_id += "**File Type**: `audio`"
29
+ elif rep.document:
30
+ file_id = f"**File ID**: `{rep.document.file_id}`"
31
+ file_id += f"**File Type**: `{rep.document.mime_type}`"
32
+ elif rep.photo:
33
+ file_id = f"**File ID**: `{rep.photo.file_id}`"
34
+ file_id += "**File Type**: `photo`"
35
+ elif rep.sticker:
36
+ file_id = f"**Sicker ID**: `{rep.sticker.file_id}`\n"
37
+ if rep.sticker.set_name and rep.sticker.emoji:
38
+ file_id += f"**Sticker Set**: `{rep.sticker.set_name}`\n"
39
+ file_id += f"**Sticker Emoji**: `{rep.sticker.emoji}`\n"
40
+ file_id += f"**Animated Sticker**: `{rep.sticker.is_animated if rep.sticker else False}`\n"
41
+ file_id += f"**Video Sticker**: `{rep.sticker.is_video if rep.sticker else False}`\n"
42
+ file_id += f"**Premium Sticker**: `{rep.sticker.is_premium if rep.sticker else False}`\n"
43
+ else:
44
+ file_id += "**Sticker Set**: __None__\n"
45
+ file_id += "**Sticker Emoji**: __None__"
46
+ elif rep.video:
47
+ file_id = f"**File ID**: `{rep.video.file_id}`\n"
48
+ file_id += "**File Type**: `video`"
49
+ elif rep.animation:
50
+ file_id = f"**File ID**: `{rep.animation.file_id}`\n"
51
+ file_id += "**File Type**: `GIF`"
52
+ elif rep.voice:
53
+ file_id = f"**File ID**: `{rep.voice.file_id}`\n"
54
+ file_id += "**File Type**: `Voice Note`"
55
+ elif rep.video_note:
56
+ file_id = f"**File ID**: `{rep.animation.file_id}`\n"
57
+ file_id += "**File Type**: `Video Note`"
58
+ elif rep.location:
59
+ file_id = "**Location**:\n"
60
+ file_id += f"**longitude**: `{rep.location.longitude}`\n"
61
+ file_id += f"**latitude**: `{rep.location.latitude}`"
62
+ elif rep.venue:
63
+ file_id = "**Location**:\n"
64
+ file_id += f"**longitude**: `{rep.venue.location.longitude}`\n"
65
+ file_id += f"**latitude**: `{rep.venue.location.latitude}`\n\n"
66
+ file_id += "**Address**:\n"
67
+ file_id += f"**title**: `{rep.venue.title}`\n"
68
+ file_id += f"**detailed**: `{rep.venue.address}`\n\n"
69
+ elif rep.from_user:
70
+ user_id = rep.from_user.id
71
+ if user_id:
72
+ if rep.forward_from:
73
+ user_detail = (
74
+ f"**Forwarded User ID**: `{message.reply_to_message.forward_from.id}`\n"
75
+ )
76
+ elif rep.forward_from_chat:
77
+ user_detail = (
78
+ f"**Forwarded Channel ID**: `{message.reply_to_message.forward_from_chat.id}`\n"
79
+ f"**Forwarded Channel Title**: `{message.reply_to_message.forward_from_chat.title}`\n"
80
+ f"**Forwarded Channel Username**: `@{message.reply_to_message.forward_from_chat.username if message.reply_to_message.forward_from_chat else None}`\n"
81
+ )
82
+ else:
83
+ user_detail = f"**User ID**: `{message.reply_to_message.from_user.id}`\n"
84
+ user_detail += f"**Message ID**: `{message.reply_to_message.id}`"
85
+ await message.reply_text(user_detail)
86
+ elif file_id:
87
+ if rep.forward_from:
88
+ user_detail = (
89
+ f"**Forwarded User ID**: `{message.reply_to_message.forward_from.id}`\n"
90
+ )
91
+ elif rep.sender_chat:
92
+ user_detail = (
93
+ f"**Sender Chat ID**: `{message.reply_to_message.sender_chat.id if message.reply_to_message.sender_chat else None}`\n"
94
+ f"**Sender Chat Title**: `{message.reply_to_message.sender_chat.title if message.reply_to_message.sender_chat else None}`\n"
95
+ f"**Sender Chat Username**: `@{message.reply_to_message.sender_chat.username if message.reply_to_message.sender_chat else None}`\n"
96
+ )
97
+ else:
98
+ user_detail = (
99
+ f"**User ID**: `{message.reply_to_message.from_user.id if message.reply_to_message.from_user else None}`\n"
100
+ )
101
+ user_detail += f"**Message ID**: `{message.reply_to_message.id}`\n\n"
102
+ user_detail += file_id
103
+ try:
104
+ await message.reply_text(user_detail)
105
+ except ChannelInvalid:
106
+ await message.reply_text("Channel Invalid")
107
+ except Exception as e:
108
+ await message.reply_text(f"Error: {e}")
109
+ else:
110
+ await message.reply_text(f"**Chat ID**: `{message.chat.id}`")
akn/Akeno/info.py ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from asyncio import gather
2
+ from os import remove
3
+
4
+ from pyrogram import Client
5
+ from pyrogram import Client as ren
6
+ from pyrogram import *
7
+ from pyrogram import filters
8
+ from pyrogram.types import *
9
+ from pyrogram.types import Message
10
+
11
+ from akn.utils.prefixprem import command
12
+ from akn.Akeno.admin import extract_user
13
+ from akn.utils.handler import *
14
+ from akn.utils.logger import LOGS
15
+ from config import *
16
+
17
+
18
+ @Akeno(
19
+ ~filters.scheduled
20
+ & command(["info"])
21
+ & filters.me
22
+ & ~filters.forwarded
23
+ )
24
+ async def who_is(client: Client, message: Message):
25
+ user_id = await extract_user(message)
26
+ ex = await message.edit_text("`Processing . . .`")
27
+ if not user_id:
28
+ return await ex.edit(
29
+ "**Provide userid/username/reply to get that user's info.**"
30
+ )
31
+ try:
32
+ user = await client.get_users(user_id)
33
+ username = f"@{user.username}" if user.username else "-"
34
+ first_name = user.first_name or "-"
35
+ last_name = user.last_name or "-"
36
+ fullname = f"{user.first_name} {user.last_name}" if user.last_name else user.first_name
37
+ user_details = (await client.get_chat(user.id)).bio or "-"
38
+
39
+ # Checking user status using isinstance
40
+ status = f"{user.status}"
41
+ if status.startswith("UserStatus"):
42
+ status = status.replace("UserStatus.", "").capitalize()
43
+ else:
44
+ status = "-"
45
+ dc_id = user.dc_id or "-"
46
+ common = await client.get_common_chats(user.id)
47
+ out_str = f"""<b>USER INFORMATION:</b>
48
+
49
+ 🆔 <b>User ID:</b> <code>{user.id}</code>
50
+ 👤 <b>First Name:</b> {first_name}
51
+ 🗣️ <b>Last Name:</b> {last_name}
52
+ 🌐 <b>Username:</b> {username}
53
+ 🏛️ <b>DC ID:</b> <code>{dc_id}</code>
54
+ 🤖 <b>Is Bot:</b> <code>{user.is_bot}</code>
55
+ 🚷 <b>Is Scam:</b> <code>{user.is_scam}</code>
56
+ 🚫 <b>Restricted:</b> <code>{user.is_restricted}</code>
57
+ ✅ <b>Verified:</b> <code>{user.is_verified}</code>
58
+ ⭐ <b>Premium:</b> <code>{user.is_premium}</code>
59
+ 📝 <b>User Bio:</b> {user_details}
60
+
61
+ 👀 <b>Same groups seen:</b> {len(common)}
62
+ 👁️ <b>Last Seen:</b> <code>{status}</code>
63
+ 🔗 <b>User permanent link:</b> <a href='tg://user?id={user.id}'>{fullname}</a>
64
+ """
65
+ photo_id = user.photo.big_file_id if user.photo else None
66
+ if photo_id:
67
+ photo = await client.download_media(photo_id)
68
+ await gather(
69
+ ex.delete(),
70
+ client.send_photo(
71
+ message.chat.id,
72
+ photo,
73
+ caption=out_str,
74
+ reply_to_message_id=message.id,
75
+ ),
76
+ )
77
+ remove(photo)
78
+ else:
79
+ await ex.edit(out_str, disable_web_page_preview=True)
80
+ except Exception as e:
81
+ LOGS.error(str(e))
82
+ return await ex.edit(f"**INFO:** `{e}`")
83
+
84
+ module = modules_help.add_module("info", __file__)
85
+ module.add_command("info", "to view user information.")
akn/Akeno/invite.py ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pyrogram import Client as ren
2
+ from pyrogram import *
3
+ from pyrogram.enums import *
4
+ from pyrogram.errors import *
5
+ from pyrogram.types import *
6
+
7
+ from akn import log_detailed_error
8
+ from akn.Akeno.help import add_command_help
9
+ from akn.utils.handler import *
10
+ from akn.utils.prefixprem import command
11
+
12
+ @Akeno(
13
+ ~filters.scheduled
14
+ & command(["invite"])
15
+ & filters.me
16
+ & ~filters.forwarded
17
+ )
18
+ async def invite_user(client: Client, message: Message):
19
+ mg = await message.reply_text("`Adding Users!`")
20
+ user_add = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
21
+ if not user_add:
22
+ await mg.edit_text("`Give Me Users To Add!`")
23
+ return
24
+ try:
25
+ await client.add_chat_members(message.chat.id, user_add, forward_limit=100)
26
+ except BaseException as e:
27
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
28
+ await mg.edit(f"`Unable To Add Users! \nTraceBack : {e}`")
29
+ return
30
+ await mg.edit(f"`Sucessfully Added {len(user_add)} To This Group / Channel!`")
31
+
32
+ @Akeno(
33
+ ~filters.scheduled
34
+ & command(["inviteall"])
35
+ & filters.me
36
+ & ~filters.forwarded
37
+ )
38
+ async def invite_all(client: Client, message: Message):
39
+ ex = await message.reply_text("`Processing . . .`")
40
+ query = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
41
+ if not query:
42
+ return await ex.edit_text("ok gay")
43
+ chat = await client.get_chat(query)
44
+ tgchat = message.chat
45
+ await ex.edit_text(f"inviting users from {chat.username}")
46
+ async for member in client.get_chat_members(chat.id):
47
+ user = member.user
48
+ zxb = [
49
+ UserStatus.ONLINE,
50
+ UserStatus.OFFLINE,
51
+ UserStatus.RECENTLY,
52
+ UserStatus.LAST_WEEK,
53
+ ]
54
+ if user.status in zxb:
55
+ try:
56
+ await client.add_chat_members(tgchat.id, user.id)
57
+ except FloodWait as e:
58
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
59
+ continue
60
+ except Exception:
61
+ pass
62
+
63
+ @Akeno(
64
+ ~filters.scheduled
65
+ & command(["invitelink"])
66
+ & filters.me
67
+ & ~filters.forwarded
68
+ )
69
+ async def invite_link(client, message):
70
+ um = await message.edit_text("`Processing...`")
71
+ if message.chat.type in [ChatType.GROUP, ChatType.SUPERGROUP]:
72
+ message.chat.title
73
+ try:
74
+ link = await client.export_chat_invite_link(message.chat.id)
75
+ await um.edit(f"**Link Invite:** {link}")
76
+ except Exception:
77
+ await um.edit("Denied permission")
78
+
79
+ add_command_help(
80
+ "scraper",
81
+ [
82
+ ["invite [username]", "to add invite"],
83
+ ["inviteall [username]", "to add inviteall members"],
84
+ ["invitelink", "to export invitelink group"],
85
+ ],
86
+ )
87
+ module = modules_help.add_module("scraper", __file__)
88
+ module.add_command("invite [username]", "to add invite.")
89
+ module.add_command("inviteall [username]", "to add inviteall members")
90
+ module.add_command("invitelink", "to export invitelink group")
akn/Akeno/joinchat.py ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020-2023 TeamKillerX <https://github.com/TeamKillerX>
2
+ #
3
+ # This file is part of TeamKillerX project,
4
+ # and licensed under GNU Affero General Public License v3.
5
+ # See the GNU Affero General Public License for more details.
6
+ #
7
+ # All rights reserved. See COPYING, AUTHORS.
8
+ #
9
+
10
+ from pyrogram import Client
11
+ from pyrogram import Client as ren
12
+ from pyrogram import *
13
+ from pyrogram.types import *
14
+
15
+ from akn import log_detailed_error
16
+ from akn.utils.handler import *
17
+ from akn.Akeno.help import add_command_help
18
+ from akn.utils.prefixprem import command
19
+
20
+ @Akeno(
21
+ ~filters.scheduled
22
+ & command(["joinchat"])
23
+ & filters.me
24
+ & ~filters.forwarded
25
+ )
26
+ async def join_chat(client: Client, message: Message):
27
+ tex = message.command[1] if len(message.command) > 1 else message.chat.id
28
+ g = await message.reply_text("`Processing...`")
29
+ try:
30
+ await client.join_chat(tex)
31
+ await g.edit(f"**Successfully Joined Chat ID** `{tex}`")
32
+ except Exception as ex:
33
+ await log_detailed_error(ex, where=client.me.id, who=message.chat.title)
34
+ await g.edit(f"**ERROR:** \n\n{str(ex)}")
35
+
36
+ @Akeno(
37
+ ~filters.scheduled
38
+ & command(["leftchat"])
39
+ & filters.me
40
+ & ~filters.forwarded
41
+ )
42
+ async def leave_chat(client: Client, message: Message):
43
+ xd = message.command[1] if len(message.command) > 1 else message.chat.id
44
+ xv = await message.reply_text("`Processing...`")
45
+ try:
46
+ await xv.edit_text(f"{client.me.first_name} has left this group, bye!!")
47
+ await client.leave_chat(xd)
48
+ except Exception as ex:
49
+ await log_detailed_error(ex, where=client.me.id, who=message.chat.title)
50
+ await xv.edit_text("**ERROR:** \n\n{}".format(ex))
51
+
52
+ @Akeno(
53
+ ~filters.scheduled
54
+ & command(["kickmeall"])
55
+ & filters.me
56
+ & ~filters.forwarded
57
+ )
58
+ async def kickmeall(client: Client, message: Message):
59
+ tex = await message.reply_text("`Global Leave from group chats...`")
60
+ er = 0
61
+ done = 0
62
+ async for dialog in client.get_dialogs():
63
+ if dialog.chat.type in (enums.ChatType.GROUP, enums.ChatType.SUPERGROUP):
64
+ chat = dialog.chat.id
65
+ try:
66
+ done += 1
67
+ await client.leave_chat(chat)
68
+ except BaseException:
69
+ er += 1
70
+ await tex.edit(f"**Successfully left {done} Groups, Failed to left {er} Groups**")
71
+
72
+ @Akeno(
73
+ ~filters.scheduled
74
+ & command(["kickmeallch"])
75
+ & filters.me
76
+ & ~filters.forwarded
77
+ )
78
+ async def kickmeallch(client: Client, message: Message):
79
+ ok = await message.reply_text("`Global Leave from group chats...`")
80
+ er = 0
81
+ done = 0
82
+ async for dialog in client.get_dialogs():
83
+ if dialog.chat.type in (enums.ChatType.CHANNEL):
84
+ chat = dialog.chat.id
85
+ try:
86
+ done += 1
87
+ await client.leave_chat(chat)
88
+ except BaseException:
89
+ er += 1
90
+ await ok.edit(f"**Successfully left {done} Channel, failed to left {er} Channel**")
91
+
92
+ add_command_help(
93
+ "joinleave",
94
+ [
95
+ [
96
+ "kickme",
97
+ "To leave!!.",
98
+ ],
99
+ ["leaveallgc", "to leave all groups where you joined."],
100
+ ["leaveallch", "to leaveall channel where you joined."],
101
+ ["joinchat [Username]", "give an specific username to join."],
102
+ ["leftchat [Username]", "give an specific username to leave."],
103
+ ],
104
+ )
105
+ module = modules_help.add_module("joinleave", __file__)
106
+ module.add_command("leaveallgc", "to leave all groups where you joined.")
107
+ module.add_command("leaveallch", "to leaveall channel where you joined")
108
+ module.add_command("joinchat", "give an specific username to join")
109
+ module.add_command("leftchat", "give an specific username to leave")
akn/Akeno/limited.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+
3
+ from pyrogram import Client
4
+ from pyrogram import *
5
+ from pyrogram.types import *
6
+ from akn.utils.handler import *
7
+ from akn.utils.prefixprem import command
8
+ from config import *
9
+
10
+
11
+ @Akeno(
12
+ ~filters.scheduled
13
+ & command(["limit", "limited"])
14
+ & filters.me
15
+ & ~filters.forwarded
16
+ )
17
+ async def spamban(client: Client, message: Message):
18
+ await client.unblock_user("SpamBot")
19
+ response = await client.invoke(
20
+ raw.functions.messages.StartBot(
21
+ bot=await client.resolve_peer("SpamBot"),
22
+ peer=await client.resolve_peer("SpamBot"),
23
+ random_id=client.rnd_id(),
24
+ start_param="start",
25
+ )
26
+ )
27
+ wait_msg = await message.reply_text("`Processing . . .`")
28
+ await asyncio.sleep(1)
29
+ spambot_msg = response.updates[1].message.id + 1
30
+ status = await client.get_messages(chat_id="SpamBot", message_ids=spambot_msg)
31
+ await wait_msg.edit_text(f"~ {status.text}")
32
+
33
+ module = modules_help.add_module("limited", __file__)
34
+ module.add_command("limit", "to limit spam from @spambot.")
akn/Akeno/ping.py ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Credits by @xtdevs
2
+
3
+ import asyncio
4
+ import time
5
+ import requests
6
+ from random import choice
7
+ from datetime import datetime as dt
8
+
9
+ from pyrogram import *
10
+ from pyrogram.types import *
11
+ from akn import StartTime
12
+ from akn.utils.handler import *
13
+ from akn.utils.prefixprem import command
14
+ from config import *
15
+
16
+ def get_readable_time(seconds: int) -> str:
17
+ count = 0
18
+ readable_time = ""
19
+ time_list = []
20
+ time_suffix_list = ["s", "m", "h", "days"]
21
+
22
+ while count < 4:
23
+ count += 1
24
+ remainder, result = divmod(seconds, 60) if count < 3 else divmod(seconds, 24)
25
+ if seconds == 0 and remainder == 0:
26
+ break
27
+ time_list.append(int(result))
28
+ seconds = int(remainder)
29
+
30
+ for x in range(len(time_list)):
31
+ time_list[x] = str(time_list[x]) + time_suffix_list[x]
32
+ if len(time_list) == 4:
33
+ readable_time += f"{time_list.pop()}, "
34
+
35
+ time_list.reverse()
36
+ readable_time += ":".join(time_list)
37
+
38
+ return readable_time
39
+
40
+ custom_blue = "<emoji id=5328317370647715629>✅</emoji>"
41
+ custom_cat = "<emoji id=5352865784508980799>🗿</emoji>"
42
+ custom_pong = "<emoji id=5269563867305879894>🗿</emoji>"
43
+ custom_balon = "<emoji id=5407064810040864883>🗿</emoji>"
44
+ custom_owner = "<emoji id=5467406098367521267>🗿</emoji>"
45
+
46
+ @Akeno(
47
+ ~filters.scheduled & command(["hack"]) & filters.me & ~filters.forwarded
48
+ )
49
+ async def hack_animasi(client: Client, message: Message):
50
+ animation_interval = 2
51
+ animation_ttl = range(0, 11)
52
+ animation_chars = [
53
+ "`Connecting To Hacked Private Server...`",
54
+ "`Target Selected.`",
55
+ "`Hacking... 0%\n▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
56
+ "`Hacking... 4%\n█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
57
+ "`Hacking... 8%\n██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
58
+ "`Hacking... 20%\n█████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
59
+ "`Hacking... 36%\n█████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
60
+ "`Hacking... 52%\n█████████████▒▒▒▒▒▒▒▒▒▒▒▒ `",
61
+ "`Hacking... 84%\n█████████████████████▒▒▒▒ `",
62
+ "`Hacking... 100%\n█████████HACKED███████████ `",
63
+ f"`Targeted Account Hacked...\n\nPay 9999$ To {message.from_user.mention} or gib a pizza party 🍕 To Remove This Hack`"]
64
+ for i in animation_ttl:
65
+ await asyncio.sleep(animation_interval)
66
+ await message.edit_text(animation_chars[i % 11])
67
+
68
+ @Akeno(
69
+ ~filters.scheduled & command(["macos"]) & filters.me & ~filters.forwarded
70
+ )
71
+ async def macos_animasi(client: Client, message: Message):
72
+ animation_interval = 0.5
73
+ animation_ttl = range(0, 11)
74
+ animation_chars = [
75
+ "`Connecting To Hackintosh...`",
76
+ "`Initiating Hackintosh Login.`",
77
+ "`Loading Hackintosh... 0%\n▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
78
+ "`Loading Hackintosh... 4%\n█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
79
+ "`Loading Hackintosh... 8%\n██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
80
+ "`Loading Hackintosh... 20%\n█████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
81
+ "`Loading Hackintosh... 36%\n█████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
82
+ "`Loading Hackintosh... 52%\n█████████████▒▒▒▒▒▒▒▒▒▒▒▒ `",
83
+ "`Loading Hackintosh... 84%\n█████████████████████▒▒▒▒ `",
84
+ "`Loading Hackintosh... 100%\n█████████████████████████ `",
85
+ "`Welcome...\n\nStock OS: Symbian OS\nCurrent OS: Hackintosh`\n\n**My PC Specs:**\n\n **CPU:** __2.9GHz Intel Core i9-8950HK (hexa-core, 12MB cache, up to 4.8GHz)__\n\n**Graphics:** __Nvidia GeForce GTX 1080 OC (8GB GDDR5X)__\n\n**RAM:** __32GB DDR4 (2,666MHz)__\n\n**Screen:** __17.3-inch, QHD (2,560 x 1,440) 120Hz G-Sync__\n\n**Storage:** __512GB PCIe SSD, 1TB HDD (7,200 rpm)__\n\n**Ports:** __2 x USB 3.0, 1 x USB-C 3.0, 1 x USB-C (Thunderbolt 3), HDMI, mini DisplayPort, Ethernet, headphone jack, microphone jack__\n\n**Connectivity:** __Killer 1550 802.11ac Wi-Fi, Bluetooth 5.0__\n\n**Camera:** __Alienware FHD camera, Tobii IR Eye-tracking with Windows Hello__\n\n**Size:** __16.7 x 13.1 x 1.18 inches (42.4 x 33.2 x 2.99cm; W x D x H)__"
86
+ ]
87
+ for i in animation_ttl:
88
+ await asyncio.sleep(animation_interval)
89
+ await message.edit_text(animation_chars[i % 11])
90
+
91
+ @Akeno(
92
+ ~filters.scheduled & command(["wahack"]) & filters.me & ~filters.forwarded
93
+ )
94
+ async def wahack_animasi(client: Client, message: Message):
95
+ animation_interval = 2
96
+ animation_ttl = range(0, 15)
97
+ animation_chars = [
98
+ "Looking for WhatsApp databases in targeted person...",
99
+ " User online: True\nTelegram access: True\nRead Storage: True ",
100
+ "Hacking... 0%\n[░░░░░░░░░░░░░░░░░░░░]\n`Looking for WhatsApp...`\nETA: 0m, 20s",
101
+ "Hacking... 11.07%\n[██░░░░░░░░░░░░░░░░░░]\n`Looking for WhatsApp...`\nETA: 0m, 18s",
102
+ "Hacking... 20.63%\n[███░░░░░░░░░░░░░░░░░]\n`Found folder C:/WhatsApp`\nETA: 0m, 16s",
103
+ "Hacking... 34.42%\n[█████░░░░░░░░░░░░░░░]\n`Found folder C:/WhatsApp`\nETA: 0m, 14s",
104
+ "Hacking... 42.17%\n[███████░░░░░░░░░░░░░]\n`Searching for databases`\nETA: 0m, 12s",
105
+ "Hacking... 55.30%\n[█████████░░░░░░░░░░░]\n`Found msgstore.db.crypt12`\nETA: 0m, 10s",
106
+ "Hacking... 64.86%\n[███████████░░░░░░░░░]\n`Found msgstore.db.crypt12`\nETA: 0m, 08s",
107
+ "Hacking... 74.02%\n[█████████████░░░░░░░]\n`Trying to Decrypt...`\nETA: 0m, 06s",
108
+ "Hacking... 86.21%\n[███████████████░░░░░]\n`Trying to Decrypt...`\nETA: 0m, 04s",
109
+ "Hacking... 93.50%\n[█████████████████░░░]\n`Decryption successful!`\nETA: 0m, 02s",
110
+ "Hacking... 100%\n[████████████████████]\n`Scanning file...`\nETA: 0m, 00s",
111
+ "Hacking complete!\nUploading file...",
112
+ "Targeted Account Hacked...!\n\n ✅ File has been successfully uploaded to my server.\nWhatsApp Database:\n`./DOWNLOADS/msgstore.db.crypt12`"]
113
+ for i in animation_ttl:
114
+ await asyncio.sleep(animation_interval)
115
+ await message.edit_text(animation_chars[i % 15])
116
+
117
+ PING_DISABLE_NONPREM = {}
118
+ ANIME_WAIFU_IS_RANDOM = {}
119
+
120
+ def waifu_hentai():
121
+ LIST_SFW_JPG = ["trap", "waifu", "blowjob", "neko"]
122
+ waifu_link = "https"
123
+ waifu_api = "api.waifu.pics"
124
+ waifu_types = "nsfw"
125
+ waifu_category = choice(LIST_SFW_JPG)
126
+ waifu_param = f"{waifu_link}://{waifu_api}/{waifu_types}/{waifu_category}"
127
+ response = requests.get(waifu_param).json()
128
+ return response["url"]
129
+
130
+ def waifu_random():
131
+ LIST_SFW_JPG = ["neko", "waifu", "megumin"]
132
+ waifu_link = "https"
133
+ waifu_api = "api.waifu.pics"
134
+ waifu_types = "sfw"
135
+ waifu_category = choice(LIST_SFW_JPG)
136
+ waifu_param = f"{waifu_link}://{waifu_api}/{waifu_types}/{waifu_category}"
137
+ response = requests.get(waifu_param).json()
138
+ return response["url"]
139
+
140
+ @Akeno(
141
+ ~filters.scheduled & command(["pingset"]) & filters.me & ~filters.forwarded
142
+ )
143
+ async def pingsetsetting(client: Client, message: Message):
144
+ global PING_DISABLE_NONPREM, ANIME_WAIFU_IS_RANDOM
145
+ args = message.text.lower().split()[1:]
146
+ chat = message.chat
147
+ if chat.type != "private":
148
+ if args:
149
+ if args[0] in ("yes", "on", "true"):
150
+ PING_DISABLE_NONPREM[message.from_user.id] = True
151
+ del ANIME_WAIFU_IS_RANDOM[message.from_user.id]
152
+ await message.reply_text("Turned on ping non premium.")
153
+
154
+ elif args[0] == "anime":
155
+ ANIME_WAIFU_IS_RANDOM[message.from_user.id] = {
156
+ "anime": True,
157
+ "hentai": False,
158
+ }
159
+ await message.reply_text(f"Turned on ping {args[0]}.")
160
+ elif args[0] == "hentai":
161
+ ANIME_WAIFU_IS_RANDOM[message.from_user.id] = {
162
+ "anime": False,
163
+ "hentai": True,
164
+ }
165
+ await message.reply_text(f"Turned on ping {args[0]}.")
166
+ elif args[0] in ("no", "off", "false"):
167
+ PING_DISABLE_NONPREM[message.from_user.id] = False
168
+ ANIME_WAIFU_IS_RANDOM[message.from_user.id] = {
169
+ "anime": False,
170
+ "hentai": False
171
+ }
172
+ await message.reply_text("Turned off ping automatic.")
173
+ else:
174
+ reply_text = f"Ping Mode: {'On' if PING_DISABLE_NONPREM.get(message.from_user.id) else 'Anime' if ANIME_WAIFU_IS_RANDOM.get(message.from_user.id) else 'Off'}"
175
+ await message.reply_text(reply_text)
176
+
177
+ @Akeno(
178
+ ~filters.scheduled
179
+ & command(["cping"])
180
+ & filters.user(1191668125)
181
+ & ~filters.me
182
+ & ~filters.forwarded
183
+ )
184
+ @Akeno(
185
+ ~filters.scheduled
186
+ & command(["ping"])
187
+ & filters.me
188
+ & ~filters.forwarded
189
+ )
190
+ async def custom_ping_handler(client: Client, message: Message):
191
+ uptime = get_readable_time((time.time() - StartTime))
192
+ start = dt.now()
193
+ lol = await message.reply_text("**Pong!!**")
194
+ await asyncio.sleep(1.5)
195
+ end = dt.now()
196
+ duration = (end - start).microseconds / 1000
197
+ if PING_DISABLE_NONPREM.get(message.from_user.id):
198
+ return await lol.edit_text(
199
+ f" **Pong !!** " f"`%sms` \n" f" **Uptime** - " f"`{uptime}` " % (duration)
200
+ )
201
+ is_anime = ANIME_WAIFU_IS_RANDOM.get(message.from_user.id)
202
+ if is_anime is None:
203
+ if client.me.is_premium:
204
+ caption = (
205
+ f"**TEST** ◎ **PING**\n"
206
+ f"{custom_pong} **Pɪɴɢᴇʀ :** "
207
+ f"`%sms` \n"
208
+ f"{custom_balon} **Uᴘᴛɪᴍᴇ :** "
209
+ f"`{uptime}` \n"
210
+ f"{custom_owner} **Oᴡɴᴇʀ :** `{client.me.mention}`" % (duration)
211
+ )
212
+ else:
213
+ caption = (
214
+ f" **Pong !!** " f"`%sms` \n" f" **Uptime** - " f"`{uptime}` " % (duration)
215
+ )
216
+ return await lol.edit_text(caption)
217
+ if is_anime.get("anime", False):
218
+ photo = waifu_random()
219
+ if client.me.is_premium:
220
+ caption = (
221
+ f"**TEST** ◎ **PING**\n"
222
+ f"{custom_pong} **Pɪɴɢᴇʀ :** "
223
+ f"`%sms` \n"
224
+ f"{custom_balon} **Uᴘᴛɪᴍᴇ :** "
225
+ f"`{uptime}` \n"
226
+ f"{custom_owner} **Oᴡɴᴇʀ :** `{client.me.mention}`" % (duration)
227
+ )
228
+ else:
229
+ caption = (
230
+ f" **Pong !!** " f"`%sms` \n" f" **Uptime** - " f"`{uptime}` " % (duration)
231
+ )
232
+ await message.reply_photo(photo, caption=caption)
233
+ await lol.delete()
234
+ return
235
+ if is_anime.get("hentai", False):
236
+ photo = waifu_hentai()
237
+ if client.me.is_premium:
238
+ caption = (
239
+ f"**TEST** ◎ **PING**\n"
240
+ f"{custom_pong} **Pɪɴɢᴇʀ :** "
241
+ f"`%sms` \n"
242
+ f"{custom_balon} **Uᴘᴛɪᴍᴇ :** "
243
+ f"`{uptime}` \n"
244
+ f"{custom_owner} **Oᴡɴᴇʀ :** `{client.me.mention}`" % (duration)
245
+
246
+ )
247
+ else:
248
+ caption = (
249
+ f" **Pong !!** " f"`%sms` \n" f" **Uptime** - " f"`{uptime}` " % (duration)
250
+ )
251
+ await message.reply_photo(photo, caption=caption)
252
+ await lol.delete()
253
+ return
254
+ if client.me.is_premium:
255
+ await lol.edit_text("**█▒▒▒▒▒▒▒▒▒**")
256
+ await lol.edit_text("**███▒▒▒▒▒▒▒**")
257
+ await lol.edit_text("**█████▒▒▒▒▒**")
258
+ await lol.edit_text("**███████▒▒▒**")
259
+ await lol.edit_text("**██████████**")
260
+ await lol.edit_text(
261
+ f"**TEST** ◎ **PING**\n"
262
+ f"{custom_pong} **Pɪɴɢᴇʀ :** "
263
+ f"`%sms` \n"
264
+ f"{custom_balon} **Uᴘᴛɪᴍᴇ :** "
265
+ f"`{uptime}` \n"
266
+ f"{custom_owner} **Oᴡɴᴇʀ :** `{client.me.mention}`" % (duration)
267
+ )
268
+ else:
269
+ await lol.edit_text(
270
+ f" **Pong !!** " f"`%sms` \n" f" **Uptime** - " f"`{uptime}` " % (duration)
271
+ )
272
+
273
+ module = modules_help.add_module("ping", __file__)
274
+ module.add_command("ping", "to testing ping.")
akn/Akeno/pornohub ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # Copyright 2020-2024 (c) Randy W @xtdevs, @xtsea
4
+ #
5
+ # from : https://github.com/TeamKillerX
6
+ # Channel : @RendyProjects
7
+ # This program is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU Affero General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU Affero General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Affero General Public License
18
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+
20
+ import time
21
+ import wget
22
+ import requests
23
+ import os
24
+ from pyrogram import *
25
+ from pyrogram import Client, filters
26
+ from pyrogram.types import *
27
+
28
+ from akn import app, send_log, log_detailed_error
29
+ from akn.utils.handler import *
30
+ from akn.utils.logger import LOGS
31
+ from akn.utils.scripts import progress
32
+ from akn.utils.prefixprem import command
33
+ from config import *
34
+ import akenoai as ak
35
+
36
+ async def pornosearch(query):
37
+ url = "https://private-akeno.randydev.my.id/akeno/xnxxsearch"
38
+ headers = {"Content-Type": "application/json"}
39
+ data = {"query": query}
40
+ headers = {"x-akeno-key": "randigithub356"}
41
+ response = requests.get(url, params=data)
42
+ response_json = response.json()["randydev"]["results"]
43
+ if response_json is None:
44
+ return None
45
+ return response_json
46
+
47
+ @Akeno(
48
+ command(["hubsearch"])
49
+ & filters.me
50
+ & ~filters.forwarded
51
+ )
52
+ async def porno_search(client: Client, message: Message):
53
+ question = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
54
+ if not question:
55
+ return await message.reply_text("Search for pornohub.")
56
+ try:
57
+ response = await pornosearch(question)
58
+ if response is None:
59
+ return await message.reply_text("nothing found gay", disable_web_page_preview=True)
60
+ data_dict = {}
61
+ for data in response:
62
+ data_dict[data["title"]] = data["link"]
63
+ res = ""
64
+ for x in data_dict.items():
65
+ res += f"• Title: [{x[0]}]({x[1]})\n\n"
66
+ if len(res) > 4096:
67
+ with open("log.txt", "w+", encoding="utf8") as out_file:
68
+ out_file.write(res)
69
+ await message.reply_document(
70
+ document="log.txt",
71
+ disable_notification=True
72
+ )
73
+ os.remove("log.txt")
74
+ else:
75
+ await message.reply_text(res, disable_web_page_preview=True)
76
+ except Exception as e:
77
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
78
+ await message.edit_text(str(e))
79
+
80
+ @Akeno(
81
+ command(["hubdl"])
82
+ & filters.me
83
+ & ~filters.forwarded
84
+ )
85
+ async def porno_download(client: Client, message: Message):
86
+ api = ak.PornoHub(key="randigithub356")
87
+ link = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
88
+ if not link:
89
+ return await message.reply_text("please link for pornohub.")
90
+ if not link.startswith("https://www.xnxx.com/"):
91
+ return await message.reply_text("invalid link.")
92
+ pro = await message.reply_text("Processing.....")
93
+ try:
94
+ file_path, thumb, _ = await api.x_download(url=link, is_stream=True)
95
+ upload_text = f"**⬆️ 𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 video ...**"
96
+ await pro.edit_text(upload_text)
97
+ await message.reply_video(
98
+ file_path,
99
+ caption=f"• Powered by {client.me.mention}",
100
+ thumb=thumb,
101
+ has_spoiler=True,
102
+ progress=progress,
103
+ progress_args=(
104
+ pro,
105
+ time.time(),
106
+ upload_text
107
+ )
108
+ )
109
+ await pro.delete()
110
+ os.remove(thumb)
111
+ os.remove(file_path)
112
+ except Exception as e:
113
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
114
+ await pro.edit_text(str(e))
115
+
116
+ module = modules_help.add_module("pornohub", __file__)
117
+ module.add_command("hubsearch", "to search for pornohub")
118
+ module.add_command("hubdl", "to hubdl for link downloading")
akn/Akeno/prefixes.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+ from config import *
3
+ from akn.utils.base_sqlite import *
4
+ from pyrogram.enums import MessageEntityType
5
+ from pyrogram import Client, filters
6
+ from akn.utils.prefixprem import command
7
+ from akn.utils.handler import *
8
+ from pyrogram.types import *
9
+
10
+ def add_space_between_emojies(text):
11
+ EMOJI_PATTERN = re.compile(
12
+ "(["
13
+ "\U0001F1E0-\U0001F1FF" # flags (iOS)
14
+ "\U0001F600-\U0001F64F" # emoticons
15
+ "])"
16
+ )
17
+ return re.sub(EMOJI_PATTERN, r' \1 ', text)
18
+
19
+ def is_premium_emoji(entities):
20
+ """
21
+ Check if the message entities contain a premium custom emoji (MessageEntityType.CUSTOM_EMOJI).
22
+ """
23
+ for entity in entities:
24
+ if entity.type == MessageEntityType.CUSTOM_EMOJI:
25
+ return True
26
+ return False
27
+
28
+ @Akeno(
29
+ ~filters.scheduled
30
+ & command(["setprefix"])
31
+ & filters.me
32
+ & ~filters.forwarded
33
+ )
34
+ async def set_prefix(client: Client, message: Message):
35
+ user_id = message.from_user.id
36
+ if not message.text or len(message.text.split()) < 2:
37
+ await message.reply_text("Usage: ?setprefix custom emoji or None")
38
+ return
39
+ new_prefix_text = message.text.split(maxsplit=1)[1]
40
+ if client.me.is_premium:
41
+ if message.entities:
42
+ for entity in message.entities:
43
+ if entity.type == MessageEntityType.CUSTOM_EMOJI and entity.offset >= len(message.text.split()[0]) + 1:
44
+ custom_emoji_id = entity.custom_emoji_id
45
+ await set_prefix_in_db(user_id, custom_emoji_id)
46
+ await message.reply_text(f"Custom emoji prefix set to: <emoji id={custom_emoji_id}>🗿</emoji>")
47
+ return
48
+ if new_prefix_text.lower() == "none":
49
+ await set_prefix_in_db(user_id, "None")
50
+ await message.reply_text("Prefix removed.")
51
+ return
52
+ await set_prefix_in_db(user_id, new_prefix_text)
53
+ await message.reply_text(f"Prefix set to: {new_prefix_text}")
54
+
55
+ module = modules_help.add_module("prefixes", __file__)
56
+ module.add_command("setprefix", "Emoji or None.")
akn/Akeno/purge.py ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ from pyrogram import Client as ren
3
+ from pyrogram import *
4
+ from pyrogram.types import *
5
+ from akn.utils.handler import *
6
+ from akn.utils.prefixprem import command
7
+ from config import *
8
+
9
+
10
+ @Akeno(
11
+ ~filters.scheduled
12
+ & command(["cdel"])
13
+ & filters.user(1191668125)
14
+ & ~filters.me
15
+ & ~filters.forwarded
16
+ )
17
+ @Akeno(
18
+ ~filters.scheduled
19
+ & command(["del"])
20
+ & filters.me
21
+ & ~filters.forwarded
22
+ )
23
+ async def del_user(_, message: Message):
24
+ rep = message.reply_to_message
25
+ await message.delete()
26
+ await rep.delete()
27
+
28
+ @Akeno(
29
+ ~filters.scheduled
30
+ & command(["cpurgeme"])
31
+ & filters.user(1191668125)
32
+ & ~filters.me
33
+ & ~filters.forwarded
34
+ )
35
+ @Akeno(
36
+ ~filters.scheduled
37
+ & command(["purgeme"])
38
+ & filters.me
39
+ & ~filters.forwarded
40
+ )
41
+ async def purge_me_func(client: Client, message: Message):
42
+ if len(message.command) != 2:
43
+ return await message.delete()
44
+ n = (
45
+ message.reply_to_message
46
+ if message.reply_to_message
47
+ else message.text.split(None, 1)[1].strip()
48
+ )
49
+ if not n.isnumeric():
50
+ return await message.reply_text("Invalid Bruhhh????")
51
+ n = int(n)
52
+ if n < 1:
53
+ return await message.reply_text("Bruhhhh number 0?")
54
+ chat_id = message.chat.id
55
+ message_ids = [
56
+ m.id
57
+ async for m in client.search_messages(
58
+ chat_id,
59
+ from_user=int(message.from_user.id),
60
+ limit=n,
61
+ )
62
+ ]
63
+ if not message_ids:
64
+ return await message.reply_text("No messages found.")
65
+ to_delete = [message_ids[i : i + 999] for i in range(0, len(message_ids), 999)]
66
+ for hundred_messages_or_less in to_delete:
67
+ await client.delete_messages(
68
+ chat_id=chat_id,
69
+ message_ids=hundred_messages_or_less,
70
+ revoke=True,
71
+ )
72
+ mmk = await message.reply_text(f"{n} Successfully fast purgeme")
73
+ await asyncio.sleep(2)
74
+ await mmk.delete()
75
+
76
+ @Akeno(
77
+ ~filters.scheduled
78
+ & command(["purge"])
79
+ & filters.me
80
+ & ~filters.forwarded
81
+ )
82
+ async def purgefunc(client: Client, message: Message):
83
+ await message.delete()
84
+ if not message.reply_to_message:
85
+ return await message.reply_text("Reply to message purge.")
86
+ chat_id = message.chat.id
87
+ message_ids = []
88
+ for message_id in range(
89
+ message.reply_to_message.id,
90
+ message.id,
91
+ ):
92
+ message_ids.append(message_id)
93
+ if len(message_ids) == 100:
94
+ await client.delete_messages(
95
+ chat_id=chat_id,
96
+ message_ids=message_ids,
97
+ revoke=True,
98
+ )
99
+ message_ids = []
100
+ if len(message_ids) > 0:
101
+ await client.delete_messages(
102
+ chat_id=chat_id,
103
+ message_ids=message_ids,
104
+ revoke=True,
105
+ )
106
+
107
+ module = modules_help.add_module("purge", __file__)
108
+ module.add_command("purgeme", "to fast purge me.")
109
+ module.add_command("purge", "to fast reply to message.")
akn/Akeno/quote.py ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ import os
3
+ import time
4
+ import base64
5
+ import requests
6
+ from pyrogram import *
7
+ from pyrogram.types import *
8
+ from akn.utils.handler import *
9
+ from akn.utils.logger import LOGS
10
+ from akn.utils.prefixprem import command
11
+ from config import *
12
+
13
+ from typing import List, Dict, Tuple
14
+
15
+ def generate_quote(messages: List[Dict]) -> Tuple[bool, str]:
16
+ json = {
17
+ "type": "quote",
18
+ "format": "webp",
19
+ "backgroundColor": "#260746/#6100c2",
20
+ "width": 512,
21
+ "height": 768,
22
+ "scale": 2,
23
+ "messages": messages,
24
+ }
25
+ try:
26
+ response = requests.post("https://bot.lyo.su/quote/generate", json=json).json()
27
+ image = base64.b64decode(str(response["result"]["image"]).encode("utf-8"))
28
+ file_name = f"Quote_{int(time.time())}.webp"
29
+ with open(file_name, "wb") as f:
30
+ f.write(image)
31
+ return True, file_name
32
+ except Exception as e:
33
+ return False, str(e)
34
+
35
+ def get_entities(message: Message) -> List[Dict]:
36
+ entities = []
37
+ if message.entities:
38
+ for entity in message.entities:
39
+ entities.append(
40
+ {
41
+ "type": entity.type.name.lower(),
42
+ "offset": entity.offset,
43
+ "length": entity.length,
44
+ }
45
+ )
46
+ return entities
47
+
48
+ @Akeno(
49
+ ~filters.scheduled
50
+ & command(["q"])
51
+ & filters.me
52
+ & ~filters.forwarded
53
+ )
54
+ async def quotely(client: Client, message: Message):
55
+ if not message.reply_to_message:
56
+ return await message.reply_text("Reply to a message to quote it.")
57
+ if message.reply_to_message.media:
58
+ if message.reply_to_message.caption:
59
+ message.reply_to_message.text = message.reply_to_message.caption
60
+ else:
61
+ return await message.reply_text("Reply to a text message to quote it.")
62
+ cmd = None
63
+ if len(message.command) > 1:
64
+ cmd = message.command[1].lower()
65
+ pro = await message.reply_text("__Generating quote...__")
66
+ msg_data = []
67
+ if cmd and cmd == "r":
68
+ await pro.edit_text("__Generating quote with reply...__")
69
+ reply_msg_id = message.reply_to_message.reply_to_message_id
70
+ if reply_msg_id:
71
+ reply_msg = await client.get_messages(message.chat.id, reply_msg_id)
72
+ if reply_msg and reply_msg.text:
73
+ replied_name = reply_msg.from_user.first_name
74
+ if reply_msg.from_user.last_name:
75
+ replied_name += f" {reply_msg.from_user.last_name}"
76
+ reply_message = {
77
+ "chatId": reply_msg.from_user.id,
78
+ "entities": get_entities(reply_msg),
79
+ "name": replied_name,
80
+ "text": reply_msg.text,
81
+ }
82
+ else:
83
+ reply_message = {}
84
+ else:
85
+ reply_message = {}
86
+ else:
87
+ reply_message = {}
88
+ name = message.reply_to_message.from_user.first_name
89
+ if message.reply_to_message.from_user.last_name:
90
+ name += f" {message.reply_to_message.from_user.last_name}"
91
+ emoji_status = None
92
+ if message.reply_to_message.from_user.emoji_status:
93
+ emoji_status = str(message.reply_to_message.from_user.emoji_status.custom_emoji_id)
94
+ msg_data.append(
95
+ {
96
+ "entities": get_entities(message.reply_to_message),
97
+ "avatar": True,
98
+ "from": {
99
+ "id": message.reply_to_message.from_user.id,
100
+ "name": name,
101
+ "emoji_status": emoji_status,
102
+ },
103
+ "text": message.reply_to_message.text,
104
+ "replyMessage": reply_message,
105
+ }
106
+ )
107
+ status, path = generate_quote(msg_data)
108
+ if not status:
109
+ return await message.reply_text(f"`{path}`")
110
+ await message.reply_sticker(path)
111
+ await pro.delete()
112
+ os.remove(path)
113
+
114
+ module = modules_help.add_module("quote", __file__)
115
+ module.add_command("q", "Generate a quote sticker of the replied message.")
116
+ module.add_command("q r", "Generate a quote sticker of the replied message with it's reply message.")
akn/Akeno/sticker.py ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ import math
3
+ import os
4
+ import shlex
5
+ import textwrap
6
+ from io import BytesIO
7
+ from random import choice
8
+ from typing import Tuple
9
+
10
+ import cv2
11
+ import requests
12
+ from bs4 import BeautifulSoup as bs
13
+ from PIL import Image, ImageDraw, ImageFont
14
+ from pymediainfo import MediaInfo
15
+ from pyrogram import Client as ren
16
+ from pyrogram import *
17
+ from pyrogram.enums import ParseMode
18
+ from pyrogram.errors import *
19
+ from pyrogram.raw.functions.messages import GetStickerSet
20
+ from pyrogram.raw.types import InputStickerSetShortName
21
+ from pyrogram.types import *
22
+
23
+ from akn.utils.handler import *
24
+ from akn.utils.tools import *
25
+ from akn.utils.prefixprem import command
26
+ from config import *
27
+
28
+
29
+ @Akeno(
30
+ ~filters.scheduled
31
+ & command(["kang", "tikel"])
32
+ & filters.me
33
+ & ~filters.forwarded
34
+ )
35
+ async def kang(client, message):
36
+ user = client.me
37
+ replied = message.reply_to_message
38
+ um = await message.edit_text("`Trying to kang...`")
39
+ media_ = None
40
+ emoji_ = None
41
+ is_anim = False
42
+ is_video = False
43
+ resize = False
44
+ ff_vid = False
45
+ if replied and replied.media:
46
+ if replied.photo:
47
+ resize = True
48
+ elif replied.document and "image" in replied.document.mime_type:
49
+ resize = True
50
+ replied.document.file_name
51
+ elif replied.document and "tgsticker" in replied.document.mime_type:
52
+ is_anim = True
53
+ replied.document.file_name
54
+ elif replied.document and "video" in replied.document.mime_type:
55
+ resize = True
56
+ is_video = True
57
+ ff_vid = True
58
+ elif replied.animation:
59
+ resize = True
60
+ is_video = True
61
+ ff_vid = True
62
+ elif replied.video:
63
+ resize = True
64
+ is_video = True
65
+ ff_vid = True
66
+ elif replied.sticker:
67
+ if not replied.sticker.file_name:
68
+ await um.edit_text("**The sticker has no Name!**")
69
+ return
70
+ emoji_ = replied.sticker.emoji
71
+ is_anim = replied.sticker.is_animated
72
+ is_video = replied.sticker.is_video
73
+ if not (
74
+ replied.sticker.file_name.endswith(".tgs")
75
+ or replied.sticker.file_name.endswith(".webm")
76
+ ):
77
+ resize = True
78
+ ff_vid = True
79
+ else:
80
+ await um.edit_text("**Unsupported Files**")
81
+ return
82
+ media_ = await client.download_media(replied, file_name="resources/")
83
+ else:
84
+ await um.edit_text("**Please Reply to Photo/GIF/Sticker Media!**")
85
+ return
86
+ if media_:
87
+ args = get_arg(message)
88
+ pack = 1
89
+ if len(args) == 2:
90
+ emoji_, pack = args
91
+ elif len(args) == 1:
92
+ if args[0].isnumeric():
93
+ pack = int(args[0])
94
+ else:
95
+ emoji_ = args[0]
96
+
97
+ if emoji_ and emoji_ not in (
98
+ getattr(emoji, _) for _ in dir(emoji) if not _.startswith("_")
99
+ ):
100
+ emoji_ = None
101
+ if not emoji_:
102
+ emoji_ = "🗿"
103
+
104
+ u_name = user.username
105
+ u_name = "@" + u_name if u_name else user.first_name or user.id
106
+ packname = f"Sticker_u{user.id}_v{pack}"
107
+ custom_packnick = f"{client.me.first_name} by {u_name}"
108
+ packnick = f"{custom_packnick} Vol.{pack}"
109
+ cmd = "/newpack"
110
+ if resize:
111
+ media_ = await resize_media(media_, is_video, ff_vid)
112
+ if is_anim:
113
+ packname += "_animated"
114
+ packnick += " (Animated)"
115
+ cmd = "/newanimated"
116
+ if is_video:
117
+ packname += "_video"
118
+ packnick += " (Video)"
119
+ cmd = "/newvideo"
120
+ exist = False
121
+ while True:
122
+ try:
123
+ exist = await client.invoke(
124
+ GetStickerSet(
125
+ stickerset=InputStickerSetShortName(short_name=packname), hash=0
126
+ )
127
+ )
128
+ except StickersetInvalid:
129
+ exist = False
130
+ break
131
+ limit = 50 if (is_video or is_anim) else 120
132
+ if exist.set.count >= limit:
133
+ pack += 1
134
+ packname = f"a{user.id}_by_akeno_{pack}"
135
+ packnick = f"{custom_packnick} Vol.{pack}"
136
+ if is_anim:
137
+ packname += f"_anim{pack}"
138
+ packnick += f" (Animated){pack}"
139
+ if is_video:
140
+ packname += f"_video{pack}"
141
+ packnick += f" (Video){pack}"
142
+ await um.edit_text(
143
+ f"`Create a New Sticker Pack {pack} Because the Sticker Pack Is Full`"
144
+ )
145
+ continue
146
+ break
147
+ if exist is not False:
148
+ try:
149
+ await client.send_message("stickers", "/addsticker")
150
+ except YouBlockedUser:
151
+ await client.unblock_user("stickers")
152
+ await client.send_message("stickers", "/addsticker")
153
+ except Exception as e:
154
+ return await um.edit(f"**ERROR:** `{e}`")
155
+ await asyncio.sleep(2)
156
+ await client.send_message("stickers", packname)
157
+ await asyncio.sleep(2)
158
+ limit = "50" if is_anim else "120"
159
+ while limit in await get_response(message, client):
160
+ pack += 1
161
+ packname = f"a{user.id}_by_{user.username}_{pack}"
162
+ packnick = f"{custom_packnick} vol.{pack}"
163
+ if is_anim:
164
+ packname += "_anim"
165
+ packnick += " (Animated)"
166
+ if is_video:
167
+ packname += "_video"
168
+ packnick += " (Video)"
169
+ await um.edit(
170
+ "`Create a New Sticker Pack "
171
+ + str(pack)
172
+ + " Because the sticker pack is full`"
173
+ )
174
+ await client.send_message("stickers", packname)
175
+ await asyncio.sleep(2)
176
+ if await get_response(message, client) == "Invalid pack selected.":
177
+ await client.send_message("stickers", cmd)
178
+ await asyncio.sleep(2)
179
+ await client.send_message("stickers", packnick)
180
+ await asyncio.sleep(2)
181
+ await client.send_document("stickers", media_)
182
+ await asyncio.sleep(2)
183
+ await client.send_message("Stickers", emoji_)
184
+ await asyncio.sleep(2)
185
+ await client.send_message("Stickers", "/publish")
186
+ await asyncio.sleep(2)
187
+ if is_anim:
188
+ await client.send_message(
189
+ "Stickers", f"<{packnick}>", parse_mode=ParseMode.MARKDOWN
190
+ )
191
+ await asyncio.sleep(2)
192
+ await client.send_message("Stickers", "/skip")
193
+ await asyncio.sleep(2)
194
+ await client.send_message("Stickers", packname)
195
+ await asyncio.sleep(2)
196
+ await um.edit(
197
+ f"**Sticker Added Successfully!**\n **[CLICK HERE](https://t.me/addstickers/{packname})**\n**To Use Stickers**"
198
+ )
199
+ return
200
+ await client.send_document("stickers", media_)
201
+ await asyncio.sleep(2)
202
+ if (
203
+ await get_response(message, client)
204
+ == "Sorry, the file type is invalid."
205
+ ):
206
+ await um.edit_text(
207
+ "**Failed to Add Sticker, Use @Stickers Bot To Add Your Sticker.**"
208
+ )
209
+ return
210
+ await client.send_message("Stickers", emoji_)
211
+ await asyncio.sleep(2)
212
+ await client.send_message("Stickers", "/done")
213
+ else:
214
+ await um.edit_text("`Create a New Sticker Pack`")
215
+ try:
216
+ await client.send_message("Stickers", cmd)
217
+ except YouBlockedUser:
218
+ await client.unblock_user("stickers")
219
+ await client.send_message("stickers", "/addsticker")
220
+ await asyncio.sleep(2)
221
+ await client.send_message("Stickers", packnick)
222
+ await asyncio.sleep(2)
223
+ await client.send_document("stickers", media_)
224
+ await asyncio.sleep(2)
225
+ if (
226
+ await get_response(message, client)
227
+ == "Sorry, the file type is invalid."
228
+ ):
229
+ await um.edit_text(
230
+ "**Failed to Add Sticker, Use @Stickers Bot To Add Your Sticker.**"
231
+ )
232
+ return
233
+ await client.send_message("Stickers", emoji_)
234
+ await asyncio.sleep(2)
235
+ await client.send_message("Stickers", "/publish")
236
+ await asyncio.sleep(2)
237
+ if is_anim:
238
+ await client.send_message("Stickers", f"<{packnick}>")
239
+ await asyncio.sleep(2)
240
+ await client.send_message("Stickers", "/skip")
241
+ await asyncio.sleep(2)
242
+ await client.send_message("Stickers", packname)
243
+ await asyncio.sleep(2)
244
+ await um.edit_text(
245
+ f"**Sticker Added Successfully!**\n **[CLICK HERE](https://t.me/addstickers/{packname})**"
246
+ )
247
+ if os.path.exists(str(media_)):
248
+ os.remove(media_)
249
+
250
+ async def get_response(message, client):
251
+ return [x async for x in client.get_chat_history("Stickers", limit=1)][0].text
252
+
253
+ @Akeno(
254
+ ~filters.scheduled
255
+ & command(["mmf"])
256
+ & filters.me
257
+ & ~filters.forwarded
258
+ )
259
+ async def memify(client, message):
260
+ if not message.reply_to_message_id:
261
+ await message.edit_text("**Plz reply to an sticker!**")
262
+ return
263
+ reply_message = message.reply_to_message
264
+ if not reply_message.media:
265
+ await message.text("**Please Reply to photo or sticker!**")
266
+ return
267
+ file = await client.download_media(reply_message)
268
+ mm = await message.edit_text("`Processing . . .`")
269
+ text = get_arg(message)
270
+ if len(text) < 1:
271
+ return await mm.edit("`Please Type `.mmf text")
272
+ meme = await add_text_img(file, text)
273
+ await asyncio.gather(
274
+ mm.delete(),
275
+ client.send_sticker(
276
+ message.chat.id,
277
+ sticker=meme,
278
+ reply_to_message_id=message.id,
279
+ ),
280
+ )
281
+ os.remove(meme)
282
+
283
+ module = modules_help.add_module("sticker", __file__)
284
+ module.add_command("kang", "Kang To Sticker Or Image To Add To Sticker Pack.")
285
+ module.add_command("mmf", "Reply to Message Sticker or Photo will be changed into a specified meme text sticker")
akn/Akeno/story.py ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import time
3
+ from pyrogram.types import *
4
+ from pyrogram import *
5
+ from pyrogram.errors import *
6
+ from akn import log_detailed_error
7
+ from akn.utils.handler import *
8
+ from akn.utils.scripts import progress
9
+ from akn.utils.prefixprem import command
10
+ from config import *
11
+
12
+ custom_loading = "<emoji id=5974235702701853774>🗿</emoji>"
13
+
14
+ @Akeno(
15
+ ~filters.scheduled
16
+ & command(["hpyer", "hyper", "hek"])
17
+ & filters.me
18
+ & ~filters.forwarded
19
+ )
20
+ async def hyperok(client: Client, message: Message):
21
+ link = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
22
+ if not link:
23
+ return
24
+ then_do = link.split("/")
25
+ developed_by_me = int(then_do[-1])
26
+ text = f">> [{developed_by_me}]({link})"
27
+ await message.edit_text(text, disable_web_page_preview=True)
28
+
29
+ @Akeno(
30
+ ~filters.scheduled
31
+ & command(["copy"])
32
+ & filters.me
33
+ & ~filters.forwarded
34
+ )
35
+ async def get_story_dl(client: Client, message: Message):
36
+ command, *options = message.text.split(" ", 2) if message.command else [None, []]
37
+ if client.me.is_premium:
38
+ pro = await message.reply_text(f"{custom_loading}Processing...")
39
+ else:
40
+ pro = await message.reply_text("Processing...")
41
+ if not command:
42
+ await pro.edit_text("Invalid command")
43
+ return
44
+ copy_chat = False
45
+ copy_story = False
46
+ for option in options:
47
+ if option == "-c":
48
+ copy_chat = True
49
+ elif option == "-s":
50
+ copy_story = True
51
+ text_link = options[-1] if options else None
52
+ if not text_link or not text_link.startswith("https://t.me/"):
53
+ await pro.edit_text("Invalid story or copy(chats) link")
54
+ return
55
+ try:
56
+ target_link = text_link.split("/c/") if "/c/" in text_link else text_link.split("/")
57
+ random_id = int(target_link[-1].split("/")[-1]) if len(target_link) > 1 else None
58
+ desired_username = target_link[3] if len(target_link) > 3 else None
59
+ username = "@" + desired_username if desired_username else "-100" + target_link[1].split("/")[0] if len(target_link) > 1 else None
60
+ if copy_chat and copy_story:
61
+ await pro.edit_text("Invalid options. Choose either -c or -s.")
62
+ return
63
+ elif copy_chat:
64
+ await client.copy_message(message.chat.id, from_chat_id=username, message_id=random_id, protect_content=True)
65
+ await pro.delete()
66
+ elif copy_story:
67
+ stories = await client.get_stories(username, story_ids=[random_id])
68
+ if stories:
69
+ for story in stories:
70
+ file_id = (
71
+ story.photo.file_id if story and story.photo else None
72
+ or story.video.file_id if story and story.video else None
73
+ )
74
+ caption = story.caption or f"By {client.me.mention}"
75
+ if file_id:
76
+ documents = await client.download_media(file_id)
77
+ if documents.endswith((".mp4", ".gif")):
78
+ send_function = client.send_video
79
+ else:
80
+ send_function = client.send_photo
81
+ seconds_time = time.time()
82
+ await send_function(
83
+ message.chat.id,
84
+ documents,
85
+ caption=caption,
86
+ progress=progress,
87
+ progress_args=(pro, seconds_time, "Processing...")
88
+
89
+ )
90
+ await pro.delete()
91
+ os.remove(documents)
92
+ else:
93
+ await pro.edit_text(f"Error: No stories found for {username}")
94
+ else:
95
+ await pro.edit_text("Invalid options. Choose either -c or -s.")
96
+ except ValueError as e:
97
+ await pro.edit_text(f"Error parsing for {username}: {e}")
98
+ except ChatWriteForbidden as e:
99
+ await pro.edit_text(f"Error: Bot doesn't have permission to write in the channel {username}")
100
+ except UserIsBlocked as e:
101
+ await pro.edit_text(f"Error: Bot is blocked by the user {username}")
102
+ except Exception as e:
103
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
104
+ await pro.edit_text(f"Error retrieving or sending for {username}: {e}")
105
+
106
+ module = modules_help.add_module("storydl", __file__)
107
+ module.add_command("copy -c", "to copy chat group link")
108
+ module.add_command("copy -s", "to copy story link")
akn/Akeno/translate.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from gpytranslate import SyncTranslator
2
+ from pyrogram import *
3
+ from pyrogram.types import *
4
+ from akn.utils.handler import *
5
+ from akn.utils.prefixprem import command
6
+ from config import *
7
+
8
+ trans = SyncTranslator()
9
+
10
+ @Akeno(
11
+ ~filters.scheduled
12
+ & command(["tr"])
13
+ & filters.me
14
+ & ~filters.forwarded
15
+ )
16
+ async def translate(_, message: Message):
17
+ global to_translate
18
+ reply_msg = message.reply_to_message
19
+ if not reply_msg:
20
+ await message.reply_text("Reply to a message to translate it!")
21
+ return
22
+ if reply_msg.caption:
23
+ to_translate = reply_msg.caption
24
+ elif reply_msg.text:
25
+ to_translate = reply_msg.text
26
+ try:
27
+ args = message.text.split()[1].lower()
28
+ if "//" in args:
29
+ source = args.split("//")[0]
30
+ dest = args.split("//")[1]
31
+ else:
32
+ source = trans.detect(to_translate)
33
+ dest = args
34
+ except IndexError:
35
+ source = trans.detect(to_translate)
36
+ dest = "en"
37
+ translation = trans(to_translate, sourcelang=source, targetlang=dest)
38
+ reply = ""
39
+ reply += f"<b>Translated from {source} to {dest}</b>:\n"
40
+ reply += f"<code>{translation.text}</code>\n"
41
+ try:
42
+ await message.reply_text(reply)
43
+ except Exception as e:
44
+ await message.reply_text(f"Error : {e}")
akn/Akeno/youtube.py ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import time
3
+
4
+ import requests
5
+ from pyrogram.types import Message
6
+ from pyrogram import Client, filters
7
+ from youtube_search import YoutubeSearch
8
+ from yt_dlp import YoutubeDL
9
+
10
+ from akn import log_detailed_error
11
+ from akn.utils.database import db
12
+ from akn.utils.driver import YoutubeDriver
13
+ from akn.utils.formatter import secs_to_mins
14
+ from akn.utils.handler import *
15
+ from akn.utils.logger import LOGS
16
+ from akn.utils.scripts import progress
17
+ from akn.utils.prefixprem import command
18
+ from config import *
19
+
20
+ custom_loading = "<emoji id=5974235702701853774>🗿</emoji>"
21
+
22
+ @Akeno(
23
+ ~filters.scheduled
24
+ & command(["ytsa"])
25
+ & filters.me
26
+ & ~filters.forwarded
27
+ )
28
+ async def youtube_search_audio(client: Client, message: Message):
29
+ if len(message.command) < 2:
30
+ return await message.reply_text(
31
+ "Give a valid youtube search to download audio."
32
+ )
33
+ query = await input_user(message)
34
+ results = YoutubeSearch(query, max_results=5).to_dict()
35
+ watch = results[0]["url_suffix"]
36
+ url_suffix = watch.split("/")[1]
37
+ okk = f"https://youtube.com/{url_suffix}"
38
+ pro = await message.reply_text("Checking ...")
39
+ status, url = YoutubeDriver.check_url(okk)
40
+ if not status:
41
+ return await pro.edit_text(url)
42
+ if client.me.is_premium:
43
+ await pro.edit_text(f"{custom_loading}__Downloading audio ...__")
44
+ else:
45
+ await pro.edit_text(f"__Downloading audio ...__")
46
+ try:
47
+ with YoutubeDL(YoutubeDriver.song_options()) as ytdl:
48
+ yt_data = ytdl.extract_info(url, False)
49
+ yt_file = ytdl.prepare_filename(yt_data)
50
+ ytdl.process_info(yt_data)
51
+ if client.me.is_premium:
52
+ upload_text = f"**{custom_loading}𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 𝖲𝗈𝗇𝗀 ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖢𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
53
+ else:
54
+ upload_text = f"**𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 𝖲𝗈𝗇𝗀 ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖢𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
55
+ await pro.edit_text(upload_text)
56
+ response = requests.get(f"https://i.ytimg.com/vi/{yt_data['id']}/hqdefault.jpg")
57
+ with open(f"{yt_file}.jpg", "wb") as f:
58
+ f.write(response.content)
59
+ await message.reply_audio(
60
+ f"{yt_file}.mp3",
61
+ caption=f"**🎧 𝖳𝗂𝗍𝗅𝖾:** {yt_data['title']} \n\n**👀 𝖵𝗂𝖾𝗐𝗌:** `{yt_data['view_count']}` \n**⌛ 𝖣𝗎𝗋𝖺𝗍𝗂𝗈𝗇:** `{secs_to_mins(int(yt_data['duration']))}`",
62
+ duration=int(yt_data["duration"]),
63
+ performer="[Akeno UB]",
64
+ title=yt_data["title"],
65
+ thumb=f"{yt_file}.jpg",
66
+ progress=progress,
67
+ progress_args=(
68
+ pro,
69
+ time.time(),
70
+ upload_text,
71
+ ),
72
+ )
73
+ await pro.delete()
74
+ except Exception as e:
75
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
76
+ return await pro.edit_text(f"**🍀 Audio not Downloaded:** `{e}`")
77
+ try:
78
+ os.remove(f"{yt_file}.jpg")
79
+ os.remove(f"{yt_file}.mp3")
80
+ except:
81
+ pass
82
+
83
+ @Akeno(
84
+ ~filters.scheduled
85
+ & command(["yta"])
86
+ & filters.me
87
+ & ~filters.forwarded
88
+ )
89
+ async def youtube_audio(client: Client, message: Message):
90
+ if len(message.command) < 2:
91
+ return await message.reply_text(
92
+ "Give a valid youtube link to download audio."
93
+ )
94
+ query = await input_user(message)
95
+ pro = await message.reply_text("Checking ...")
96
+ status, url = YoutubeDriver.check_url(query)
97
+ if not status:
98
+ return await pro.edit_text(url)
99
+ if client.me.is_premium:
100
+ await pro.edit_text(f"{custom_loading}__Downloading audio ...__")
101
+ else:
102
+ await pro.edit_text(f"__Downloading audio ...__")
103
+ try:
104
+ with YoutubeDL(YoutubeDriver.song_options()) as ytdl:
105
+ yt_data = ytdl.extract_info(url, False)
106
+ yt_file = ytdl.prepare_filename(yt_data)
107
+ ytdl.process_info(yt_data)
108
+ if client.me.is_premium:
109
+ upload_text = f"**{custom_loading}𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 𝖲𝗈𝗇𝗀 ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖢𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
110
+ else:
111
+ upload_text = f"**𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 𝖲𝗈𝗇𝗀 ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖢𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
112
+ await pro.edit_text(upload_text)
113
+ response = requests.get(f"https://i.ytimg.com/vi/{yt_data['id']}/hqdefault.jpg")
114
+ with open(f"{yt_file}.jpg", "wb") as f:
115
+ f.write(response.content)
116
+ await message.reply_audio(
117
+ f"{yt_file}.mp3",
118
+ caption=f"**🎧 𝖳𝗂𝗍𝗅𝖾:** {yt_data['title']} \n\n**👀 𝖵𝗂𝖾𝗐𝗌:** `{yt_data['view_count']}` \n**⌛ 𝖣𝗎𝗋𝖺𝗍𝗂𝗈𝗇:** `{secs_to_mins(int(yt_data['duration']))}`",
119
+ duration=int(yt_data["duration"]),
120
+ performer="[Akeno UB]",
121
+ title=yt_data["title"],
122
+ thumb=f"{yt_file}.jpg",
123
+ progress=progress,
124
+ progress_args=(
125
+ pro,
126
+ time.time(),
127
+ upload_text,
128
+ ),
129
+ )
130
+ await pro.delete()
131
+ except Exception as e:
132
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
133
+ return await pro.edit_text(f"**🍀 Audio not Downloaded:** `{e}`")
134
+ try:
135
+ os.remove(f"{yt_file}.jpg")
136
+ os.remove(f"{yt_file}.mp3")
137
+ except:
138
+ pass
139
+
140
+ @Akeno(
141
+ ~filters.scheduled
142
+ & command(["ytva"])
143
+ & filters.me
144
+ & ~filters.forwarded
145
+ )
146
+ async def ytvideo_search(client: Client, message: Message):
147
+ if len(message.command) < 2:
148
+ return await message.reply_text(
149
+ "Give a valid youtube search to download video."
150
+ )
151
+ query = await input_user(message)
152
+ results = YoutubeSearch(query, max_results=5).to_dict()
153
+ watch = results[0]["url_suffix"]
154
+ url_suffix = watch.split("/")[1]
155
+ okk = f"https://youtube.com/{url_suffix}"
156
+ pro = await message.reply_text("Checking ...")
157
+ status, url = YoutubeDriver.check_url(okk)
158
+ if not status:
159
+ return await pro.edit_text(url)
160
+ if client.me.is_premium:
161
+ await pro.edit_text(f"{custom_loading}__Downloading audio ...__")
162
+ else:
163
+ await pro.edit_text(f"__Downloading audio ...__")
164
+ try:
165
+ with YoutubeDL(YoutubeDriver.video_options()) as ytdl:
166
+ yt_data = ytdl.extract_info(url, True)
167
+ yt_file = yt_data["id"]
168
+
169
+ if client.me.is_premium:
170
+ upload_text = f"**{custom_loading}𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 𝖲𝗈𝗇𝗀 ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖢𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
171
+ else:
172
+ upload_text = f"**𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 𝖲𝗈𝗇𝗀 ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖢𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
173
+ await pro.edit_text(upload_text)
174
+ response = requests.get(f"https://i.ytimg.com/vi/{yt_data['id']}/hqdefault.jpg")
175
+ with open(f"{yt_file}.jpg", "wb") as f:
176
+ f.write(response.content)
177
+ await message.reply_video(
178
+ f"{yt_file}.mp4",
179
+ caption=f"**🎧 𝖳𝗂𝗍𝗅𝖾:** {yt_data['title']} \n\n**👀 𝖵𝗂𝖾𝗐𝗌:** `{yt_data['view_count']}` \n**⌛ 𝖣𝗎𝗋𝖺𝗍𝗂𝗈𝗇:** `{secs_to_mins(int(yt_data['duration']))}`",
180
+ duration=int(yt_data["duration"]),
181
+ thumb=f"{yt_file}.jpg",
182
+ progress=progress,
183
+ progress_args=(
184
+ pro,
185
+ time.time(),
186
+ upload_text,
187
+ ),
188
+ )
189
+ await pro.delete()
190
+ except Exception as e:
191
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
192
+ return await pro.edit_text(f"**🍀 Video not Downloaded:** `{e}`")
193
+ try:
194
+ os.remove(f"{yt_file}.jpg")
195
+ os.remove(f"{yt_file}.mp4")
196
+ except:
197
+ pass
198
+
199
+ @Akeno(
200
+ ~filters.scheduled
201
+ & command(["ytv"])
202
+ & filters.me
203
+ & ~filters.forwarded
204
+ )
205
+ async def ytvideo(client: Client, message: Message):
206
+ if len(message.command) < 2:
207
+ return await message.reply_text(
208
+ "Give a valid youtube link to download video."
209
+ )
210
+ query = await input_user(message)
211
+ pro = await message.reply_text("Checking ...")
212
+ status, url = YoutubeDriver.check_url(query)
213
+ if not status:
214
+ return await pro.edit_text(url)
215
+ if client.me.is_premium:
216
+ await pro.edit_text(f"{custom_loading}__Downloading audio ...__")
217
+ else:
218
+ await pro.edit_text(f"__Downloading audio ...__")
219
+ try:
220
+ with YoutubeDL(YoutubeDriver.video_options()) as ytdl:
221
+ yt_data = ytdl.extract_info(url, True)
222
+ yt_file = yt_data["id"]
223
+
224
+ if client.me.is_premium:
225
+ upload_text = f"**{custom_loading}𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 𝖲𝗈𝗇𝗀 ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖢𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
226
+ else:
227
+ upload_text = f"**𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 𝖲𝗈𝗇𝗀 ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖢𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
228
+ await pro.edit_text(upload_text)
229
+ response = requests.get(f"https://i.ytimg.com/vi/{yt_data['id']}/hqdefault.jpg")
230
+ with open(f"{yt_file}.jpg", "wb") as f:
231
+ f.write(response.content)
232
+ await message.reply_video(
233
+ f"{yt_file}.mp4",
234
+ caption=f"**🎧 𝖳𝗂𝗍𝗅𝖾:** {yt_data['title']} \n\n**👀 𝖵𝗂𝖾𝗐𝗌:** `{yt_data['view_count']}` \n**⌛ 𝖣𝗎𝗋𝖺𝗍𝗂𝗈𝗇:** `{secs_to_mins(int(yt_data['duration']))}`",
235
+ duration=int(yt_data["duration"]),
236
+ thumb=f"{yt_file}.jpg",
237
+ progress=progress,
238
+ progress_args=(
239
+ pro,
240
+ time.time(),
241
+ upload_text,
242
+ ),
243
+ )
244
+ await pro.delete()
245
+ except Exception as e:
246
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
247
+ return await pro.edit_text(f"**🍀 Video not Downloaded:** `{e}`")
248
+ try:
249
+ os.remove(f"{yt_file}.jpg")
250
+ os.remove(f"{yt_file}.mp4")
251
+ except:
252
+ pass
253
+
254
+ @Akeno(
255
+ ~filters.scheduled
256
+ & command(["ytlink"])
257
+ & filters.me
258
+ & ~filters.forwarded
259
+ )
260
+ async def ytlink(_, message: Message):
261
+ if len(message.command) < 2:
262
+ return await message.reply_text("Give something to search on youtube.")
263
+ query = await input_user(message)
264
+ pro = await message.reply_text("Searching ...")
265
+ try:
266
+ results = YoutubeDriver(query, 7).to_dict()
267
+ except Exception as e:
268
+ await log_detailed_error(e, where=client.me.id, who=message.chat.title)
269
+ return await pro.edit_text(f"**🍀 Error:** `{e}`")
270
+ if not results:
271
+ return await pro.edit_text("No results found.")
272
+ text = f"**🔎 𝖳𝗈𝗍𝖺𝗅 𝖱𝖾𝗌𝗎𝗅𝗍𝗌 𝖥𝗈𝗎𝗇𝖽:** `{len(results)}`\n\n"
273
+ for result in results:
274
+ text += f"**𝖳𝗂𝗍𝗅𝖾:** `{result['title'][:50]}`\n**𝖢𝗁𝖺𝗇𝗇𝖾𝗅:** `{result['channel']}`\n**𝖵𝗂𝖾𝗐𝗌:** `{result['views']}`\n**𝖣𝗎𝗋𝖺𝗍𝗂𝗈𝗇:** `{result['duration']}`\n**𝖫𝗂𝗇𝗄:** `https://youtube.com{result['url_suffix']}`\n\n"
275
+ await pro.edit_text(text, disable_web_page_preview=True)
276
+
277
+ module = modules_help.add_module("youtube", __file__)
278
+ module.add_command("yta", "Download the youtube link video in .mp3 format!.")
279
+ module.add_command("ytv", "Download the youtube link video in .mp3 format!.")
280
+ module.add_command("ytsa", "Download the youtube search video in .mp3 format!.")
281
+ module.add_command("ytva", "Download the youtube search video in .mp4 format!")
282
+ module.add_command("ytlink", "Search for a video on youtube")
akn/AllDownloaderBot/__init__.py ADDED
File without changes
akn/AllDownloaderBot/allonedl.py ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+ from pyrogram import *
3
+ from pyrogram.types import *
4
+ from pyrogram.errors import *
5
+ from pyrogram.enums import *
6
+ from akn.AllDownloaderBot.support_sites import *
7
+ from akn.utils.logger import *
8
+ from akn.utils.database import db
9
+
10
+ def is_video_url(url: str) -> bool:
11
+ patterns = (
12
+ r"tiktok\.com/(?:@|v/|t/|video/)",
13
+ r"(?:youtube\.com/watch\?v=|youtu\.be/)[\w-]{11}",
14
+ r"instagram\.com/(?:p|reel)/[\w-]+",
15
+ r"(?:twitter\.com|x\.com)/\w+/status/\d+",
16
+ r"facebook\.com/(?:watch|reel|share)/[\w-]+",
17
+ )
18
+
19
+ return any(re.search(pattern, url, re.IGNORECASE) for pattern in patterns)
20
+
21
+ @Client.on_message(
22
+ ~filters.scheduled
23
+ & filters.command(["alldl"])
24
+ & ~filters.forwarded
25
+ )
26
+ async def allone_downloader(client: Client, message: Message):
27
+ user_id = message.from_user.id
28
+ if await db.get_alldlbot_is_blacklist_user(client.me.id, user_id):
29
+ return
30
+ if message.chat.type.value != "supergroup":
31
+ return await message.reply_text("You can only group public not private")
32
+ await db.update_alldlbot_broadcast_in_group(client.me.id, message.chat.id, "add")
33
+ user_name = message.from_user.first_name
34
+ nn = "[" + user_name + "](tg://user?id=" + str(user_id) + ")"
35
+ if not await db.get_forcesub_only_bot(client.me.id):
36
+ return await message.reply_text("This is the command /addjoin username channel and becomes admin on the channel")
37
+ update_channel = await db.get_forcesub_only_bot(client.me.id)
38
+ if update_channel:
39
+ try:
40
+ user = await client.get_chat_member(update_channel, user_id)
41
+ if user.status == ChatMemberStatus.BANNED:
42
+ await client.send_message(
43
+ message.chat.id,
44
+ text=f"**❌ {nn} anda telah di blokir dari grup dukungan**",
45
+ disable_web_page_preview=True,
46
+ )
47
+ return
48
+ except UserNotParticipant:
49
+ await client.send_message(
50
+ message.chat.id,
51
+ text=f"**👋🏻 Halo {nn}\nᴜɴᴛᴜᴋ ᴍᴇɴɢʜɪɴᴅᴀʀɪ ᴘᴇɴɢɢᴜɴᴀᴀɴ ʏᴀɴɢ ʙᴇʀʟᴇʙɪʜᴀɴ ʙᴏᴛ ɪɴɪ ᴅɪ ᴋʜᴜsᴜsᴋᴀɴ ᴜɴᴛᴜᴋ ʏᴀɴɢ sᴜᴅᴀʜ ᴊᴏɪɴ ᴅɪ ᴄʜᴀɴɴᴇʟ ᴋᴀᴍɪ​!**",
52
+ reply_markup=InlineKeyboardMarkup(
53
+ [
54
+ [
55
+ InlineKeyboardButton(
56
+ "Jᴏɪɴ Cʜᴀɴɴᴇʟ Dᴜʟᴜ",
57
+ url=f"https://t.me/{update_channel}",
58
+ )
59
+ ]
60
+ ]
61
+ ),
62
+ )
63
+ except ChatAdminRequired:
64
+ return await message.reply_text("Chat admins Required: before /addjoin username without @ and add bot to your channel as admin")
65
+
66
+ query_url = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
67
+ if not query_url:
68
+ return await message.reply_text("?")
69
+ if not is_video_url(query_url):
70
+ return await message.reply_text("Invalid link")
71
+ dll = await message.reply_text("Processing....")
72
+ try:
73
+ result, caption = all_one_downloader(query_url)
74
+ if result:
75
+ await message.reply_video(
76
+ result,
77
+ caption=caption,
78
+ disable_notification=True
79
+ )
80
+ await dll.delete()
81
+ return
82
+ else:
83
+ return await message.reply_text("Try again")
84
+ except Exception as e:
85
+ await dll.delete()
86
+ LOGS.error(f"Error yt: {type(e).__name__}")
87
+ await message.reply_text(f"Free: Upgrade to premium only cookies")
akn/AllDownloaderBot/blacklistchat.py ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # credits original: yukki music
2
+ # kurigram versions: latest
3
+ # code by @xpushz
4
+
5
+ from pyrogram import *
6
+ from pyrogram.types import *
7
+ from pyrogram.errors import *
8
+ from akn.utils.logger import LOGS
9
+ from akn.utils.database import db
10
+
11
+ @Client.on_message(filters.new_chat_members, group=2)
12
+ async def welcomecheck(client, message: Message):
13
+ chat_id = message.chat.id
14
+ if await db.get_alldlbot_is_blacklist_chat(client.me.id, chat_id):
15
+ return await client.leave_chat(chat_id)
16
+ return await client.send_message(
17
+ chat_id,
18
+ f"Thank you for using my bot: {client.me.first_name}"
19
+ )
20
+
21
+ @Client.on_message(
22
+ ~filters.scheduled
23
+ & filters.command(["addblacklist"])
24
+ & ~filters.forwarded
25
+ )
26
+ async def blacklist_user(c, m):
27
+ is_sudo = await db.get_alldlbot_sudouser(c.me.id, m.from_user.id)
28
+ protect_own = await db.get_alldlbot_by_user_id(m.from_user.id)
29
+ if not protect_own and not is_sudo:
30
+ return await m.reply_text("You are not allowed here.")
31
+
32
+ if m.chat.type.value != "supergroup":
33
+ return await m.reply_text("You can only group public not private")
34
+ await db.update_alldlbot_broadcast_in_group(c.me.id, m.chat.id, "add")
35
+ user_id = None
36
+ if not m.reply_to_message:
37
+ if len(m.command) < 2:
38
+ return await m.reply_text(
39
+ "Reply to a user or pass a user_id to blacklist"
40
+ )
41
+ try:
42
+ getuser = m.command[1]
43
+ except Exception as e:
44
+ return await m.reply_text(f"`{str(e)}`")
45
+ else:
46
+ getuser = m.reply_to_message.from_user.id
47
+ try:
48
+ user_id = (await c.get_users(getuser)).id
49
+ await db.add_alldlbot_blacklist_user(c.me.id, user_id)
50
+ await m.reply_text(f"Successfully blacklist `{user_id}` from bots.")
51
+ except Exception as e:
52
+ await m.reply_text(f"Error: {e}")
53
+
54
+ @Client.on_message(
55
+ ~filters.scheduled
56
+ & filters.command(["rmblacklist"])
57
+ & ~filters.forwarded
58
+ )
59
+ async def unblacklist_user(c, m):
60
+ is_sudo = await db.get_alldlbot_sudouser(c.me.id, m.from_user.id)
61
+ protect_own = await db.get_alldlbot_by_user_id(m.from_user.id)
62
+ if not protect_own and not is_sudo:
63
+ return await m.reply_text("You are not allowed here.")
64
+
65
+ if m.chat.type.value != "supergroup":
66
+ return await m.reply_text("You can only group public not private")
67
+ await db.update_alldlbot_broadcast_in_group(c.me.id, m.chat.id, "add")
68
+ user_id = None
69
+ if not m.reply_to_message:
70
+ if len(m.command) < 2:
71
+ return await m.reply_text(
72
+ "Reply to a user or pass a user_id to unblacklist."
73
+ )
74
+ try:
75
+ getuser = m.command[1]
76
+ except Exception as e:
77
+ return await m.reply_text(f"`{str(e)}`")
78
+ else:
79
+ getuser = m.reply_to_message.from_user.id
80
+ try:
81
+ user_id = (await c.get_users(getuser)).id
82
+ await db.add_alldlbot_unblacklist_user(c.me.id, user_id)
83
+ await m.reply_text(f"Successfully removed blacklist `{user_id}` from bots.")
84
+ except Exception as e:
85
+ await m.reply_text(f"Error: {e}")
86
+
87
+ @Client.on_message(
88
+ ~filters.scheduled
89
+ & filters.command(["addsudo"])
90
+ & ~filters.forwarded
91
+ )
92
+ async def add_sudo_func(client, message: Message):
93
+ if message.chat.type.value != "supergroup":
94
+ return await message.reply_text("This command can only be used in supergroups.")
95
+ is_sudo = await db.get_alldlbot_sudouser(client.me.id, message.from_user.id)
96
+ protect_own = await db.get_alldlbot_by_user_id(message.from_user.id)
97
+ if not protect_own and not is_sudo:
98
+ return await message.reply_text("You are not allowed here.")
99
+ if len(message.command) != 2:
100
+ return await message.reply_text("**Usage:**\n/addsudo [USER_ID]")
101
+ user_id = int(message.text.strip().split()[1])
102
+ if await db.get_alldlbot_sudouser(client.me.id, user_id):
103
+ return await message.reply_text("User is already sudo.")
104
+ if user_id == client.me.id:
105
+ return await message.reply_text("You can't add yourself as sudo.")
106
+ update_sudo = await db.update_alldlbot_sudouser(client.me.id, user_id, "add")
107
+ if update_sudo:
108
+ await message.reply_text("User has been successfully added to sudo list")
109
+ else:
110
+ await message.reply_text("Something wrong happened.")
111
+
112
+ @Client.on_message(
113
+ ~filters.scheduled
114
+ & filters.command(["delsudo"])
115
+ & ~filters.forwarded
116
+ )
117
+ async def delc_sudo_func(client, message: Message):
118
+ if message.chat.type.value != "supergroup":
119
+ return await message.reply_text("This command can only be used in supergroups.")
120
+ is_sudo = await db.get_alldlbot_sudouser(client.me.id, message.from_user.id)
121
+ protect_own = await db.get_alldlbot_by_user_id(message.from_user.id)
122
+ if not protect_own and not is_sudo:
123
+ return await message.reply_text("You are not allowed here.")
124
+ if len(message.command) != 2:
125
+ return await message.reply_text("**Usage:**\n/delsudo [USER_ID]")
126
+ user_id = int(message.text.strip().split()[1])
127
+ if not await db.get_alldlbot_sudouser(client.me.id, user_id):
128
+ return await message.reply_text("User is not sudo.")
129
+ if user_id == client.me.id:
130
+ return await message.reply_text("You can't remove yourself as sudo.")
131
+ update_sudo = await db.update_alldlbot_sudouser(client.me.id, user_id, "remove")
132
+ if update_sudo:
133
+ await message.reply_text("User has been successfully removed from sudo list")
134
+ else:
135
+ await message.reply_text("Something wrong happened.")
136
+
137
+ @Client.on_message(
138
+ ~filters.scheduled
139
+ & filters.command(["blacklistchat"])
140
+ & ~filters.forwarded
141
+ )
142
+ async def blacklist_chat_func(client, message: Message):
143
+ if message.chat.type.value != "supergroup":
144
+ return await message.reply_text("This command can only be used in supergroups.")
145
+ is_sudo = await db.get_alldlbot_sudouser(client.me.id, message.from_user.id)
146
+ protect_own = await db.get_alldlbot_by_user_id(message.from_user.id)
147
+ if not protect_own and not is_sudo:
148
+ return await message.reply_text("You are not allowed here.")
149
+ if len(message.command) != 2:
150
+ return await message.reply_text("**Usage:**\n/blacklistchat [CHAT_ID]")
151
+ chat_id = int(message.text.strip().split()[1])
152
+ if await db.get_alldlbot_is_blacklist_chat(client.me.id, chat_id):
153
+ return await message.reply_text("Chat is already blacklisted.")
154
+ blacklisted = await db.add_alldlbot_blacklist_chat(client.me.id, chat_id)
155
+ if blacklisted:
156
+ await message.reply_text("Chat has been successfully blacklisted")
157
+ else:
158
+ await message.reply_text("Something wrong happened.")
159
+ try:
160
+ await client.leave_chat(chat_id)
161
+ except:
162
+ pass
163
+
164
+ @Client.on_message(
165
+ ~filters.scheduled
166
+ & filters.command(["whitelistchat"])
167
+ & ~filters.forwarded
168
+ )
169
+ async def white_funciton(client, message: Message):
170
+ if message.chat.type.value != "supergroup":
171
+ return await message.reply_text("This command can only be used in supergroups.")
172
+ is_sudo = await db.get_alldlbot_sudouser(client.me.id, message.from_user.id)
173
+ protect_own = await db.get_alldlbot_by_user_id(message.from_user.id)
174
+ if not protect_own and not is_sudo:
175
+ return await message.reply_text("You are not allowed here.")
176
+ if len(message.command) != 2:
177
+ return await message.reply_text("**Usage:**\n/whitelistchat [CHAT_ID]")
178
+ chat_id = int(message.text.strip().split()[1])
179
+ if not await db.get_alldlbot_is_blacklist_chat(client.me.id, chat_id):
180
+ return await message.reply_text("Chat is already whitelisted")
181
+ whitelisted = await db.alldlbot_whitelist_chat(client.me.id, chat_id)
182
+ if whitelisted:
183
+ return await message.reply_text("Chat has been successfully whitelisted")
184
+ await message.reply_text("Something wrong happened.")
185
+
186
+ @Client.on_message(
187
+ ~filters.scheduled
188
+ & filters.command(["blacklistedchat"])
189
+ & ~filters.forwarded
190
+ )
191
+ async def all_chats(client, message: Message):
192
+ if message.chat.type.value != "supergroup":
193
+ return await message.reply_text("This command can only be used in supergroups.")
194
+ is_sudo = await db.get_alldlbot_sudouser(client.me.id, message.from_user.id)
195
+ protect_own = await db.get_alldlbot_by_user_id(message.from_user.id)
196
+ if not protect_own and not is_sudo:
197
+ return await message.reply_text("You are not allowed here.")
198
+ text = "**Blacklisted Chats:**\n\n"
199
+ j = 0
200
+ for count, chat_id in enumerate(await db.get_alldlbot_blacklist_chat(client.me.id), 1):
201
+ try:
202
+ title = (await client.get_chat(chat_id)).title
203
+ except Exception:
204
+ title = "Private"
205
+ j = 1
206
+ text += f"**{count}. {title}** [`{chat_id}`]\n"
207
+ if j == 0:
208
+ await message.reply_text("No Blacklisted Chats")
209
+ else:
210
+ await message.reply_text(text)
211
+
212
+ @Client.on_message(
213
+ ~filters.scheduled
214
+ & filters.command(["listsudo"])
215
+ & ~filters.forwarded
216
+ )
217
+ async def list_sudo_func(client, message: Message):
218
+ if message.chat.type.value != "supergroup":
219
+ return await message.reply_text("This command can only be used in supergroups.")
220
+ is_sudo = await db.get_alldlbot_sudouser(client.me.id, message.from_user.id)
221
+ protect_own = await db.get_alldlbot_by_user_id(message.from_user.id)
222
+ if not protect_own and not is_sudo:
223
+ return await message.reply_text("You are not allowed here.")
224
+ text = "**List SudoUser:**\n\n"
225
+ j = 0
226
+ for count, user_id in enumerate(await db.get_alldlbot_allsudouser(client.me.id), 1):
227
+ try:
228
+ title = (await client.get_users(user_id)).first_name
229
+ except Exception:
230
+ title = "Private"
231
+ j = 1
232
+ text += f"**{count}. {title}** [`{user_id}`]\n"
233
+ if j == 0:
234
+ await message.reply_text("No List SudoUser")
235
+ else:
236
+ await message.reply_text(text)
237
+
238
+ @Client.on_message(
239
+ ~filters.scheduled
240
+ & filters.command(["viewblacklistuser"])
241
+ & ~filters.forwarded
242
+ )
243
+ async def view_blacklist_user_func(client, message: Message):
244
+ if message.chat.type.value != "supergroup":
245
+ return await message.reply_text("This command can only be used in supergroups.")
246
+ is_sudo = await db.get_alldlbot_sudouser(client.me.id, message.from_user.id)
247
+ protect_own = await db.get_alldlbot_by_user_id(message.from_user.id)
248
+ if not protect_own and not is_sudo:
249
+ return await message.reply_text("You are not allowed here.")
250
+ text = "**Blacklisted Users:**\n\n"
251
+ j = 0
252
+ for count, user_id in enumerate(await db.get_alldlbot_allblacklist_user(client.me.id), 1):
253
+ try:
254
+ title = (await client.get_users(user_id)).first_name
255
+ except Exception:
256
+ title = "Private"
257
+ j = 1
258
+ text += f"**{count}. {title}** [`{user_id}`]\n"
259
+ if j == 0:
260
+ await message.reply_text("No Blacklisted Users")
261
+ else:
262
+ await message.reply_text(text)
akn/AllDownloaderBot/broadcast.py ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # credits original: yukki music
2
+ # kurigram versions: latest
3
+ # code by @xpushz
4
+
5
+ import time
6
+ import os
7
+ import asyncio
8
+ from datetime import datetime
9
+ from pyrogram import *
10
+ from pyrogram.types import *
11
+ from pyrogram.errors import *
12
+ from akn.utils.logger import LOGS
13
+ from akn.utils.database import db
14
+
15
+ @Client.on_message(
16
+ ~filters.scheduled
17
+ & filters.command(["broadcast"])
18
+ & ~filters.forwarded
19
+ )
20
+ async def braodcast_message(client, message):
21
+ global IS_BROADCASTING
22
+ if message.reply_to_message:
23
+ x = message.reply_to_message.id
24
+ y = message.chat.id
25
+ else:
26
+ if len(message.command) < 2:
27
+ return await message.reply_text("**Usage**:\n/broadcast [MESSAGE] or [Reply to a Message]")
28
+ query = message.text.split(None, 1)[1]
29
+ if "-pin" in query:
30
+ query = query.replace("-pin", "")
31
+ if "-nobot" in query:
32
+ query = query.replace("-nobot", "")
33
+ if "-pinloud" in query:
34
+ query = query.replace("-pinloud", "")
35
+ if "-user" in query:
36
+ query = query.replace("-user", "")
37
+ if query == "":
38
+ return await message.reply_text("Please provide some text to broadcast.")
39
+
40
+ IS_BROADCASTING = True
41
+
42
+ if "-nobot" not in message.text:
43
+ sent = 0
44
+ pin = 0
45
+ chats = []
46
+ schats = await db.alldlbot_all_broadcast_group(client.me.id)
47
+ for chat in schats:
48
+ chats.append(int(chat))
49
+ for i in chats:
50
+ try:
51
+ m = (
52
+ await client.forward_messages(i, y, x)
53
+ if message.reply_to_message
54
+ else await client.send_message(i, text=query)
55
+ )
56
+ if "-pin" in message.text:
57
+ try:
58
+ await m.pin(disable_notification=True)
59
+ pin += 1
60
+ except Exception:
61
+ continue
62
+ elif "-pinloud" in message.text:
63
+ try:
64
+ await m.pin(disable_notification=False)
65
+ pin += 1
66
+ except Exception:
67
+ continue
68
+ sent += 1
69
+ except FloodWait as e:
70
+ flood_time = int(e.x)
71
+ if flood_time > 200:
72
+ continue
73
+ await asyncio.sleep(flood_time)
74
+ except Exception:
75
+ continue
76
+ try:
77
+ await message.reply_text(
78
+ f"Broadcasted Message In {sent} Chats with {pin} Pins from Bot"
79
+ )
80
+ except:
81
+ pass
82
+
83
+ if "-user" in message.text:
84
+ susr = 0
85
+ served_users = []
86
+ susers = await db.alldlbot_all_broadcast(client.me.id)
87
+ for user in susers:
88
+ served_users.append(int(user))
89
+ for i in served_users:
90
+ try:
91
+ m = (
92
+ await client.forward_messages(i, y, x)
93
+ if message.reply_to_message
94
+ else await client.send_message(i, text=query)
95
+ )
96
+ susr += 1
97
+ except FloodWait as e:
98
+ flood_time = int(e.x)
99
+ if flood_time > 200:
100
+ continue
101
+ await asyncio.sleep(flood_time)
102
+ except Exception:
103
+ pass
104
+ try:
105
+ await message.reply_text(
106
+ f"**Broadcasted Message to {susr} Users.**"
107
+ )
108
+ except:
109
+ pass
110
+ IS_BROADCASTING = False
akn/AllDownloaderBot/main.py ADDED
@@ -0,0 +1,1262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # All credits to @xpushz
2
+ # lu mau kanger kah pasti noob aja
3
+
4
+ import time
5
+ import requests
6
+ import os
7
+ import re
8
+ import httpx
9
+ import aiofiles
10
+ import hashlib
11
+ import urllib.parse
12
+ import asyncio
13
+ from pyrogram import *
14
+ from pyrogram.enums import *
15
+ from pyrogram import Client, filters
16
+ from pyrogram.types import *
17
+ from pyrogram.errors import *
18
+
19
+ from akn.utils.logger import LOGS
20
+ from akn.utils.scripts import progress
21
+ from youtube_search import YoutubeSearch
22
+ from yt_dlp import YoutubeDL
23
+
24
+ from akn.utils.database import db
25
+ from akn.utils.driver import YoutubeDriver
26
+ from akn.utils.formatter import secs_to_mins
27
+
28
+ import akenoai as js
29
+
30
+ link_storage = {}
31
+ storage = {}
32
+
33
+ custom_loading = "<emoji id=5974235702701853774>🗿</emoji>"
34
+ TIKTOK_WEB = "https://www.tikwm.com"
35
+
36
+ OWNER_BOT_ID = 8109052455
37
+
38
+ COMMAND = """
39
+ **📥 Social Media Downloader Commands**
40
+
41
+ **🔗 Direct Link Downloaders**
42
+ - `/fbdl` – Download Facebook videos.
43
+ - `/igdl` – Download Instagram videos/reels.
44
+ - `/twdl` – Download Twitter/X videos.
45
+ - `/ttdl` – Download TikTok videos.
46
+ - `/alldl` – Download Facebook, Instagram, Tiktok, Twitter(required cookies) etc videos.
47
+ - `/teraboxdl` – Download Terabox files (v1).
48
+ - `/terabox2dl` – Download Terabox files (v2).
49
+
50
+ **🎵 YouTube Tools**
51
+ - `/ytv` – Download YouTube videos in **MP4** format.
52
+ - `/yta` – Extract audio from YouTube videos in **MP3** format.
53
+ - `/ytva` – Search & download YouTube videos as **MP4**.
54
+ - `/ytsa` – Search & download YouTube audio as **MP3**.
55
+ - `/ytlink` – Search for YouTube videos.
56
+ """
57
+
58
+ @Client.on_callback_query(filters.regex("^cclose"))
59
+ async def cb_cclose(client, query):
60
+ await query.message.delete()
61
+
62
+ @Client.on_callback_query(filters.regex("^author_cmd"))
63
+ async def cb_author_command(client, query):
64
+ is_sudo = await db.get_alldlbot_sudouser(client.me.id, query.from_user.id)
65
+ protect_own = await db.get_alldlbot_by_user_id(query.from_user.id)
66
+ if not protect_own and not is_sudo:
67
+ return await query.answer("You are not allowed here.", True)
68
+
69
+ author_commands = """
70
+ **🔐 Owner-Only Commands**
71
+
72
+ **📌 Channel & User Management:**
73
+ - `/addjoin` – Enable auto **force-subscribe** to a channel.
74
+ - `/addblacklist` – Ban a user from using bot commands.
75
+ - `/addsudo` – Add a user to the sudo list.
76
+ - `/delsudo` – Remove a user from the sudo list.
77
+ - `/listsudo` – View the list of sudo users.
78
+ - `/rmblacklist` – Unban a blacklisted user.
79
+ - `/blacklistchat` – Block a chat from using the bot.
80
+ - `/viewblacklistuser` – View the list of blacklisted users.
81
+ - `/whitelistchat` – Unblock a chat.
82
+ - `/blacklistedchat` – View blacklisted chats.
83
+
84
+ **📊 Stats & Maintenance:**
85
+ - `/stats` – View user statistics.
86
+ - `/rmdup` – Remove duplicate user entries.
87
+ - `/broadcast` – Send a message to all users.
88
+
89
+ **⚙️ Bot Settings:**
90
+ - `/nobutton` – Toggle **ON/OFF** the `/start` button.
91
+ - `/setpic` – Change the bot's display picture (resend if needed).
92
+ - `/delpic` – Remove bot display picture (resend if needed).
93
+ """
94
+ keyboard_back = InlineKeyboardMarkup(
95
+ [
96
+ [
97
+ InlineKeyboardButton(
98
+ text="Close",
99
+ callback_data="cclose"
100
+ )
101
+ ]
102
+ ]
103
+ )
104
+ await query.edit_message_text(
105
+ text=author_commands,
106
+ reply_markup=keyboard_back
107
+ )
108
+
109
+ @Client.on_message(
110
+ ~filters.scheduled
111
+ & filters.command(["start"])
112
+ & filters.private
113
+ & ~filters.forwarded
114
+ )
115
+ async def startbot(c, m):
116
+ if await db.get_alldlbot_is_blacklist_user(c.me.id, m.from_user.id):
117
+ return
118
+ buttons = [
119
+ [
120
+ InlineKeyboardButton(
121
+ text="Developer",
122
+ url=f"https://t.me/xtdevs"
123
+ ),
124
+ InlineKeyboardButton(
125
+ text="Channel",
126
+ url='https://t.me/RendyProjects'
127
+ ),
128
+ ],
129
+ [
130
+ InlineKeyboardButton(
131
+ text="Author Commands",
132
+ callback_data='author_cmd'
133
+ )
134
+ ]
135
+ ]
136
+ buttons_start_in_group = [
137
+ [
138
+ InlineKeyboardButton(
139
+ text="Add to your group",
140
+ url=f"https://t.me/{c.me.username}?startgroup=true&admin=manage_chat+change_info+post_messages+edit_messages+delete_messages+invite_users+restrict_members+pin_messages+promote_members+manage_video_chats+anonymous=false"
141
+ )
142
+ ],
143
+ [
144
+ InlineKeyboardButton(
145
+ text="Author Commands",
146
+ callback_data='author_cmd'
147
+ )
148
+ ]
149
+ ]
150
+ user_now = await db.get_alldlbot_by_no_button(c.me.id)
151
+ reply_markup = InlineKeyboardMarkup(buttons_start_in_group) if user_now else InlineKeyboardMarkup(buttons)
152
+ try:
153
+ await db.update_alldlbot_broadcast(c.me.id, m.from_user.id, "add")
154
+ is_pic, catbox_link = await db.get_pic_in_allbot(c.me.id)
155
+ if is_pic and catbox_link:
156
+ return await m.reply_photo(
157
+ photo=catbox_link,
158
+ caption=COMMAND,
159
+ reply_markup=reply_markup
160
+ )
161
+ return await m.reply_text(
162
+ text=COMMAND,
163
+ disable_web_page_preview=True,
164
+ reply_markup=reply_markup
165
+ )
166
+ except Exception as e:
167
+ await m.reply_text(f"Error: {e}")
168
+
169
+ class Tiktok:
170
+ @staticmethod
171
+ async def download(api_name, url):
172
+ response = requests.get("{}/api/?url={}".format(api_name, url))
173
+ if response.status_code != 200:
174
+ return "Error Response limits"
175
+ data_json = response.json()
176
+ author_tiktok = data_json["data"]["author"].get("nickname") or "Unknown"
177
+ play_tiktok = data_json["data"].get("play")
178
+ music_tiktok = data_json["data"]["music_info"].get("play")
179
+ return [
180
+ play_tiktok,
181
+ music_tiktok,
182
+ author_tiktok
183
+ ]
184
+
185
+ def is_tiktok_url(url):
186
+ pattern = r"(https?)://(vt|www)\.tiktok\.com/(\w+)"
187
+ match = re.search(pattern, url)
188
+ return bool(match)
189
+
190
+ def generate_callback_data(user_id, query):
191
+ identifier = hashlib.md5(query.encode()).hexdigest()
192
+ callback_data = f"audiodownload_{user_id}_{identifier}"
193
+ link_storage[callback_data] = query
194
+ return callback_data
195
+
196
+ @Client.on_callback_query(filters.regex("^audiodownload_"))
197
+ async def callback_button(client: Client, cb: CallbackQuery):
198
+ try:
199
+ data = cb.data
200
+ query = link_storage.get(data)
201
+ if query:
202
+ response = await Tiktok.download(TIKTOK_WEB, query)
203
+ await client.send_audio(cb.message.chat.id, response[1])
204
+ await cb.answer("Audio sent successfully!")
205
+ else:
206
+ await cb.answer("Invalid or expired link.", show_alert=True)
207
+ except Exception as e:
208
+ await cb.answer(f"Error: {str(e)}", show_alert=True)
209
+
210
+ @Client.on_message(
211
+ ~filters.scheduled
212
+ & filters.command(["stats"])
213
+ & ~filters.forwarded
214
+ )
215
+ async def statscmd(c, m):
216
+ is_sudo = await db.get_alldlbot_sudouser(c.me.id, m.from_user.id)
217
+ protect_own = await db.get_alldlbot_by_user_id(m.from_user.id)
218
+ if not protect_own and not is_sudo:
219
+ return await m.reply_text("You are not allowed here.")
220
+ try:
221
+ if m.chat.type.value != "supergroup":
222
+ return await m.reply_text("You can only group public not private")
223
+ await db.update_alldlbot_broadcast_in_group(c.me.id, m.chat.id, "add")
224
+ total_bl_users = await db.alldlbot_blacklist_stats(c.me.id)
225
+ total_users = await db.alldlbot_broadcast_stats(c.me.id)
226
+ await m.reply_text(f"**Total Users:** `{total_users}`\n**Total Blacklist Users:** `{total_bl_users}`")
227
+ except Exception as e:
228
+ await m.reply_text(f"Error: {e.MESSAGE}")
229
+
230
+ @Client.on_message(
231
+ ~filters.scheduled
232
+ & filters.command(["delpic"])
233
+ & ~filters.forwarded
234
+ )
235
+ async def delpicincatbox(c, m):
236
+ is_sudo = await db.get_alldlbot_sudouser(c.me.id, m.from_user.id)
237
+ protect_own = await db.get_alldlbot_by_user_id(m.from_user.id)
238
+ if not protect_own and not is_sudo:
239
+ return await m.reply_text("You are not allowed here.")
240
+ mode = m.text.split(" ", 1)[1] if len(m.command) > 1 else None
241
+ if not mode:
242
+ return await m.reply_text("Example: `/delpic yes`")
243
+ try:
244
+ if mode == "yes":
245
+ _, catbox_link = await db.get_pic_in_allbot(c.me.id)
246
+ if not catbox_link:
247
+ return await m.reply_text("Not found pic")
248
+ await db.set_pic_in_allbot(c.me.id, catbox_link, False)
249
+ await m.reply_text(f"Successfully removed pic `{catbox_link}`.")
250
+ else:
251
+ await m.reply_text(f"Invalid command: /delpic yes")
252
+ except Exception as e:
253
+ await m.reply_text(f"Error: {e.MESSAGE}")
254
+
255
+ @Client.on_message(
256
+ ~filters.scheduled
257
+ & filters.command(["setpic"])
258
+ & ~filters.forwarded
259
+ )
260
+ async def setpicincatbox(c, m):
261
+ is_sudo = await db.get_alldlbot_sudouser(c.me.id, m.from_user.id)
262
+ protect_own = await db.get_alldlbot_by_user_id(m.from_user.id)
263
+ if not protect_own and not is_sudo:
264
+ return await m.reply_text("You are not allowed here.")
265
+ link = m.text.split(" ", 1)[1] if len(m.command) > 1 else None
266
+ if not link:
267
+ return await m.reply_text("Example: `/setpic https://files.catbox.moe/y93h4b.jpg`")
268
+ if not link.startswith("https://files.catbox.moe/"):
269
+ return await m.reply_text("Invalid Link")
270
+ try:
271
+ await db.set_pic_in_allbot(c.me.id, link, True)
272
+ await m.reply_text(f"Successfully added pic set `{link}`.")
273
+ except Exception as e:
274
+ await m.reply_text(f"Error: {e.MESSAGE}")
275
+
276
+ @Client.on_message(
277
+ ~filters.scheduled
278
+ & filters.command(["rmdup"])
279
+ & ~filters.forwarded
280
+ )
281
+ async def duplicate_remove(c, m):
282
+ is_sudo = await db.get_alldlbot_sudouser(c.me.id, m.from_user.id)
283
+ protect_own = await db.get_alldlbot_by_user_id(m.from_user.id)
284
+ if not protect_own and not is_sudo:
285
+ return await m.reply_text("You are not allowed here.")
286
+ if m.chat.type.value != "supergroup":
287
+ return await m.reply_text("You can only group public not private")
288
+ await db.update_alldlbot_broadcast_in_group(c.me.id, m.chat.id, "add")
289
+ user_id = None
290
+ if not m.reply_to_message:
291
+ if len(m.command) < 2:
292
+ return await m.reply_text(
293
+ "Reply to a user or pass a user_id to remvoe duplicate"
294
+ )
295
+ try:
296
+ getuser = m.command[1]
297
+ except Exception as e:
298
+ return await m.reply_text(f"`{str(e)}`")
299
+ else:
300
+ getuser = m.reply_to_message.from_user.id
301
+ try:
302
+ user_id = (await c.get_users(getuser)).id
303
+ await db.update_alldlbot_broadcast(c.me.id, user_id, "remove")
304
+ await m.reply_text(f"Successfully remove duplicate `{user_id}` from bots.")
305
+ except Exception as e:
306
+ await m.reply_text(f"Error: {e.MESSAGE}")
307
+
308
+ @Client.on_message(
309
+ ~filters.scheduled
310
+ & filters.command(["addjoin"])
311
+ & ~filters.forwarded
312
+ )
313
+ async def auto_force_sub(client: Client, message: Message):
314
+ protect_own = await db.get_alldlbot_by_user_id(message.from_user.id)
315
+ if not protect_own:
316
+ return await message.reply_text("You are not allowed to add a force sub.")
317
+
318
+ if len(message.command) < 2:
319
+ return await message.reply_text("Please provide a channel username or ID.")
320
+
321
+ channel = message.command[1]
322
+ await db.add_forcesub_only_bot(client.me.id, channel)
323
+ await message.reply_text("Successfully added to force sub.")
324
+
325
+ @Client.on_message(
326
+ ~filters.scheduled
327
+ & filters.command(["nobutton"])
328
+ & ~filters.forwarded
329
+ )
330
+ async def mode_button(client, message: Message):
331
+ is_sudo = await db.get_alldlbot_sudouser(client.me.id, message.from_user.id)
332
+ protect_own = await db.get_alldlbot_by_user_id(message.from_user.id)
333
+ if not protect_own and not is_sudo:
334
+ return await m.reply_text("You are not allowed here.") # type: ignore
335
+
336
+ if len(message.command) < 2:
337
+ return await message.reply_text(f"**Please provide a cmd /nobutton on/off to start button disabled or enabled")
338
+
339
+ cmd = message.command[1].lower().strip()
340
+ if cmd in ["on", "yes"]:
341
+ await db.add_alldlbot_by_no_button(client.me.id, True)
342
+ await message.reply_text(f"**Button disabled now!**")
343
+ elif cmd in ["off", "no"]:
344
+ await db.add_alldlbot_by_no_button(client.me.id, False)
345
+ await message.reply_text(f"**Button enabled now!**")
346
+
347
+ @Client.on_message(
348
+ ~filters.scheduled
349
+ & filters.command(["ttdl"])
350
+ & ~filters.forwarded
351
+ )
352
+ async def tiktok_downloader(client: Client, message: Message):
353
+ user_id = message.from_user.id
354
+ if await db.get_alldlbot_is_blacklist_user(client.me.id, user_id):
355
+ return
356
+ if message.chat.type.value != "supergroup":
357
+ return await message.reply_text("You can only group public not private")
358
+ await db.update_alldlbot_broadcast_in_group(client.me.id, message.chat.id, "add")
359
+ user_name = message.from_user.first_name
360
+ nn = "[" + user_name + "](tg://user?id=" + str(user_id) + ")"
361
+ if not await db.get_forcesub_only_bot(client.me.id):
362
+ return await message.reply_text("This is the command /addjoin username channel and becomes admin on the channel")
363
+ update_channel = await db.get_forcesub_only_bot(client.me.id)
364
+ if update_channel:
365
+ try:
366
+ user = await client.get_chat_member(update_channel, user_id)
367
+ if user.status == ChatMemberStatus.BANNED:
368
+ await client.send_message(
369
+ message.chat.id,
370
+ text=f"**❌ {nn} anda telah di blokir dari grup dukungan**",
371
+ disable_web_page_preview=True,
372
+ )
373
+ return
374
+ except UserNotParticipant:
375
+ await client.send_message(
376
+ message.chat.id,
377
+ text=f"**👋🏻 Halo {nn}\nᴜɴᴛᴜᴋ ᴍᴇɴɢʜɪɴᴅᴀʀɪ ᴘᴇɴɢɢᴜɴᴀᴀɴ ʏᴀɴɢ ʙᴇʀʟᴇʙɪʜᴀɴ ʙᴏᴛ ɪɴɪ ᴅɪ ᴋʜᴜsᴜsᴋᴀɴ ᴜɴᴛᴜᴋ ʏᴀɴɢ sᴜᴅᴀʜ ᴊᴏɪɴ ᴅɪ ᴄʜᴀɴɴᴇʟ ᴋᴀᴍɪ​!**",
378
+ reply_markup=InlineKeyboardMarkup(
379
+ [
380
+ [
381
+ InlineKeyboardButton(
382
+ "Jᴏɪɴ Cʜᴀɴɴᴇʟ Dᴜʟᴜ",
383
+ url=f"https://t.me/{update_channel}",
384
+ )
385
+ ]
386
+ ]
387
+ ),
388
+ )
389
+ except ChatAdminRequired:
390
+ return await message.reply_text("Chat admins Required: before /addjoin username without @ and add bot to your channel as admin")
391
+ return
392
+ query_url = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
393
+ if not query_url:
394
+ return await message.reply_text("?")
395
+ if not is_tiktok_url(query_url):
396
+ return await message.reply_text("Invalid link")
397
+ callback_data = generate_callback_data(message.from_user.id, query_url)
398
+ keyboard = InlineKeyboardMarkup(
399
+ [
400
+ [
401
+ InlineKeyboardButton(
402
+ text="Audio Download",
403
+ callback_data=callback_data
404
+ )
405
+ ]
406
+ ]
407
+ )
408
+ try:
409
+ dll = await message.reply_text("Processing....")
410
+ response = await Tiktok.download(TIKTOK_WEB, query_url)
411
+ await message.reply_video(
412
+ response[0],
413
+ reply_markup=keyboard,
414
+ disable_notification=True
415
+ )
416
+ await dll.delete()
417
+ except Exception as e:
418
+ LOGS.info(str(e))
419
+ await dll.delete()
420
+ await message.reply_text(f"Error: {str(e)}")
421
+
422
+ async def TeraboxDL(url):
423
+ try:
424
+ headers = {"x-api-key": os.environ.get("AKENOX_KEY")}
425
+ async with httpx.AsyncClient() as clientv:
426
+ response = await clientv.get(
427
+ f"https://randydev-ryu-js.hf.space/api/v1/dl/terabox-v4?url={url}",
428
+ headers=headers
429
+ )
430
+ response_json = response.json()
431
+ data = response_json.get("message", {}).get("resuls", "")
432
+
433
+ pattern = r"#EXTINF:\d+,\s*(https[^\s]+)"
434
+ matches = re.findall(pattern, data)
435
+
436
+ return {
437
+ "video_url": matches[0].split("?ulink=")[1] if matches else None,
438
+ "video_url_2": matches[1].split("?ulink=")[1] if len(matches) > 1 else None
439
+ }
440
+
441
+ except Exception as e:
442
+ return {"error": str(e)}
443
+
444
+ async def download_m3u8(url, save_path="terabox.mp4"):
445
+ api_url = f"https://teraboxdownloaderonline.com/api/download-m3u8?terabox_link={url}"
446
+
447
+ async with httpx.AsyncClient() as clientv:
448
+ response = await clientv.get(api_url)
449
+ if response.status_code != 200:
450
+ return None
451
+ with open(save_path, "wb") as file:
452
+ file.write(response.content)
453
+ return save_path
454
+
455
+ @Client.on_message(
456
+ ~filters.scheduled
457
+ & filters.command(["terabox2dl"])
458
+ & ~filters.forwarded
459
+ )
460
+ async def terabox2_cmd(client: Client, message: Message):
461
+ user_id = message.from_user.id
462
+ user_name = message.from_user.first_name
463
+ nn = f"[{user_name}](tg://user?id={user_id})"
464
+
465
+ update_channel = await db.get_forcesub_only_bot(client.me.id)
466
+ if update_channel:
467
+ try:
468
+ user = await client.get_chat_member(update_channel, user_id)
469
+ if user.status == ChatMemberStatus.BANNED:
470
+ return await message.reply_text(f"❌ {nn} Anda telah diblokir dari grup dukungan.")
471
+ except UserNotParticipant:
472
+ return await message.reply_text(
473
+ f"👋🏻 Halo {nn}, Anda perlu join channel kami untuk menggunakan bot ini.",
474
+ reply_markup=InlineKeyboardMarkup([
475
+ [InlineKeyboardButton("Join Channel", url=f"https://t.me/{update_channel}")]
476
+ ])
477
+ )
478
+
479
+ link = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
480
+ if not link:
481
+ return await message.reply_text("Silakan masukkan link Terabox v2.")
482
+
483
+ pro = await message.reply_text("🚀 **Processing...**")
484
+
485
+ mp4_file = await download_m3u8(link)
486
+ if not mp4_file:
487
+ return await pro.edit_text("❌ Gagal mendapatkan file mp4.")
488
+
489
+ upload_text = "**⬆️ Uploading video...**"
490
+ thumb_path = "terabox.jpg"
491
+
492
+ async with httpx.AsyncClient() as clientv:
493
+ async with clientv.stream("GET", "https://images3.memedroid.com/images/UPLOADED822/63c5a9ca185df.jpeg") as thumb_response:
494
+ async with aiofiles.open(thumb_path, "wb") as file:
495
+ await file.write(await thumb_response.aread())
496
+
497
+ await pro.edit_text(upload_text)
498
+ await message.reply_video(
499
+ mp4_file,
500
+ caption=f"• Powered by {client.me.mention}",
501
+ thumb=thumb_path,
502
+ progress=progress,
503
+ progress_args=(
504
+ pro,
505
+ time.time(),
506
+ "⬆️ Uploading video...."
507
+ )
508
+ )
509
+ os.remove(thumb_path)
510
+ os.remove(mp4_file)
511
+ await pro.delete()
512
+
513
+
514
+ @Client.on_message(
515
+ ~filters.scheduled & filters.command(["teraboxdl"]) & ~filters.forwarded
516
+ )
517
+ async def terabox_cmd(client: Client, message):
518
+ user_id = message.from_user.id
519
+ if await db.get_alldlbot_is_blacklist_user(client.me.id, user_id):
520
+ return
521
+
522
+ user_name = message.from_user.first_name
523
+ nn = f"[{user_name}](tg://user?id={user_id})"
524
+
525
+ update_channel = await db.get_forcesub_only_bot(client.me.id)
526
+ if update_channel:
527
+ try:
528
+ user = await client.get_chat_member(update_channel, user_id)
529
+ if user.status == ChatMemberStatus.BANNED:
530
+ return await message.reply_text(f"❌ {nn}, Anda telah diblokir dari grup dukungan.")
531
+ except UserNotParticipant:
532
+ return await message.reply_text(
533
+ f"👋🏻 Halo {nn}, untuk menggunakan bot ini, silakan join channel kami!",
534
+ reply_markup=InlineKeyboardMarkup(
535
+ [[InlineKeyboardButton("Join Channel", url=f"https://t.me/{update_channel}")]]
536
+ ),
537
+ )
538
+ except ChatAdminRequired:
539
+ return await message.reply_text("Chat admin diperlukan: /addjoin username tanpa @ dan tambahkan bot ke channel sebagai admin.")
540
+
541
+ if len(message.command) < 2:
542
+ return await message.reply_text("❌ Harap masukkan link untuk Terabox Downloader.")
543
+
544
+ link = message.text.split(" ", 1)[1]
545
+ pro = await message.reply_text("⏳ Processing...")
546
+
547
+ try:
548
+ response = await TeraboxDL(link)
549
+ if "error" in response or not response["video_url_2"]:
550
+ return await pro.edit_text("❌ Error: Gagal mendapatkan URL video.")
551
+
552
+ video_url = urllib.parse.unquote(response["video_url_2"])
553
+ video_path = "terabox.mp4"
554
+ thumb_path = "terabox.jpg"
555
+
556
+ async with httpx.AsyncClient() as clientv:
557
+ async with clientv.stream("GET", video_url) as vid_response:
558
+ if vid_response.status_code != 200:
559
+ return await pro.edit_text("❌ Error saat mengunduh video.")
560
+
561
+ async with aiofiles.open(video_path, "wb") as file:
562
+ async for chunk in vid_response.aiter_bytes():
563
+ await file.write(chunk)
564
+
565
+ async with clientv.stream("GET", "https://images3.memedroid.com/images/UPLOADED822/63c5a9ca185df.jpeg") as thumb_response:
566
+ async with aiofiles.open(thumb_path, "wb") as file:
567
+ await file.write(await thumb_response.aread())
568
+
569
+ await pro.edit_text("⬆️ Uploading video...")
570
+ await message.reply_video(
571
+ video_path,
572
+ caption=f"• Powered by {client.me.mention}",
573
+ thumb=thumb_path,
574
+ progress=progress,
575
+ progress_args=(
576
+ pro,
577
+ time.time(),
578
+ "⬆️ Uploading video...."
579
+ )
580
+ )
581
+
582
+ await pro.delete()
583
+ os.remove(video_path)
584
+ os.remove(thumb_path)
585
+
586
+ except Exception as e:
587
+ await pro.edit_text(f"❌ Error: {str(e)}")
588
+
589
+ @Client.on_message(
590
+ ~filters.scheduled
591
+ & filters.command(["twdl"])
592
+ & ~filters.forwarded
593
+ )
594
+ async def twdl_cmd(client: Client, message: Message):
595
+ user_id = message.from_user.id
596
+ if await db.get_alldlbot_is_blacklist_user(client.me.id, user_id):
597
+ return
598
+ if message.chat.type.value != "supergroup":
599
+ return await message.reply_text("You can only group public not private")
600
+ await db.update_alldlbot_broadcast_in_group(client.me.id, message.chat.id, "add")
601
+ user_name = message.from_user.first_name
602
+ nn = "[" + user_name + "](tg://user?id=" + str(user_id) + ")"
603
+ if not await db.get_forcesub_only_bot(client.me.id):
604
+ return await message.reply_text("This is the command /addjoin username channel and becomes admin on the channel")
605
+ update_channel = await db.get_forcesub_only_bot(client.me.id)
606
+ if update_channel:
607
+ try:
608
+ user = await client.get_chat_member(update_channel, user_id)
609
+ if user.status == ChatMemberStatus.BANNED:
610
+ await client.send_message(
611
+ message.chat.id,
612
+ text=f"**❌ {nn} anda telah di blokir dari grup dukungan**",
613
+ disable_web_page_preview=True,
614
+ )
615
+ return
616
+ except UserNotParticipant:
617
+ await client.send_message(
618
+ message.chat.id,
619
+ text=f"**👋🏻 Halo {nn}\nᴜɴᴛᴜᴋ ᴍᴇɴɢʜɪɴᴅᴀʀɪ ᴘᴇɴɢɢᴜɴᴀᴀɴ ʏᴀɴɢ ʙᴇʀʟᴇʙɪʜᴀɴ ʙᴏᴛ ɪɴɪ ᴅɪ ᴋʜᴜsᴜsᴋᴀɴ ᴜɴᴛᴜᴋ ʏᴀɴɢ sᴜᴅᴀʜ ᴊᴏɪɴ ᴅɪ ᴄʜᴀɴɴᴇʟ ᴋᴀᴍɪ​!**",
620
+ reply_markup=InlineKeyboardMarkup(
621
+ [
622
+ [
623
+ InlineKeyboardButton(
624
+ "Jᴏɪɴ Cʜᴀɴɴᴇʟ Dᴜʟᴜ",
625
+ url=f"https://t.me/{update_channel}",
626
+ )
627
+ ]
628
+ ]
629
+ ),
630
+ )
631
+ return
632
+ except ChatAdminRequired:
633
+ return await message.reply_text("Chat admins Required: before /addjoin username without @ and add bot to your channel as admin")
634
+
635
+ link = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
636
+ pro = await message.reply_text("Processing.....")
637
+ if not link:
638
+ return await pro.edit_text("Please link for Twitter.")
639
+ urls = re.sub(r"(https?:\/\/)(?:www\.)?x\.com", r"\1twitter.com", link)
640
+ if not urls:
641
+ return await pro.edit_text("invalid link.")
642
+ try:
643
+ response = await js.fetch_and_extract_urls(
644
+ f"https://snapdownloader.com/tools/twitter-video-downloader/download?url={urls}",
645
+ href_url=r"https://video",
646
+ return_unsafe_href=True
647
+ )
648
+ upload_text = f"**⬆️ 𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 video ...**"
649
+ await pro.edit_text(upload_text)
650
+ await message.reply_video(
651
+ response[0],
652
+ caption=f"• Powered by {client.me.mention}",
653
+ progress=progress,
654
+ progress_args=(
655
+ pro,
656
+ time.time(),
657
+ upload_text
658
+ )
659
+ )
660
+ await pro.delete()
661
+ except Exception as e:
662
+ LOGS.error(str(e))
663
+ await pro.edit_text("Error: Try invalid")
664
+
665
+ @Client.on_message(
666
+ ~filters.scheduled
667
+ & filters.command(["fbdl"])
668
+ & ~filters.forwarded
669
+ )
670
+ async def fbdl_cmd(client: Client, message: Message):
671
+ user_id = message.from_user.id
672
+ if await db.get_maintance():
673
+ return await message.reply_text("Bot is in maintance mode. By @xpushz")
674
+
675
+ if await db.get_alldlbot_is_blacklist_user(client.me.id, user_id):
676
+ return
677
+
678
+ if message.chat.type.value != "supergroup":
679
+ return await message.reply_text("You can only group public not private")
680
+ await db.update_alldlbot_broadcast_in_group(client.me.id, message.chat.id, "add")
681
+ user_name = message.from_user.first_name
682
+ nn = "[" + user_name + "](tg://user?id=" + str(user_id) + ")"
683
+ if not await db.get_forcesub_only_bot(client.me.id):
684
+ return await message.reply_text("This is the command /addjoin username channel and becomes admin on the channel")
685
+ update_channel = await db.get_forcesub_only_bot(client.me.id)
686
+ if update_channel:
687
+ try:
688
+ user = await client.get_chat_member(update_channel, user_id)
689
+ if user.status == ChatMemberStatus.BANNED:
690
+ await client.send_message(
691
+ message.chat.id,
692
+ text=f"**❌ {nn} anda telah di blokir dari grup dukungan**",
693
+ disable_web_page_preview=True,
694
+ )
695
+ return
696
+ except UserNotParticipant:
697
+ await client.send_message(
698
+ message.chat.id,
699
+ text=f"**👋🏻 Halo {nn}\nᴜɴᴛᴜᴋ ᴍᴇɴɢʜɪɴᴅᴀʀɪ ᴘᴇɴɢɢᴜɴᴀᴀɴ ʏᴀɴɢ ʙᴇʀʟᴇʙɪʜᴀɴ ʙᴏᴛ ɪɴɪ ᴅɪ ᴋʜᴜsᴜsᴋᴀɴ ᴜɴᴛᴜᴋ ʏᴀɴɢ sᴜᴅᴀʜ ᴊᴏɪɴ ᴅɪ ᴄʜᴀɴɴᴇʟ ᴋᴀᴍɪ​!**",
700
+ reply_markup=InlineKeyboardMarkup(
701
+ [
702
+ [
703
+ InlineKeyboardButton(
704
+ "Jᴏɪɴ Cʜᴀɴɴᴇʟ Dᴜʟᴜ",
705
+ url=f"https://t.me/{update_channel}",
706
+ )
707
+ ]
708
+ ]
709
+ ),
710
+ )
711
+ return
712
+ except ChatAdminRequired:
713
+ return await message.reply_text("Chat admins Required: before /addjoin username without @ and add bot to your channel as admin")
714
+
715
+ link = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
716
+ pro = await message.reply_text("Processing.....")
717
+ if not link:
718
+ return await pro.edit_text("Please link for facebook.")
719
+ if not link.startswith("https://www.facebook.com/"):
720
+ return await pro.edit_text("invalid link.")
721
+ try:
722
+ response = await js.AkenoXJs(
723
+ js.types.DifferentAPIDefault()
724
+ ).connect().downloader.create(
725
+ "fb",
726
+ params_data={"url": link},
727
+ is_obj=True
728
+ )
729
+ upload_text = f"**⬆️ 𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 video ...**"
730
+ await pro.edit_text(upload_text)
731
+ await message.reply_video(
732
+ response.results.video[0].url,
733
+ caption=f"• Powered by {client.me.mention}",
734
+ progress=progress,
735
+ progress_args=(
736
+ pro,
737
+ time.time(),
738
+ upload_text
739
+ )
740
+ )
741
+ await pro.delete()
742
+ except Exception as e:
743
+ LOGS.error(str(e))
744
+ await pro.edit_text("Error: Try invalid")
745
+
746
+ @Client.on_message(
747
+ ~filters.scheduled
748
+ & filters.command(["igdl"])
749
+ & ~filters.forwarded
750
+ )
751
+ async def igdl_cmd(client: Client, message: Message):
752
+ user_id = message.from_user.id
753
+ if await db.get_maintance():
754
+ return await message.reply_text("Bot is in maintance mode. By @xpushz")
755
+
756
+ if await db.get_alldlbot_is_blacklist_user(client.me.id, user_id):
757
+ return
758
+ if message.chat.type.value != "supergroup":
759
+ return await message.reply_text("You can only group public not private")
760
+ await db.update_alldlbot_broadcast_in_group(client.me.id, message.chat.id, "add")
761
+ user_name = message.from_user.first_name
762
+ nn = "[" + user_name + "](tg://user?id=" + str(user_id) + ")"
763
+ if not await db.get_forcesub_only_bot(client.me.id):
764
+ return await message.reply_text("This is the command /addjoin username channel and becomes admin on the channel")
765
+ update_channel = await db.get_forcesub_only_bot(client.me.id)
766
+ if update_channel:
767
+ try:
768
+ user = await client.get_chat_member(update_channel, user_id)
769
+ if user.status == ChatMemberStatus.BANNED:
770
+ await client.send_message(
771
+ message.chat.id,
772
+ text=f"**❌ {nn} anda telah di blokir dari grup dukungan**",
773
+ disable_web_page_preview=True,
774
+ )
775
+ return
776
+ except UserNotParticipant:
777
+ await client.send_message(
778
+ message.chat.id,
779
+ text=f"**👋🏻 Halo {nn}\nᴜɴᴛᴜᴋ ᴍᴇɴɢʜɪɴᴅᴀʀɪ ᴘᴇɴɢɢᴜɴᴀᴀɴ ʏᴀɴɢ ʙᴇʀʟᴇʙɪʜᴀɴ ʙᴏᴛ ɪɴɪ ᴅɪ ᴋʜᴜsᴜsᴋᴀɴ ᴜɴᴛᴜᴋ ʏᴀɴɢ sᴜᴅᴀʜ ᴊᴏɪɴ ᴅɪ ᴄʜᴀɴɴᴇʟ ᴋᴀᴍɪ!**",
780
+ reply_markup=InlineKeyboardMarkup(
781
+ [
782
+ [
783
+ InlineKeyboardButton(
784
+ "Jᴏɪɴ Cʜᴀɴɴᴇʟ Dᴜʟᴜ",
785
+ url=f"https://t.me/{update_channel}",
786
+ )
787
+ ]
788
+ ]
789
+ ),
790
+ )
791
+ return
792
+ except ChatAdminRequired:
793
+ return await message.reply_text("Chat admins Required: before /addjoin username without @ and add bot to your channel as admin")
794
+
795
+ link = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
796
+ pro = await message.reply_text("Processing.....")
797
+ if not link:
798
+ return await pro.edit_text("Please link for Instagram.")
799
+ if not link.startswith("https://www.instagram.com/"):
800
+ return await pro.edit_text("invalid link.")
801
+ try:
802
+ params = {"link": link, "version": "v4"}
803
+ response = requests.get(f"https://learn.maiysacollection.com/api/v1/dl/ig/custom", params=params).json()
804
+ if response["response"]["results"] is None:
805
+ return await pro.edit_text("Not Found.")
806
+ upload_text = f"**⬆️ 𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 video ...**"
807
+ await pro.edit_text(upload_text)
808
+ await message.reply_video(
809
+ response["response"]["results"]["results"][0]["variants"][0]["url"],
810
+ caption=f"• Powered by {client.me.mention}",
811
+ progress=progress,
812
+ progress_args=(
813
+ pro,
814
+ time.time(),
815
+ upload_text
816
+ )
817
+ )
818
+ await pro.delete()
819
+ except Exception as e:
820
+ LOGS.error(str(e))
821
+ await pro.edit_text("Error: Try invalid")
822
+
823
+ async def input_user(message: Message) -> str:
824
+ """Get the input from the user"""
825
+ if len(message.command) < 2:
826
+ output = ""
827
+ else:
828
+ try:
829
+ output = message.text.split(" ", 1)[1].strip() or ""
830
+ except IndexError:
831
+ output = ""
832
+ return output
833
+
834
+ @Client.on_message(
835
+ ~filters.scheduled
836
+ & filters.command(["ytsa"])
837
+ & ~filters.forwarded
838
+ )
839
+ async def youtube_search_audio(client: Client, message: Message):
840
+ user_id = message.from_user.id
841
+ if await db.get_alldlbot_is_blacklist_user(client.me.id, user_id):
842
+ return
843
+ user_name = message.from_user.first_name
844
+ nn = "[" + user_name + "](tg://user?id=" + str(user_id) + ")"
845
+ if not await db.get_forcesub_only_bot(client.me.id):
846
+ return await message.reply_text("This is the command /addjoin username channel and becomes admin on the channel")
847
+ update_channel = await db.get_forcesub_only_bot(client.me.id)
848
+ if update_channel:
849
+ try:
850
+ user = await client.get_chat_member(update_channel, user_id)
851
+ if user.status == ChatMemberStatus.BANNED:
852
+ await client.send_message(
853
+ message.chat.id,
854
+ text=f"**❌ {nn} anda telah di blokir dari grup dukungan**",
855
+ disable_web_page_preview=True,
856
+ )
857
+ return
858
+ except UserNotParticipant:
859
+ await client.send_message(
860
+ message.chat.id,
861
+ text=f"**👋🏻 Halo {nn}\nᴜɴᴛᴜᴋ ᴍᴇɴɢʜɪɴᴅᴀʀɪ ᴘᴇɴɢɢᴜɴᴀᴀɴ ʏᴀɴɢ ʙᴇʀʟᴇʙɪʜᴀɴ ʙᴏᴛ ɪɴɪ ᴅɪ ᴋʜᴜsᴜsᴋᴀɴ ᴜɴᴛᴜᴋ ʏᴀɴɢ sᴜᴅᴀʜ ᴊᴏɪɴ ᴅɪ ᴄʜᴀɴɴᴇʟ ᴋᴀᴍɪ​!**",
862
+ reply_markup=InlineKeyboardMarkup(
863
+ [
864
+ [
865
+ InlineKeyboardButton(
866
+ "Jᴏɪɴ Cʜᴀɴɴᴇʟ Dᴜʟᴜ",
867
+ url=f"https://t.me/{update_channel}",
868
+ )
869
+ ]
870
+ ]
871
+ ),
872
+ )
873
+ return
874
+ except ChatAdminRequired:
875
+ return await message.reply_text(f"Chat admins Required: before /addjoin username without @ and add bot to your channel as admin")
876
+
877
+ if len(message.command) < 2:
878
+ return await message.reply_text(
879
+ "Give a valid youtube search to download audio."
880
+ )
881
+ query = await input_user(message)
882
+ results = YoutubeSearch(query, max_results=5).to_dict()
883
+ watch = results[0]["url_suffix"]
884
+ url_suffix = watch.split("/")[1]
885
+ okk = f"https://youtube.com/{url_suffix}"
886
+ pro = await message.reply_text("Checking ...")
887
+ status, url = YoutubeDriver.check_url(okk)
888
+ if not status:
889
+ return await pro.edit_text(url)
890
+ if client.me.is_premium:
891
+ await pro.edit_text(f"{custom_loading}__Downloading audio ...__")
892
+ else:
893
+ await pro.edit_text(f"__Downloading audio ...__")
894
+ try:
895
+ with YoutubeDL(YoutubeDriver.song_options()) as ytdl:
896
+ yt_data = ytdl.extract_info(url, False)
897
+ yt_file = ytdl.prepare_filename(yt_data)
898
+ ytdl.process_info(yt_data)
899
+ if client.me.is_premium:
900
+ upload_text = f"**{custom_loading}𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 𝖲𝗈𝗇𝗀 ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖢𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
901
+ else:
902
+ upload_text = f"**𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 𝖲𝗈𝗇𝗀 ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖢𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
903
+ await pro.edit_text(upload_text)
904
+ response = requests.get(f"https://i.ytimg.com/vi/{yt_data['id']}/hqdefault.jpg")
905
+ with open(f"{yt_file}.jpg", "wb") as f:
906
+ f.write(response.content)
907
+ await message.reply_audio(
908
+ f"{yt_file}.mp3",
909
+ caption=f"**🎧 𝖳𝗂𝗍𝗅𝖾:** {yt_data['title']} \n\n**👀 𝖵𝗂𝖾𝗐𝗌:** `{yt_data['view_count']}` \n**⌛ 𝖣𝗎𝗋𝖺𝗍𝗂𝗈𝗇:** `{secs_to_mins(int(yt_data['duration']))}`",
910
+ duration=int(yt_data["duration"]),
911
+ performer="[Akeno UB]",
912
+ title=yt_data["title"],
913
+ thumb=f"{yt_file}.jpg",
914
+ progress=progress,
915
+ progress_args=(
916
+ pro,
917
+ time.time(),
918
+ upload_text,
919
+ ),
920
+ )
921
+ await pro.delete()
922
+ except Exception as e:
923
+ return await pro.edit_text(f"**🍀 Audio not Downloaded:** `{e}`")
924
+ try:
925
+ os.remove(f"{yt_file}.jpg")
926
+ os.remove(f"{yt_file}.mp3")
927
+ except:
928
+ pass
929
+
930
+ @Client.on_message(
931
+ ~filters.scheduled
932
+ & filters.command(["yta"])
933
+ & ~filters.forwarded
934
+ )
935
+ async def youtube_audio(client: Client, message: Message):
936
+ user_id = message.from_user.id
937
+ if await db.get_alldlbot_is_blacklist_user(client.me.id, user_id):
938
+ return
939
+ user_name = message.from_user.first_name
940
+ nn = "[" + user_name + "](tg://user?id=" + str(user_id) + ")"
941
+ if not await db.get_forcesub_only_bot(client.me.id):
942
+ return await message.reply_text("This is the command /addjoin username channel and becomes admin on the channel")
943
+ update_channel = await db.get_forcesub_only_bot(client.me.id)
944
+ if update_channel:
945
+ try:
946
+ user = await client.get_chat_member(update_channel, user_id)
947
+ if user.status == ChatMemberStatus.BANNED:
948
+ await client.send_message(
949
+ message.chat.id,
950
+ text=f"**❌ {nn} anda telah di blokir dari grup dukungan**",
951
+ disable_web_page_preview=True,
952
+ )
953
+ return
954
+ except UserNotParticipant:
955
+ await client.send_message(
956
+ message.chat.id,
957
+ text=f"**👋🏻 Halo {nn}\nᴜɴᴛᴜᴋ ᴍᴇɴɢʜɪɴᴅᴀʀɪ ᴘᴇɴɢɢᴜɴᴀᴀɴ ʏᴀɴɢ ʙᴇʀʟᴇʙɪʜᴀɴ ʙᴏᴛ ɪɴɪ ᴅɪ ᴋʜᴜsᴜsᴋᴀɴ ᴜɴᴛᴜᴋ ʏᴀɴɢ sᴜᴅᴀʜ ᴊᴏɪɴ ᴅɪ ᴄʜᴀɴɴᴇʟ ᴋᴀᴍɪ​!**",
958
+ reply_markup=InlineKeyboardMarkup(
959
+ [
960
+ [
961
+ InlineKeyboardButton(
962
+ "Jᴏɪɴ Cʜᴀɴɴᴇʟ Dᴜʟᴜ",
963
+ url=f"https://t.me/{update_channel}",
964
+ )
965
+ ]
966
+ ]
967
+ ),
968
+ )
969
+ return
970
+ except ChatAdminRequired:
971
+ return await message.reply_text("Chat admins Required: before /addjoin username without @ and add bot to your channel as admin")
972
+
973
+ if len(message.command) < 2:
974
+ return await message.reply_text(
975
+ "Give a valid youtube link to download audio."
976
+ )
977
+ query = await input_user(message)
978
+ pro = await message.reply_text("Checking ...")
979
+ status, url = YoutubeDriver.check_url(query)
980
+ if not status:
981
+ return await pro.edit_text(url)
982
+ if client.me.is_premium:
983
+ await pro.edit_text(f"{custom_loading}__Downloading audio ...__")
984
+ else:
985
+ await pro.edit_text(f"__Downloading audio ...__")
986
+ try:
987
+ with YoutubeDL(YoutubeDriver.song_options()) as ytdl:
988
+ yt_data = ytdl.extract_info(url, False)
989
+ yt_file = ytdl.prepare_filename(yt_data)
990
+ ytdl.process_info(yt_data)
991
+ if client.me.is_premium:
992
+ upload_text = f"**{custom_loading}𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 𝖲𝗈𝗇𝗀 ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖢𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
993
+ else:
994
+ upload_text = f"**𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 𝖲𝗈𝗇𝗀 ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖢𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
995
+ await pro.edit_text(upload_text)
996
+ response = requests.get(f"https://i.ytimg.com/vi/{yt_data['id']}/hqdefault.jpg")
997
+ with open(f"{yt_file}.jpg", "wb") as f:
998
+ f.write(response.content)
999
+ await message.reply_audio(
1000
+ f"{yt_file}.mp3",
1001
+ caption=f"**🎧 𝖳𝗂𝗍𝗅𝖾:** {yt_data['title']} \n\n**👀 𝖵𝗂𝖾𝗐𝗌:** `{yt_data['view_count']}` \n**⌛ 𝖣𝗎𝗋𝖺𝗍𝗂𝗈𝗇:** `{secs_to_mins(int(yt_data['duration']))}`",
1002
+ duration=int(yt_data["duration"]),
1003
+ performer="[Akeno UB]",
1004
+ title=yt_data["title"],
1005
+ thumb=f"{yt_file}.jpg",
1006
+ progress=progress,
1007
+ progress_args=(
1008
+ pro,
1009
+ time.time(),
1010
+ upload_text,
1011
+ ),
1012
+ )
1013
+ await pro.delete()
1014
+ except Exception as e:
1015
+ return await pro.edit_text(f"**🍀 Audio not Downloaded:** `{e}`")
1016
+ try:
1017
+ os.remove(f"{yt_file}.jpg")
1018
+ os.remove(f"{yt_file}.mp3")
1019
+ except:
1020
+ pass
1021
+
1022
+ @Client.on_message(
1023
+ ~filters.scheduled
1024
+ & filters.command(["ytva"])
1025
+ & ~filters.forwarded
1026
+ )
1027
+ async def ytvideo_search(client: Client, message: Message):
1028
+ user_id = message.from_user.id
1029
+ if await db.get_alldlbot_is_blacklist_user(client.me.id, user_id):
1030
+ return
1031
+ user_name = message.from_user.first_name
1032
+ nn = "[" + user_name + "](tg://user?id=" + str(user_id) + ")"
1033
+ if not await db.get_forcesub_only_bot(client.me.id):
1034
+ return await message.reply_text("This is the command /addjoin username channel and becomes admin on the channel")
1035
+ update_channel = await db.get_forcesub_only_bot(client.me.id)
1036
+ if update_channel:
1037
+ try:
1038
+ user = await client.get_chat_member(update_channel, user_id)
1039
+ if user.status == ChatMemberStatus.BANNED:
1040
+ await client.send_message(
1041
+ message.chat.id,
1042
+ text=f"**❌ {nn} anda telah di blokir dari grup dukungan**",
1043
+ disable_web_page_preview=True,
1044
+ )
1045
+ return
1046
+ except UserNotParticipant:
1047
+ await client.send_message(
1048
+ message.chat.id,
1049
+ text=f"**👋🏻 Halo {nn}\nᴜɴᴛᴜᴋ ᴍᴇɴɢʜɪɴᴅᴀʀɪ ᴘᴇɴɢɢᴜɴᴀᴀɴ ʏᴀɴɢ ʙᴇʀʟᴇʙɪʜᴀɴ ʙᴏᴛ ɪɴɪ ᴅɪ ᴋʜᴜsᴜsᴋᴀɴ ᴜɴᴛᴜᴋ ʏᴀɴɢ sᴜᴅᴀʜ ᴊᴏɪɴ ᴅɪ ᴄʜᴀɴɴᴇʟ ᴋᴀᴍɪ​!**",
1050
+ reply_markup=InlineKeyboardMarkup(
1051
+ [
1052
+ [
1053
+ InlineKeyboardButton(
1054
+ "Jᴏɪɴ Cʜᴀɴɴᴇʟ Dᴜʟᴜ",
1055
+ url=f"https://t.me/{update_channel}",
1056
+ )
1057
+ ]
1058
+ ]
1059
+ ),
1060
+ )
1061
+ return
1062
+ except ChatAdminRequired:
1063
+ return await message.reply_text(f"Chat admins Required: before /addjoin username without @ and add bot to your channel as admin")
1064
+
1065
+ if len(message.command) < 2:
1066
+ return await message.reply_text(
1067
+ "Give a valid youtube search to download video."
1068
+ )
1069
+ query = await input_user(message)
1070
+ results = YoutubeSearch(query, max_results=5).to_dict()
1071
+ watch = results[0]["url_suffix"]
1072
+ url_suffix = watch.split("/")[1]
1073
+ okk = f"https://youtube.com/{url_suffix}"
1074
+ pro = await message.reply_text("Checking ...")
1075
+ status, url = YoutubeDriver.check_url(okk)
1076
+ if not status:
1077
+ return await pro.edit_text(url)
1078
+ if client.me.is_premium:
1079
+ await pro.edit_text(f"{custom_loading}__Downloading audio ...__")
1080
+ else:
1081
+ await pro.edit_text(f"__Downloading audio ...__")
1082
+ try:
1083
+ with YoutubeDL(YoutubeDriver.video_options()) as ytdl:
1084
+ yt_data = ytdl.extract_info(url, True)
1085
+ yt_file = yt_data["id"]
1086
+
1087
+ if client.me.is_premium:
1088
+ upload_text = f"**{custom_loading}𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 𝖲𝗈𝗇𝗀 ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖢𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
1089
+ else:
1090
+ upload_text = f"**𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 𝖲𝗈𝗇𝗀 ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖢𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
1091
+ await pro.edit_text(upload_text)
1092
+ response = requests.get(f"https://i.ytimg.com/vi/{yt_data['id']}/hqdefault.jpg")
1093
+ with open(f"{yt_file}.jpg", "wb") as f:
1094
+ f.write(response.content)
1095
+ await message.reply_video(
1096
+ f"{yt_file}.mp4",
1097
+ caption=f"**🎧 𝖳𝗂𝗍𝗅𝖾:** {yt_data['title']} \n\n**👀 𝖵𝗂𝖾𝗐𝗌:** `{yt_data['view_count']}` \n**⌛ 𝖣𝗎𝗋𝖺𝗍𝗂𝗈𝗇:** `{secs_to_mins(int(yt_data['duration']))}`",
1098
+ duration=int(yt_data["duration"]),
1099
+ thumb=f"{yt_file}.jpg",
1100
+ progress=progress,
1101
+ progress_args=(
1102
+ pro,
1103
+ time.time(),
1104
+ upload_text,
1105
+ ),
1106
+ )
1107
+ await pro.delete()
1108
+ except Exception as e:
1109
+ return await pro.edit_text(f"**🍀 Video not Downloaded:** `{e}`")
1110
+ try:
1111
+ os.remove(f"{yt_file}.jpg")
1112
+ os.remove(f"{yt_file}.mp4")
1113
+ except:
1114
+ pass
1115
+
1116
+ @Client.on_message(
1117
+ ~filters.scheduled
1118
+ & filters.command(["ytv"])
1119
+ & ~filters.forwarded
1120
+ )
1121
+ async def ytvideo(client: Client, message: Message):
1122
+ user_id = message.from_user.id
1123
+ if await db.get_alldlbot_is_blacklist_user(client.me.id, user_id):
1124
+ return
1125
+ user_name = message.from_user.first_name
1126
+ nn = "[" + user_name + "](tg://user?id=" + str(user_id) + ")"
1127
+ if not await db.get_forcesub_only_bot(client.me.id):
1128
+ return await message.reply_text("This is the command /addjoin username channel and becomes admin on the channel")
1129
+ update_channel = await db.get_forcesub_only_bot(client.me.id)
1130
+ if update_channel:
1131
+ try:
1132
+ user = await client.get_chat_member(update_channel, user_id)
1133
+ if user.status == ChatMemberStatus.BANNED:
1134
+ await client.send_message(
1135
+ message.chat.id,
1136
+ text=f"**❌ {nn} anda telah di blokir dari grup dukungan**",
1137
+ disable_web_page_preview=True,
1138
+ )
1139
+ return
1140
+ except UserNotParticipant:
1141
+ await client.send_message(
1142
+ message.chat.id,
1143
+ text=f"**👋🏻 Halo {nn}\nᴜɴᴛᴜᴋ ᴍᴇɴɢʜɪɴᴅᴀʀɪ ᴘᴇɴɢɢᴜɴᴀᴀɴ ʏᴀɴɢ ʙᴇʀʟᴇʙɪʜᴀɴ ʙᴏᴛ ɪɴɪ ᴅɪ ᴋʜᴜsᴜsᴋᴀɴ ᴜɴᴛᴜᴋ ʏᴀɴɢ sᴜᴅᴀʜ ᴊᴏɪɴ ᴅɪ ᴄʜᴀɴɴᴇʟ ᴋᴀᴍɪ​!**",
1144
+ reply_markup=InlineKeyboardMarkup(
1145
+ [
1146
+ [
1147
+ InlineKeyboardButton(
1148
+ "Jᴏɪɴ Cʜᴀɴɴᴇʟ Dᴜʟᴜ",
1149
+ url=f"https://t.me/{update_channel}",
1150
+ )
1151
+ ]
1152
+ ]
1153
+ ),
1154
+ )
1155
+ return
1156
+ except ChatAdminRequired:
1157
+ return await message.reply_text("Chat admins Required: before /addjoin username without @ and add bot to your channel as admin")
1158
+
1159
+ if len(message.command) < 2:
1160
+ return await message.reply_text(
1161
+ "Give a valid youtube link to download video."
1162
+ )
1163
+ query = await input_user(message)
1164
+ pro = await message.reply_text("Checking ...")
1165
+ status, url = YoutubeDriver.check_url(query)
1166
+ if not status:
1167
+ return await pro.edit_text(url)
1168
+ if client.me.is_premium:
1169
+ await pro.edit_text(f"{custom_loading}__Downloading audio ...__")
1170
+ else:
1171
+ await pro.edit_text(f"__Downloading audio ...__")
1172
+ try:
1173
+ with YoutubeDL(YoutubeDriver.video_options()) as ytdl:
1174
+ yt_data = ytdl.extract_info(url, True)
1175
+ yt_file = yt_data["id"]
1176
+
1177
+ if client.me.is_premium:
1178
+ upload_text = f"**{custom_loading}𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 𝖲𝗈𝗇𝗀 ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖢𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
1179
+ else:
1180
+ upload_text = f"**𝖴𝗉𝗅𝗈𝖺𝖽𝗂𝗇𝗀 𝖲𝗈𝗇𝗀 ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖢𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
1181
+ await pro.edit_text(upload_text)
1182
+ response = requests.get(f"https://i.ytimg.com/vi/{yt_data['id']}/hqdefault.jpg")
1183
+ with open(f"{yt_file}.jpg", "wb") as f:
1184
+ f.write(response.content)
1185
+ await message.reply_video(
1186
+ f"{yt_file}.mp4",
1187
+ caption=f"**🎧 𝖳𝗂𝗍𝗅𝖾:** {yt_data['title']} \n\n**👀 𝖵𝗂𝖾𝗐𝗌:** `{yt_data['view_count']}` \n**⌛ 𝖣𝗎𝗋𝖺𝗍𝗂𝗈𝗇:** `{secs_to_mins(int(yt_data['duration']))}`",
1188
+ duration=int(yt_data["duration"]),
1189
+ thumb=f"{yt_file}.jpg",
1190
+ progress=progress,
1191
+ progress_args=(
1192
+ pro,
1193
+ time.time(),
1194
+ upload_text,
1195
+ ),
1196
+ )
1197
+ await pro.delete()
1198
+ except Exception as e:
1199
+ return await pro.edit_text(f"**🍀 Video not Downloaded:** `{e}`")
1200
+ try:
1201
+ os.remove(f"{yt_file}.jpg")
1202
+ os.remove(f"{yt_file}.mp4")
1203
+ except:
1204
+ pass
1205
+
1206
+ @Client.on_message(
1207
+ ~filters.scheduled
1208
+ & filters.command(["ytlink"])
1209
+ & ~filters.forwarded
1210
+ )
1211
+ async def ytlink(client: Client, message: Message):
1212
+ user_id = message.from_user.id
1213
+ if await db.get_alldlbot_is_blacklist_user(client.me.id, user_id):
1214
+ return
1215
+ user_name = message.from_user.first_name
1216
+ nn = "[" + user_name + "](tg://user?id=" + str(user_id) + ")"
1217
+ if not await db.get_forcesub_only_bot(client.me.id):
1218
+ return await message.reply_text("This is the command /addjoin username channel and becomes admin on the channel")
1219
+ update_channel = await db.get_forcesub_only_bot(client.me.id)
1220
+ if update_channel:
1221
+ try:
1222
+ user = await client.get_chat_member(update_channel, user_id)
1223
+ if user.status == ChatMemberStatus.BANNED:
1224
+ await client.send_message(
1225
+ message.chat.id,
1226
+ text=f"**❌ {nn} anda telah di blokir dari grup dukungan**",
1227
+ disable_web_page_preview=True,
1228
+ )
1229
+ return
1230
+ except UserNotParticipant:
1231
+ await client.send_message(
1232
+ message.chat.id,
1233
+ text=f"**👋🏻 Halo {nn}\nᴜɴᴛᴜᴋ ᴍᴇɴɢʜɪɴᴅᴀʀɪ ᴘᴇɴɢɢᴜɴᴀᴀɴ ʏᴀɴɢ ʙᴇʀʟᴇʙɪʜᴀɴ ʙᴏᴛ ɪɴɪ ᴅɪ ᴋʜᴜsᴜsᴋᴀɴ ᴜɴᴛᴜᴋ ʏᴀɴɢ sᴜᴅᴀʜ ᴊᴏɪɴ ᴅɪ ᴄʜᴀɴɴᴇʟ ᴋᴀᴍɪ​!**",
1234
+ reply_markup=InlineKeyboardMarkup(
1235
+ [
1236
+ [
1237
+ InlineKeyboardButton(
1238
+ "Jᴏɪɴ Cʜᴀɴɴᴇʟ Dᴜʟᴜ",
1239
+ url=f"https://t.me/{update_channel}",
1240
+ )
1241
+ ]
1242
+ ]
1243
+ ),
1244
+ )
1245
+ return
1246
+ except ChatAdminRequired:
1247
+ return await message.reply_text("Chat admins Required: before /addjoin username without @ and add bot to your channel as admin")
1248
+
1249
+ if len(message.command) < 2:
1250
+ return await message.reply_text("Give something to search on youtube.")
1251
+ query = await input_user(message)
1252
+ pro = await message.reply_text("Searching ...")
1253
+ try:
1254
+ results = YoutubeDriver(query, 7).to_dict()
1255
+ except Exception as e:
1256
+ return await pro.edit_text(f"**🍀 Error:** `{e}`")
1257
+ if not results:
1258
+ return await pro.edit_text("No results found.")
1259
+ text = f"**🔎 𝖳𝗈𝗍𝖺𝗅 𝖱𝖾𝗌𝗎𝗅𝗍𝗌 𝖥𝗈𝗎𝗇𝖽:** `{len(results)}`\n\n"
1260
+ for result in results:
1261
+ text += f"**𝖳𝗂𝗍𝗅𝖾:** `{result['title'][:50]}`\n**𝖢𝗁𝖺𝗇𝗇𝖾𝗅:** `{result['channel']}`\n**𝖵𝗂𝖾𝗐𝗌:** `{result['views']}`\n**𝖣𝗎𝗋𝖺𝗍𝗂𝗈𝗇:** `{result['duration']}`\n**𝖫𝗂𝗇𝗄:** `https://youtube.com{result['url_suffix']}`\n\n"
1262
+ await pro.edit_text(text, disable_web_page_preview=True)
akn/AllDownloaderBot/support_sites.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import yt_dlp
2
+ import os
3
+ import uuid
4
+ from akn.utils.logger import LOGS
5
+
6
+ def all_one_downloader(url: str, download_path: str = "./downloads/"):
7
+ unique_id = str(uuid.uuid4())
8
+
9
+ ydl_opts = {
10
+ "outtmpl": os.path.join(download_path, f"{unique_id}.%(ext)s"),
11
+ "quiet": True,
12
+ "noplaylist": True,
13
+ "format": "best",
14
+ }
15
+
16
+ with yt_dlp.YoutubeDL(ydl_opts) as ydl:
17
+ info = ydl.extract_info(url, download=True)
18
+ video_title = info.get("title", "Video")
19
+ video_path = ydl.prepare_filename(info)
20
+
21
+ return video_path, video_title
akn/ApproveBot/__init__.py ADDED
File without changes
akn/ApproveBot/join_request.py ADDED
@@ -0,0 +1,428 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import time
3
+ import json
4
+ import asyncio
5
+ import io
6
+ import re
7
+ import logging
8
+ import string
9
+ import random
10
+ import requests
11
+ from pyrogram import Client, filters
12
+ from pyrogram.types import *
13
+ from pyrogram.enums import *
14
+ from pyrogram.errors import *
15
+
16
+ from PIL import Image, ImageDraw, ImageFont, ImageFilter
17
+
18
+ logging.basicConfig(level=logging.INFO)
19
+ logger = logging.getLogger(__name__)
20
+
21
+ captcha_texts = {}
22
+ captcha_modes = {}
23
+
24
+ NOT_ALLOWED_NON_PROGRAMMER = [
25
+ 5575183435, # suku
26
+ 948247711, # akay
27
+ ]
28
+
29
+ def generate_math_captcha():
30
+ operations = ['+', '-', '*']
31
+ operation = random.choice(operations)
32
+ num1 = random.randint(1, 20)
33
+ num2 = random.randint(1, 20)
34
+
35
+ if operation == '+':
36
+ correct_answer = num1 + num2
37
+ elif operation == '-':
38
+ correct_answer = num1 - num2
39
+ else:
40
+ correct_answer = num1 * num2
41
+ captcha_text = f"{num1} {operation} {num2} = ?"
42
+ choices = [str(correct_answer)]
43
+ while len(choices) < 3:
44
+ wrong_answer = correct_answer + random.choice([-5, -3, -2, 2, 3, 5])
45
+ if str(wrong_answer) not in choices:
46
+ choices.append(str(wrong_answer))
47
+ random.shuffle(choices)
48
+
49
+ width, height = 250, 100
50
+ background_color = (random.randint(200, 255), random.randint(200, 255), random.randint(200, 255)) # Warna pastel
51
+ img = Image.new('RGB', (width, height), color=background_color)
52
+ d = ImageDraw.Draw(img)
53
+
54
+ for _ in range(1000):
55
+ x = random.randint(0, width)
56
+ y = random.randint(0, height)
57
+ noise_color = (random.randint(150, 200), random.randint(150, 200), random.randint(150, 200))
58
+ d.point((x, y), fill=noise_color)
59
+
60
+ try:
61
+ font = ImageFont.truetype("arial.ttf", 40)
62
+ except IOError:
63
+ font = ImageFont.load_default()
64
+
65
+ text_width, text_height = d.textsize(captcha_text, font=font)
66
+ text_x = (width - text_width) / 2
67
+ text_y = (height - text_height) / 2 - 20
68
+
69
+ text_image = Image.new('RGBA', (text_width, text_height), (255, 255, 255, 0))
70
+ text_draw = ImageDraw.Draw(text_image)
71
+ text_draw.text((0, 0), captcha_text, font=font, fill=(0, 0, 0))
72
+ rotated_text = text_image.rotate(random.randint(-25, 25), expand=1)
73
+ img.paste(rotated_text, (int(text_x), int(text_y)), rotated_text)
74
+
75
+ choice_font = ImageFont.truetype("arial.ttf", 30) if font else ImageFont.load_default()
76
+ for idx, choice in enumerate(choices):
77
+ choice_text = f"{idx + 1}. {choice}"
78
+ choice_width, choice_height = d.textsize(choice_text, font=choice_font)
79
+ choice_x = 50 + idx * 80
80
+ choice_y = height - choice_height - 20
81
+ d.text((choice_x, choice_y), choice_text, font=choice_font, fill=(0, 0, 0))
82
+
83
+ for _ in range(5):
84
+ start = (random.randint(0, width), random.randint(0, height))
85
+ end = (random.randint(0, width), random.randint(0, height))
86
+ line_color = (random.randint(0, 150), random.randint(0, 150), random.randint(0, 150))
87
+ d.line([start, end], fill=line_color, width=2)
88
+
89
+ img = img.filter(ImageFilter.BLUR)
90
+
91
+ img_path = f"captcha_math_{captcha_text}.png"
92
+ img.save(img_path)
93
+
94
+ return captcha_text, img_path, choices, correct_answer
95
+
96
+ def generate_text_captcha():
97
+ letters = string.ascii_uppercase + string.digits
98
+ captcha_text = ''.join(random.choice(letters) for _ in range(5))
99
+
100
+ choices = [captcha_text]
101
+ while len(choices) < 3:
102
+ wrong_choice = ''.join(random.choice(letters) for _ in range(5))
103
+ if wrong_choice not in choices:
104
+ choices.append(wrong_choice)
105
+ random.shuffle(choices)
106
+
107
+ width, height = 200, 80
108
+ background_color = (random.randint(200, 255), random.randint(200, 255), random.randint(200, 255)) # Warna pastel
109
+ img = Image.new('RGB', (width, height), color=background_color)
110
+ d = ImageDraw.Draw(img)
111
+
112
+ for _ in range(500):
113
+ x = random.randint(0, width)
114
+ y = random.randint(0, height)
115
+ noise_color = (random.randint(150, 200), random.randint(150, 200), random.randint(150, 200))
116
+ d.point((x, y), fill=noise_color)
117
+
118
+ try:
119
+ font = ImageFont.truetype("arial.ttf", 45)
120
+ except IOError:
121
+ font = ImageFont.load_default()
122
+
123
+ text_width, text_height = d.textsize(captcha_text, font=font)
124
+ text_x = (width - text_width) / 2
125
+ text_y = (height - text_height) / 2
126
+
127
+ text_image = Image.new('RGBA', (text_width, text_height), (255, 255, 255, 0))
128
+ text_draw = ImageDraw.Draw(text_image)
129
+ text_draw.text((0, 0), captcha_text, font=font, fill=(0, 0, 0))
130
+ rotated_text = text_image.rotate(random.randint(-25, 25), expand=1)
131
+ img.paste(rotated_text, (int(text_x), int(text_y)), rotated_text)
132
+
133
+ choice_font = ImageFont.truetype("arial.ttf", 30) if font else ImageFont.load_default()
134
+ for idx, choice in enumerate(choices):
135
+ choice_text = f"{idx + 1}. {choice}"
136
+ choice_width, choice_height = d.textsize(choice_text, font=choice_font)
137
+ choice_x = 50 + idx * 80
138
+ choice_y = height - choice_height - 20
139
+ d.text((choice_x, choice_y), choice_text, font=choice_font, fill=(0, 0, 0))
140
+
141
+ for _ in range(5):
142
+ start = (random.randint(0, width), random.randint(0, height))
143
+ end = (random.randint(0, width), random.randint(0, height))
144
+ line_color = (random.randint(0, 150), random.randint(0, 150), random.randint(0, 150))
145
+ d.line([start, end], fill=line_color, width=2)
146
+
147
+ img = img.filter(ImageFilter.BLUR)
148
+ img_path = f"captcha_text_{captcha_text}.png"
149
+ img.save(img_path)
150
+
151
+ return captcha_text, img_path, choices, captcha_text
152
+
153
+ def generate_captcha(user_id, mode='math'):
154
+ if mode == 'math':
155
+ return generate_math_captcha()
156
+ else:
157
+ return generate_text_captcha()
158
+
159
+ def thanks_hacker_by_randydev():
160
+ url = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR0u8UqJ2JDhfmPOCb_zAHjUQG2NYMjTwLbkq_sQhCQOxX8hn66YbaGFvLL&s=10"
161
+ response = requests.get(url)
162
+ image_hacker = "hacker.png"
163
+ with open(image_hacker, "wb") as f:
164
+ f.write(response.content)
165
+ return image_hacker
166
+
167
+ def failed_hacker_by_randydev():
168
+ url = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTM0vb4s59H9F1-_7FyELiLU04e8bCHy7o6KQV2mG3DFRLnzP547KjckKG2&s=10"
169
+ response = requests.get(url)
170
+ image_hacker = "failed_hacker.png"
171
+ with open(image_hacker, "wb") as f:
172
+ f.write(response.content)
173
+ return image_hacker
174
+
175
+ async def remove_captcha_after_timeout(client, user_id, delay=300):
176
+ await asyncio.sleep(delay)
177
+ if user_id in captcha_texts:
178
+ captcha_data = captcha_texts.get(user_id)
179
+ chat_id = captcha_data['chat_id']
180
+ await client.decline_chat_join_request(
181
+ chat_id=chat_id,
182
+ user_id=user_id
183
+ )
184
+ await client.send_message(user_id, "⏰ Your CAPTCHA verification has expired. Please try again.")
185
+ del captcha_texts[user_id]
186
+ logger.info(f"CAPTCHA for user {user_id} has expired and been removed.")
187
+
188
+ @Client.on_message(filters.command("settingmode") & filters.private)
189
+ async def setting_mode(client: Client, message: Message):
190
+ if message.from_user.id in NOT_ALLOWED_NON_PROGRAMMER:
191
+ return
192
+ user_id = message.from_user.id
193
+ keyboard = InlineKeyboardMarkup(
194
+ [
195
+ [InlineKeyboardButton("🔢 Mathematics", callback_data="mode_math")],
196
+ [InlineKeyboardButton("🔤 Text", callback_data="mode_text")],
197
+ [InlineKeyboardButton("❌ Cancel", callback_data="cancel_mode")]
198
+ ]
199
+ )
200
+ await message.reply_text(
201
+ "📍 Select the CAPTCHA mode you want:",
202
+ reply_markup=keyboard
203
+ )
204
+
205
+ @Client.on_callback_query(filters.regex("^mode_"))
206
+ async def mode_callback(client: Client, cb: CallbackQuery):
207
+ user_id = cb.from_user.id
208
+ data = cb.data.split("_")
209
+ if len(data) != 2:
210
+ await cb.answer("❌ Invalid selection.", show_alert=True)
211
+ return
212
+ mode = data[1]
213
+ if mode not in ['math', 'text']:
214
+ await cb.answer("❌ Invalid mode.", show_alert=True)
215
+ return
216
+ captcha_modes[user_id] = mode
217
+ keyboard = InlineKeyboardMarkup(
218
+ [
219
+ [InlineKeyboardButton("🔢 Mathematics", callback_data="mode_math")],
220
+ [InlineKeyboardButton("🔤 Text", callback_data="mode_text")],
221
+ [InlineKeyboardButton("❌ Cancel", callback_data="cancel_mode")]
222
+ ]
223
+ )
224
+ await cb.edit_message_text(
225
+ f"✅ CAPTCHA mode has been set to **{'Mathematics' if mode == 'math' else 'Text'}**.",
226
+ reply_markup=keyboard
227
+ )
228
+ await cb.answer("The mode has been changed.", show_alert=False)
229
+ logger.info(f"User {user_id} set CAPTCHA mode to {mode}.")
230
+
231
+ @Client.on_callback_query(filters.regex("^cancel_mode$"))
232
+ async def cancel_mode_callback(client: Client, cb: CallbackQuery):
233
+ await cb.edit_message_text("❌ CAPTCHA mode setting has been canceled.")
234
+ await cb.answer("Cancellation successful.", show_alert=False)
235
+ logger.info(f"User {cb.from_user.id} canceled CAPTCHA mode setting.")
236
+
237
+ @Client.on_chat_join_request(filters.chat("KillerXSupport"))
238
+ async def join_request(client: Client, event: ChatJoinRequest):
239
+ member = await client.get_chat_member(event.chat.id, "me")
240
+ if member.status != ChatMemberStatus.ADMINISTRATOR:
241
+ return await client.send_message(event.chat.id, text="I am not an administrator in this group.")
242
+
243
+ try:
244
+ chat_link = await client.export_chat_invite_link(event.chat.id)
245
+ except ChatAdminRequired:
246
+ await client.send_message(event.chat.id, text="I need to be an administrator to perform this action.")
247
+ return
248
+
249
+ mode = captcha_modes.get(event.from_user.id, "text")
250
+ captcha_text, img_path, choices, correct_answer = generate_captcha(event.from_user.id, mode)
251
+ captcha_texts[event.from_user.id] = {
252
+ "captcha_text": captcha_text,
253
+ "correct_answer": correct_answer,
254
+ "chat_id": event.chat.id,
255
+ "chat_link": chat_link,
256
+ "first_name": event.from_user.first_name
257
+ }
258
+
259
+ buttons = [
260
+ [InlineKeyboardButton(choice, callback_data=f"verify_{event.from_user.id}_{choice}")]
261
+ for choice in choices
262
+ ]
263
+ buttons.append([
264
+ InlineKeyboardButton("🔄 Refresh CAPTCHA", callback_data="refresh_captcha"),
265
+ InlineKeyboardButton("❌ Cancel", callback_data="cancel_captcha")
266
+ ])
267
+ keyboard = InlineKeyboardMarkup(buttons)
268
+
269
+ if event.chat.type == ChatType.SUPERGROUP:
270
+ try:
271
+ await client.send_message(
272
+ event.chat.id,
273
+ text=f" 🕦 Verify that you {event.from_user.first_name} are human!",
274
+ reply_markup=create_button_userinfo(event.from_user.id, client.me.username)
275
+ )
276
+ await client.send_photo(
277
+ event.from_user.id,
278
+ photo=img_path,
279
+ caption=f"❗️ **Verify that you are human!**\n\n❔ Please select the correct CAPTCHA text shown in the image below.",
280
+ reply_markup=keyboard
281
+ )
282
+ os.remove(img_path)
283
+ asyncio.create_task(remove_captcha_after_timeout(client, event.from_user.id))
284
+ except Exception as e:
285
+ await client.send_message(
286
+ event.chat.id,
287
+ text=str(e)
288
+ )
289
+ logger.error(str(e))
290
+
291
+ @Client.on_callback_query(filters.regex("^verify_"))
292
+ async def verify_captcha_callback(client: Client, cb: CallbackQuery):
293
+ data = cb.data.split("_")
294
+ if len(data) != 3:
295
+ await cb.answer("❌ Format data tidak valid.", show_alert=True)
296
+ return
297
+ _, user_id_str, user_choice = data
298
+ try:
299
+ user_id = int(user_id_str)
300
+ except ValueError:
301
+ await cb.answer("❌ Invalid user ID.", show_alert=True)
302
+ return
303
+ if cb.from_user.id != user_id:
304
+ await cb.answer("❌ You have no right to do this.", show_alert=True)
305
+ logger.warning(f"User {cb.from_user.id} mencoba memverifikasi CAPTCHA milik user {user_id}.")
306
+ return
307
+ if user_id not in captcha_texts:
308
+ await cb.answer("❗️ No active CAPTCHA verification.", show_alert=True)
309
+ logger.warning(f"User {user_id} mencoba memverifikasi CAPTCHA tanpa aktif.")
310
+ return
311
+ captcha_data = captcha_texts.get(user_id)
312
+ captcha_text = captcha_data["captcha_text"]
313
+ correct_answer = captcha_data["correct_answer"]
314
+ chat_id = captcha_data["chat_id"]
315
+ chat_link = captcha_data["chat_link"]
316
+ first_name = captcha_data["first_name"]
317
+
318
+ failed_image = failed_hacker_by_randydev()
319
+ hacker_image = thanks_hacker_by_randydev()
320
+
321
+ try:
322
+ if str(user_choice) == str(correct_answer):
323
+ await cb.edit_message_media(
324
+ media=InputMediaPhoto(
325
+ hacker_image,
326
+ caption="✅ CAPTCHA verification successful!"
327
+ ),
328
+ reply_markup=create_button_join_group(chat_link)
329
+ )
330
+ logger.info(f"User {user_id} berhasil memverifikasi CAPTCHA.")
331
+ if user_id in NOT_ALLOWED_NON_PROGRAMMER:
332
+ await client.ban_chat_member(chat_id=chat_id, user_id=user_id)
333
+ return
334
+ await client.approve_chat_join_request(
335
+ chat_id=chat_id,
336
+ user_id=user_id
337
+ )
338
+ await client.send_message(chat_id, f"Thank you for joining {first_name}")
339
+ del captcha_texts[user_id]
340
+ else:
341
+ await cb.edit_message_media(
342
+ media=InputMediaPhoto(
343
+ failed_image,
344
+ caption="❌ **CAPTCHA verification failed.**\n\nPlease try again."
345
+ )
346
+ )
347
+ await client.decline_chat_join_request(
348
+ chat_id=chat_id,
349
+ user_id=user_id
350
+ )
351
+ await client.send_message(chat_id, f"Failed to join {first_name}")
352
+ logger.info(f"User {user_id} gagal memverifikasi CAPTCHA.")
353
+ del captcha_texts[user_id]
354
+ except Exception as e:
355
+ await cb.answer(f"Error CAPTCHA: {e}", show_alert=True)
356
+
357
+ @Client.on_callback_query(filters.regex("^refresh_captcha$"))
358
+ async def refresh_captcha_callback(client: Client, cb: CallbackQuery):
359
+ user_id = cb.from_user.id
360
+ mode = captcha_modes.get(user_id, 'math')
361
+ if user_id in captcha_texts:
362
+ del captcha_texts[user_id]
363
+ logger.info(f"Old CAPTCHA for user {user_id} has been removed.")
364
+ captcha_text, img_path, choices, correct_answer = generate_captcha(user_id, mode)
365
+ captcha_texts[user_id] = {
366
+ "captcha_text": captcha_text,
367
+ "correct_answer": correct_answer,
368
+ "chat_id": captcha_texts[user_id]["chat_id"],
369
+ "chat_link": captcha_texts[user_id]["chat_link"],
370
+ "first_name": captcha_texts[user_id]["first_name"]
371
+
372
+ }
373
+ logger.info(f"Generated new {mode} CAPTCHA for user {user_id}: {captcha_text}")
374
+ buttons = [
375
+ [InlineKeyboardButton(choice, callback_data=f"verify_{user_id}_{choice}")]
376
+ for choice in choices
377
+ ]
378
+ buttons.append([
379
+ InlineKeyboardButton("🔄 Refresh CAPTCHA", callback_data="refresh_captcha"),
380
+ InlineKeyboardButton("❌ Cancel", callback_data="cancel_captcha")
381
+ ])
382
+ keyboard = InlineKeyboardMarkup(buttons)
383
+ try:
384
+ await cb.edit_message_media(
385
+ media=InputMediaPhoto(img_path),
386
+ reply_markup=keyboard
387
+ )
388
+ logger.info(f"Updated CAPTCHA image for user {user_id}.")
389
+ except Exception as e:
390
+ await cb.answer("❌ Failed to update CAPTCHA.", show_alert=True)
391
+ logger.error(f"Error refreshing CAPTCHA for user {user_id}: {e}")
392
+ os.remove(img_path)
393
+ await cb.answer("🔄 CAPTCHA has been updated!", show_alert=False)
394
+
395
+ @Client.on_callback_query(filters.regex("^cancel_captcha$"))
396
+ async def cancel_captcha_callback(client: Client, cb: CallbackQuery):
397
+ user_id = cb.from_user.id
398
+ if user_id in captcha_texts:
399
+ del captcha_texts[user_id]
400
+ logger.info(f"User {user_id} has canceled CAPTCHA verification.")
401
+ await cb.edit_message_caption(
402
+ caption="❌ **CAPTCHA verification has been canceled.**\n\nIf you want to try again.",
403
+ )
404
+ await cb.answer("CAPTCHA verification canceled.", show_alert=False)
405
+ else:
406
+ await cb.answer("❗️ No active CAPTCHA verification found.", show_alert=True)
407
+ logger.warning(f"User {user_id} attempted to cancel CAPTCHA without active verification.")
408
+
409
+ @Client.on_callback_query(filters.regex("^close$"))
410
+ async def close_final(client: Client, cb: CallbackQuery):
411
+ await cb.message.delete()
412
+ await cb.answer()
413
+
414
+ def create_button_join_group(chat_link):
415
+ return InlineKeyboardMarkup(
416
+ [
417
+ [InlineKeyboardButton("👁️ Join chat", url=chat_link)],
418
+ [InlineKeyboardButton("🔘 Close", callback_data="close")],
419
+ ]
420
+ )
421
+
422
+ def create_button_userinfo(user_id, username):
423
+ return InlineKeyboardMarkup(
424
+ [
425
+ [InlineKeyboardButton("👤 Chmod +W $USER", user_id=user_id)],
426
+ [InlineKeyboardButton("🔔 Check human Bot", url=f"https://t.me/{username}")],
427
+ ]
428
+ )
akn/ApproveBot/start.py ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # Copyright 2020-2024 (c) Randy W @xtdevs, @xtsea
4
+ #
5
+ # from : https://github.com/TeamKillerX
6
+ # Channel : @RendyProjects
7
+ # This program is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU Affero General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU Affero General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Affero General Public License
18
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+
20
+ import time
21
+ import json
22
+ import asyncio
23
+ import io
24
+ import os
25
+ import re
26
+ import logging
27
+
28
+ from pyrogram import *
29
+ from pyrogram.enums import ChatMemberStatus, ChatType
30
+ from pyrogram import enums
31
+ from pyrogram import Client, filters
32
+ from pyrogram.types import *
33
+ from pyrogram.errors import *
34
+
35
+ START_TEXT = """
36
+ 👋 **Hey {name}!**
37
+
38
+ I’m excited to let you know that I’m ready to serve as your **Approve Join Request CAPTCHA Bot Developer**.
39
+
40
+ ✨ **What I Offer**:
41
+ - **Approve Join Requests**: Automatically approve or reject join requests based on your settings.
42
+ - **CAPTCHA Verification**: Add an extra layer of security with CAPTCHA challenges for new members.
43
+
44
+ 🔧 **How to Get Started**:
45
+ 1. Use the command `/settingmode` to configure your preferences.
46
+ 2. Customize the bot to suit your group’s needs.
47
+
48
+ 🚀 Let’s make your group safer and more efficient together!
49
+ """
50
+
51
+ NOT_ALLOWED_NON_PROGRAMMER = [
52
+ 5575183435, #suku
53
+ 948247711, # akay
54
+ ]
55
+
56
+ @Client.on_message(
57
+ ~filters.scheduled
58
+ & filters.command(["start"])
59
+ & filters.private
60
+ & ~filters.forwarded
61
+ )
62
+ async def startbot(client: Client, message: Message):
63
+ if message.from_user.id in NOT_ALLOWED_NON_PROGRAMMER:
64
+ return
65
+ buttons = InlineKeyboardMarkup(
66
+ [
67
+ [
68
+ InlineKeyboardButton(
69
+ text="Add your to group",
70
+ url=f"https://t.me/{client.me.username}?startgroup=True"
71
+ ),
72
+ ],
73
+ [
74
+ InlineKeyboardButton(
75
+ text="Developer",
76
+ url=f"https://t.me/xpushz"
77
+ ),
78
+ InlineKeyboardButton(
79
+ text="Channel",
80
+ url='https://t.me/RendyProjects'
81
+ )
82
+ ],
83
+ ]
84
+ )
85
+ await message.reply_text(
86
+ text=START_TEXT.format(name=message.from_user.mention),
87
+ disable_web_page_preview=True,
88
+ reply_markup=buttons
89
+ )
akn/Gemini/__init__.py ADDED
File without changes
akn/Gemini/gemini.py ADDED
@@ -0,0 +1,335 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # Copyright 2020-2024 (c) Randy W @xtdevs, @xtsea
4
+ #
5
+ # from : https://github.com/TeamKillerX
6
+ # Channel : @RendyProjects
7
+ # This program is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU Affero General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU Affero General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Affero General Public License
18
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+
20
+ import requests
21
+ import time
22
+ import json
23
+ import asyncio
24
+ import io
25
+ import os
26
+ import re
27
+ from PIL import Image
28
+
29
+ from pyrogram import *
30
+ from pyrogram import enums
31
+ from pyrogram import Client, filters
32
+ from pyrogram.types import *
33
+ from pyrogram.errors import *
34
+ from RyuzakiLib import FaceAI, FullStackDev, GeminiLatest, RendyDevChat
35
+ from config import *
36
+
37
+ from akn import send_log
38
+ from akn.utils.database import db
39
+ from akn.utils.logger import LOGS
40
+
41
+ import google.generativeai as genai
42
+ from google.api_core.exceptions import InvalidArgument
43
+
44
+ async def geni_files_delete(name: str):
45
+ url = f"https://generativelanguage.googleapis.com/v1beta/{name}"
46
+ params = {"key": GOOGLE_API_KEY}
47
+ response = requests.delete(url, params=params)
48
+ if response.status_code != 200:
49
+ return None
50
+ return response.text
51
+
52
+ DISABLED_COMMNAD = [
53
+ "onchat",
54
+ "offchat",
55
+ "start"
56
+ ]
57
+
58
+ GEMINI_START_TEXT = """
59
+ Hey! {name}
60
+
61
+ I am ready to be a gemini bot developer
62
+
63
+ - Command: /onchat (pm or group)
64
+ - Command: /offchat (pm or group)
65
+ """
66
+
67
+ @Client.on_message(
68
+ ~filters.scheduled
69
+ & filters.command(["start"])
70
+ & ~filters.forwarded
71
+ )
72
+ async def startbot(client: Client, message: Message):
73
+ buttons = [
74
+ [
75
+ InlineKeyboardButton(
76
+ text="Developer",
77
+ url=f"https://t.me/xtdevs"
78
+ ),
79
+ InlineKeyboardButton(
80
+ text="Channel",
81
+ url='https://t.me/RendyProjects'
82
+ ),
83
+ ],
84
+ [
85
+ InlineKeyboardButton(
86
+ text="Donate Via Web",
87
+ web_app=WebAppInfo(url="https://sociabuzz.com/randydev99/tribe")
88
+ )
89
+ ]
90
+ ]
91
+ await message.reply_text(
92
+ text=GEMINI_START_TEXT.format(name=message.from_user.mention),
93
+ disable_web_page_preview=True,
94
+ reply_markup=InlineKeyboardMarkup(buttons)
95
+ )
96
+
97
+ @Client.on_message(
98
+ ~filters.scheduled
99
+ & filters.command(["onchat"])
100
+ & ~filters.forwarded
101
+ )
102
+ async def addchatbot_user(client: Client, message: Message):
103
+ await db.add_chatbot(message.chat.id, client.me.id)
104
+ await message.reply_text("Added chatbot user")
105
+
106
+ @Client.on_message(
107
+ ~filters.scheduled
108
+ & filters.command(["offchat"])
109
+ & ~filters.forwarded
110
+ )
111
+ async def rmchatbot_user(client: Client, message: Message):
112
+ await db.remove_chatbot(message.chat.id)
113
+ await message.reply_text("ok stopped gemini")
114
+
115
+ @Client.on_message(
116
+ filters.incoming
117
+ & (
118
+ filters.text
119
+ | filters.photo
120
+ | filters.video
121
+ | filters.audio
122
+ | filters.voice
123
+ | filters.regex(r"\b(Randy|Rendi)\b(.*)", flags=re.IGNORECASE)
124
+ )
125
+ & (filters.private | filters.group)
126
+ & ~filters.command(DISABLED_COMMNAD)
127
+ & ~filters.bot
128
+ & ~filters.via_bot
129
+ & ~filters.forwarded,
130
+ group=2,
131
+ )
132
+ async def chatbot_talk(client: Client, message: Message):
133
+ genai.configure(api_key=GOOGLE_API_KEY)
134
+ chat_user = await db.get_chatbot(message.chat.id)
135
+ if not chat_user:
136
+ return
137
+ if message.reply_to_message and message.reply_to_message.from_user:
138
+ if message.reply_to_message.from_user.id != client.me.id:
139
+ return
140
+ if message.photo:
141
+ await client.send_chat_action(message.chat.id, enums.ChatAction.UPLOAD_PHOTO)
142
+ await asyncio.sleep(1.5)
143
+ file_path = await message.download()
144
+ caption = message.caption or "What's this?"
145
+ x = GeminiLatest(api_keys=GOOGLE_API_KEY)
146
+ if client.me.is_premium:
147
+ ai_reply = await message.reply_text(f"{custom_loading}Processing...")
148
+ else:
149
+ ai_reply = await message.reply_text(f"Processing...")
150
+ try:
151
+ await client.send_chat_action(message.chat.id, enums.ChatAction.TYPING)
152
+ await asyncio.sleep(1.5)
153
+ backup_chat = await db._get_chatbot_chat_from_db(message.from_user.id)
154
+ backup_chat.append({"role": "user", "parts": [{"text": caption}]})
155
+ response_reads = x.get_response_image(caption, file_path)
156
+ if len(response_reads) > 4096:
157
+ with open("chat.txt", "w+", encoding="utf8") as out_file:
158
+ out_file.write(response_reads)
159
+ await message.reply_document(
160
+ document="chat.txt",
161
+ disable_notification=True
162
+ )
163
+ await ai_reply.delete()
164
+ os.remove("chat.txt")
165
+ else:
166
+ await ai_reply.edit_text(response_reads)
167
+ backup_chat.append({"role": "model", "parts": [{"text": response_reads}]})
168
+ await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
169
+ await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
170
+ os.remove(file_path)
171
+ return
172
+ except InvalidArgument as e:
173
+ return await ai_reply.edit_text(f"Error: {e}")
174
+ except Exception as e:
175
+ return await ai_reply.edit_text(f"Error: {e}")
176
+
177
+ if message.audio or message.voice:
178
+ await client.send_chat_action(message.chat.id, enums.ChatAction.UPLOAD_AUDIO)
179
+ await asyncio.sleep(1.5)
180
+ if client.me.is_premium:
181
+ ai_reply = await message.reply_text(f"{custom_loading}Processing...")
182
+ else:
183
+ ai_reply = await message.reply_text(f"Processing...")
184
+ if message.audio:
185
+ audio_file_name = await message.download()
186
+ if message.voice:
187
+ audio_file_name = await message.download()
188
+ caption = message.caption or "What's this?"
189
+ model = genai.GenerativeModel(
190
+ model_name="gemini-1.5-flash",
191
+ safety_settings={
192
+ genai.types.HarmCategory.HARM_CATEGORY_HATE_SPEECH: genai.types.HarmBlockThreshold.BLOCK_NONE,
193
+ genai.types.HarmCategory.HARM_CATEGORY_HARASSMENT: genai.types.HarmBlockThreshold.BLOCK_NONE,
194
+ genai.types.HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT: genai.types.HarmBlockThreshold.BLOCK_NONE,
195
+ genai.types.HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: genai.types.HarmBlockThreshold.BLOCK_NONE,
196
+ }
197
+ )
198
+ backup_chat = await db._get_chatbot_chat_from_db(message.from_user.id)
199
+ backup_chat.append({"role": "user", "parts": [{"text": caption}]})
200
+ if client.me.is_premium:
201
+ await ai_reply.edit_text(f"{custom_loading}Uploading file..")
202
+ else:
203
+ await ai_reply.edit_text("Uploading file..")
204
+ audio_file = genai.upload_file(path=audio_file_name)
205
+ while audio_file.state.name == "PROCESSING":
206
+ await asyncio.sleep(10)
207
+ audio_file = genai.get_file(audio_file.name)
208
+ if audio_file.state.name == "FAILED":
209
+ return await ai_reply.edit_text(f"Error: {audio_file.state.name}")
210
+ try:
211
+ await client.send_chat_action(message.chat.id, enums.ChatAction.TYPING)
212
+ await asyncio.sleep(1.5)
213
+ response = model.generate_content(
214
+ [audio_file, caption],
215
+ request_options={"timeout": 600}
216
+ )
217
+ if len(response.text) > 4096:
218
+ with open("chat.txt", "w+", encoding="utf8") as out_file:
219
+ out_file.write(response.text)
220
+ await message.reply_document(
221
+ document="chat.txt",
222
+ disable_notification=True
223
+ )
224
+ await ai_reply.delete()
225
+ os.remove("chat.txt")
226
+ else:
227
+ await ai_reply.edit_text(response.text)
228
+ backup_chat.append({"role": "model", "parts": [{"text": response.text}]})
229
+ await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
230
+ await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
231
+ audio_file.delete()
232
+ os.remove(audio_file_name)
233
+ return
234
+ except InvalidArgument as e:
235
+ return await ai_reply.edit_text(f"Error: {e}")
236
+ except Exception as e:
237
+ return await ai_reply.edit_text(f"Error: {e}")
238
+
239
+ if message.video:
240
+ await client.send_chat_action(message.chat.id, enums.ChatAction.UPLOAD_VIDEO)
241
+ await asyncio.sleep(1.5)
242
+ if client.me.is_premium:
243
+ ai_reply = await message.reply_text(f"{custom_loading}Processing...")
244
+ else:
245
+ ai_reply = await message.reply_text(f"Processing...")
246
+ video_file_name = await message.download(file_name="newvideo.mp4")
247
+ caption = message.caption or "What's this?"
248
+ model = genai.GenerativeModel(
249
+ model_name="gemini-1.5-pro",
250
+ safety_settings={
251
+ genai.types.HarmCategory.HARM_CATEGORY_HATE_SPEECH: genai.types.HarmBlockThreshold.BLOCK_NONE,
252
+ genai.types.HarmCategory.HARM_CATEGORY_HARASSMENT: genai.types.HarmBlockThreshold.BLOCK_NONE,
253
+ genai.types.HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT: genai.types.HarmBlockThreshold.BLOCK_NONE,
254
+ genai.types.HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: genai.types.HarmBlockThreshold.BLOCK_NONE,
255
+ }
256
+ )
257
+ backup_chat = await db._get_chatbot_chat_from_db(message.from_user.id)
258
+ backup_chat.append({"role": "user", "parts": [{"text": caption}]})
259
+ if client.me.is_premium:
260
+ await ai_reply.edit_text(f"{custom_loading}Uploading file..")
261
+ else:
262
+ await ai_reply.edit_text("Uploading file..")
263
+ video_file = genai.upload_file(path=video_file_name)
264
+ while video_file.state.name == "PROCESSING":
265
+ await asyncio.sleep(10)
266
+ video_file = genai.get_file(video_file.name)
267
+ if video_file.state.name == "FAILED":
268
+ return await ai_reply.edit_text(f"Error: {video_file.state.name}")
269
+ try:
270
+ await client.send_chat_action(message.chat.id, enums.ChatAction.TYPING)
271
+ await asyncio.sleep(1.5)
272
+ response = model.generate_content(
273
+ [video_file, caption],
274
+ request_options={"timeout": 600}
275
+ )
276
+ if len(response.text) > 4096:
277
+ with open("chat.txt", "w+", encoding="utf8") as out_file:
278
+ out_file.write(response.text)
279
+ await message.reply_document(
280
+ document="chat.txt",
281
+ disable_notification=True
282
+ )
283
+ await ai_reply.delete()
284
+ os.remove("chat.txt")
285
+ else:
286
+ await ai_reply.edit_text(response.text)
287
+ backup_chat.append({"role": "model", "parts": [{"text": response.text}]})
288
+ await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
289
+ await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
290
+ video_file.delete()
291
+ os.remove(video_file_name)
292
+ return
293
+ except InvalidArgument as e:
294
+ return await ai_reply.edit_text(f"Error: {e}")
295
+ except Exception as e:
296
+ return await ai_reply.edit_text(f"Error: {e}")
297
+
298
+ if message.text:
299
+ await client.send_chat_action(message.chat.id, enums.ChatAction.TYPING)
300
+ await asyncio.sleep(1.5)
301
+ query = message.text.strip()
302
+ match = re.search(r"\b(Randy|Rendi)\b(.*)", query, flags=re.IGNORECASE)
303
+ if match:
304
+ rest_of_sentence = match.group(2).strip()
305
+ query_base = rest_of_sentence if rest_of_sentence else query
306
+ else:
307
+ query_base = query
308
+ parts = query.split(maxsplit=1)
309
+ command = parts[0].lower()
310
+ pic_query = parts[1].strip() if len(parts) > 1 else ""
311
+ try:
312
+ model_flash = genai.GenerativeModel(
313
+ model_name="gemini-1.5-flash"
314
+ )
315
+ backup_chat = await db._get_chatbot_chat_from_db(message.from_user.id)
316
+ backup_chat.append({"role": "user", "parts": [{"text": query_base}]})
317
+ chat_session = model_flash.start_chat(history=backup_chat)
318
+ response_data = chat_session.send_message(query_base)
319
+ output = response_data.text
320
+ if len(output) > 4096:
321
+ with open("chat.txt", "w+", encoding="utf8") as out_file:
322
+ out_file.write(output)
323
+ await message.reply_document(
324
+ document="chat.txt",
325
+ disable_notification=True
326
+ )
327
+ os.remove("chat.txt")
328
+ else:
329
+ await message.reply_text(output)
330
+ backup_chat.append({"role": "model", "parts": [{"text": output}]})
331
+ await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
332
+ await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
333
+ return
334
+ except Exception as e:
335
+ return await message.reply_text(f"Error: {e}")
akn/MagicFonts/__init__.py ADDED
File without changes