Upload 47 files
Browse files- 1.py +60 -0
- Dockerfile +11 -0
- Procfile +2 -0
- Script.py +238 -0
- app.json +171 -0
- bot.py +79 -0
- combined.txt +0 -0
- database/connections_mdb.py +135 -0
- database/filters_mdb.py +118 -0
- database/gfilters_mdb.py +110 -0
- database/ia_filterdb.py +123 -0
- database/users_chats_db.py +148 -0
- image/edit_1.py +246 -0
- image/edit_2.py +398 -0
- image/edit_3.py +164 -0
- image/edit_4.py +408 -0
- image/edit_5.py +424 -0
- image/font_string.py +2365 -0
- info.py +82 -0
- logging.conf +33 -0
- plugins/ExtraMods/carbon.py +37 -0
- plugins/ExtraMods/font.py +179 -0
- plugins/ExtraMods/group_manager.py +222 -0
- plugins/ExtraMods/json.py +48 -0
- plugins/ExtraMods/lyrics.py +38 -0
- plugins/ExtraMods/password.py +19 -0
- plugins/ExtraMods/paste.py +62 -0
- plugins/ExtraMods/photo.py +36 -0
- plugins/ExtraMods/share_text.py +26 -0
- plugins/ExtraMods/telegraph.py +43 -0
- plugins/ExtraMods/tts.py +42 -0
- plugins/ExtraMods/yt_dl.py +133 -0
- plugins/admin_control.py +387 -0
- plugins/banned.py +26 -0
- plugins/broadcast.py +218 -0
- plugins/commands.py +392 -0
- plugins/connection.py +117 -0
- plugins/file_store.py +120 -0
- plugins/filters_global.py +409 -0
- plugins/group_filter.py +466 -0
- plugins/index.py +140 -0
- plugins/inline.py +103 -0
- plugins/pm_filter.py +243 -0
- plugins/query.py +608 -0
- requirements.txt +36 -0
- runtime.txt +1 -0
- utils.py +366 -0
1.py
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
def collect_files(directory, extensions):
|
4 |
+
collected_files = []
|
5 |
+
for root, dirs, files in os.walk(directory):
|
6 |
+
for file in files:
|
7 |
+
if any(file.endswith(ext) for ext in extensions):
|
8 |
+
file_path = os.path.join(root, file)
|
9 |
+
collected_files.append((file_path, file))
|
10 |
+
return collected_files
|
11 |
+
|
12 |
+
def write_combined_file(text_files, media_files, output_file):
|
13 |
+
with open(output_file, 'w', encoding='utf-8') as aio_file:
|
14 |
+
# Write text file contents
|
15 |
+
if text_files:
|
16 |
+
aio_file.write("# Text Files Contents\n")
|
17 |
+
for file_path, file_name in text_files:
|
18 |
+
aio_file.write(f"# File: {file_path}\n")
|
19 |
+
try:
|
20 |
+
with open(file_path, 'r', encoding='utf-8') as file:
|
21 |
+
aio_file.write(file.read())
|
22 |
+
except Exception as e:
|
23 |
+
aio_file.write(f"Error reading file {file_path}: {str(e)}\n")
|
24 |
+
aio_file.write("\n" + "="*80 + "\n\n")
|
25 |
+
|
26 |
+
# Write media file paths with folder structure
|
27 |
+
if media_files:
|
28 |
+
aio_file.write("# Media File Paths\n")
|
29 |
+
current_folder = None
|
30 |
+
for file_path, file_name in sorted(media_files, key=lambda x: x[0]):
|
31 |
+
folder = os.path.dirname(file_path)
|
32 |
+
if folder != current_folder:
|
33 |
+
if current_folder is not None:
|
34 |
+
aio_file.write("\n" + "="*80 + "\n\n")
|
35 |
+
aio_file.write(f"# Folder: {folder}\n")
|
36 |
+
current_folder = folder
|
37 |
+
aio_file.write(f"File: {file_path}\n")
|
38 |
+
if current_folder is not None:
|
39 |
+
aio_file.write("\n" + "="*80 + "\n\n")
|
40 |
+
|
41 |
+
def main():
|
42 |
+
directory = os.getcwd() # Current working directory
|
43 |
+
|
44 |
+
# Define extensions for text files and media files
|
45 |
+
text_extensions = ['.py', '.js', '.html', '.css', '.txt', '.md', '.json']
|
46 |
+
media_extensions = ['.jpg', '.jpeg', '.png', '.webp', '.avi', '.mp3', '.mp4']
|
47 |
+
|
48 |
+
# Collect text files
|
49 |
+
text_files = collect_files(directory, text_extensions)
|
50 |
+
|
51 |
+
# Collect media files
|
52 |
+
media_files = collect_files(directory, media_extensions)
|
53 |
+
|
54 |
+
# Combine both text file contents and media file paths into one file
|
55 |
+
output_file = 'combined.txt'
|
56 |
+
write_combined_file(text_files, media_files, output_file)
|
57 |
+
print(f"All text file contents and media file paths have been written to {output_file}")
|
58 |
+
|
59 |
+
if __name__ == "__main__":
|
60 |
+
main()
|
Dockerfile
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.10
|
2 |
+
RUN apt update && apt upgrade -y
|
3 |
+
RUN apt install git -y
|
4 |
+
COPY requirements.txt /requirements.txt
|
5 |
+
|
6 |
+
RUN cd /
|
7 |
+
RUN pip install -U pip && pip install -U -r requirements.txt
|
8 |
+
WORKDIR /app
|
9 |
+
|
10 |
+
COPY . .
|
11 |
+
CMD ["python", "bot.py"]
|
Procfile
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
web: python3 bot.py
|
2 |
+
worker: python3 bot.py
|
Script.py
ADDED
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class script(object):
|
2 |
+
START_TXT = """<b>✨ Hᴇʟʟᴏ {user}.
|
3 |
+
|
4 |
+
Mʏ Nᴀᴍᴇ Is {bot}.
|
5 |
+
|
6 |
+
I Cᴀɴ Pʀᴏᴠɪᴅᴇ Mᴏᴠɪᴇ Fᴏʀ Yᴏᴜ Jᴜsᴛ Aᴅᴅ Mᴇ Iɴ Yᴏᴜʀ Gʀᴏᴜᴘ Oʀ Jᴏɪɴ Oᴜʀ Gʀᴏᴜᴘ</b>"""
|
7 |
+
|
8 |
+
HELP_TXT = "Hᴇʏ {}\nHᴇʀᴇ Mꜱ Mʏ Hᴇʟᴩ"
|
9 |
+
|
10 |
+
ABOUT_TXT = """<b>✯ Mʏ ɴᴀᴍᴇ: {}
|
11 |
+
✯ Dᴇᴠᴇʟᴏᴩᴇʀ: <a herf=https://t.me/Mr_MKN>ᴍʀ.ᴍᴋɴ ᴛɢ</a>
|
12 |
+
✯ Cᴏᴅᴇᴅ Oɴ: ᴩʏᴛʜᴏɴ/ᴩʏʀᴏɢʀᴀᴍ
|
13 |
+
✯ Mʏ DᴀᴛᴀBᴀꜱᴇ: ᴍᴏɴɢᴏ-ᴅʙ
|
14 |
+
✯ Mʏ Sᴇʀᴠᴇʀ: ᴀɴʏᴡʜᴇʀᴇ
|
15 |
+
✯ Mʏ Vᴇʀꜱɪᴏɴ: ᴩʀᴏꜰᴇꜱꜱᴏʀ-ʙᴏᴛ ᴠ4.5.0</b>"""
|
16 |
+
|
17 |
+
SOURCE_TXT = """<b>NOTE:</b>
|
18 |
+
- ꜱᴏᴜʀᴄᴇ ᴄᴏᴅᴇ ʜᴇʀᴇ ◉› :<a href=https://github.com/MrMKN/PROFESSOR-BOT>𝐏𝐑𝐎𝐅𝐄𝐒𝐒𝐎𝐑-𝐁𝐎𝐓</a>
|
19 |
+
|
20 |
+
<b>ᴅᴇᴠ: <a herf=https://t.me/Mr_MKN>ᴍʀ.ᴍᴋɴ ᴛɢ</a></b>"""
|
21 |
+
|
22 |
+
FILE_TXT = """<b>➤ Hᴇʟᴘ Fᴏʀ Fɪʟᴇ Sᴛᴏʀᴇ</b>
|
23 |
+
|
24 |
+
<i>Bʏ Usɪɴɢ Tʜɪs Mᴏᴅᴜʟᴇ Yᴏᴜ Cᴀɴ Sᴛᴏʀᴇ Fɪʟᴇs Iɴ Mʏ Dᴀᴛᴀʙᴀsᴇ Aɴᴅ I Wɪʟʟ Gɪᴠᴇ Yᴏᴜ A Pᴇʀᴍᴀɴᴇɴᴛ Lɪɴᴋ Tᴏ Aᴄᴄᴇss Tʜᴇ Sᴀᴠᴇᴅ Fɪʟᴇs. Iғ Yᴏᴜ Wᴀɴᴛ Tᴏ Aᴅᴅ Fɪʟᴇs Fʀᴏᴍ A Pᴜʙʟɪᴄ Cʜᴀɴɴᴇʟ Sᴇɴᴅ Tʜᴇ Fɪʟᴇ Lɪɴᴋ Oɴʟʏ Oʀ Yᴏᴜ Wᴀɴᴛ Tᴏ Aᴅᴅ Fɪʟᴇs Fʀᴏᴍ A Pʀɪᴠᴀᴛᴇ Cʜᴀɴɴᴇʟ Yᴏᴜʀ Mᴜsᴛ Mᴀᴋᴇ Mᴇ Aᴅᴍɪɴ Oɴ Tʜᴇ Cʜᴀɴɴᴇʟ Tᴏ Aᴄᴄᴇss Fɪʟᴇs</i>
|
25 |
+
|
26 |
+
<b>⪼ Cᴏᴍᴍᴀɴᴅ & Usᴀɢᴇ</b>
|
27 |
+
➪ /link › Rᴇᴘʟʏ Tᴏ Aɴʏ Mᴇᴅɪᴀ Tᴏ Gᴇᴛ Tʜᴇ Lɪɴᴋ
|
28 |
+
➪ /batch › Tᴏ Cʀᴇᴀᴛᴇ Lɪɴᴋ Fᴏʀ Mᴜʟᴛɪᴘʟᴇ Mᴇᴅɪᴀ
|
29 |
+
|
30 |
+
<b>⪼ EG:</b>
|
31 |
+
</code>/batch https://t.me/mkn_bots_updates/1 https://t.me/mkn_bots_updates/10</code>"""
|
32 |
+
|
33 |
+
FILTER_TXT = "Sᴇʟᴇᴄᴛ Wʜɪᴄʜ Oɴᴇ Yᴏᴜ Wᴀɴᴛ...✨"
|
34 |
+
|
35 |
+
GLOBALFILTER_TXT = """<b>Hᴇʟᴘ Fᴏʀ Gʟᴏʙᴀʟ Fɪʟᴛᴇʀs</b>
|
36 |
+
|
37 |
+
<i>Fɪʟᴛᴇʀ Is Tʜᴇ Fᴇᴀᴛᴜʀᴇ Wᴇʀᴇ Usᴇʀs Cᴀɴ Sᴇᴛ Aᴜᴛᴏᴍᴀᴛᴇᴅ Rᴇᴘʟɪᴇs Fᴏʀ A Pᴀʀᴛɪᴄᴜʟᴀʀ Kᴇʏᴡᴏʀᴅ Aɴᴅ Bᴏᴛ Wɪʟʟ Rᴇsᴘᴏɴᴅ Wʜᴇɴᴇᴠᴇʀ A Kᴇʏᴡᴏʀᴅ Is Fᴏᴜɴᴅ Tʜᴇ Mᴇssᴀɢᴇ</i>
|
38 |
+
|
39 |
+
<b>Nᴏᴛᴇ:</b>
|
40 |
+
Tʜɪs Mᴏᴅᴜʟᴇ Oɴʟʏ Wᴏʀᴋs Fᴏʀ Mʏ Aᴅᴍɪɴs
|
41 |
+
|
42 |
+
<b>Cᴏᴍᴍᴀɴᴅs Aɴᴅ Usᴀɢᴇ:</b>
|
43 |
+
• /gfilter - Tᴏ Aᴅᴅ Gʟᴏʙᴀʟ Fɪʟᴛᴇʀs
|
44 |
+
• /gfilters - Tᴏ Vɪᴇᴡ Lɪsᴛ Oғ Aʟʟ Gʟᴏʙᴀʟ Fɪʟᴛᴇʀs
|
45 |
+
• /delg - Tᴏ Dᴇʟᴇᴛᴇ A Sᴘᴇᴄɪғɪᴄ Gʟᴏʙᴀʟ Fɪʟᴛᴇʀ
|
46 |
+
• /delallg - Tᴏ Dᴇʟᴇᴛᴇ Aʟʟ Gʟᴏʙᴀʟ Fɪʟᴛᴇʀꜱ
|
47 |
+
|
48 |
+
• /g_filter off Usᴇ Tʜɪs Cᴏᴍᴍᴏᴀɴᴅ + on/offғ Iɴ Yᴏᴜʀ Gʀᴏᴜᴘ Tᴏ Cᴏɴᴛʀᴏʟ Gʟᴏʙᴀʟ Fɪʟᴛᴇʀ Iɴ Yᴏᴜʀ Gʀᴏᴜᴘ"""
|
49 |
+
|
50 |
+
MANUELFILTER_TXT = """<b>Hᴇʟᴘ Fᴏʀ Fɪʟᴛᴇʀs</b>
|
51 |
+
|
52 |
+
<i>Fɪʟᴛᴇʀ Is Tʜᴇ Fᴇᴀᴛᴜʀᴇ Wᴇʀᴇ Usᴇʀs Cᴀɴ Sᴇᴛ Aᴜᴛᴏᴍᴀᴛᴇᴅ Rᴇᴘʟɪᴇs Fᴏʀ A Pᴀʀᴛɪᴄᴜʟᴀʀ Kᴇʏᴡᴏʀᴅ Aɴᴅ Bᴏᴛ Wɪʟʟ Rᴇsᴘᴏɴᴅ Wʜᴇɴᴇᴠᴇʀ A Kᴇʏᴡᴏʀᴅ Is Fᴏᴜɴᴅ Tʜᴇ Mᴇssᴀɢᴇ</i>
|
53 |
+
|
54 |
+
<b>Nᴏᴛᴇ:</b>
|
55 |
+
𝟷. Tʜɪs Bᴏᴛ Sʜᴏᴜʟᴅ Hᴀᴠᴇ Aᴅᴍɪɴ Pʀɪᴠɪʟʟᴀɢᴇ.
|
56 |
+
𝟸. Oɴʟʏ Aᴅᴍɪɴs Cᴀɴ Aᴅᴅ Fɪʟᴛᴇʀs Iɴ A Cʜᴀᴛ.
|
57 |
+
𝟹. Aʟᴇʀᴛ Bᴜᴛᴛᴏɴs Hᴀᴠᴇ A Lɪᴍɪᴛ Oғ 𝟼𝟺 Cʜᴀʀᴀᴄᴛᴇʀs.
|
58 |
+
|
59 |
+
<b>Cᴏᴍᴍᴀɴᴅs Aɴᴅ Usᴀɢᴇ:</b>
|
60 |
+
• /filter - Aᴅᴅ A Fɪʟᴛᴇʀ Iɴ Cʜᴀᴛ
|
61 |
+
• /filters - Lɪsᴛ Aʟʟ Tʜᴇ Fɪʟᴛᴇʀs Oғ A Cʜᴀᴛ
|
62 |
+
• /del - Dᴇʟᴇᴛᴇ A Sᴘᴇᴄɪғɪᴄ Fɪʟᴛᴇʀ Iɴ Cʜᴀᴛ
|
63 |
+
• /delall - Dᴇʟᴇᴛᴇ Tʜᴇ Wʜᴏʟᴇ Fɪʟᴛᴇʀs Iɴ A Cʜᴀᴛ (Cʜᴀᴛ Oᴡɴᴇʀ Oɴʟʏ)
|
64 |
+
|
65 |
+
• /g_filter off Usᴇ Tʜɪs Cᴏᴍᴍᴏᴀɴᴅ + on/offғ Iɴ Yᴏᴜʀ Gʀᴏᴜᴘ Tᴏ Cᴏɴᴛʀᴏʟ Gʟᴏʙᴀʟ Fɪʟᴛᴇʀ Iɴ Yᴏᴜʀ Gʀᴏᴜᴘ"""
|
66 |
+
|
67 |
+
BUTTON_TXT = """<b>Hᴇʟᴘ Fᴏʀ Bᴜᴛᴛᴏɴs</b>
|
68 |
+
|
69 |
+
<i>Tʜɪs Bᴏᴛ Sᴜᴘᴘᴏʀᴛs Bᴏᴛʜ Uʀʟ Aɴᴅ Aʟᴇʀᴛ Iɴʟɪɴᴇ Bᴜᴛᴛᴏɴs.</i>
|
70 |
+
|
71 |
+
<b>Nᴏᴛᴇ:</b>
|
72 |
+
𝟷. Tᴇʟᴇɢʀᴀᴍ Wɪʟʟ Nᴏᴛ Aʟʟᴏᴡs Yᴏᴜ Tᴏ Sᴇɴᴅ Bᴜᴛᴛᴏɴs Wɪᴛʜᴏᴜᴛ Aɴʏ Cᴏɴᴛᴇɴᴛ, Sᴏ Cᴏɴᴛᴇɴᴛ Is Mᴀɴᴅᴀᴛᴏʀʏ.
|
73 |
+
𝟸. Tʜɪs Bᴏᴛ Sᴜᴘᴘᴏʀᴛs Bᴜᴛᴛᴏɴs Wɪᴛʜ Aɴʏ Tᴇʟᴇɢʀᴀᴍ Mᴇᴅɪᴀ Tʏᴘᴇ.
|
74 |
+
𝟹. Bᴜᴛᴛᴏɴs Sʜᴏᴜʟᴅ Bᴇ Pʀᴏᴘᴇʀʟʏ Pᴀʀsᴇᴅ As Mᴀʀᴋᴅᴏᴡɴ Fᴏʀᴍᴀᴛ
|
75 |
+
|
76 |
+
<b>Uʀʟ Bᴜᴛᴛᴏɴs:</b>
|
77 |
+
[Bᴜᴛᴛᴏɴ Tᴇxᴛ](buttonurl:xxxxxxxxxxxx)
|
78 |
+
|
79 |
+
<b>Aʟᴇʀᴛ Bᴜᴛᴛᴏɴs:</b>
|
80 |
+
[Bᴜᴛᴛᴏɴ Tᴇxᴛ](buttonalert:Tʜɪs Is Aɴ Aʟᴇʀᴛ Mᴇssᴀɢᴇ)"""
|
81 |
+
|
82 |
+
AUTOFILTER_TXT = """<b>Hᴇʟᴘ Fᴏʀ AᴜᴛᴏFɪʟᴛᴇʀ</b>
|
83 |
+
|
84 |
+
<Ai>Aᴜᴛᴏ Fɪʟᴛᴇʀ Is Tʜ��� Fᴇᴀᴛᴜʀᴇ Tᴏ Fɪʟᴛᴇʀ & Sᴀᴠᴇ Tʜᴇ Fɪʟᴇs Aᴜᴛᴏᴍᴀᴛɪᴄᴀʟʟʏ Fʀᴏᴍ Cᴜᴀɴɴᴇʟ Tᴏ Gʀᴏᴜᴘ. Yᴏᴜ Cᴀɴ Usᴇ Tʜᴇ Fᴏʟʟᴏᴡɪɴɢ Cᴏᴍᴍᴀɴᴅ Tᴏ ᴏɴ/ᴏғғ Tʜᴇ AᴜᴛᴏFɪʟᴛᴇʀ Iɴ Yᴏᴜʀ Gʀᴏᴜᴘ</i>
|
85 |
+
|
86 |
+
• /autofilter on - ᴀᴜᴛᴏғɪʟᴛᴇʀ ᴇɴᴀʙʟᴇ ɪɴ ʏᴏʀ ᴄʜᴀᴛ
|
87 |
+
• /autofilter off - ᴀᴜᴛᴏғɪʟᴛᴇʀ ᴅɪsᴀʙʟᴇ ɪɴ ʏᴏᴜʀ ᴄʜᴀᴛ
|
88 |
+
|
89 |
+
<Ob>Oᴛʜᴇʀ Cᴏᴍᴍᴀɴᴅs:</b>
|
90 |
+
• /set_template - Sᴇᴛ Iᴍᴅʙ Tᴇᴍᴘʟᴀᴛᴇ Fᴏʀ Yᴏᴜʀ Gʀᴏᴜᴘ
|
91 |
+
• /get_template - Gᴇᴛ Cᴜʀʀᴇɴᴛ Iᴍᴅʙ Tᴇᴍᴘʟᴀᴛᴇ Fᴏʀ Yᴏᴜʀ Gʀᴏᴜᴘ"""
|
92 |
+
|
93 |
+
CONNECTION_TXT = """<b>Hᴇʟᴘ Fᴏʀ Cᴏɴɴᴇᴄᴛɪᴏɴs</b>
|
94 |
+
|
95 |
+
<i> Usᴇᴅ Tᴏ Cᴏɴɴᴇᴄᴛ Bᴏᴛ Tᴏ Pᴍ Fᴏʀ Mᴀɴᴀɢɪɴɢ Fɪʟᴛᴇʀs. Iᴛ Hᴇʟᴘs Tᴏ Aᴠᴏɪᴅ Sᴘᴀᴍᴍɪɴɢ Iɴ Gʀᴏᴜᴘs</i>
|
96 |
+
|
97 |
+
<b>Nᴏᴛᴇ:</b>
|
98 |
+
• Oɴʟʏ Aᴅᴍɪɴs Cᴀɴ Aᴅᴅ A Cᴏɴɴᴇᴄᴛɪᴏɴ.
|
99 |
+
• Sᴇɴᴅ /connect Fᴏʀ Cᴏɴɴᴇᴄᴛɪɴɢ Mᴇ Tᴏ Uʀ Pᴍ
|
100 |
+
|
101 |
+
<Cb>Cᴏᴍᴍᴀɴᴅs Aɴᴅ Usᴀɢᴇ:</b>
|
102 |
+
• /connect - Cᴏɴɴᴇᴄᴛ A Pᴀʀᴛɪᴄᴜʟᴀʀ Cʜᴀᴛ Tᴏ Yᴏᴜʀ Pᴍ
|
103 |
+
• /disconnect - Dɪsᴄᴏɴɴᴇᴄᴛ Fʀᴏᴍ A Cʜᴀᴛ
|
104 |
+
• /connections - Lɪsᴛ Aʟʟ Yᴏᴜʀ Cᴏɴɴᴇᴄᴛɪᴏɴs"""
|
105 |
+
|
106 |
+
ADMIN_TXT = """<b>Hᴇʟᴩ Fᴏʀ Aᴅᴍɪɴꜱ</b>
|
107 |
+
|
108 |
+
<i>Tʜɪs Mᴏᴅᴜʟᴇ Oɴʟʏ Wᴏʀᴋs Fᴏʀ Mʏ Aᴅᴍɪɴs</i>
|
109 |
+
|
110 |
+
<b>Cᴏᴍᴍᴀɴᴅ & Uꜱᴀɢᴇ</b>
|
111 |
+
• /logs - Tᴏ Gᴇᴛ Tʜᴇ Rᴇᴄᴇɴᴛ Eʀʀᴏʀꜱ
|
112 |
+
• /delete - Tᴏ Dᴇʟᴇᴛᴇ A Sᴘᴇᴄɪꜰɪᴄ Fɪʟᴇ Fʀᴏᴍ DB
|
113 |
+
• /deleteall - Tᴏ Dᴇʟᴇᴛᴇ Aʟʟ Fɪʟᴇs Fʀᴏᴍ DB
|
114 |
+
• /users - Tᴏ Gᴇᴛ Lɪꜱᴛ Oꜰ Mʏ Uꜱᴇʀꜱ Aɴᴅ Iᴅꜱ
|
115 |
+
• /chats - Tᴏ Gᴇᴛ Lɪꜱᴛ Oꜰ Mʏ Cʜᴀᴛꜱ Aɴᴅ Iᴅꜱ
|
116 |
+
• /channel - Tᴏ Gᴇᴛ Lɪꜱᴛ Oꜰ Tᴏᴛᴀʟ Cᴏɴɴᴇᴄᴛᴇᴅ Cʜᴀɴɴᴇʟꜱ
|
117 |
+
• /broadcast - Tᴏ Bʀᴏᴀᴅᴄᴀꜱᴛ A Mᴇꜱꜱᴀɢᴇ Tᴏ Aʟʟ Uꜱᴇʀꜱ
|
118 |
+
• /group_broadcast - Tᴏ Bʀᴏᴀᴅᴄᴀsᴛ A Mᴇssᴀɢᴇ Tᴏ Aʟʟ Cᴏɴɴᴇᴄᴛᴇᴅ Gʀᴏᴜᴘs
|
119 |
+
• /leave - Wɪᴛʜ Cʜᴀᴛ Iᴅ Tᴏ Lᴇᴀᴠᴇ Fʀᴏᴍ A Cʜᴀᴛ
|
120 |
+
• /disable - Wɪᴛʜ Cʜᴀᴛ Iᴅ Tᴏ Dɪꜱᴀʙʟᴇ A Cʜᴀᴛ
|
121 |
+
• /invite - Wɪᴛʜ Cʜᴀᴛ Iᴅ Tᴏ Gᴇᴛ Tʜᴇ Iɴᴠɪᴛᴇ Lɪɴᴋ Oғ Aɴʏ Cʜᴀᴛ Wʜᴇʀᴇ Tʜᴇ Bᴏᴛ Is Aᴅᴍɪɴ
|
122 |
+
• /ban_user - Wɪᴛʜ Iᴅ Tᴏ Bᴀɴ A Uꜱᴇʀ
|
123 |
+
• /unban_user - Wɪᴛʜ Iᴅ Tᴏ Uɴʙᴀɴ A Uꜱᴇʀ
|
124 |
+
• /restart - Tᴏ Rᴇsᴛᴀʀᴛ Tʜᴇ Bᴏᴛ
|
125 |
+
• /clear_junk - Cʟᴇᴀʀ Aʟʟ Dᴇʟᴇᴛᴇ Aᴄᴄᴏᴜɴᴛ & Bʟᴏᴄᴋᴇᴅ Aᴄᴄᴏᴜɴᴛ Iɴ Dᴀᴛᴀʙᴀsᴇ
|
126 |
+
• /clear_junk_group - Cʟᴇᴀʀ Aᴅᴅ Rᴇᴍᴏᴠᴇᴅ Gʀᴏᴜᴘ Oʀ Dᴇᴀᴄᴛɪᴠᴀᴛᴇᴅ Gʀᴏᴜᴘs Oɴ Dʙ"""
|
127 |
+
|
128 |
+
|
129 |
+
STATUS_TXT = """<b>◉ ᴛᴏᴛᴀʟ ꜰɪʟᴇꜱ: <code>{}</code>
|
130 |
+
◉ ᴛᴏᴛᴀʟ ᴜꜱᴇʀꜱ: <code>{}</code>
|
131 |
+
◉ ᴛᴏᴛᴀʟ ᴄʜᴀᴛꜱ: <code>{}</code>
|
132 |
+
◉ ᴜꜱᴇᴅ ᴅʙ ꜱɪᴢᴇ: <code>{}</code>
|
133 |
+
◉ ꜰᴇᴇᴇ ᴅʙ ꜱɪᴢᴇ: <code>{}</code></b>"""
|
134 |
+
|
135 |
+
LOG_TEXT_G = """<b>#ɴᴇᴡ_ɢʀᴏᴜᴩ
|
136 |
+
|
137 |
+
◉ ɢʀᴏᴜᴩ: {a}
|
138 |
+
◉ ɢ-ɪᴅ: <code>{b}</code>
|
139 |
+
◉ ʟɪɴᴋ: @{c}
|
140 |
+
◉ ᴍᴇᴍʙᴇʀꜱ: <code>{d}</code>
|
141 |
+
◉ ᴀᴅᴅᴇᴅ ʙʏ: {e}
|
142 |
+
|
143 |
+
◉ ʙʏ: @{f}</b>"""
|
144 |
+
|
145 |
+
LOG_TEXT_P = """#ɴᴇᴡ_ᴜꜱᴇʀ
|
146 |
+
|
147 |
+
◉ ᴜꜱᴇʀ-ɪᴅ: <code>{}</code>
|
148 |
+
◉ ᴀᴄᴄ-ɴᴀᴍᴇ: {}
|
149 |
+
◉ ᴜꜱᴇʀɴᴀᴍᴇ: @{}
|
150 |
+
|
151 |
+
◉ ʙʏ: @{}</b>"""
|
152 |
+
|
153 |
+
GROUPMANAGER_TXT = """<b>Hᴇʟᴩ Fᴏʀ GʀᴏᴜᴩMᴀɴᴀɢᴇʀ</b>
|
154 |
+
|
155 |
+
<i>Tʜɪꜱ Iꜱ Hᴇʟᴩ Oꜰ Yᴏᴜʀ Gʀᴏᴜᴩ Mᴀɴᴀɢɪɴɢ. Tʜɪꜱ Wɪʟʟ Wᴏʀᴋ Oɴʟʏ Fᴏʀ Gʀᴏᴜᴩ aᴅᴍɪɴꜱ</i>
|
156 |
+
|
157 |
+
<b>Cᴏᴍᴍᴀɴᴅ & Uꜱᴀɢᴇ:</b>
|
158 |
+
• /inkick - Cᴏᴍᴍᴀɴᴅ Wɪᴛʜ Rᴇǫᴜɪʀᴇᴅ Aʀɢᴜᴍᴇɴᴛs Aɴᴅ I Wɪʟʟ Kɪᴄᴋ Mᴇᴍʙᴇʀs Fʀᴏᴍ Gʀᴏᴜᴘ.
|
159 |
+
• /instatus - Tᴏ Cʜᴇᴄᴋ Cᴜʀʀᴇɴᴛ Sᴛᴀᴛᴜs Oғ Cʜᴀᴛ Mᴇᴍʙᴇʀ Fʀᴏᴍ Gʀᴏᴜᴘ.
|
160 |
+
• /dkick - Tᴏ Kɪᴄᴋ Dᴇʟᴇᴛᴇᴅ Aᴄᴄᴏᴜɴᴛs
|
161 |
+
• /ban - To Bᴀɴ A Uꜱᴇʀ Fᴏʀᴍ Tʜᴇ Gʀᴏᴜᴩ
|
162 |
+
• /unban - Uɴʙᴀɴ Tʜᴇ Bᴀɴɴᴇᴅ Uꜱᴇʀ
|
163 |
+
• /tban - Tᴇᴍᴩᴏʀᴀʀʏ Bᴀɴ A Uꜱᴇʀ
|
164 |
+
• /mute - To Mᴜᴛᴇ A Uꜱᴇʀ
|
165 |
+
• /unmute - To Uɴᴍᴜᴛᴇ Tʜᴇ Mᴜᴛᴇᴅ Uꜱᴇʀ
|
166 |
+
• /tmute - Wɪᴛʜ Vᴀʟᴜᴇ To Mᴜᴛᴇ Uᴩ To Pᴀʀᴛɪᴄᴜʟᴀʀ Tɪᴍᴇ Eɢ: <code>/tmute 2h</code> To Mᴜᴛᴇ 2Hᴏᴜʀ Vᴀʟᴜᴇꜱ Iꜱ (m/h/d)
|
167 |
+
• /pin - Tᴏ Pɪɴ A Mᴇꜱꜱᴀɢᴇ Oɴ Yᴏᴜʀ Cʜᴀᴛ
|
168 |
+
• /unpin - Tᴏ Uɴᴩɪɴ Tʜᴇ Mᴇꜱꜱᴀɢᴇ Oɴ Yᴏᴜʀ Cʜᴀᴛ
|
169 |
+
• /purge - Dᴇʟᴇᴛᴇ Aʟʟ Mᴇssᴀɢᴇs Fʀᴏᴍ Tʜᴇ Rᴇᴘʟɪᴇᴅ Tᴏ Mᴇssᴀɢᴇ, Tᴏ Tʜᴇ Cᴜʀʀᴇɴᴛ Mᴇssᴀɢᴇ """
|
170 |
+
|
171 |
+
EXTRAMOD_TXT = """<b>Hᴇʟᴩ Fᴏʀ Exᴛʀᴀ Mᴏᴅᴜʟᴇ</b>
|
172 |
+
|
173 |
+
<i>Jᴜꜱᴛ Sᴇɴᴅ Aɴʏ Iᴍᴀɢᴇ Tᴏ Eᴅɪᴛ Iᴍᴀɢᴇ ✨</i>
|
174 |
+
|
175 |
+
<b>Cᴏᴍᴍᴀɴᴅꜱ & Uꜱᴀɢᴇ:</b>
|
176 |
+
• /id - Gᴇᴛ Iᴅ Oғ A Sᴘᴇᴄɪғᴇᴅ Usᴇʀ
|
177 |
+
• /info - Gᴇᴛ Iɴғᴏʀᴍᴀᴛɪᴏɴ Aʙᴏᴜᴛ A Usᴇʀ
|
178 |
+
• /imdb - Gᴇᴛ Tʜᴇ Fɪʟᴍ Iɴғᴏʀᴍᴀᴛɪᴏɴ Fʀᴏᴍ Iᴍᴅʙ Sᴏᴜʀᴄᴇ
|
179 |
+
• /paste [ᴛᴇxᴛ] - Pᴀsᴛᴇ Tʜᴇ Gɪᴠᴇɴ Tᴇxᴛ Oɴ Pᴀsᴛʏ
|
180 |
+
• /tts [ᴛᴇxᴛ] - Cᴏɴᴠᴇʀᴛ Tᴇxᴛ Tᴏ Sᴘᴇᴇᴄʜ
|
181 |
+
• /telegraph - Sᴇɴᴅ Mᴇ Tʜɪs Cᴏᴍᴍᴀɴᴅ Rᴇᴘʟʏ Wɪᴛʜ Pɪᴄᴛᴜʀᴇ Oʀ Vɪᴅᴇ Uɴᴅᴇʀ (𝟻ᴍʙ)
|
182 |
+
• /json - Rᴇᴩʟʏ Wɪᴛʜ Aɴʏ Mᴇꜱꜱᴀɢᴇ Tᴏ Gᴇᴛ Mᴇꜱꜱᴀɢᴇ Iɴꜰᴏ (ᴜꜱᴇꜰᴜʟʟ ꜰᴏʀ ɢʀᴏᴜᴩ)
|
183 |
+
• /written - Rᴇᴩʟʏ Wɪᴛʜ Tᴇxᴛ Tᴏ Gᴇᴛ Fɪʟᴇ (ᴜꜱᴇꜰᴜʟʟ ꜰᴏʀ ᴄᴏᴅᴇʀꜱ)
|
184 |
+
• /carbon - Rᴇᴘʟʏ Wɪᴛʜ Tᴇxᴛ Tᴏ Gᴇᴛ Cᴀʀʙᴏɴᴀᴛᴇᴅ Iᴍᴀɢᴇ
|
185 |
+
• /font [ᴛᴇxᴛ] - Tᴏ Cʜᴀɴɢᴇ Yᴏᴜʀ Tᴇxᴛ Fᴏɴᴛs Tᴏ Fᴀɴᴄʏ Fᴏɴᴛ
|
186 |
+
• /share - Rᴇᴘʟʏ Wɪᴛʜ Tᴇxᴛ Tᴏ Gᴇᴛ Tᴇxᴛ Sʜᴀʀᴀʙʟᴇ Lɪɴᴋ
|
187 |
+
• /song [ɴᴀᴍᴇ] - Tᴏ Sᴇᴀʀᴄʜ Tʜᴇ Sᴏɴɢ Iɴ YᴏᴜTᴜʙᴇ
|
188 |
+
• /video [ʟɪɴᴋ] - Tᴏ Dᴏᴡɴʟᴏᴀᴅ Tʜᴇ YᴏᴜTᴜʙᴇ Vɪᴅᴇᴏ"""
|
189 |
+
|
190 |
+
CREATOR_REQUIRED = "❗<b>Yᴏᴜ Hᴀᴠᴇ To Bᴇ Tʜᴇ Gʀᴏᴜᴩ Cʀᴇᴀᴛᴏʀ Tᴏ Dᴏ Tʜᴀᴛ</b>"
|
191 |
+
|
192 |
+
INPUT_REQUIRED = "❗ **Aʀɢᴜᴍᴇɴ Rqᴜɪʀᴇᴅ**"
|
193 |
+
|
194 |
+
KICKED = "✔️ Sᴜᴄᴄᴇꜱꜱꜰᴜʟʟʏ Kɪᴄᴋᴇᴅ {} Mᴇᴍʙᴇʀꜱ Acᴄᴏʀᴅɪɴɢ To Tʜᴇ Aʀɢᴜᴍᴇɴᴛꜱ Prᴏᴠɪᴅᴇᴅ"
|
195 |
+
|
196 |
+
START_KICK = "Rᴇᴍᴏᴠɪɴɢ Iɴᴀᴄᴛɪᴠᴇ Mᴇᴍʙᴇʀs Tʜɪs Mᴀʏ Tᴀᴋᴇ A Wʜɪʟᴇ"
|
197 |
+
|
198 |
+
ADMIN_REQUIRED = "❗<b>Iᴀᴍ Nᴏᴛ Aᴅᴍɪɴ Iɴ Tʜɪꜱ Cʜᴀᴛ Sᴏ Pʟᴇᴀꜱᴇ Aᴅᴅ Mᴇ Aɢᴀɪɴ Wɪᴛʜ Aʟʟ Pᴅᴍɪɴ Pᴇʀᴍɪꜱꜱɪᴏɴ</b>"
|
199 |
+
|
200 |
+
DKICK = "✔️ Kɪᴄᴋᴇᴅ {} Dᴇʟᴇᴛᴇᴅ Aᴄᴄᴏᴜɴᴛꜱ Sᴜᴄᴄᴇꜱꜱꜰᴜʟʟʏ"
|
201 |
+
|
202 |
+
FETCHING_INFO = "<b>Wᴀɪᴛ I Wɪʟʟ Tᴀᴋᴇ Tʜᴇ Aʟʟ Iɴꜰᴏ</b>"
|
203 |
+
|
204 |
+
SERVER_STATS = """Sᴇʀᴠᴇʀ Sᴛᴀᴛꜱ:
|
205 |
+
|
206 |
+
Uᴩᴛɪᴍᴇ: {}
|
207 |
+
CPU Uꜱᴀɢᴇ: {}%
|
208 |
+
RAM Uꜱᴀɢᴇ: {}%
|
209 |
+
Tᴏᴛᴀʟ Dɪꜱᴋ: {}
|
210 |
+
Uꜱᴇᴅ Dɪꜱᴋ: {} ({}%)
|
211 |
+
Fʀᴇᴇ Dɪꜱᴋ: {}"""
|
212 |
+
|
213 |
+
BUTTON_LOCK_TEXT = "Hᴇʏ {query}\nTʜɪꜱ Iꜱ Nᴏᴛ Fᴏʀ Yᴏᴜ. Sᴇᴀʀᴄʜ Yᴏᴜʀ Sᴇʟꜰ"
|
214 |
+
|
215 |
+
FORCE_SUB_TEXT = "Sᴏʀʀʏ Bʀᴏ Yᴏᴜʀ Nᴏᴛ Jᴏɪɴᴇᴅ Mʏ Cʜᴀɴɴᴇʟ Sᴏ Pʟᴇᴀsᴇ Cʟɪᴄᴋ Jᴏɪɴ Bᴜᴛᴛᴏɴ Tᴏ Jᴏɪɴ Mʏ Cʜᴀɴɴᴇʟ Aɴᴅ Tʀʏ Aɢᴀɪɴ"
|
216 |
+
|
217 |
+
WELCOM_TEXT = """Hᴇʏ {user} 💞
|
218 |
+
|
219 |
+
Wᴇʟᴄᴏᴍᴇ ᴛᴏ {chat}.
|
220 |
+
|
221 |
+
ꜱʜᴀʀᴇ & ꜱᴜᴩᴩᴏʀᴛ, ʀᴇqᴜᴇꜱᴛ ʏᴏᴜ ᴡᴀɴᴛᴇᴅ ᴍᴏᴠɪᴇꜱ"""
|
222 |
+
|
223 |
+
IMDB_TEMPLATE = """<b>Qᴜᴇʀʏ: {query}</b>
|
224 |
+
|
225 |
+
🏷 Tɪᴛʟᴇ: <a href={url}>{title}</a>
|
226 |
+
🎭 Gᴇɴʀᴇꜱ: {genres}
|
227 |
+
📆 Yᴇᴀʀ: <a href={url}/releaseinfo>{year}</a>
|
228 |
+
🌟 Rᴀᴛɪɴɢ: <a href={url}/ratings>{rating}</a>/10"""
|
229 |
+
|
230 |
+
|
231 |
+
|
232 |
+
|
233 |
+
|
234 |
+
|
235 |
+
|
236 |
+
|
237 |
+
|
238 |
+
|
app.json
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "PROFESSOR-BOT",
|
3 |
+
"description": "The Telegram Autofilter Bot",
|
4 |
+
"logo": "https://graph.org/file/b7e8484f6395a180b6380.jpg",
|
5 |
+
"keywords": ["Telegram", "auto-filter", "MrMKN"],
|
6 |
+
"repository": "https://github.com/MrMKN/PROFESSOR-BOT",
|
7 |
+
"env": {
|
8 |
+
"WEBHOOK": {
|
9 |
+
"description": "True/False if your server is web support required? the value is True else False",
|
10 |
+
"value": "True",
|
11 |
+
"required": true
|
12 |
+
},
|
13 |
+
"BOT_TOKEN": {
|
14 |
+
"description": "Your bot token.",
|
15 |
+
"required": true
|
16 |
+
},
|
17 |
+
"API_ID": {
|
18 |
+
"description": "Get this value from https://my.telegram.org",
|
19 |
+
"required": true
|
20 |
+
},
|
21 |
+
"API_HASH": {
|
22 |
+
"description": "Get this value from https://my.telegram.org",
|
23 |
+
"required": true
|
24 |
+
},
|
25 |
+
"CHANNELS": {
|
26 |
+
"description": "Username or ID of channel or group. Separate multiple IDs by space.",
|
27 |
+
"required": false
|
28 |
+
},
|
29 |
+
"ADMINS": {
|
30 |
+
"description": "Username or ID of Admin. Separate multiple Admins by space.",
|
31 |
+
"required": true
|
32 |
+
},
|
33 |
+
"SHORT_API": {
|
34 |
+
"description": "Api Key Of shortner You Use.",
|
35 |
+
"required": false
|
36 |
+
},
|
37 |
+
"SHORT_URL": {
|
38 |
+
"description": "Url of shortner site you use.",
|
39 |
+
"required": false
|
40 |
+
},
|
41 |
+
"PICS": {
|
42 |
+
"description": "Add some telegraph link of pictures .",
|
43 |
+
"required": false
|
44 |
+
},
|
45 |
+
"LOG_CHANNEL": {
|
46 |
+
"description": "Bot Logs,Give a channel id with -100xxxxxxx",
|
47 |
+
"required": true
|
48 |
+
},
|
49 |
+
"AUTH_CHANNEL": {
|
50 |
+
"description": "ID of channel.Make sure bot is admin in this channel. Without subscribing this channel users cannot use bot.",
|
51 |
+
"required": false
|
52 |
+
},
|
53 |
+
"MAX_RIST_BTNS": {
|
54 |
+
"description": "Maximum number of serch result buttons count ⚠️below 10 only ",
|
55 |
+
"value": "10",
|
56 |
+
"required": false
|
57 |
+
},
|
58 |
+
"CUSTOM_FILE_CAPTION": {
|
59 |
+
"description": "A custom file caption for your files. formatable with , file_name, file_caption, file_size, Read Readme.md for better understanding.",
|
60 |
+
"value": "Hey {mention}👋\n\n{file_name}\n\n🔘 size - {file_size}\n\n╭─── • ❰ @MR_LINK_Z ❱ • ────➤\n┣ ▫️ @MRxSERIES\n┣ ▫️ @MalluMovie_Official\n╰─────── • ◆ • ───────➤",
|
61 |
+
"required": false
|
62 |
+
},
|
63 |
+
"DATABASE_URL": {
|
64 |
+
"description": "mongoDB URI.",
|
65 |
+
"required": true
|
66 |
+
},
|
67 |
+
"DATABASE_NAME": {
|
68 |
+
"description": "Name of the database in mongoDB.",
|
69 |
+
"value": "Cluster0",
|
70 |
+
"required": false
|
71 |
+
},
|
72 |
+
"COLLECTION_NAME": {
|
73 |
+
"description": "Name of the collections. Defaults to Telegram_files. If you are using the same database, then use different collection name for each bot",
|
74 |
+
"value": "Telegram_files",
|
75 |
+
"required": false
|
76 |
+
},
|
77 |
+
"SUPPORT_CHAT": {
|
78 |
+
"description": "Updated Channel Username Without @ Not Chanel ID",
|
79 |
+
"value": "MKN_BOTZ_DISCUSSION_GROUP",
|
80 |
+
"required": false
|
81 |
+
},
|
82 |
+
"IMDB": {
|
83 |
+
"description": "Imdb, the view of information when making True/False",
|
84 |
+
"value": "True",
|
85 |
+
"required": false
|
86 |
+
},
|
87 |
+
"PM_IMDB": {
|
88 |
+
"description": "pm Imdb, the view of information when making True/False",
|
89 |
+
"value": "True",
|
90 |
+
"required": false
|
91 |
+
},
|
92 |
+
"IMDB_TEMPLATE": {
|
93 |
+
"description": "Custom IMDB Template",
|
94 |
+
"value": "<b>Qᴜᴇʀʏ: {query}</b>\n\n🏷 Tɪᴛʟᴇ: <a href={url}>{title}</a>\n🎭 Gᴇɴʀᴇꜱ: {genres}\n📆 Yᴇᴀʀ: <a href={url}/releaseinfo>{year}</a>\n🌟 Rᴀᴛɪɴɢ: <a href={url}/ratings>{rating}</a>/10",
|
95 |
+
"required": false
|
96 |
+
},
|
97 |
+
"IMDB_DELET_TIME": {
|
98 |
+
"description": "bot risult aouto delet time in second do to avoid group copyright issue. default is 300 ",
|
99 |
+
"value": "300",
|
100 |
+
"required": false
|
101 |
+
},
|
102 |
+
"SINGLE_BUTTON": {
|
103 |
+
"description": "choose b/w single or double buttons https://github.com/Aadhi000/Ajax/issues/22",
|
104 |
+
"value": "True",
|
105 |
+
"required": false
|
106 |
+
},
|
107 |
+
"START_MESSAGE": {
|
108 |
+
"description": "bot start message text [ {user} = bot startd user name {bot} = your bot name",
|
109 |
+
"value": "<b>✨ Hᴇʟʟᴏ {user}.\n\nMʏ Nᴀᴍᴇ Is {bot}.\n\nI Cᴀɴ Pʀᴏᴠɪᴅᴇ Mᴏᴠɪᴇ Fᴏʀ Yᴏᴜ Jᴜsᴛ Aᴅᴅ Mᴇ Iɴ Yᴏᴜʀ Gʀᴏᴜᴘ Oʀ Jᴏɪɴ Oᴜʀ Gʀᴏᴜᴘ</b>",
|
110 |
+
"required": false
|
111 |
+
},
|
112 |
+
"FORCE_SUB_TEXT": {
|
113 |
+
"description": "custom force sub text (use ** = bold / use ``= mono)",
|
114 |
+
"value": "Sᴏʀʀʏ Bʀᴏ Yᴏᴜʀ Nᴏᴛ Jᴏɪɴᴇᴅ Mʏ Cʜᴀɴɴᴇʟ Sᴏ Pʟᴇᴀsᴇ Cʟɪᴄᴋ Jᴏɪɴ Bᴜᴛᴛᴏɴ Tᴏ Jᴏɪɴ Mʏ Cʜᴀɴɴᴇʟ Aɴᴅ Tʀʏ Aɢᴀɪɴ",
|
115 |
+
"required": false
|
116 |
+
},
|
117 |
+
"AUTH_GROUPS": {
|
118 |
+
"description": "Group Id. Only work a specific group/ your bot is public use? please just Skip this",
|
119 |
+
"value": "",
|
120 |
+
"required": false
|
121 |
+
},
|
122 |
+
"WELCOM_PIC": {
|
123 |
+
"description": "Welcome message pic (telegraph link)",
|
124 |
+
"value": "",
|
125 |
+
"required": false
|
126 |
+
},
|
127 |
+
"WELCOM_TEXT": {
|
128 |
+
"description": "your group welcome text keyword({user} = joined use & {chat} = your chat name",
|
129 |
+
"value": "Hᴇʏ {user} 💞\nWᴇʟᴄᴏᴍᴇ ᴛᴏ {chat}.\n\nꜱʜᴀʀᴇ & ꜱᴜᴩᴩᴏʀᴛ, ʀᴇqᴜᴇꜱᴛ ʏᴏᴜ ᴡᴀɴᴛᴇᴅ ᴍᴏᴠɪᴇꜱ",
|
130 |
+
"required": false
|
131 |
+
},
|
132 |
+
"BUTTON_LOCK_TEXT": {
|
133 |
+
"description": "button lock text [User = {query}]",
|
134 |
+
"value": "Hᴇʏ {query}\nTʜɪꜱ Iꜱ Nᴏᴛ Fᴏʀ Yᴏᴜ. Sᴇᴀʀᴄʜ Yᴏᴜʀ Sᴇʟꜰ",
|
135 |
+
"required": false
|
136 |
+
},
|
137 |
+
"PMFILTER": {
|
138 |
+
"description": "PM AutoFilter. set True to on / False to off",
|
139 |
+
"value": "True",
|
140 |
+
"required": false
|
141 |
+
},
|
142 |
+
"G_FILTER": {
|
143 |
+
"description": "GlobalFilter set True to on / False to off",
|
144 |
+
"value": "True",
|
145 |
+
"required": false
|
146 |
+
},
|
147 |
+
"BUTTON_LOCK": {
|
148 |
+
"description": "Button alert set True to on / False to off",
|
149 |
+
"value": "True",
|
150 |
+
"required": false
|
151 |
+
},
|
152 |
+
"RemoveBG_API": {
|
153 |
+
"description": "background remover website api key. get from https://www.remove.bg/b/background-removal-api",
|
154 |
+
"required": false
|
155 |
+
},
|
156 |
+
"P_TTI_SHOW_OFF": {
|
157 |
+
"description": "Customize Result Buttons to Callback or Url by (True = url / False = callback)",
|
158 |
+
"value": "True",
|
159 |
+
"required": false
|
160 |
+
}
|
161 |
+
},
|
162 |
+
"buildpacks":
|
163 |
+
[
|
164 |
+
{"url": "heroku/python"}
|
165 |
+
]
|
166 |
+
}
|
167 |
+
|
168 |
+
|
169 |
+
|
170 |
+
|
171 |
+
|
bot.py
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os, math, logging, datetime, pytz, logging.config
|
2 |
+
|
3 |
+
from aiohttp import web
|
4 |
+
from pyrogram import Client, types
|
5 |
+
from database.users_chats_db import db
|
6 |
+
from database.ia_filterdb import Media
|
7 |
+
from typing import Union, Optional, AsyncGenerator
|
8 |
+
from utils import temp, __repo__, __license__, __copyright__, __version__
|
9 |
+
from info import API_ID, API_HASH, BOT_TOKEN, LOG_CHANNEL, UPTIME, WEB_SUPPORT, LOG_MSG
|
10 |
+
|
11 |
+
# Get logging configurations
|
12 |
+
logging.config.fileConfig("logging.conf")
|
13 |
+
logging.getLogger(__name__).setLevel(logging.INFO)
|
14 |
+
logging.getLogger("cinemagoer").setLevel(logging.ERROR)
|
15 |
+
|
16 |
+
|
17 |
+
class Bot(Client):
|
18 |
+
def __init__(self):
|
19 |
+
super().__init__(
|
20 |
+
name="Professor-Bot",
|
21 |
+
api_id=API_ID,
|
22 |
+
api_hash=API_HASH,
|
23 |
+
bot_token=BOT_TOKEN,
|
24 |
+
plugins=dict(root="plugins")
|
25 |
+
)
|
26 |
+
|
27 |
+
async def start(self):
|
28 |
+
b_users, b_chats = await db.get_banned()
|
29 |
+
temp.BANNED_USERS = b_users
|
30 |
+
temp.BANNED_CHATS = b_chats
|
31 |
+
|
32 |
+
await super().start()
|
33 |
+
await Media.ensure_indexes()
|
34 |
+
me = await self.get_me()
|
35 |
+
temp.U_NAME = me.username
|
36 |
+
temp.B_NAME = me.first_name
|
37 |
+
self.id = me.id
|
38 |
+
self.name = me.first_name
|
39 |
+
self.mention = me.mention
|
40 |
+
self.username = me.username
|
41 |
+
self.log_channel = LOG_CHANNEL
|
42 |
+
self.uptime = UPTIME
|
43 |
+
curr = datetime.datetime.now(pytz.timezone("Asia/Kolkata"))
|
44 |
+
date = curr.strftime('%d %B, %Y')
|
45 |
+
tame = curr.strftime('%I:%M:%S %p')
|
46 |
+
logging.info(LOG_MSG.format(me.first_name, date, tame, __repo__, __version__, __license__, __copyright__))
|
47 |
+
|
48 |
+
try: await self.send_message(LOG_CHANNEL, text=LOG_MSG.format(me.first_name, date, tame, __repo__, __version__, __license__, __copyright__), disable_web_page_preview=True)
|
49 |
+
except Exception as e: logging.warning(f"Bot Isn't Able To Send Message To LOG_CHANNEL \n{e}")
|
50 |
+
|
51 |
+
if bool(WEB_SUPPORT) is True:
|
52 |
+
app = web.AppRunner(web.Application(client_max_size=30000000))
|
53 |
+
await app.setup()
|
54 |
+
await web.TCPSite(app, "0.0.0.0", 8080).start()
|
55 |
+
logging.info("Web Response Is Running......🕸️")
|
56 |
+
|
57 |
+
async def stop(self, *args):
|
58 |
+
await super().stop()
|
59 |
+
logging.info(f"Bot Is Restarting ⟳...")
|
60 |
+
|
61 |
+
async def iter_messages(self, chat_id: Union[int, str], limit: int, offset: int = 0) -> Optional[AsyncGenerator["types.Message", None]]:
|
62 |
+
current = offset
|
63 |
+
while True:
|
64 |
+
new_diff = min(200, limit - current)
|
65 |
+
if new_diff <= 0:
|
66 |
+
return
|
67 |
+
messages = await self.get_messages(chat_id, list(range(current, current+new_diff+1)))
|
68 |
+
for message in messages:
|
69 |
+
yield message
|
70 |
+
current += 1
|
71 |
+
|
72 |
+
|
73 |
+
|
74 |
+
Bot().run()
|
75 |
+
|
76 |
+
|
77 |
+
|
78 |
+
|
79 |
+
|
combined.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
database/connections_mdb.py
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pymongo
|
2 |
+
|
3 |
+
from info import DATABASE_URL, DATABASE_NAME
|
4 |
+
|
5 |
+
import logging
|
6 |
+
logger = logging.getLogger(__name__)
|
7 |
+
logger.setLevel(logging.ERROR)
|
8 |
+
|
9 |
+
myclient = pymongo.MongoClient(DATABASE_URL)
|
10 |
+
mydb = myclient[DATABASE_NAME]
|
11 |
+
mycol = mydb['CONNECTION']
|
12 |
+
|
13 |
+
|
14 |
+
async def add_connection(group_id, user_id):
|
15 |
+
query = mycol.find_one(
|
16 |
+
{ "_id": user_id },
|
17 |
+
{ "_id": 0, "active_group": 0 }
|
18 |
+
)
|
19 |
+
if query is not None:
|
20 |
+
group_ids = [x["group_id"] for x in query["group_details"]]
|
21 |
+
if group_id in group_ids:
|
22 |
+
return False
|
23 |
+
|
24 |
+
group_details = {
|
25 |
+
"group_id" : group_id
|
26 |
+
}
|
27 |
+
|
28 |
+
data = {
|
29 |
+
'_id': user_id,
|
30 |
+
'group_details' : [group_details],
|
31 |
+
'active_group' : group_id,
|
32 |
+
}
|
33 |
+
|
34 |
+
if mycol.count_documents( {"_id": user_id} ) == 0:
|
35 |
+
try:
|
36 |
+
mycol.insert_one(data)
|
37 |
+
return True
|
38 |
+
except:
|
39 |
+
logger.exception('Some error occured!', exc_info=True)
|
40 |
+
|
41 |
+
else:
|
42 |
+
try:
|
43 |
+
mycol.update_one(
|
44 |
+
{'_id': user_id},
|
45 |
+
{
|
46 |
+
"$push": {"group_details": group_details},
|
47 |
+
"$set": {"active_group" : group_id}
|
48 |
+
}
|
49 |
+
)
|
50 |
+
return True
|
51 |
+
except:
|
52 |
+
logger.exception('Some error occured!', exc_info=True)
|
53 |
+
|
54 |
+
|
55 |
+
async def active_connection(user_id):
|
56 |
+
|
57 |
+
query = mycol.find_one(
|
58 |
+
{ "_id": user_id },
|
59 |
+
{ "_id": 0, "group_details": 0 }
|
60 |
+
)
|
61 |
+
if not query:
|
62 |
+
return None
|
63 |
+
|
64 |
+
group_id = query['active_group']
|
65 |
+
if group_id != None:
|
66 |
+
return int(group_id)
|
67 |
+
else:
|
68 |
+
return None
|
69 |
+
|
70 |
+
|
71 |
+
async def all_connections(user_id):
|
72 |
+
query = mycol.find_one(
|
73 |
+
{ "_id": user_id },
|
74 |
+
{ "_id": 0, "active_group": 0 }
|
75 |
+
)
|
76 |
+
if query is not None:
|
77 |
+
return [x["group_id"] for x in query["group_details"]]
|
78 |
+
else:
|
79 |
+
return None
|
80 |
+
|
81 |
+
|
82 |
+
async def if_active(user_id, group_id):
|
83 |
+
query = mycol.find_one(
|
84 |
+
{ "_id": user_id },
|
85 |
+
{ "_id": 0, "group_details": 0 }
|
86 |
+
)
|
87 |
+
return query is not None and query['active_group'] == group_id
|
88 |
+
|
89 |
+
|
90 |
+
async def make_active(user_id, group_id):
|
91 |
+
update = mycol.update_one(
|
92 |
+
{'_id': user_id},
|
93 |
+
{"$set": {"active_group" : group_id}}
|
94 |
+
)
|
95 |
+
return update.modified_count != 0
|
96 |
+
|
97 |
+
|
98 |
+
async def make_inactive(user_id):
|
99 |
+
update = mycol.update_one(
|
100 |
+
{'_id': user_id},
|
101 |
+
{"$set": {"active_group" : None}}
|
102 |
+
)
|
103 |
+
return update.modified_count != 0
|
104 |
+
|
105 |
+
|
106 |
+
async def delete_connection(user_id, group_id):
|
107 |
+
|
108 |
+
try:
|
109 |
+
update = mycol.update_one(
|
110 |
+
{"_id": user_id},
|
111 |
+
{"$pull" : { "group_details" : {"group_id":group_id} } }
|
112 |
+
)
|
113 |
+
if update.modified_count == 0:
|
114 |
+
return False
|
115 |
+
query = mycol.find_one(
|
116 |
+
{ "_id": user_id },
|
117 |
+
{ "_id": 0 }
|
118 |
+
)
|
119 |
+
if len(query["group_details"]) >= 1:
|
120 |
+
if query['active_group'] == group_id:
|
121 |
+
prvs_group_id = query["group_details"][len(query["group_details"]) - 1]["group_id"]
|
122 |
+
|
123 |
+
mycol.update_one(
|
124 |
+
{'_id': user_id},
|
125 |
+
{"$set": {"active_group" : prvs_group_id}}
|
126 |
+
)
|
127 |
+
else:
|
128 |
+
mycol.update_one(
|
129 |
+
{'_id': user_id},
|
130 |
+
{"$set": {"active_group" : None}}
|
131 |
+
)
|
132 |
+
return True
|
133 |
+
except Exception as e:
|
134 |
+
logger.exception(f'Some error occured! {e}', exc_info=True)
|
135 |
+
return False
|
database/filters_mdb.py
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pymongo
|
2 |
+
from pyrogram import enums
|
3 |
+
from info import DATABASE_URL, DATABASE_NAME
|
4 |
+
import logging
|
5 |
+
logger = logging.getLogger(__name__)
|
6 |
+
logger.setLevel(logging.ERROR)
|
7 |
+
|
8 |
+
myclient = pymongo.MongoClient(DATABASE_URL)
|
9 |
+
mydb = myclient["ManualFilters"]
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
async def add_filter(grp_id, text, reply_text, btn, file, alert):
|
14 |
+
mycol = mydb[str(grp_id)]
|
15 |
+
# mycol.create_index([('text', 'text')])
|
16 |
+
|
17 |
+
data = {
|
18 |
+
'text':str(text),
|
19 |
+
'reply':str(reply_text),
|
20 |
+
'btn':str(btn),
|
21 |
+
'file':str(file),
|
22 |
+
'alert':str(alert)
|
23 |
+
}
|
24 |
+
|
25 |
+
try:
|
26 |
+
mycol.update_one({'text': str(text)}, {"$set": data}, upsert=True)
|
27 |
+
except:
|
28 |
+
logger.exception('Some error occured!', exc_info=True)
|
29 |
+
|
30 |
+
|
31 |
+
async def find_filter(group_id, name):
|
32 |
+
mycol = mydb[str(group_id)]
|
33 |
+
|
34 |
+
query = mycol.find( {"text":name})
|
35 |
+
# query = mycol.find( { "$text": {"$search": name}})
|
36 |
+
try:
|
37 |
+
for file in query:
|
38 |
+
reply_text = file['reply']
|
39 |
+
btn = file['btn']
|
40 |
+
fileid = file['file']
|
41 |
+
try:
|
42 |
+
alert = file['alert']
|
43 |
+
except:
|
44 |
+
alert = None
|
45 |
+
return reply_text, btn, alert, fileid
|
46 |
+
except:
|
47 |
+
return None, None, None, None
|
48 |
+
|
49 |
+
|
50 |
+
async def get_filters(group_id):
|
51 |
+
mycol = mydb[str(group_id)]
|
52 |
+
|
53 |
+
texts = []
|
54 |
+
query = mycol.find()
|
55 |
+
try:
|
56 |
+
for file in query:
|
57 |
+
text = file['text']
|
58 |
+
texts.append(text)
|
59 |
+
except:
|
60 |
+
pass
|
61 |
+
return texts
|
62 |
+
|
63 |
+
|
64 |
+
async def delete_filter(message, text, group_id):
|
65 |
+
mycol = mydb[str(group_id)]
|
66 |
+
|
67 |
+
myquery = {'text':text }
|
68 |
+
query = mycol.count_documents(myquery)
|
69 |
+
if query == 1:
|
70 |
+
mycol.delete_one(myquery)
|
71 |
+
await message.reply_text(
|
72 |
+
f"'`{text}`' deleted. I'll not respond to that filter anymore.",
|
73 |
+
quote=True,
|
74 |
+
parse_mode=enums.ParseMode.MARKDOWN
|
75 |
+
)
|
76 |
+
else:
|
77 |
+
await message.reply_text("Couldn't find that filter!", quote=True)
|
78 |
+
|
79 |
+
|
80 |
+
async def del_all(message, group_id, title):
|
81 |
+
if str(group_id) not in mydb.list_collection_names():
|
82 |
+
await message.edit_text(f"Nothing to remove in {title}!")
|
83 |
+
return
|
84 |
+
|
85 |
+
mycol = mydb[str(group_id)]
|
86 |
+
try:
|
87 |
+
mycol.drop()
|
88 |
+
await message.edit_text(f"All filters from {title} has been removed")
|
89 |
+
except:
|
90 |
+
await message.edit_text("Couldn't remove all filters from group!")
|
91 |
+
return
|
92 |
+
|
93 |
+
|
94 |
+
async def count_filters(group_id):
|
95 |
+
mycol = mydb[str(group_id)]
|
96 |
+
|
97 |
+
count = mycol.count()
|
98 |
+
if count == 0:
|
99 |
+
return False
|
100 |
+
else:
|
101 |
+
return count
|
102 |
+
|
103 |
+
|
104 |
+
async def filter_stats():
|
105 |
+
collections = mydb.list_collection_names()
|
106 |
+
|
107 |
+
if "CONNECTION" in collections:
|
108 |
+
collections.remove("CONNECTION")
|
109 |
+
|
110 |
+
totalcount = 0
|
111 |
+
for collection in collections:
|
112 |
+
mycol = mydb[collection]
|
113 |
+
count = mycol.count()
|
114 |
+
totalcount += count
|
115 |
+
|
116 |
+
totalcollections = len(collections)
|
117 |
+
|
118 |
+
return totalcollections, totalcount
|
database/gfilters_mdb.py
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pymongo
|
2 |
+
from info import DATABASE_URL, DATABASE_NAME
|
3 |
+
from pyrogram import enums
|
4 |
+
import logging
|
5 |
+
logger = logging.getLogger(__name__)
|
6 |
+
logger.setLevel(logging.ERROR)
|
7 |
+
|
8 |
+
myclient = pymongo.MongoClient(DATABASE_URL)
|
9 |
+
mydb = myclient["GlobalFilters"]
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
async def add_gfilter(gfilters, text, reply_text, btn, file, alert):
|
14 |
+
mycol = mydb[str(gfilters)]
|
15 |
+
data = {
|
16 |
+
'text':str(text),
|
17 |
+
'reply':str(reply_text),
|
18 |
+
'btn':str(btn),
|
19 |
+
'file':str(file),
|
20 |
+
'alert':str(alert)
|
21 |
+
}
|
22 |
+
try:
|
23 |
+
mycol.update_one({'text': str(text)}, {"$set": data}, upsert=True)
|
24 |
+
except:
|
25 |
+
logger.exception('Some error occured!', exc_info=True)
|
26 |
+
|
27 |
+
|
28 |
+
async def find_gfilter(gfilters, name):
|
29 |
+
mycol = mydb[str(gfilters)]
|
30 |
+
|
31 |
+
query = mycol.find( {"text":name})
|
32 |
+
# query = mycol.find( { "$text": {"$search": name}})
|
33 |
+
try:
|
34 |
+
for file in query:
|
35 |
+
reply_text = file['reply']
|
36 |
+
btn = file['btn']
|
37 |
+
fileid = file['file']
|
38 |
+
try:
|
39 |
+
alert = file['alert']
|
40 |
+
except:
|
41 |
+
alert = None
|
42 |
+
return reply_text, btn, alert, fileid
|
43 |
+
except:
|
44 |
+
return None, None, None, None
|
45 |
+
|
46 |
+
|
47 |
+
async def get_gfilters(gfilters):
|
48 |
+
mycol = mydb[str(gfilters)]
|
49 |
+
|
50 |
+
texts = []
|
51 |
+
query = mycol.find()
|
52 |
+
try:
|
53 |
+
for file in query:
|
54 |
+
text = file['text']
|
55 |
+
texts.append(text)
|
56 |
+
except:
|
57 |
+
pass
|
58 |
+
return texts
|
59 |
+
|
60 |
+
|
61 |
+
async def delete_gfilter(message, text, gfilters):
|
62 |
+
mycol = mydb[str(gfilters)]
|
63 |
+
|
64 |
+
myquery = {'text':text }
|
65 |
+
query = mycol.count_documents(myquery)
|
66 |
+
if query == 1:
|
67 |
+
mycol.delete_one(myquery)
|
68 |
+
await message.reply_text(
|
69 |
+
f"'`{text}`' deleted. I'll not respond to that gfilter anymore.",
|
70 |
+
quote=True,
|
71 |
+
parse_mode=enums.ParseMode.MARKDOWN
|
72 |
+
)
|
73 |
+
else:
|
74 |
+
await message.reply_text("Couldn't find that gfilter!", quote=True)
|
75 |
+
|
76 |
+
async def del_allg(message, gfilters):
|
77 |
+
if str(gfilters) not in mydb.list_collection_names():
|
78 |
+
await message.edit_text("Nothin!")
|
79 |
+
return
|
80 |
+
|
81 |
+
mycol = mydb[str(gfilters)]
|
82 |
+
try:
|
83 |
+
mycol.drop()
|
84 |
+
await message.edit_text(f"All filters has been removed")
|
85 |
+
except:
|
86 |
+
await message.edit_text("Couldn't remove all filters!")
|
87 |
+
return
|
88 |
+
|
89 |
+
async def count_gfilters(gfilters):
|
90 |
+
mycol = mydb[str(gfilters)]
|
91 |
+
|
92 |
+
count = mycol.count()
|
93 |
+
return False if count == 0 else count
|
94 |
+
|
95 |
+
|
96 |
+
async def gfilter_stats():
|
97 |
+
collections = mydb.list_collection_names()
|
98 |
+
|
99 |
+
if "CONNECTION" in collections:
|
100 |
+
collections.remove("CONNECTION")
|
101 |
+
|
102 |
+
totalcount = 0
|
103 |
+
for collection in collections:
|
104 |
+
mycol = mydb[collection]
|
105 |
+
count = mycol.count()
|
106 |
+
totalcount += count
|
107 |
+
|
108 |
+
totalcollections = len(collections)
|
109 |
+
|
110 |
+
return totalcollections, totalcount
|
database/ia_filterdb.py
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import logging
|
2 |
+
from struct import pack
|
3 |
+
import re
|
4 |
+
import base64
|
5 |
+
from pyrogram.file_id import FileId
|
6 |
+
from pymongo.errors import DuplicateKeyError
|
7 |
+
from umongo import Instance, Document, fields
|
8 |
+
from motor.motor_asyncio import AsyncIOMotorClient
|
9 |
+
from marshmallow.exceptions import ValidationError
|
10 |
+
from info import FILE_DB_URL, FILE_DB_NAME, COLLECTION_NAME, MAX_RIST_BTNS
|
11 |
+
|
12 |
+
logger = logging.getLogger(__name__)
|
13 |
+
logger.setLevel(logging.INFO)
|
14 |
+
|
15 |
+
|
16 |
+
client = AsyncIOMotorClient(FILE_DB_URL)
|
17 |
+
db = client[FILE_DB_NAME]
|
18 |
+
instance = Instance.from_db(db)
|
19 |
+
|
20 |
+
@instance.register
|
21 |
+
class Media(Document):
|
22 |
+
file_id = fields.StrField(attribute='_id')
|
23 |
+
file_ref = fields.StrField(allow_none=True)
|
24 |
+
file_name = fields.StrField(required=True)
|
25 |
+
file_size = fields.IntField(required=True)
|
26 |
+
file_type = fields.StrField(allow_none=True)
|
27 |
+
mime_type = fields.StrField(allow_none=True)
|
28 |
+
caption = fields.StrField(allow_none=True)
|
29 |
+
|
30 |
+
class Meta:
|
31 |
+
collection_name = COLLECTION_NAME
|
32 |
+
|
33 |
+
|
34 |
+
async def save_file(media):
|
35 |
+
file_id, file_ref = unpack_new_file_id(media.file_id)
|
36 |
+
file_name = re.sub(r"@\w+|(_|\-|\.|\+)", " ", str(media.file_name))
|
37 |
+
try:
|
38 |
+
file = Media(
|
39 |
+
file_id=file_id,
|
40 |
+
file_ref=file_ref,
|
41 |
+
file_name=file_name,
|
42 |
+
file_size=media.file_size,
|
43 |
+
file_type=media.file_type,
|
44 |
+
mime_type=media.mime_type
|
45 |
+
)
|
46 |
+
except ValidationError:
|
47 |
+
logger.exception('Error Occurred While Saving File In Database')
|
48 |
+
return False, 2
|
49 |
+
else:
|
50 |
+
try:
|
51 |
+
await file.commit()
|
52 |
+
except DuplicateKeyError:
|
53 |
+
logger.warning(str(getattr(media, "file_name", "NO FILE NAME")) + " is already saved in database")
|
54 |
+
return False, 0
|
55 |
+
else:
|
56 |
+
logger.info(str(getattr(media, "file_name", "NO FILE NAME")) + " is saved in database")
|
57 |
+
return True, 1
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
async def get_search_results(query, file_type=None, max_results=(MAX_RIST_BTNS), offset=0, filter=False):
|
62 |
+
query = query.strip()
|
63 |
+
if not query: raw_pattern = '.'
|
64 |
+
elif ' ' not in query: raw_pattern = r'(\b|[\.\+\-_])' + query + r'(\b|[\.\+\-_])'
|
65 |
+
else: raw_pattern = query.replace(' ', r'.*[\s\.\+\-_]')
|
66 |
+
try: regex = re.compile(raw_pattern, flags=re.IGNORECASE)
|
67 |
+
except: return [], '', 0
|
68 |
+
filter = {'file_name': regex}
|
69 |
+
if file_type: filter['file_type'] = file_type
|
70 |
+
|
71 |
+
total_results = await Media.count_documents(filter)
|
72 |
+
next_offset = offset + max_results
|
73 |
+
if next_offset > total_results: next_offset = ''
|
74 |
+
|
75 |
+
cursor = Media.find(filter)
|
76 |
+
# Sort by recent
|
77 |
+
cursor.sort('$natural', -1)
|
78 |
+
# Slice files according to offset and max results
|
79 |
+
cursor.skip(offset).limit(max_results)
|
80 |
+
# Get list of files
|
81 |
+
files = await cursor.to_list(length=max_results)
|
82 |
+
return files, next_offset, total_results
|
83 |
+
|
84 |
+
|
85 |
+
async def get_file_details(query):
|
86 |
+
filter = {'file_id': query}
|
87 |
+
cursor = Media.find(filter)
|
88 |
+
filedetails = await cursor.to_list(length=1)
|
89 |
+
return filedetails
|
90 |
+
|
91 |
+
|
92 |
+
def encode_file_id(s: bytes) -> str:
|
93 |
+
r = b""
|
94 |
+
n = 0
|
95 |
+
for i in s + bytes([22]) + bytes([4]):
|
96 |
+
if i == 0:
|
97 |
+
n += 1
|
98 |
+
else:
|
99 |
+
if n:
|
100 |
+
r += b"\x00" + bytes([n])
|
101 |
+
n = 0
|
102 |
+
r += bytes([i])
|
103 |
+
return base64.urlsafe_b64encode(r).decode().rstrip("=")
|
104 |
+
|
105 |
+
|
106 |
+
def encode_file_ref(file_ref: bytes) -> str:
|
107 |
+
return base64.urlsafe_b64encode(file_ref).decode().rstrip("=")
|
108 |
+
|
109 |
+
|
110 |
+
def unpack_new_file_id(new_file_id):
|
111 |
+
"""Return file_id, file_ref"""
|
112 |
+
decoded = FileId.decode(new_file_id)
|
113 |
+
file_id = encode_file_id(
|
114 |
+
pack(
|
115 |
+
"<iiqq",
|
116 |
+
int(decoded.file_type),
|
117 |
+
decoded.dc_id,
|
118 |
+
decoded.media_id,
|
119 |
+
decoded.access_hash
|
120 |
+
)
|
121 |
+
)
|
122 |
+
file_ref = encode_file_ref(decoded.file_reference)
|
123 |
+
return file_id, file_ref
|
database/users_chats_db.py
ADDED
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import motor.motor_asyncio
|
2 |
+
from info import DATABASE_NAME, DATABASE_URL, IMDB, IMDB_TEMPLATE, MELCOW_NEW_USERS, P_TTI_SHOW_OFF, SINGLE_BUTTON, SPELL_CHECK_REPLY, PROTECT_CONTENT, MAX_RIST_BTNS, IMDB_DELET_TIME
|
3 |
+
|
4 |
+
class Database:
|
5 |
+
|
6 |
+
def __init__(self, uri, database_name):
|
7 |
+
self._client = motor.motor_asyncio.AsyncIOMotorClient(uri)
|
8 |
+
self.db = self._client[database_name]
|
9 |
+
self.col = self.db.users
|
10 |
+
self.grp = self.db.groups
|
11 |
+
|
12 |
+
|
13 |
+
def new_user(self, id, name):
|
14 |
+
return dict(
|
15 |
+
id = id,
|
16 |
+
name = name,
|
17 |
+
ban_status=dict(
|
18 |
+
is_banned=False,
|
19 |
+
ban_reason="",
|
20 |
+
),
|
21 |
+
)
|
22 |
+
|
23 |
+
|
24 |
+
def new_group(self, id, title, username):
|
25 |
+
return dict(
|
26 |
+
id = id,
|
27 |
+
title = title,
|
28 |
+
username = username,
|
29 |
+
chat_status=dict(
|
30 |
+
is_disabled=False,
|
31 |
+
reason="",
|
32 |
+
),
|
33 |
+
)
|
34 |
+
|
35 |
+
async def add_user(self, id, name):
|
36 |
+
user = self.new_user(id, name)
|
37 |
+
await self.col.insert_one(user)
|
38 |
+
|
39 |
+
async def is_user_exist(self, id):
|
40 |
+
user = await self.col.find_one({'id':int(id)})
|
41 |
+
return bool(user)
|
42 |
+
|
43 |
+
async def total_users_count(self):
|
44 |
+
count = await self.col.count_documents({})
|
45 |
+
return count
|
46 |
+
|
47 |
+
async def remove_ban(self, id):
|
48 |
+
ban_status = dict(
|
49 |
+
is_banned=False,
|
50 |
+
ban_reason=''
|
51 |
+
)
|
52 |
+
await self.col.update_one({'id': id}, {'$set': {'ban_status': ban_status}})
|
53 |
+
|
54 |
+
async def ban_user(self, user_id, ban_reason="No Reason"):
|
55 |
+
ban_status = dict(
|
56 |
+
is_banned=True,
|
57 |
+
ban_reason=ban_reason
|
58 |
+
)
|
59 |
+
await self.col.update_one({'id': user_id}, {'$set': {'ban_status': ban_status}})
|
60 |
+
|
61 |
+
async def get_ban_status(self, id):
|
62 |
+
default = dict(
|
63 |
+
is_banned=False,
|
64 |
+
ban_reason=''
|
65 |
+
)
|
66 |
+
user = await self.col.find_one({'id':int(id)})
|
67 |
+
if not user:
|
68 |
+
return default
|
69 |
+
return user.get('ban_status', default)
|
70 |
+
|
71 |
+
async def get_all_users(self):
|
72 |
+
return self.col.find({})
|
73 |
+
|
74 |
+
|
75 |
+
async def delete_user(self, user_id):
|
76 |
+
await self.col.delete_many({'id': int(user_id)})
|
77 |
+
|
78 |
+
async def delete_chat(self, chat_id):
|
79 |
+
await self.grp.delete_many({'id': int(chat_id)})
|
80 |
+
|
81 |
+
async def get_banned(self):
|
82 |
+
users = self.col.find({'ban_status.is_banned': True})
|
83 |
+
chats = self.grp.find({'chat_status.is_disabled': True})
|
84 |
+
b_chats = [chat['id'] async for chat in chats]
|
85 |
+
b_users = [user['id'] async for user in users]
|
86 |
+
return b_users, b_chats
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
async def add_chat(self, chat, title, username):
|
91 |
+
chat = self.new_group(chat, title, username)
|
92 |
+
await self.grp.insert_one(chat)
|
93 |
+
|
94 |
+
|
95 |
+
async def get_chat(self, chat):
|
96 |
+
chat = await self.grp.find_one({'id':int(chat)})
|
97 |
+
return False if not chat else chat.get('chat_status')
|
98 |
+
|
99 |
+
|
100 |
+
async def re_enable_chat(self, id):
|
101 |
+
chat_status=dict(
|
102 |
+
is_disabled=False,
|
103 |
+
reason="",
|
104 |
+
)
|
105 |
+
await self.grp.update_one({'id': int(id)}, {'$set': {'chat_status': chat_status}})
|
106 |
+
|
107 |
+
async def update_settings(self, id, settings):
|
108 |
+
await self.grp.update_one({'id': int(id)}, {'$set': {'settings': settings}})
|
109 |
+
|
110 |
+
|
111 |
+
async def get_settings(self, id):
|
112 |
+
default = {
|
113 |
+
'button': SINGLE_BUTTON,
|
114 |
+
'botpm': P_TTI_SHOW_OFF,
|
115 |
+
'file_secure': PROTECT_CONTENT,
|
116 |
+
'imdb': IMDB,
|
117 |
+
'spell_check': SPELL_CHECK_REPLY,
|
118 |
+
'welcome': MELCOW_NEW_USERS,
|
119 |
+
'template': IMDB_TEMPLATE
|
120 |
+
}
|
121 |
+
chat = await self.grp.find_one({'id':int(id)})
|
122 |
+
if chat:
|
123 |
+
return chat.get('settings', default)
|
124 |
+
return default
|
125 |
+
|
126 |
+
|
127 |
+
async def disable_chat(self, chat, reason="No Reason"):
|
128 |
+
chat_status=dict(
|
129 |
+
is_disabled=True,
|
130 |
+
reason=reason,
|
131 |
+
)
|
132 |
+
await self.grp.update_one({'id': int(chat)}, {'$set': {'chat_status': chat_status}})
|
133 |
+
|
134 |
+
|
135 |
+
async def total_chat_count(self):
|
136 |
+
count = await self.grp.count_documents({})
|
137 |
+
return count
|
138 |
+
|
139 |
+
|
140 |
+
async def get_all_chats(self):
|
141 |
+
return self.grp.find({})
|
142 |
+
|
143 |
+
|
144 |
+
async def get_db_size(self):
|
145 |
+
return (await self.db.command("dbstats"))['dataSize']
|
146 |
+
|
147 |
+
|
148 |
+
db = Database(DATABASE_URL, DATABASE_NAME)
|
image/edit_1.py
ADDED
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from PIL import Image, ImageEnhance, ImageFilter
|
2 |
+
from pyrogram.enums import ChatAction
|
3 |
+
import shutil
|
4 |
+
import cv2
|
5 |
+
import os
|
6 |
+
|
7 |
+
|
8 |
+
async def bright(client, message):
|
9 |
+
try:
|
10 |
+
userid = str(message.chat.id)
|
11 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
12 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
13 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
14 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "brightness.jpg"
|
15 |
+
if not message.reply_to_message.empty:
|
16 |
+
msg = await message.reply_to_message.reply_text(
|
17 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
18 |
+
)
|
19 |
+
a = await client.download_media(
|
20 |
+
message=message.reply_to_message, file_name=download_location
|
21 |
+
)
|
22 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
23 |
+
image = Image.open(a)
|
24 |
+
brightness = ImageEnhance.Brightness(image)
|
25 |
+
brightness.enhance(1.5).save(edit_img_loc)
|
26 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
27 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
28 |
+
await msg.delete()
|
29 |
+
else:
|
30 |
+
await message.reply_text("Why did you delete that??")
|
31 |
+
try:
|
32 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
33 |
+
except Exception:
|
34 |
+
pass
|
35 |
+
except Exception as e:
|
36 |
+
print("bright-error - " + str(e))
|
37 |
+
if "USER_IS_BLOCKED" in str(e):
|
38 |
+
return
|
39 |
+
else:
|
40 |
+
try:
|
41 |
+
await message.reply_to_message.reply_text(
|
42 |
+
f"{e} \nSomething went wrong!", quote=True
|
43 |
+
)
|
44 |
+
except Exception:
|
45 |
+
return
|
46 |
+
|
47 |
+
|
48 |
+
async def mix(client, message):
|
49 |
+
try:
|
50 |
+
userid = str(message.chat.id)
|
51 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
52 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
53 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
54 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "mix.jpg"
|
55 |
+
if not message.reply_to_message.empty:
|
56 |
+
msg = await message.reply_to_message.reply_text(
|
57 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
58 |
+
)
|
59 |
+
a = await client.download_media(
|
60 |
+
message=message.reply_to_message, file_name=download_location
|
61 |
+
)
|
62 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
63 |
+
image = Image.open(a)
|
64 |
+
red, green, blue = image.split()
|
65 |
+
new_image = Image.merge("RGB", (green, red, blue))
|
66 |
+
new_image.save(edit_img_loc)
|
67 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
68 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
69 |
+
await msg.delete()
|
70 |
+
else:
|
71 |
+
await message.reply_text("Why did you delete that??")
|
72 |
+
try:
|
73 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
74 |
+
except Exception:
|
75 |
+
pass
|
76 |
+
except Exception as e:
|
77 |
+
print("mix-error - " + str(e))
|
78 |
+
if "USER_IS_BLOCKED" in str(e):
|
79 |
+
return
|
80 |
+
else:
|
81 |
+
try:
|
82 |
+
await message.reply_to_message.reply_text(
|
83 |
+
"Something went wrong!", quote=True
|
84 |
+
)
|
85 |
+
except Exception:
|
86 |
+
return
|
87 |
+
|
88 |
+
|
89 |
+
async def black_white(client, message):
|
90 |
+
try:
|
91 |
+
userid = str(message.chat.id)
|
92 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
93 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
94 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
95 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "black_white.jpg"
|
96 |
+
if not message.reply_to_message.empty:
|
97 |
+
msg = await message.reply_to_message.reply_text(
|
98 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
99 |
+
)
|
100 |
+
a = await client.download_media(
|
101 |
+
message=message.reply_to_message, file_name=download_location
|
102 |
+
)
|
103 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
104 |
+
image_file = cv2.imread(a)
|
105 |
+
grayImage = cv2.cvtColor(image_file, cv2.COLOR_BGR2GRAY)
|
106 |
+
cv2.imwrite(edit_img_loc, grayImage)
|
107 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
108 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
109 |
+
await msg.delete()
|
110 |
+
else:
|
111 |
+
await message.reply_text("Why did you delete that??")
|
112 |
+
try:
|
113 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
114 |
+
except Exception:
|
115 |
+
pass
|
116 |
+
except Exception as e:
|
117 |
+
print("black_white-error - " + str(e))
|
118 |
+
if "USER_IS_BLOCKED" in str(e):
|
119 |
+
return
|
120 |
+
else:
|
121 |
+
try:
|
122 |
+
await message.reply_to_message.reply_text(
|
123 |
+
"Something went wrong!", quote=True
|
124 |
+
)
|
125 |
+
except Exception:
|
126 |
+
return
|
127 |
+
|
128 |
+
|
129 |
+
async def normal_blur(client, message):
|
130 |
+
try:
|
131 |
+
userid = str(message.chat.id)
|
132 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
133 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
134 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
135 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "BlurImage.jpg"
|
136 |
+
if not message.reply_to_message.empty:
|
137 |
+
msg = await message.reply_to_message.reply_text(
|
138 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
139 |
+
)
|
140 |
+
a = await client.download_media(
|
141 |
+
message=message.reply_to_message, file_name=download_location
|
142 |
+
)
|
143 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
144 |
+
OriImage = Image.open(a)
|
145 |
+
blurImage = OriImage.filter(ImageFilter.BLUR)
|
146 |
+
blurImage.save(edit_img_loc)
|
147 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
148 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
149 |
+
await msg.delete()
|
150 |
+
else:
|
151 |
+
await message.reply_text("Why did you delete that??")
|
152 |
+
try:
|
153 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
154 |
+
except Exception:
|
155 |
+
pass
|
156 |
+
except Exception as e:
|
157 |
+
print("normal_blur-error - " + str(e))
|
158 |
+
if "USER_IS_BLOCKED" in str(e):
|
159 |
+
return
|
160 |
+
else:
|
161 |
+
try:
|
162 |
+
await message.reply_to_message.reply_text(
|
163 |
+
"Something went wrong!", quote=True
|
164 |
+
)
|
165 |
+
except Exception:
|
166 |
+
return
|
167 |
+
|
168 |
+
|
169 |
+
async def g_blur(client, message):
|
170 |
+
try:
|
171 |
+
userid = str(message.chat.id)
|
172 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
173 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
174 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
175 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "gaussian_blur.jpg"
|
176 |
+
if not message.reply_to_message.empty:
|
177 |
+
msg = await message.reply_to_message.reply_text(
|
178 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
179 |
+
)
|
180 |
+
a = await client.download_media(
|
181 |
+
message=message.reply_to_message, file_name=download_location
|
182 |
+
)
|
183 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
184 |
+
im1 = Image.open(a)
|
185 |
+
im2 = im1.filter(ImageFilter.GaussianBlur(radius=5))
|
186 |
+
im2.save(edit_img_loc)
|
187 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
188 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
189 |
+
await msg.delete()
|
190 |
+
else:
|
191 |
+
await message.reply_text("Why did you delete that??")
|
192 |
+
try:
|
193 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
194 |
+
except Exception:
|
195 |
+
pass
|
196 |
+
except Exception as e:
|
197 |
+
print("g_blur-error - " + str(e))
|
198 |
+
if "USER_IS_BLOCKED" in str(e):
|
199 |
+
return
|
200 |
+
else:
|
201 |
+
try:
|
202 |
+
await message.reply_to_message.reply_text(
|
203 |
+
"Something went wrong!", quote=True
|
204 |
+
)
|
205 |
+
except Exception:
|
206 |
+
return
|
207 |
+
|
208 |
+
|
209 |
+
async def box_blur(client, message):
|
210 |
+
try:
|
211 |
+
userid = str(message.chat.id)
|
212 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
213 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
214 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
215 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "box_blur.jpg"
|
216 |
+
if not message.reply_to_message.empty:
|
217 |
+
msg = await message.reply_to_message.reply_text(
|
218 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
219 |
+
)
|
220 |
+
a = await client.download_media(
|
221 |
+
message=message.reply_to_message, file_name=download_location
|
222 |
+
)
|
223 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
224 |
+
im1 = Image.open(a)
|
225 |
+
im2 = im1.filter(ImageFilter.BoxBlur(0))
|
226 |
+
im2.save(edit_img_loc)
|
227 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
228 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
229 |
+
await msg.delete()
|
230 |
+
else:
|
231 |
+
await message.reply_text("Why did you delete that??")
|
232 |
+
try:
|
233 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
234 |
+
except Exception:
|
235 |
+
pass
|
236 |
+
except Exception as e:
|
237 |
+
print("box_blur-error - " + str(e))
|
238 |
+
if "USER_IS_BLOCKED" in str(e):
|
239 |
+
return
|
240 |
+
else:
|
241 |
+
try:
|
242 |
+
await message.reply_to_message.reply_text(
|
243 |
+
"Something went wrong!", quote=True
|
244 |
+
)
|
245 |
+
except Exception:
|
246 |
+
return
|
image/edit_2.py
ADDED
@@ -0,0 +1,398 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from PIL import Image, ImageEnhance, ImageDraw
|
2 |
+
from pyrogram.enums import ChatAction
|
3 |
+
import numpy as np
|
4 |
+
import os
|
5 |
+
import cv2
|
6 |
+
import shutil
|
7 |
+
|
8 |
+
|
9 |
+
async def circle_with_bg(client, message):
|
10 |
+
try:
|
11 |
+
userid = str(message.chat.id)
|
12 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
13 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
14 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
15 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "circle.png"
|
16 |
+
if not message.reply_to_message.empty:
|
17 |
+
msg = await message.reply_to_message.reply_text(
|
18 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
19 |
+
)
|
20 |
+
a = await client.download_media(
|
21 |
+
message=message.reply_to_message, file_name=download_location
|
22 |
+
)
|
23 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
24 |
+
img = Image.open(a).convert("RGB")
|
25 |
+
npImage = np.array(img)
|
26 |
+
h, w = img.size
|
27 |
+
alpha = Image.new("L", img.size, 0)
|
28 |
+
draw = ImageDraw.Draw(alpha)
|
29 |
+
draw.pieslice([0, 0, h, w], 0, 360, fill=255)
|
30 |
+
npAlpha = np.array(alpha)
|
31 |
+
npImage = np.dstack((npImage, npAlpha))
|
32 |
+
Image.fromarray(npImage).save(edit_img_loc)
|
33 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
34 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
35 |
+
await msg.delete()
|
36 |
+
else:
|
37 |
+
await message.reply_text("Why did you delete that??")
|
38 |
+
try:
|
39 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
40 |
+
except Exception:
|
41 |
+
pass
|
42 |
+
except Exception as e:
|
43 |
+
print("circle_with_bg-error - " + str(e))
|
44 |
+
if "USER_IS_BLOCKED" in str(e):
|
45 |
+
return
|
46 |
+
else:
|
47 |
+
try:
|
48 |
+
await message.reply_to_message.reply_text(
|
49 |
+
"Something went wrong!", quote=True
|
50 |
+
)
|
51 |
+
except Exception:
|
52 |
+
return
|
53 |
+
|
54 |
+
|
55 |
+
async def circle_without_bg(client, message):
|
56 |
+
try:
|
57 |
+
userid = str(message.chat.id)
|
58 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
59 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
60 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
61 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "circle.png"
|
62 |
+
if not message.reply_to_message.empty:
|
63 |
+
msg = await message.reply_to_message.reply_text(
|
64 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
65 |
+
)
|
66 |
+
a = await client.download_media(
|
67 |
+
message=message.reply_to_message, file_name=download_location
|
68 |
+
)
|
69 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
70 |
+
img = Image.open(a).convert("RGB")
|
71 |
+
npImage = np.array(img)
|
72 |
+
h, w = img.size
|
73 |
+
alpha = Image.new("L", img.size, 0)
|
74 |
+
draw = ImageDraw.Draw(alpha)
|
75 |
+
draw.pieslice([0, 0, h, w], 0, 360, fill=255)
|
76 |
+
npAlpha = np.array(alpha)
|
77 |
+
npImage = np.dstack((npImage, npAlpha))
|
78 |
+
Image.fromarray(npImage).save(edit_img_loc)
|
79 |
+
await message.reply_chat_action(ChatAction.UPLOAD_DOCUMENT)
|
80 |
+
await message.reply_to_message.reply_document(edit_img_loc, quote=True)
|
81 |
+
await msg.delete()
|
82 |
+
else:
|
83 |
+
await message.reply_text("Why did you delete that??")
|
84 |
+
try:
|
85 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
86 |
+
except Exception:
|
87 |
+
pass
|
88 |
+
except Exception as e:
|
89 |
+
print("circle_without_bg-error - " + str(e))
|
90 |
+
if "USER_IS_BLOCKED" in str(e):
|
91 |
+
return
|
92 |
+
else:
|
93 |
+
try:
|
94 |
+
await message.reply_to_message.reply_text(
|
95 |
+
"Something went wrong!", quote=True
|
96 |
+
)
|
97 |
+
except Exception:
|
98 |
+
return
|
99 |
+
|
100 |
+
|
101 |
+
async def sticker(client, message):
|
102 |
+
try:
|
103 |
+
userid = str(message.chat.id)
|
104 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
105 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
106 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
107 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "sticker.webp"
|
108 |
+
if not message.reply_to_message.empty:
|
109 |
+
msg = await message.reply_to_message.reply_text(
|
110 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
111 |
+
)
|
112 |
+
a = await client.download_media(
|
113 |
+
message=message.reply_to_message, file_name=download_location
|
114 |
+
)
|
115 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
116 |
+
os.rename(a, edit_img_loc)
|
117 |
+
await message.reply_to_message.reply_sticker(edit_img_loc, quote=True)
|
118 |
+
await msg.delete()
|
119 |
+
else:
|
120 |
+
await message.reply_text("Why did you delete that??")
|
121 |
+
try:
|
122 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
123 |
+
except Exception:
|
124 |
+
pass
|
125 |
+
except Exception as e:
|
126 |
+
print("sticker-error - " + str(e))
|
127 |
+
if "USER_IS_BLOCKED" in str(e):
|
128 |
+
return
|
129 |
+
else:
|
130 |
+
try:
|
131 |
+
await message.reply_to_message.reply_text(
|
132 |
+
"Something went wrong!", quote=True
|
133 |
+
)
|
134 |
+
except Exception:
|
135 |
+
return
|
136 |
+
|
137 |
+
|
138 |
+
def add_corners(im, rad):
|
139 |
+
circle = Image.new("L", (rad * 2, rad * 2), 0)
|
140 |
+
draw = ImageDraw.Draw(circle)
|
141 |
+
draw.ellipse((0, 0, rad * 2, rad * 2), fill=255)
|
142 |
+
alpha = Image.new("L", im.size, 255)
|
143 |
+
w, h = im.size
|
144 |
+
alpha.paste(circle.crop((0, 0, rad, rad)), (0, 0))
|
145 |
+
alpha.paste(circle.crop((0, rad, rad, rad * 2)), (0, h - rad))
|
146 |
+
alpha.paste(circle.crop((rad, 0, rad * 2, rad)), (w - rad, 0))
|
147 |
+
alpha.paste(circle.crop((rad, rad, rad * 2, rad * 2)), (w - rad, h - rad))
|
148 |
+
im.putalpha(alpha)
|
149 |
+
return im
|
150 |
+
|
151 |
+
|
152 |
+
async def edge_curved(client, message):
|
153 |
+
try:
|
154 |
+
userid = str(message.chat.id)
|
155 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
156 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
157 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
158 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "edge_curved.webp"
|
159 |
+
if not message.reply_to_message.empty:
|
160 |
+
msg = await message.reply_to_message.reply_text(
|
161 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
162 |
+
)
|
163 |
+
a = await client.download_media(
|
164 |
+
message=message.reply_to_message, file_name=download_location
|
165 |
+
)
|
166 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
167 |
+
im = Image.open(a)
|
168 |
+
im = add_corners(im, 100)
|
169 |
+
im.save(edit_img_loc)
|
170 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
171 |
+
await message.reply_to_message.reply_sticker(edit_img_loc, quote=True)
|
172 |
+
await msg.delete()
|
173 |
+
else:
|
174 |
+
await message.reply_text("Why did you delete that??")
|
175 |
+
try:
|
176 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
177 |
+
except Exception:
|
178 |
+
pass
|
179 |
+
except Exception as e:
|
180 |
+
print("edge_curved-error - " + str(e))
|
181 |
+
if "USER_IS_BLOCKED" in str(e):
|
182 |
+
return
|
183 |
+
else:
|
184 |
+
try:
|
185 |
+
await message.reply_to_message.reply_text(
|
186 |
+
"Something went wrong!", quote=True
|
187 |
+
)
|
188 |
+
except Exception:
|
189 |
+
return
|
190 |
+
|
191 |
+
|
192 |
+
async def contrast(client, message):
|
193 |
+
try:
|
194 |
+
userid = str(message.chat.id)
|
195 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
196 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
197 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
198 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "contrast.jpg"
|
199 |
+
if not message.reply_to_message.empty:
|
200 |
+
msg = await message.reply_to_message.reply_text(
|
201 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
202 |
+
)
|
203 |
+
a = await client.download_media(
|
204 |
+
message=message.reply_to_message, file_name=download_location
|
205 |
+
)
|
206 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
207 |
+
image = Image.open(a)
|
208 |
+
contrast = ImageEnhance.Contrast(image)
|
209 |
+
contrast.enhance(1.5).save(edit_img_loc)
|
210 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
211 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
212 |
+
await msg.delete()
|
213 |
+
else:
|
214 |
+
await message.reply_text("Why did you delete that??")
|
215 |
+
try:
|
216 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
217 |
+
except Exception:
|
218 |
+
pass
|
219 |
+
except Exception as e:
|
220 |
+
print("contrast-error - " + str(e))
|
221 |
+
if "USER_IS_BLOCKED" in str(e):
|
222 |
+
return
|
223 |
+
else:
|
224 |
+
try:
|
225 |
+
await message.reply_to_message.reply_text(
|
226 |
+
"Something went wrong!", quote=True
|
227 |
+
)
|
228 |
+
except Exception:
|
229 |
+
return
|
230 |
+
|
231 |
+
|
232 |
+
def sepia(img):
|
233 |
+
width, height = img.size
|
234 |
+
new_img = img.copy()
|
235 |
+
for x in range(width):
|
236 |
+
for y in range(height):
|
237 |
+
red, green, blue = img.getpixel((x, y))
|
238 |
+
new_val = 0.3 * red + 0.59 * green + 0.11 * blue
|
239 |
+
new_red = int(new_val * 2)
|
240 |
+
if new_red > 255:
|
241 |
+
new_red = 255
|
242 |
+
new_green = int(new_val * 1.5)
|
243 |
+
if new_green > 255:
|
244 |
+
new_green = 255
|
245 |
+
new_blue = int(new_val)
|
246 |
+
if new_blue > 255:
|
247 |
+
new_blue = 255
|
248 |
+
|
249 |
+
new_img.putpixel((x, y), (new_red, new_green, new_blue))
|
250 |
+
|
251 |
+
return new_img
|
252 |
+
|
253 |
+
|
254 |
+
async def sepia_mode(client, message):
|
255 |
+
try:
|
256 |
+
userid = str(message.chat.id)
|
257 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
258 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
259 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
260 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "sepia.jpg"
|
261 |
+
if not message.reply_to_message.empty:
|
262 |
+
msg = await message.reply_to_message.reply_text(
|
263 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
264 |
+
)
|
265 |
+
a = await client.download_media(
|
266 |
+
message=message.reply_to_message, file_name=download_location
|
267 |
+
)
|
268 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
269 |
+
image = Image.open(a)
|
270 |
+
new_img = sepia(image)
|
271 |
+
new_img.save(edit_img_loc)
|
272 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
273 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
274 |
+
await msg.delete()
|
275 |
+
else:
|
276 |
+
await message.reply_text("Why did you delete that??")
|
277 |
+
try:
|
278 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
279 |
+
except Exception:
|
280 |
+
pass
|
281 |
+
except Exception as e:
|
282 |
+
print("sepia_mode-error - " + str(e))
|
283 |
+
if "USER_IS_BLOCKED" in str(e):
|
284 |
+
return
|
285 |
+
else:
|
286 |
+
try:
|
287 |
+
await message.reply_to_message.reply_text(
|
288 |
+
"Something went wrong!", quote=True
|
289 |
+
)
|
290 |
+
except Exception:
|
291 |
+
return
|
292 |
+
|
293 |
+
|
294 |
+
def dodgeV2(x, y):
|
295 |
+
return cv2.divide(x, 255 - y, scale=256)
|
296 |
+
|
297 |
+
|
298 |
+
async def pencil(client, message):
|
299 |
+
try:
|
300 |
+
userid = str(message.chat.id)
|
301 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
302 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
303 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
304 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "pencil.jpg"
|
305 |
+
if not message.reply_to_message.empty:
|
306 |
+
msg = await message.reply_to_message.reply_text(
|
307 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
308 |
+
)
|
309 |
+
a = await client.download_media(
|
310 |
+
message=message.reply_to_message, file_name=download_location
|
311 |
+
)
|
312 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
313 |
+
img = cv2.imread(a)
|
314 |
+
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
315 |
+
img_invert = cv2.bitwise_not(img_gray)
|
316 |
+
img_smoothing = cv2.GaussianBlur(img_invert, (21, 21), sigmaX=0, sigmaY=0)
|
317 |
+
final_img = dodgeV2(img_gray, img_smoothing)
|
318 |
+
cv2.imwrite(edit_img_loc, final_img)
|
319 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
320 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
321 |
+
await msg.delete()
|
322 |
+
else:
|
323 |
+
await message.reply_text("Why did you delete that??")
|
324 |
+
try:
|
325 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
326 |
+
except Exception:
|
327 |
+
pass
|
328 |
+
except Exception as e:
|
329 |
+
print("pencil-error - " + str(e))
|
330 |
+
if "USER_IS_BLOCKED" in str(e):
|
331 |
+
return
|
332 |
+
else:
|
333 |
+
try:
|
334 |
+
await message.reply_to_message.reply_text(
|
335 |
+
"Something went wrong!", quote=True
|
336 |
+
)
|
337 |
+
except Exception:
|
338 |
+
return
|
339 |
+
|
340 |
+
|
341 |
+
def color_quantization(img, k):
|
342 |
+
data = np.float32(img).reshape((-1, 3))
|
343 |
+
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 20, 1.0)
|
344 |
+
_, label, center = cv2.kmeans(
|
345 |
+
data, k, None, criteria, 10, cv2.KMEANS_RANDOM_CENTERS
|
346 |
+
)
|
347 |
+
center = np.uint8(center)
|
348 |
+
result = center[label.flatten()]
|
349 |
+
result = result.reshape(img.shape)
|
350 |
+
return result
|
351 |
+
|
352 |
+
|
353 |
+
async def cartoon(client, message):
|
354 |
+
try:
|
355 |
+
userid = str(message.chat.id)
|
356 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
357 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
358 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
359 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "kang.jpg"
|
360 |
+
if not message.reply_to_message.empty:
|
361 |
+
msg = await message.reply_to_message.reply_text(
|
362 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
363 |
+
)
|
364 |
+
a = await client.download_media(
|
365 |
+
message=message.reply_to_message, file_name=download_location
|
366 |
+
)
|
367 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
368 |
+
img = cv2.imread(a)
|
369 |
+
edges = cv2.Canny(img, 100, 200)
|
370 |
+
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
371 |
+
edges = cv2.adaptiveThreshold(
|
372 |
+
gray, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY, 9, 5
|
373 |
+
)
|
374 |
+
color = cv2.bilateralFilter(img, d=9, sigmaColor=200, sigmaSpace=200)
|
375 |
+
|
376 |
+
cv2.bitwise_and(color, color, mask=edges)
|
377 |
+
img_1 = color_quantization(img, 7)
|
378 |
+
cv2.imwrite(edit_img_loc, img_1)
|
379 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
380 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
381 |
+
await msg.delete()
|
382 |
+
else:
|
383 |
+
await message.reply_text("Why did you delete that??")
|
384 |
+
try:
|
385 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
386 |
+
except Exception:
|
387 |
+
pass
|
388 |
+
except Exception as e:
|
389 |
+
print("cartoon-error - " + str(e))
|
390 |
+
if "USER_IS_BLOCKED" in str(e):
|
391 |
+
return
|
392 |
+
else:
|
393 |
+
try:
|
394 |
+
await message.reply_to_message.reply_text(
|
395 |
+
"Something went wrong!", quote=True
|
396 |
+
)
|
397 |
+
except Exception:
|
398 |
+
return
|
image/edit_3.py
ADDED
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram.enums import ChatAction
|
2 |
+
from PIL import Image, ImageOps
|
3 |
+
import shutil
|
4 |
+
import os
|
5 |
+
|
6 |
+
|
7 |
+
async def black_border(client, message):
|
8 |
+
try:
|
9 |
+
userid = str(message.chat.id)
|
10 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
11 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
12 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
13 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "imaged-black-border.png"
|
14 |
+
if not message.reply_to_message.empty:
|
15 |
+
msg = await message.reply_to_message.reply_text(
|
16 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
17 |
+
)
|
18 |
+
a = await client.download_media(
|
19 |
+
message=message.reply_to_message, file_name=download_location
|
20 |
+
)
|
21 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
22 |
+
img = Image.open(a)
|
23 |
+
img_with_border = ImageOps.expand(img, border=100, fill="black")
|
24 |
+
img_with_border.save(edit_img_loc)
|
25 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
26 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
27 |
+
await msg.delete()
|
28 |
+
else:
|
29 |
+
await message.reply_text("Why did you delete that??")
|
30 |
+
try:
|
31 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
32 |
+
except Exception:
|
33 |
+
pass
|
34 |
+
except Exception as e:
|
35 |
+
print("black_border-error - " + str(e))
|
36 |
+
if "USER_IS_BLOCKED" in str(e):
|
37 |
+
return
|
38 |
+
else:
|
39 |
+
try:
|
40 |
+
await message.reply_to_message.reply_text(
|
41 |
+
"Something went wrong!", quote=True
|
42 |
+
)
|
43 |
+
except Exception:
|
44 |
+
return
|
45 |
+
|
46 |
+
|
47 |
+
async def green_border(client, message):
|
48 |
+
try:
|
49 |
+
userid = str(message.chat.id)
|
50 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
51 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
52 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
53 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "imaged-green-border.png"
|
54 |
+
if not message.reply_to_message.empty:
|
55 |
+
msg = await message.reply_to_message.reply_text(
|
56 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
57 |
+
)
|
58 |
+
a = await client.download_media(
|
59 |
+
message=message.reply_to_message, file_name=download_location
|
60 |
+
)
|
61 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
62 |
+
img = Image.open(a)
|
63 |
+
img_with_border = ImageOps.expand(img, border=100, fill="green")
|
64 |
+
img_with_border.save(edit_img_loc)
|
65 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
66 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
67 |
+
await msg.delete()
|
68 |
+
else:
|
69 |
+
await message.reply_text("Why did you delete that??")
|
70 |
+
try:
|
71 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
72 |
+
except Exception:
|
73 |
+
pass
|
74 |
+
except Exception as e:
|
75 |
+
print("green_border-error - " + str(e))
|
76 |
+
if "USER_IS_BLOCKED" in str(e):
|
77 |
+
return
|
78 |
+
else:
|
79 |
+
try:
|
80 |
+
await message.reply_to_message.reply_text(
|
81 |
+
"Something went wrong!", quote=True
|
82 |
+
)
|
83 |
+
except Exception:
|
84 |
+
return
|
85 |
+
|
86 |
+
|
87 |
+
async def blue_border(client, message):
|
88 |
+
try:
|
89 |
+
userid = str(message.chat.id)
|
90 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
91 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
92 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
93 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "imaged-blue-border.png"
|
94 |
+
if not message.reply_to_message.empty:
|
95 |
+
msg = await message.reply_to_message.reply_text(
|
96 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
97 |
+
)
|
98 |
+
a = await client.download_media(
|
99 |
+
message=message.reply_to_message, file_name=download_location
|
100 |
+
)
|
101 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
102 |
+
img = Image.open(a)
|
103 |
+
img_with_border = ImageOps.expand(img, border=100, fill="blue")
|
104 |
+
img_with_border.save(edit_img_loc)
|
105 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
106 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
107 |
+
await msg.delete()
|
108 |
+
else:
|
109 |
+
await message.reply_text("Why did you delete that??")
|
110 |
+
try:
|
111 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
112 |
+
except Exception:
|
113 |
+
pass
|
114 |
+
except Exception as e:
|
115 |
+
print("blue_border-error - " + str(e))
|
116 |
+
if "USER_IS_BLOCKED" in str(e):
|
117 |
+
return
|
118 |
+
else:
|
119 |
+
try:
|
120 |
+
await message.reply_to_message.reply_text(
|
121 |
+
"Something went wrong!", quote=True
|
122 |
+
)
|
123 |
+
except Exception:
|
124 |
+
return
|
125 |
+
|
126 |
+
|
127 |
+
async def red_border(client, message):
|
128 |
+
try:
|
129 |
+
userid = str(message.chat.id)
|
130 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
131 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
132 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
133 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "imaged-red-border.png"
|
134 |
+
if not message.reply_to_message.empty:
|
135 |
+
msg = await message.reply_to_message.reply_text(
|
136 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
137 |
+
)
|
138 |
+
a = await client.download_media(
|
139 |
+
message=message.reply_to_message, file_name=download_location
|
140 |
+
)
|
141 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
142 |
+
img = Image.open(a)
|
143 |
+
img_with_border = ImageOps.expand(img, border=100, fill="red")
|
144 |
+
img_with_border.save(edit_img_loc)
|
145 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
146 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
147 |
+
await msg.delete()
|
148 |
+
else:
|
149 |
+
await message.reply_text("Why did you delete that??")
|
150 |
+
try:
|
151 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
152 |
+
except Exception:
|
153 |
+
pass
|
154 |
+
except Exception as e:
|
155 |
+
print("red_border-error - " + str(e))
|
156 |
+
if "USER_IS_BLOCKED" in str(e):
|
157 |
+
return
|
158 |
+
else:
|
159 |
+
try:
|
160 |
+
await message.reply_to_message.reply_text(
|
161 |
+
"Something went wrong!", quote=True
|
162 |
+
)
|
163 |
+
except Exception:
|
164 |
+
return
|
image/edit_4.py
ADDED
@@ -0,0 +1,408 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from PIL import Image, ImageOps, ImageDraw
|
2 |
+
from pyrogram.enums import ChatAction
|
3 |
+
import numpy as np
|
4 |
+
import requests
|
5 |
+
import shutil
|
6 |
+
import cv2
|
7 |
+
import io
|
8 |
+
import os
|
9 |
+
from info import RemoveBG_API
|
10 |
+
|
11 |
+
|
12 |
+
async def rotate_90(client, message):
|
13 |
+
try:
|
14 |
+
userid = str(message.chat.id)
|
15 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
16 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
17 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
18 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "rotate_90.jpg"
|
19 |
+
if not message.reply_to_message.empty:
|
20 |
+
msg = await message.reply_to_message.reply_text(
|
21 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
22 |
+
)
|
23 |
+
a = await client.download_media(
|
24 |
+
message=message.reply_to_message, file_name=download_location
|
25 |
+
)
|
26 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
27 |
+
src = cv2.imread(a)
|
28 |
+
image = cv2.rotate(src, cv2.cv2.ROTATE_90_CLOCKWISE)
|
29 |
+
cv2.imwrite(edit_img_loc, image)
|
30 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
31 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
32 |
+
await msg.delete()
|
33 |
+
else:
|
34 |
+
await message.reply_text("Why did you delete that??")
|
35 |
+
try:
|
36 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
37 |
+
except Exception:
|
38 |
+
pass
|
39 |
+
except Exception as e:
|
40 |
+
print("rotate_90-error - " + str(e))
|
41 |
+
if "USER_IS_BLOCKED" in str(e):
|
42 |
+
return
|
43 |
+
else:
|
44 |
+
try:
|
45 |
+
await message.reply_to_message.reply_text(
|
46 |
+
"Something went wrong!", quote=True
|
47 |
+
)
|
48 |
+
except Exception:
|
49 |
+
return
|
50 |
+
|
51 |
+
|
52 |
+
async def rotate_180(client, message):
|
53 |
+
try:
|
54 |
+
userid = str(message.chat.id)
|
55 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
56 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
57 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
58 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "rotate_180.jpg"
|
59 |
+
if not message.reply_to_message.empty:
|
60 |
+
msg = await message.reply_to_message.reply_text(
|
61 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
62 |
+
)
|
63 |
+
a = await client.download_media(
|
64 |
+
message=message.reply_to_message, file_name=download_location
|
65 |
+
)
|
66 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
67 |
+
src = cv2.imread(a)
|
68 |
+
image = cv2.rotate(src, cv2.ROTATE_180)
|
69 |
+
cv2.imwrite(edit_img_loc, image)
|
70 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
71 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
72 |
+
await msg.delete()
|
73 |
+
else:
|
74 |
+
await message.reply_text("Why did you delete that??")
|
75 |
+
try:
|
76 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
77 |
+
except Exception:
|
78 |
+
pass
|
79 |
+
except Exception as e:
|
80 |
+
print("rotate_180-error - " + str(e))
|
81 |
+
if "USER_IS_BLOCKED" in str(e):
|
82 |
+
return
|
83 |
+
else:
|
84 |
+
try:
|
85 |
+
await message.reply_to_message.reply_text(
|
86 |
+
"Something went wrong!", quote=True
|
87 |
+
)
|
88 |
+
except Exception:
|
89 |
+
return
|
90 |
+
|
91 |
+
|
92 |
+
async def rotate_270(client, message):
|
93 |
+
try:
|
94 |
+
userid = str(message.chat.id)
|
95 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
96 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
97 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
98 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "rotate_270.jpg"
|
99 |
+
if not message.reply_to_message.empty:
|
100 |
+
msg = await message.reply_to_message.reply_text(
|
101 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
102 |
+
)
|
103 |
+
a = await client.download_media(
|
104 |
+
message=message.reply_to_message, file_name=download_location
|
105 |
+
)
|
106 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
107 |
+
src = cv2.imread(a)
|
108 |
+
image = cv2.rotate(src, cv2.ROTATE_90_COUNTERCLOCKWISE)
|
109 |
+
cv2.imwrite(edit_img_loc, image)
|
110 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
111 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
112 |
+
await msg.delete()
|
113 |
+
else:
|
114 |
+
await message.reply_text("Why did you delete that??")
|
115 |
+
try:
|
116 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
117 |
+
except Exception:
|
118 |
+
pass
|
119 |
+
except Exception as e:
|
120 |
+
print("rotate_270-error - " + str(e))
|
121 |
+
if "USER_IS_BLOCKED" in str(e):
|
122 |
+
return
|
123 |
+
else:
|
124 |
+
try:
|
125 |
+
await message.reply_to_message.reply_text(
|
126 |
+
"Something went wrong!", quote=True
|
127 |
+
)
|
128 |
+
except Exception:
|
129 |
+
return
|
130 |
+
|
131 |
+
|
132 |
+
def resize_photo(photo: str, userid: str) -> io.BytesIO:
|
133 |
+
image = Image.open(photo)
|
134 |
+
maxsize = 512
|
135 |
+
scale = maxsize / max(image.width, image.height)
|
136 |
+
new_size = (int(image.width * scale), int(image.height * scale))
|
137 |
+
image = image.resize(new_size, Image.LANCZOS)
|
138 |
+
resized_photo = io.BytesIO()
|
139 |
+
resized_photo.name = "./DOWNLOADS" + "/" + userid + "resized.png"
|
140 |
+
image.save(resized_photo, "PNG")
|
141 |
+
return resized_photo
|
142 |
+
|
143 |
+
|
144 |
+
async def round_sticker(client, message):
|
145 |
+
try:
|
146 |
+
userid = str(message.chat.id)
|
147 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
148 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
149 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
150 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "rounded.webp"
|
151 |
+
if not message.reply_to_message.empty:
|
152 |
+
msg = await message.reply_to_message.reply_text(
|
153 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
154 |
+
)
|
155 |
+
a = await client.download_media(
|
156 |
+
message=message.reply_to_message, file_name=download_location
|
157 |
+
)
|
158 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
159 |
+
resized = resize_photo(a, userid)
|
160 |
+
img = Image.open(resized).convert("RGB")
|
161 |
+
npImage = np.array(img)
|
162 |
+
h, w = img.size
|
163 |
+
alpha = Image.new("L", img.size, 0)
|
164 |
+
draw = ImageDraw.Draw(alpha)
|
165 |
+
draw.pieslice([0, 0, h, w], 0, 360, fill=255)
|
166 |
+
npAlpha = np.array(alpha)
|
167 |
+
npImage = np.dstack((npImage, npAlpha))
|
168 |
+
Image.fromarray(npImage).save(edit_img_loc)
|
169 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
170 |
+
await message.reply_to_message.reply_sticker(edit_img_loc, quote=True)
|
171 |
+
await msg.delete()
|
172 |
+
else:
|
173 |
+
await message.reply_text("Why did you delete that??")
|
174 |
+
try:
|
175 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
176 |
+
except Exception:
|
177 |
+
pass
|
178 |
+
except Exception as e:
|
179 |
+
print("round_sticker-error - " + str(e))
|
180 |
+
if "USER_IS_BLOCKED" in str(e):
|
181 |
+
return
|
182 |
+
else:
|
183 |
+
try:
|
184 |
+
await message.reply_to_message.reply_text(
|
185 |
+
"Something went wrong!", quote=True
|
186 |
+
)
|
187 |
+
except Exception:
|
188 |
+
return
|
189 |
+
|
190 |
+
|
191 |
+
async def inverted(client, message):
|
192 |
+
try:
|
193 |
+
userid = str(message.chat.id)
|
194 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
195 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
196 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
197 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "inverted.png"
|
198 |
+
if not message.reply_to_message.empty:
|
199 |
+
msg = await message.reply_to_message.reply_text(
|
200 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
201 |
+
)
|
202 |
+
a = await client.download_media(
|
203 |
+
message=message.reply_to_message, file_name=download_location
|
204 |
+
)
|
205 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
206 |
+
image = Image.open(a)
|
207 |
+
inverted_image = ImageOps.invert(image)
|
208 |
+
inverted_image.save(edit_img_loc)
|
209 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
210 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
211 |
+
await msg.delete()
|
212 |
+
else:
|
213 |
+
await message.reply_text("Why did you delete that??")
|
214 |
+
try:
|
215 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
216 |
+
except Exception:
|
217 |
+
pass
|
218 |
+
except Exception as e:
|
219 |
+
print("inverted-error - " + str(e))
|
220 |
+
if "USER_IS_BLOCKED" in str(e):
|
221 |
+
return
|
222 |
+
else:
|
223 |
+
try:
|
224 |
+
await message.reply_to_message.reply_text(
|
225 |
+
"Something went wrong!", quote=True
|
226 |
+
)
|
227 |
+
except Exception:
|
228 |
+
return
|
229 |
+
|
230 |
+
|
231 |
+
async def removebg_plain(client, message):
|
232 |
+
try:
|
233 |
+
if not (RemoveBG_API == ""):
|
234 |
+
userid = str(message.chat.id)
|
235 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
236 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
237 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
238 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "nobgplain.png"
|
239 |
+
if not message.reply_to_message.empty:
|
240 |
+
msg = await message.reply_to_message.reply_text(
|
241 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
242 |
+
)
|
243 |
+
await client.download_media(
|
244 |
+
message=message.reply_to_message, file_name=download_location
|
245 |
+
)
|
246 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
247 |
+
|
248 |
+
response = requests.post(
|
249 |
+
"https://api.remove.bg/v1.0/removebg",
|
250 |
+
files={"image_file": open(download_location, "rb")},
|
251 |
+
data={"size": "auto"},
|
252 |
+
headers={"X-Api-Key": RemoveBG_API},
|
253 |
+
)
|
254 |
+
if response.status_code == 200:
|
255 |
+
with open(f"{edit_img_loc}", "wb") as out:
|
256 |
+
out.write(response.content)
|
257 |
+
else:
|
258 |
+
await message.reply_to_message.reply_text(
|
259 |
+
"Check if your api is correct", quote=True
|
260 |
+
)
|
261 |
+
return
|
262 |
+
|
263 |
+
await message.reply_chat_action(ChatAction.UPLOAD_DOCUMENT)
|
264 |
+
await message.reply_to_message.reply_document(edit_img_loc, quote=True)
|
265 |
+
await msg.delete()
|
266 |
+
else:
|
267 |
+
await message.reply_text("Why did you delete that??")
|
268 |
+
try:
|
269 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
270 |
+
except Exception:
|
271 |
+
pass
|
272 |
+
else:
|
273 |
+
await message.reply_to_message.reply_text(
|
274 |
+
"Get the api from https://www.remove.bg/b/background-removal-api and add in Config Var",
|
275 |
+
quote=True,
|
276 |
+
disable_web_page_preview=True,
|
277 |
+
)
|
278 |
+
except Exception as e:
|
279 |
+
print("removebg_plain-error - " + str(e))
|
280 |
+
if "USER_IS_BLOCKED" in str(e):
|
281 |
+
return
|
282 |
+
else:
|
283 |
+
try:
|
284 |
+
await message.reply_to_message.reply_text(
|
285 |
+
"Something went wrong!", quote=True
|
286 |
+
)
|
287 |
+
except Exception:
|
288 |
+
return
|
289 |
+
|
290 |
+
|
291 |
+
async def removebg_white(client, message):
|
292 |
+
try:
|
293 |
+
if not (RemoveBG_API == ""):
|
294 |
+
userid = str(message.chat.id)
|
295 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
296 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
297 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
298 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "nobgwhite.png"
|
299 |
+
if not message.reply_to_message.empty:
|
300 |
+
msg = await message.reply_to_message.reply_text(
|
301 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
302 |
+
)
|
303 |
+
await client.download_media(
|
304 |
+
message=message.reply_to_message, file_name=download_location
|
305 |
+
)
|
306 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
307 |
+
|
308 |
+
response = requests.post(
|
309 |
+
"https://api.remove.bg/v1.0/removebg",
|
310 |
+
files={"image_file": open(download_location, "rb")},
|
311 |
+
data={"size": "auto"},
|
312 |
+
headers={"X-Api-Key": RemoveBG_API},
|
313 |
+
)
|
314 |
+
if response.status_code == 200:
|
315 |
+
with open(f"{edit_img_loc}", "wb") as out:
|
316 |
+
out.write(response.content)
|
317 |
+
else:
|
318 |
+
await message.reply_to_message.reply_text(
|
319 |
+
"Check if your api is correct", quote=True
|
320 |
+
)
|
321 |
+
return
|
322 |
+
|
323 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
324 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
325 |
+
await msg.delete()
|
326 |
+
else:
|
327 |
+
await message.reply_text("Why did you delete that??")
|
328 |
+
try:
|
329 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
330 |
+
except Exception:
|
331 |
+
pass
|
332 |
+
else:
|
333 |
+
await message.reply_to_message.reply_text(
|
334 |
+
"Get the api from https://www.remove.bg/b/background-removal-api and add in Config Var",
|
335 |
+
quote=True,
|
336 |
+
disable_web_page_preview=True,
|
337 |
+
)
|
338 |
+
except Exception as e:
|
339 |
+
print("removebg_white-error - " + str(e))
|
340 |
+
if "USER_IS_BLOCKED" in str(e):
|
341 |
+
return
|
342 |
+
else:
|
343 |
+
try:
|
344 |
+
await message.reply_to_message.reply_text(
|
345 |
+
"Something went wrong!", quote=True
|
346 |
+
)
|
347 |
+
except Exception:
|
348 |
+
return
|
349 |
+
|
350 |
+
|
351 |
+
async def removebg_sticker(client, message):
|
352 |
+
try:
|
353 |
+
if not (RemoveBG_API == ""):
|
354 |
+
userid = str(message.chat.id)
|
355 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
356 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
357 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
358 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "nobgsticker.webp"
|
359 |
+
if not message.reply_to_message.empty:
|
360 |
+
msg = await message.reply_to_message.reply_text(
|
361 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
362 |
+
)
|
363 |
+
await client.download_media(
|
364 |
+
message=message.reply_to_message, file_name=download_location
|
365 |
+
)
|
366 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
367 |
+
|
368 |
+
response = requests.post(
|
369 |
+
"https://api.remove.bg/v1.0/removebg",
|
370 |
+
files={"image_file": open(download_location, "rb")},
|
371 |
+
data={"size": "auto"},
|
372 |
+
headers={"X-Api-Key": RemoveBG_API},
|
373 |
+
)
|
374 |
+
if response.status_code == 200:
|
375 |
+
with open(f"{edit_img_loc}", "wb") as out:
|
376 |
+
out.write(response.content)
|
377 |
+
else:
|
378 |
+
await message.reply_to_message.reply_text(
|
379 |
+
"Check if your api is correct", quote=True
|
380 |
+
)
|
381 |
+
return
|
382 |
+
|
383 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
384 |
+
await message.reply_to_message.reply_sticker(edit_img_loc, quote=True)
|
385 |
+
await msg.delete()
|
386 |
+
else:
|
387 |
+
await message.reply_text("Why did you delete that??")
|
388 |
+
try:
|
389 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
390 |
+
except Exception:
|
391 |
+
pass
|
392 |
+
else:
|
393 |
+
await message.reply_to_message.reply_text(
|
394 |
+
"Get the api from https://www.remove.bg/b/background-removal-api and add in Config Var",
|
395 |
+
quote=True,
|
396 |
+
disable_web_page_preview=True,
|
397 |
+
)
|
398 |
+
except Exception as e:
|
399 |
+
print("removebg_sticker-error - " + str(e))
|
400 |
+
if "USER_IS_BLOCKED" in str(e):
|
401 |
+
return
|
402 |
+
else:
|
403 |
+
try:
|
404 |
+
await message.reply_to_message.reply_text(
|
405 |
+
"Something went wrong!", quote=True
|
406 |
+
)
|
407 |
+
except Exception:
|
408 |
+
return
|
image/edit_5.py
ADDED
@@ -0,0 +1,424 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram.enums import ChatAction
|
2 |
+
import asyncio
|
3 |
+
import shutil
|
4 |
+
import os
|
5 |
+
|
6 |
+
|
7 |
+
async def normalglitch_1(client, message):
|
8 |
+
try:
|
9 |
+
userid = str(message.chat.id)
|
10 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
11 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
12 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
13 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "normalglitch_1.jpg"
|
14 |
+
if not message.reply_to_message.empty:
|
15 |
+
msg = await message.reply_to_message.reply_text(
|
16 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
17 |
+
)
|
18 |
+
await client.download_media(
|
19 |
+
message=message.reply_to_message, file_name=download_location
|
20 |
+
)
|
21 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
22 |
+
cd = ["glitch_this", "-c", "-o", edit_img_loc, download_location, "1"]
|
23 |
+
process = await asyncio.create_subprocess_exec(
|
24 |
+
*cd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
25 |
+
)
|
26 |
+
await process.communicate()
|
27 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
28 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
29 |
+
await msg.delete()
|
30 |
+
else:
|
31 |
+
await message.reply_text("Why did you delete that??")
|
32 |
+
try:
|
33 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
34 |
+
except Exception:
|
35 |
+
pass
|
36 |
+
except Exception as e:
|
37 |
+
print("normalglitch_1-error - " + str(e))
|
38 |
+
if "USER_IS_BLOCKED" in str(e):
|
39 |
+
return
|
40 |
+
else:
|
41 |
+
try:
|
42 |
+
await message.reply_to_message.reply_text(
|
43 |
+
"Something went wrong!", quote=True
|
44 |
+
)
|
45 |
+
except Exception:
|
46 |
+
return
|
47 |
+
|
48 |
+
|
49 |
+
async def normalglitch_2(client, message):
|
50 |
+
try:
|
51 |
+
userid = str(message.chat.id)
|
52 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
53 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
54 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
55 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "normalglitch_2.jpg"
|
56 |
+
if not message.reply_to_message.empty:
|
57 |
+
msg = await message.reply_to_message.reply_text(
|
58 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
59 |
+
)
|
60 |
+
await client.download_media(
|
61 |
+
message=message.reply_to_message, file_name=download_location
|
62 |
+
)
|
63 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
64 |
+
cd = ["glitch_this", "-c", "-o", edit_img_loc, download_location, "2"]
|
65 |
+
process = await asyncio.create_subprocess_exec(
|
66 |
+
*cd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
67 |
+
)
|
68 |
+
await process.communicate()
|
69 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
70 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
71 |
+
await msg.delete()
|
72 |
+
else:
|
73 |
+
await message.reply_text("Why did you delete that??")
|
74 |
+
try:
|
75 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
76 |
+
except Exception:
|
77 |
+
pass
|
78 |
+
except Exception as e:
|
79 |
+
print("normalglitch_2-error - " + str(e))
|
80 |
+
if "USER_IS_BLOCKED" in str(e):
|
81 |
+
return
|
82 |
+
else:
|
83 |
+
try:
|
84 |
+
await message.reply_to_message.reply_text(
|
85 |
+
"Something went wrong!", quote=True
|
86 |
+
)
|
87 |
+
except Exception:
|
88 |
+
return
|
89 |
+
|
90 |
+
|
91 |
+
async def normalglitch_3(client, message):
|
92 |
+
try:
|
93 |
+
userid = str(message.chat.id)
|
94 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
95 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
96 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
97 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "normalglitch_3.jpg"
|
98 |
+
if not message.reply_to_message.empty:
|
99 |
+
msg = await message.reply_to_message.reply_text(
|
100 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
101 |
+
)
|
102 |
+
await client.download_media(
|
103 |
+
message=message.reply_to_message, file_name=download_location
|
104 |
+
)
|
105 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
106 |
+
cd = ["glitch_this", "-c", "-o", edit_img_loc, download_location, "3"]
|
107 |
+
process = await asyncio.create_subprocess_exec(
|
108 |
+
*cd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
109 |
+
)
|
110 |
+
await process.communicate()
|
111 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
112 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
113 |
+
await msg.delete()
|
114 |
+
else:
|
115 |
+
await message.reply_text("Why did you delete that??")
|
116 |
+
try:
|
117 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
118 |
+
except Exception:
|
119 |
+
pass
|
120 |
+
except Exception as e:
|
121 |
+
print("normalglitch_3-error - " + str(e))
|
122 |
+
if "USER_IS_BLOCKED" in str(e):
|
123 |
+
return
|
124 |
+
else:
|
125 |
+
try:
|
126 |
+
await message.reply_to_message.reply_text(
|
127 |
+
"Something went wrong!", quote=True
|
128 |
+
)
|
129 |
+
except Exception:
|
130 |
+
return
|
131 |
+
|
132 |
+
|
133 |
+
async def normalglitch_4(client, message):
|
134 |
+
try:
|
135 |
+
userid = str(message.chat.id)
|
136 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
137 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
138 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
139 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "normalglitch_4.jpg"
|
140 |
+
if not message.reply_to_message.empty:
|
141 |
+
msg = await message.reply_to_message.reply_text(
|
142 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
143 |
+
)
|
144 |
+
await client.download_media(
|
145 |
+
message=message.reply_to_message, file_name=download_location
|
146 |
+
)
|
147 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
148 |
+
cd = ["glitch_this", "-c", "-o", edit_img_loc, download_location, "4"]
|
149 |
+
process = await asyncio.create_subprocess_exec(
|
150 |
+
*cd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
151 |
+
)
|
152 |
+
await process.communicate()
|
153 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
154 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
155 |
+
await msg.delete()
|
156 |
+
else:
|
157 |
+
await message.reply_text("Why did you delete that??")
|
158 |
+
try:
|
159 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
160 |
+
except Exception:
|
161 |
+
pass
|
162 |
+
except Exception as e:
|
163 |
+
print("normalglitch_4-error - " + str(e))
|
164 |
+
if "USER_IS_BLOCKED" in str(e):
|
165 |
+
return
|
166 |
+
else:
|
167 |
+
try:
|
168 |
+
await message.reply_to_message.reply_text(
|
169 |
+
"Something went wrong!", quote=True
|
170 |
+
)
|
171 |
+
except Exception:
|
172 |
+
return
|
173 |
+
|
174 |
+
|
175 |
+
async def normalglitch_5(client, message):
|
176 |
+
try:
|
177 |
+
userid = str(message.chat.id)
|
178 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
179 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
180 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
181 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "normalglitch_5.jpg"
|
182 |
+
if not message.reply_to_message.empty:
|
183 |
+
msg = await message.reply_to_message.reply_text(
|
184 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
185 |
+
)
|
186 |
+
await client.download_media(
|
187 |
+
message=message.reply_to_message, file_name=download_location
|
188 |
+
)
|
189 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
190 |
+
cd = ["glitch_this", "-c", "-o", edit_img_loc, download_location, "5"]
|
191 |
+
process = await asyncio.create_subprocess_exec(
|
192 |
+
*cd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
193 |
+
)
|
194 |
+
await process.communicate()
|
195 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
196 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
197 |
+
await msg.delete()
|
198 |
+
else:
|
199 |
+
await message.reply_text("Why did you delete that??")
|
200 |
+
try:
|
201 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
202 |
+
except Exception:
|
203 |
+
pass
|
204 |
+
except Exception as e:
|
205 |
+
print("normalglitch_5-error - " + str(e))
|
206 |
+
if "USER_IS_BLOCKED" in str(e):
|
207 |
+
return
|
208 |
+
else:
|
209 |
+
try:
|
210 |
+
await message.reply_to_message.reply_text(
|
211 |
+
"Something went wrong!", quote=True
|
212 |
+
)
|
213 |
+
except Exception:
|
214 |
+
return
|
215 |
+
|
216 |
+
|
217 |
+
async def scanlineglitch_1(client, message):
|
218 |
+
try:
|
219 |
+
userid = str(message.chat.id)
|
220 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
221 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
222 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
223 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "scanlineglitch_1.jpg"
|
224 |
+
if not message.reply_to_message.empty:
|
225 |
+
msg = await message.reply_to_message.reply_text(
|
226 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
227 |
+
)
|
228 |
+
await client.download_media(
|
229 |
+
message=message.reply_to_message, file_name=download_location
|
230 |
+
)
|
231 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶����....</b>")
|
232 |
+
cd = ["glitch_this", "-c", "-s", "-o", edit_img_loc, download_location, "1"]
|
233 |
+
process = await asyncio.create_subprocess_exec(
|
234 |
+
*cd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
235 |
+
)
|
236 |
+
await process.communicate()
|
237 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
238 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
239 |
+
await msg.delete()
|
240 |
+
else:
|
241 |
+
await message.reply_text("Why did you delete that??")
|
242 |
+
try:
|
243 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
244 |
+
except Exception:
|
245 |
+
pass
|
246 |
+
except Exception as e:
|
247 |
+
print("scanlineglitch_1-error - " + str(e))
|
248 |
+
if "USER_IS_BLOCKED" in str(e):
|
249 |
+
return
|
250 |
+
else:
|
251 |
+
try:
|
252 |
+
await message.reply_to_message.reply_text(
|
253 |
+
"Something went wrong!", quote=True
|
254 |
+
)
|
255 |
+
except Exception:
|
256 |
+
return
|
257 |
+
|
258 |
+
|
259 |
+
async def scanlineglitch_2(client, message):
|
260 |
+
try:
|
261 |
+
userid = str(message.chat.id)
|
262 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
263 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
264 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
265 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "scanlineglitch_2.jpg"
|
266 |
+
if not message.reply_to_message.empty:
|
267 |
+
msg = await message.reply_to_message.reply_text(
|
268 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
269 |
+
)
|
270 |
+
await client.download_media(
|
271 |
+
message=message.reply_to_message, file_name=download_location
|
272 |
+
)
|
273 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
274 |
+
cd = ["glitch_this", "-c", "-s", "-o", edit_img_loc, download_location, "2"]
|
275 |
+
process = await asyncio.create_subprocess_exec(
|
276 |
+
*cd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
277 |
+
)
|
278 |
+
await process.communicate()
|
279 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
280 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
281 |
+
await msg.delete()
|
282 |
+
else:
|
283 |
+
await message.reply_text("Why did you delete that??")
|
284 |
+
try:
|
285 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
286 |
+
except Exception:
|
287 |
+
pass
|
288 |
+
except Exception as e:
|
289 |
+
print("scanlineglitch_2-error - " + str(e))
|
290 |
+
if "USER_IS_BLOCKED" in str(e):
|
291 |
+
return
|
292 |
+
else:
|
293 |
+
try:
|
294 |
+
await message.reply_to_message.reply_text(
|
295 |
+
"Something went wrong!", quote=True
|
296 |
+
)
|
297 |
+
except Exception:
|
298 |
+
return
|
299 |
+
|
300 |
+
|
301 |
+
async def scanlineglitch_3(client, message):
|
302 |
+
try:
|
303 |
+
userid = str(message.chat.id)
|
304 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
305 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
306 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
307 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "scanlineglitch_3.jpg"
|
308 |
+
if not message.reply_to_message.empty:
|
309 |
+
msg = await message.reply_to_message.reply_text(
|
310 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
311 |
+
)
|
312 |
+
await client.download_media(
|
313 |
+
message=message.reply_to_message, file_name=download_location
|
314 |
+
)
|
315 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
316 |
+
cd = ["glitch_this", "-c", "-s", "-o", edit_img_loc, download_location, "3"]
|
317 |
+
process = await asyncio.create_subprocess_exec(
|
318 |
+
*cd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
319 |
+
)
|
320 |
+
await process.communicate()
|
321 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
322 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
323 |
+
await msg.delete()
|
324 |
+
else:
|
325 |
+
await message.reply_text("Why did you delete that??")
|
326 |
+
try:
|
327 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
328 |
+
except Exception:
|
329 |
+
pass
|
330 |
+
except Exception as e:
|
331 |
+
print("scanlineglitch_3-error - " + str(e))
|
332 |
+
if "USER_IS_BLOCKED" in str(e):
|
333 |
+
return
|
334 |
+
else:
|
335 |
+
try:
|
336 |
+
await message.reply_to_message.reply_text(
|
337 |
+
"Something went wrong!", quote=True
|
338 |
+
)
|
339 |
+
except Exception:
|
340 |
+
return
|
341 |
+
|
342 |
+
|
343 |
+
async def scanlineglitch_4(client, message):
|
344 |
+
try:
|
345 |
+
userid = str(message.chat.id)
|
346 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
347 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
348 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
349 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "scanlineglitch_4.jpg"
|
350 |
+
if not message.reply_to_message.empty:
|
351 |
+
msg = await message.reply_to_message.reply_text(
|
352 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
353 |
+
)
|
354 |
+
await client.download_media(
|
355 |
+
message=message.reply_to_message, file_name=download_location
|
356 |
+
)
|
357 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
358 |
+
cd = ["glitch_this", "-c", "-s", "-o", edit_img_loc, download_location, "4"]
|
359 |
+
process = await asyncio.create_subprocess_exec(
|
360 |
+
*cd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
361 |
+
)
|
362 |
+
await process.communicate()
|
363 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
364 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
365 |
+
await msg.delete()
|
366 |
+
else:
|
367 |
+
await message.reply_text("Why did you delete that??")
|
368 |
+
try:
|
369 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
370 |
+
except Exception:
|
371 |
+
pass
|
372 |
+
except Exception as e:
|
373 |
+
print("scanlineglitch_4-error - " + str(e))
|
374 |
+
if "USER_IS_BLOCKED" in str(e):
|
375 |
+
return
|
376 |
+
else:
|
377 |
+
try:
|
378 |
+
await message.reply_to_message.reply_text(
|
379 |
+
"Something went wrong!", quote=True
|
380 |
+
)
|
381 |
+
except Exception:
|
382 |
+
return
|
383 |
+
|
384 |
+
|
385 |
+
async def scanlineglitch_5(client, message):
|
386 |
+
try:
|
387 |
+
userid = str(message.chat.id)
|
388 |
+
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
|
389 |
+
os.makedirs(f"./DOWNLOADS/{userid}")
|
390 |
+
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
|
391 |
+
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "scanlineglitch_5.jpg"
|
392 |
+
if not message.reply_to_message.empty:
|
393 |
+
msg = await message.reply_to_message.reply_text(
|
394 |
+
"<b>𝙳𝙾𝚆𝙽𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>", quote=True
|
395 |
+
)
|
396 |
+
await client.download_media(
|
397 |
+
message=message.reply_to_message, file_name=download_location
|
398 |
+
)
|
399 |
+
await msg.edit("<b>𝚄𝙿𝙻𝙾𝙰𝙳𝙸𝙽𝙶 𝙸𝙼𝙰𝙶𝙴....</b>")
|
400 |
+
cd = ["glitch_this", "-c", "-s", "-o", edit_img_loc, download_location, "5"]
|
401 |
+
process = await asyncio.create_subprocess_exec(
|
402 |
+
*cd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
403 |
+
)
|
404 |
+
await process.communicate()
|
405 |
+
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
|
406 |
+
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
|
407 |
+
await msg.delete()
|
408 |
+
else:
|
409 |
+
await message.reply_text("Why did you delete that??")
|
410 |
+
try:
|
411 |
+
shutil.rmtree(f"./DOWNLOADS/{userid}")
|
412 |
+
except Exception:
|
413 |
+
pass
|
414 |
+
except Exception as e:
|
415 |
+
print("scanlineglitch_5-error - " + str(e))
|
416 |
+
if "USER_IS_BLOCKED" in str(e):
|
417 |
+
return
|
418 |
+
else:
|
419 |
+
try:
|
420 |
+
await message.reply_to_message.reply_text(
|
421 |
+
"Something went wrong!", quote=True
|
422 |
+
)
|
423 |
+
except Exception:
|
424 |
+
return
|
image/font_string.py
ADDED
@@ -0,0 +1,2365 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
|
4 |
+
class Fonts:
|
5 |
+
def typewriter(text):
|
6 |
+
style = {
|
7 |
+
'a': '𝚊',
|
8 |
+
'b': '𝚋',
|
9 |
+
'c': '𝚌',
|
10 |
+
'd': '𝚍',
|
11 |
+
'e': '𝚎',
|
12 |
+
'f': '𝚏',
|
13 |
+
'g': '𝚐',
|
14 |
+
'h': '𝚑',
|
15 |
+
'i': '𝚒',
|
16 |
+
'j': '𝚓',
|
17 |
+
'k': '𝚔',
|
18 |
+
'l': '𝚕',
|
19 |
+
'm': '𝚖',
|
20 |
+
'n': '𝚗',
|
21 |
+
'o': '𝚘',
|
22 |
+
'p': '𝚙',
|
23 |
+
'q': '𝚚',
|
24 |
+
'r': '𝚛',
|
25 |
+
's': '𝚜',
|
26 |
+
't': '𝚝',
|
27 |
+
'u': '𝚞',
|
28 |
+
'v': '𝚟',
|
29 |
+
'w': '𝚠',
|
30 |
+
'x': '𝚡',
|
31 |
+
'y': '𝚢',
|
32 |
+
'z': '𝚣',
|
33 |
+
'A': '𝙰',
|
34 |
+
'B': '𝙱',
|
35 |
+
'C': '𝙲',
|
36 |
+
'D': '𝙳',
|
37 |
+
'E': '𝙴',
|
38 |
+
'F': '𝙵',
|
39 |
+
'G': '𝙶',
|
40 |
+
'H': '𝙷',
|
41 |
+
'I': '𝙸',
|
42 |
+
'J': '𝙹',
|
43 |
+
'K': '𝙺',
|
44 |
+
'L': '𝙻',
|
45 |
+
'M': '𝙼',
|
46 |
+
'N': '𝙽',
|
47 |
+
'O': '𝙾',
|
48 |
+
'P': '𝙿',
|
49 |
+
'Q': '𝚀',
|
50 |
+
'R': '𝚁',
|
51 |
+
'S': '𝚂',
|
52 |
+
'T': '𝚃',
|
53 |
+
'U': '𝚄',
|
54 |
+
'V': '𝚅',
|
55 |
+
'W': '𝚆',
|
56 |
+
'X': '𝚇',
|
57 |
+
'Y': '𝚈',
|
58 |
+
'Z': '𝚉'
|
59 |
+
}
|
60 |
+
for i, j in style.items():
|
61 |
+
text = text.replace(i, j)
|
62 |
+
return text
|
63 |
+
|
64 |
+
def outline(text):
|
65 |
+
style = {
|
66 |
+
'a': '𝕒',
|
67 |
+
'b': '𝕓',
|
68 |
+
'c': '𝕔',
|
69 |
+
'd': '𝕕',
|
70 |
+
'e': '𝕖',
|
71 |
+
'f': '𝕗',
|
72 |
+
'g': '𝕘',
|
73 |
+
'h': '𝕙',
|
74 |
+
'i': '𝕚',
|
75 |
+
'j': '𝕛',
|
76 |
+
'k': '𝕜',
|
77 |
+
'l': '𝕝',
|
78 |
+
'm': '𝕞',
|
79 |
+
'n': '𝕟',
|
80 |
+
'o': '𝕠',
|
81 |
+
'p': '𝕡',
|
82 |
+
'q': '𝕢',
|
83 |
+
'r': '𝕣',
|
84 |
+
's': '𝕤',
|
85 |
+
't': '𝕥',
|
86 |
+
'u': '𝕦',
|
87 |
+
'v': '𝕧',
|
88 |
+
'w': '𝕨',
|
89 |
+
'x': '𝕩',
|
90 |
+
'y': '𝕪',
|
91 |
+
'z': '𝕫',
|
92 |
+
'A': '𝔸',
|
93 |
+
'B': '𝔹',
|
94 |
+
'C': 'ℂ',
|
95 |
+
'D': '𝔻',
|
96 |
+
'E': '𝔼',
|
97 |
+
'F': '𝔽',
|
98 |
+
'G': '𝔾',
|
99 |
+
'H': 'ℍ',
|
100 |
+
'I': '𝕀',
|
101 |
+
'J': '𝕁',
|
102 |
+
'K': '𝕂',
|
103 |
+
'L': '𝕃',
|
104 |
+
'M': '𝕄',
|
105 |
+
'N': 'ℕ',
|
106 |
+
'O': '𝕆',
|
107 |
+
'P': 'ℙ',
|
108 |
+
'Q': 'ℚ',
|
109 |
+
'R': 'ℝ',
|
110 |
+
'S': '𝕊',
|
111 |
+
'T': '𝕋',
|
112 |
+
'U': '𝕌',
|
113 |
+
'V': '𝕍',
|
114 |
+
'W': '𝕎',
|
115 |
+
'X': '𝕏',
|
116 |
+
'Y': '𝕐',
|
117 |
+
'Z': 'ℤ',
|
118 |
+
'0': '𝟘',
|
119 |
+
'1': '𝟙',
|
120 |
+
'2': '𝟚',
|
121 |
+
'3': '𝟛',
|
122 |
+
'4': '𝟜',
|
123 |
+
'5': '𝟝',
|
124 |
+
'6': '𝟞',
|
125 |
+
'7': '𝟟',
|
126 |
+
'8': '𝟠',
|
127 |
+
'9': '𝟡'
|
128 |
+
}
|
129 |
+
for i, j in style.items():
|
130 |
+
text = text.replace(i, j)
|
131 |
+
return text
|
132 |
+
|
133 |
+
def serief(text):
|
134 |
+
style = {
|
135 |
+
'a': '𝐚',
|
136 |
+
'b': '𝐛',
|
137 |
+
'c': '𝐜',
|
138 |
+
'd': '𝐝',
|
139 |
+
'e': '𝐞',
|
140 |
+
'f': '𝐟',
|
141 |
+
'g': '𝐠',
|
142 |
+
'h': '𝐡',
|
143 |
+
'i': '𝐢',
|
144 |
+
'j': '𝐣',
|
145 |
+
'k': '𝐤',
|
146 |
+
'l': '𝐥',
|
147 |
+
'm': '𝐦',
|
148 |
+
'n': '𝐧',
|
149 |
+
'o': '𝐨',
|
150 |
+
'p': '𝐩',
|
151 |
+
'q': '𝐪',
|
152 |
+
'r': '𝐫',
|
153 |
+
's': '𝐬',
|
154 |
+
't': '𝐭',
|
155 |
+
'u': '𝐮',
|
156 |
+
'v': '𝐯',
|
157 |
+
'w': '𝐰',
|
158 |
+
'x': '𝐱',
|
159 |
+
'y': '𝐲',
|
160 |
+
'z': '𝐳',
|
161 |
+
'A': '𝐀',
|
162 |
+
'B': '𝐁',
|
163 |
+
'C': '𝐂',
|
164 |
+
'D': '𝐃',
|
165 |
+
'E': '𝐄',
|
166 |
+
'F': '𝐅',
|
167 |
+
'G': '𝐆',
|
168 |
+
'H': '𝐇',
|
169 |
+
'I': '𝐈',
|
170 |
+
'J': '𝐉',
|
171 |
+
'K': '𝐊',
|
172 |
+
'L': '𝐋',
|
173 |
+
'M': '𝐌',
|
174 |
+
'N': '𝐍',
|
175 |
+
'O': '𝐎',
|
176 |
+
'P': '𝐏',
|
177 |
+
'Q': '𝐐',
|
178 |
+
'R': '𝐑',
|
179 |
+
'S': '𝐒',
|
180 |
+
'T': '𝐓',
|
181 |
+
'U': '𝐔',
|
182 |
+
'V': '𝐕',
|
183 |
+
'W': '𝐖',
|
184 |
+
'X': '𝐗',
|
185 |
+
'Y': '𝐘',
|
186 |
+
'Z': '𝐙',
|
187 |
+
'0': '𝟎',
|
188 |
+
'1': '𝟏',
|
189 |
+
'2': '𝟐',
|
190 |
+
'3': '𝟑',
|
191 |
+
'4': '𝟒',
|
192 |
+
'5': '𝟓',
|
193 |
+
'6': '𝟔',
|
194 |
+
'7': '𝟕',
|
195 |
+
'8': '𝟖',
|
196 |
+
'9': '𝟗'
|
197 |
+
}
|
198 |
+
for i, j in style.items():
|
199 |
+
text = text.replace(i, j)
|
200 |
+
return text
|
201 |
+
|
202 |
+
def bold_cool(text):
|
203 |
+
style = {
|
204 |
+
'a': '𝒂',
|
205 |
+
'b': '𝒃',
|
206 |
+
'c': '𝒄',
|
207 |
+
'd': '𝒅',
|
208 |
+
'e': '𝒆',
|
209 |
+
'f': '𝒇',
|
210 |
+
'g': '𝒈',
|
211 |
+
'h': '𝒉',
|
212 |
+
'i': '𝒊',
|
213 |
+
'j': '𝒋',
|
214 |
+
'k': '𝒌',
|
215 |
+
'l': '𝒍',
|
216 |
+
'm': '𝒎',
|
217 |
+
'n': '𝒏',
|
218 |
+
'o': '𝒐',
|
219 |
+
'p': '𝒑',
|
220 |
+
'q': '𝒒',
|
221 |
+
'r': '𝒓',
|
222 |
+
's': '𝒔',
|
223 |
+
't': '𝒕',
|
224 |
+
'u': '𝒖',
|
225 |
+
'v': '𝒗',
|
226 |
+
'w': '𝒘',
|
227 |
+
'x': '𝒙',
|
228 |
+
'y': '𝒚',
|
229 |
+
'z': '𝒛',
|
230 |
+
'A': '𝑨',
|
231 |
+
'B': '𝑩',
|
232 |
+
'C': '𝑪',
|
233 |
+
'D': '𝑫',
|
234 |
+
'E': '𝑬',
|
235 |
+
'F': '𝑭',
|
236 |
+
'G': '𝑮',
|
237 |
+
'H': '𝑯',
|
238 |
+
'I': '𝑰',
|
239 |
+
'J': '𝑱',
|
240 |
+
'K': '𝑲',
|
241 |
+
'L': '𝑳',
|
242 |
+
'M': '𝑴',
|
243 |
+
'N': '𝑵',
|
244 |
+
'O': '𝑶',
|
245 |
+
'P': '𝑷',
|
246 |
+
'Q': '𝑸',
|
247 |
+
'R': '𝑹',
|
248 |
+
'S': '𝑺',
|
249 |
+
'T': '𝑻',
|
250 |
+
'U': '𝑼',
|
251 |
+
'V': '𝑽',
|
252 |
+
'W': '𝑾',
|
253 |
+
'X': '𝑿',
|
254 |
+
'Y': '𝒀',
|
255 |
+
'Z': '𝒁'
|
256 |
+
}
|
257 |
+
for i, j in style.items():
|
258 |
+
text = text.replace(i, j)
|
259 |
+
return text
|
260 |
+
|
261 |
+
def cool(text):
|
262 |
+
style = {
|
263 |
+
'a': '𝑎',
|
264 |
+
'b': '𝑏',
|
265 |
+
'c': '𝑐',
|
266 |
+
'd': '𝑑',
|
267 |
+
'e': '𝑒',
|
268 |
+
'f': '𝑓',
|
269 |
+
'g': '𝑔',
|
270 |
+
'h': 'ℎ',
|
271 |
+
'i': '𝑖',
|
272 |
+
'j': '𝑗',
|
273 |
+
'k': '𝑘',
|
274 |
+
'l': '𝑙',
|
275 |
+
'm': '𝑚',
|
276 |
+
'n': '𝑛',
|
277 |
+
'o': '𝑜',
|
278 |
+
'p': '𝑝',
|
279 |
+
'q': '𝑞',
|
280 |
+
'r': '𝑟',
|
281 |
+
's': '𝑠',
|
282 |
+
't': '𝑡',
|
283 |
+
'u': '𝑢',
|
284 |
+
'v': '𝑣',
|
285 |
+
'w': '𝑤',
|
286 |
+
'x': '𝑥',
|
287 |
+
'y': '𝑦',
|
288 |
+
'z': '𝑧',
|
289 |
+
'A': '𝐴',
|
290 |
+
'B': '𝐵',
|
291 |
+
'C': '𝐶',
|
292 |
+
'D': '𝐷',
|
293 |
+
'E': '𝐸',
|
294 |
+
'F': '𝐹',
|
295 |
+
'G': '𝐺',
|
296 |
+
'H': '𝐻',
|
297 |
+
'I': '𝐼',
|
298 |
+
'J': '𝐽',
|
299 |
+
'K': '𝐾',
|
300 |
+
'L': '𝐿',
|
301 |
+
'M': '𝑀',
|
302 |
+
'N': '𝑁',
|
303 |
+
'O': '𝑂',
|
304 |
+
'P': '𝑃',
|
305 |
+
'Q': '𝑄',
|
306 |
+
'R': '𝑅',
|
307 |
+
'S': '𝑆',
|
308 |
+
'T': '𝑇',
|
309 |
+
'U': '𝑈',
|
310 |
+
'V': '𝑉',
|
311 |
+
'W': '𝑊',
|
312 |
+
'X': '𝑋',
|
313 |
+
'Y': '𝑌',
|
314 |
+
'Z': '𝑍'
|
315 |
+
}
|
316 |
+
for i, j in style.items():
|
317 |
+
text = text.replace(i, j)
|
318 |
+
return text
|
319 |
+
|
320 |
+
def smallcap(text):
|
321 |
+
style = {
|
322 |
+
'a': 'ᴀ',
|
323 |
+
'b': 'ʙ',
|
324 |
+
'c': 'ᴄ',
|
325 |
+
'd': 'ᴅ',
|
326 |
+
'e': 'ᴇ',
|
327 |
+
'f': 'ғ',
|
328 |
+
'g': 'ɢ',
|
329 |
+
'h': 'ʜ',
|
330 |
+
'i': 'ɪ',
|
331 |
+
'j': 'ɪ',
|
332 |
+
'k': 'ᴋ',
|
333 |
+
'l': 'ʟ',
|
334 |
+
'm': 'ᴍ',
|
335 |
+
'n': 'ɴ',
|
336 |
+
'o': 'ᴏ',
|
337 |
+
'p': 'ᴘ',
|
338 |
+
'q': 'ǫ',
|
339 |
+
'r': 'ʀ',
|
340 |
+
's': 's',
|
341 |
+
't': 'ᴛ',
|
342 |
+
'u': 'ᴜ',
|
343 |
+
'v': 'ᴠ',
|
344 |
+
'w': 'ᴡ',
|
345 |
+
'x': 'x',
|
346 |
+
'y': 'ʏ',
|
347 |
+
'z': 'ᴢ',
|
348 |
+
'A': 'A',
|
349 |
+
'B': 'B',
|
350 |
+
'C': 'C',
|
351 |
+
'D': 'D',
|
352 |
+
'E': 'E',
|
353 |
+
'F': 'F',
|
354 |
+
'G': 'G',
|
355 |
+
'H': 'H',
|
356 |
+
'I': 'I',
|
357 |
+
'J': 'J',
|
358 |
+
'K': 'K',
|
359 |
+
'L': 'L',
|
360 |
+
'M': 'M',
|
361 |
+
'N': 'N',
|
362 |
+
'O': 'O',
|
363 |
+
'P': 'P',
|
364 |
+
'Q': 'Q',
|
365 |
+
'R': 'R',
|
366 |
+
'S': 'S',
|
367 |
+
'T': 'T',
|
368 |
+
'U': 'U',
|
369 |
+
'V': 'V',
|
370 |
+
'W': 'W',
|
371 |
+
'X': 'X',
|
372 |
+
'Y': 'Y',
|
373 |
+
'Z': 'Z',
|
374 |
+
'0': '𝟶',
|
375 |
+
'1': '𝟷',
|
376 |
+
'2': '𝟸',
|
377 |
+
'3': '𝟹',
|
378 |
+
'4': '𝟺',
|
379 |
+
'5': '𝟻',
|
380 |
+
'6': '𝟼',
|
381 |
+
'7': '𝟽',
|
382 |
+
'8': '𝟾',
|
383 |
+
'9': '𝟿'
|
384 |
+
}
|
385 |
+
for i, j in style.items():
|
386 |
+
text = text.replace(i, j)
|
387 |
+
return text
|
388 |
+
|
389 |
+
def script(text):
|
390 |
+
style = {
|
391 |
+
'a': '𝒶',
|
392 |
+
'b': '𝒷',
|
393 |
+
'c': '𝒸',
|
394 |
+
'd': '𝒹',
|
395 |
+
'e': 'ℯ',
|
396 |
+
'f': '𝒻',
|
397 |
+
'g': 'ℊ',
|
398 |
+
'h': '𝒽',
|
399 |
+
'i': '𝒾',
|
400 |
+
'j': '𝒿',
|
401 |
+
'k': '𝓀',
|
402 |
+
'l': '𝓁',
|
403 |
+
'm': '𝓂',
|
404 |
+
'n': '𝓃',
|
405 |
+
'o': 'ℴ',
|
406 |
+
'p': '𝓅',
|
407 |
+
'q': '𝓆',
|
408 |
+
'r': '𝓇',
|
409 |
+
's': '���',
|
410 |
+
't': '𝓉',
|
411 |
+
'u': '𝓊',
|
412 |
+
'v': '𝓋',
|
413 |
+
'w': '𝓌',
|
414 |
+
'x': '𝓍',
|
415 |
+
'y': '𝓎',
|
416 |
+
'z': '𝓏',
|
417 |
+
'A': '𝒜',
|
418 |
+
'B': 'ℬ',
|
419 |
+
'C': '𝒞',
|
420 |
+
'D': '𝒟',
|
421 |
+
'E': 'ℰ',
|
422 |
+
'F': 'ℱ',
|
423 |
+
'G': '𝒢',
|
424 |
+
'H': 'ℋ',
|
425 |
+
'I': 'ℐ',
|
426 |
+
'J': '𝒥',
|
427 |
+
'K': '𝒦',
|
428 |
+
'L': 'ℒ',
|
429 |
+
'M': 'ℳ',
|
430 |
+
'N': '𝒩',
|
431 |
+
'O': '𝒪',
|
432 |
+
'P': '𝒫',
|
433 |
+
'Q': '𝒬',
|
434 |
+
'R': 'ℛ',
|
435 |
+
'S': '𝒮',
|
436 |
+
'T': '𝒯',
|
437 |
+
'U': '𝒰',
|
438 |
+
'V': '𝒱',
|
439 |
+
'W': '𝒲',
|
440 |
+
'X': '𝒳',
|
441 |
+
'Y': '𝒴',
|
442 |
+
'Z': '𝒵'
|
443 |
+
}
|
444 |
+
for i, j in style.items():
|
445 |
+
text = text.replace(i, j)
|
446 |
+
return text
|
447 |
+
|
448 |
+
def bold_script(text):
|
449 |
+
style = {
|
450 |
+
'a': '𝓪',
|
451 |
+
'b': '𝓫',
|
452 |
+
'c': '𝓬',
|
453 |
+
'd': '𝓭',
|
454 |
+
'e': '𝓮',
|
455 |
+
'f': '𝓯',
|
456 |
+
'g': '𝓰',
|
457 |
+
'h': '𝓱',
|
458 |
+
'i': '𝓲',
|
459 |
+
'j': '𝓳',
|
460 |
+
'k': '𝓴',
|
461 |
+
'l': '𝓵',
|
462 |
+
'm': '𝓶',
|
463 |
+
'n': '𝓷',
|
464 |
+
'o': '𝓸',
|
465 |
+
'p': '𝓹',
|
466 |
+
'q': '𝓺',
|
467 |
+
'r': '𝓻',
|
468 |
+
's': '𝓼',
|
469 |
+
't': '𝓽',
|
470 |
+
'u': '𝓾',
|
471 |
+
'v': '𝓿',
|
472 |
+
'w': '𝔀',
|
473 |
+
'x': '𝔁',
|
474 |
+
'y': '𝔂',
|
475 |
+
'z': '𝔃',
|
476 |
+
'A': '𝓐',
|
477 |
+
'B': '𝓑',
|
478 |
+
'C': '𝓒',
|
479 |
+
'D': '𝓓',
|
480 |
+
'E': '𝓔',
|
481 |
+
'F': '𝓕',
|
482 |
+
'G': '𝓖',
|
483 |
+
'H': '𝓗',
|
484 |
+
'I': '𝓘',
|
485 |
+
'J': '𝓙',
|
486 |
+
'K': '𝓚',
|
487 |
+
'L': '𝓛',
|
488 |
+
'M': '𝓜',
|
489 |
+
'N': '𝓝',
|
490 |
+
'O': '𝓞',
|
491 |
+
'P': '𝓟',
|
492 |
+
'Q': '𝓠',
|
493 |
+
'R': '𝓡',
|
494 |
+
'S': '𝓢',
|
495 |
+
'T': '𝓣',
|
496 |
+
'U': '𝓤',
|
497 |
+
'V': '𝓥',
|
498 |
+
'W': '𝓦',
|
499 |
+
'X': '𝓧',
|
500 |
+
'Y': '𝓨',
|
501 |
+
'Z': '𝓩'
|
502 |
+
}
|
503 |
+
for i, j in style.items():
|
504 |
+
text = text.replace(i, j)
|
505 |
+
return text
|
506 |
+
|
507 |
+
def tiny(text):
|
508 |
+
style = {
|
509 |
+
'a': 'ᵃ',
|
510 |
+
'b': 'ᵇ',
|
511 |
+
'c': 'ᶜ',
|
512 |
+
'd': 'ᵈ',
|
513 |
+
'e': 'ᵉ',
|
514 |
+
'f': 'ᶠ',
|
515 |
+
'g': 'ᵍ',
|
516 |
+
'h': 'ʰ',
|
517 |
+
'i': 'ⁱ',
|
518 |
+
'j': 'ʲ',
|
519 |
+
'k': 'ᵏ',
|
520 |
+
'l': 'ˡ',
|
521 |
+
'm': 'ᵐ',
|
522 |
+
'n': 'ⁿ',
|
523 |
+
'o': 'ᵒ',
|
524 |
+
'p': 'ᵖ',
|
525 |
+
'q': 'ᵠ',
|
526 |
+
'r': 'ʳ',
|
527 |
+
's': 'ˢ',
|
528 |
+
't': 'ᵗ',
|
529 |
+
'u': 'ᵘ',
|
530 |
+
'v': 'ᵛ',
|
531 |
+
'w': 'ʷ',
|
532 |
+
'x': 'ˣ',
|
533 |
+
'y': 'ʸ',
|
534 |
+
'z': 'ᶻ',
|
535 |
+
'A': 'ᵃ',
|
536 |
+
'B': 'ᵇ',
|
537 |
+
'C': 'ᶜ',
|
538 |
+
'D': 'ᵈ',
|
539 |
+
'E': 'ᵉ',
|
540 |
+
'F': 'ᶠ',
|
541 |
+
'G': 'ᵍ',
|
542 |
+
'H': 'ʰ',
|
543 |
+
'I': 'ⁱ',
|
544 |
+
'J': 'ʲ',
|
545 |
+
'K': 'ᵏ',
|
546 |
+
'L': 'ˡ',
|
547 |
+
'M': 'ᵐ',
|
548 |
+
'N': 'ⁿ',
|
549 |
+
'O': 'ᵒ',
|
550 |
+
'P': 'ᵖ',
|
551 |
+
'Q': 'ᵠ',
|
552 |
+
'R': 'ʳ',
|
553 |
+
'S': 'ˢ',
|
554 |
+
'T': 'ᵗ',
|
555 |
+
'U': 'ᵘ',
|
556 |
+
'V': 'ᵛ',
|
557 |
+
'W': 'ʷ',
|
558 |
+
'X': 'ˣ',
|
559 |
+
'Y': 'ʸ',
|
560 |
+
'Z': 'ᶻ'
|
561 |
+
}
|
562 |
+
for i, j in style.items():
|
563 |
+
text = text.replace(i, j)
|
564 |
+
return text
|
565 |
+
|
566 |
+
def comic(text):
|
567 |
+
style = {
|
568 |
+
'a': 'ᗩ',
|
569 |
+
'b': 'ᗷ',
|
570 |
+
'c': 'ᑕ',
|
571 |
+
'd': 'ᗪ',
|
572 |
+
'e': 'ᗴ',
|
573 |
+
'f': 'ᖴ',
|
574 |
+
'g': 'ᘜ',
|
575 |
+
'h': 'ᕼ',
|
576 |
+
'i': 'I',
|
577 |
+
'j': 'ᒍ',
|
578 |
+
'k': 'K',
|
579 |
+
'l': 'ᒪ',
|
580 |
+
'm': 'ᗰ',
|
581 |
+
'n': 'ᑎ',
|
582 |
+
'o': 'O',
|
583 |
+
'p': 'ᑭ',
|
584 |
+
'q': 'ᑫ',
|
585 |
+
'r': 'ᖇ',
|
586 |
+
's': 'Տ',
|
587 |
+
't': 'T',
|
588 |
+
'u': 'ᑌ',
|
589 |
+
'v': 'ᐯ',
|
590 |
+
'w': 'ᗯ',
|
591 |
+
'x': '᙭',
|
592 |
+
'y': 'Y',
|
593 |
+
'z': 'ᘔ',
|
594 |
+
'A': 'ᗩ',
|
595 |
+
'B': 'ᗷ',
|
596 |
+
'C': 'ᑕ',
|
597 |
+
'D': 'ᗪ',
|
598 |
+
'E': 'ᗴ',
|
599 |
+
'F': 'ᖴ',
|
600 |
+
'G': 'ᘜ',
|
601 |
+
'H': 'ᕼ',
|
602 |
+
'I': 'I',
|
603 |
+
'J': 'ᒍ',
|
604 |
+
'K': 'K',
|
605 |
+
'L': 'ᒪ',
|
606 |
+
'M': 'ᗰ',
|
607 |
+
'N': 'ᑎ',
|
608 |
+
'O': 'O',
|
609 |
+
'P': 'ᑭ',
|
610 |
+
'Q': 'ᑫ',
|
611 |
+
'R': 'ᖇ',
|
612 |
+
'S': 'Տ',
|
613 |
+
'T': 'T',
|
614 |
+
'U': 'ᑌ',
|
615 |
+
'V': 'ᐯ',
|
616 |
+
'W': 'ᗯ',
|
617 |
+
'X': '᙭',
|
618 |
+
'Y': 'Y',
|
619 |
+
'Z': 'ᘔ'
|
620 |
+
}
|
621 |
+
for i, j in style.items():
|
622 |
+
text = text.replace(i, j)
|
623 |
+
return text
|
624 |
+
|
625 |
+
def san(text):
|
626 |
+
style = {
|
627 |
+
'a': '𝗮',
|
628 |
+
'b': '𝗯',
|
629 |
+
'c': '𝗰',
|
630 |
+
'd': '𝗱',
|
631 |
+
'e': '𝗲',
|
632 |
+
'f': '𝗳',
|
633 |
+
'g': '𝗴',
|
634 |
+
'h': '𝗵',
|
635 |
+
'i': '𝗶',
|
636 |
+
'j': '𝗷',
|
637 |
+
'k': '𝗸',
|
638 |
+
'l': '𝗹',
|
639 |
+
'm': '𝗺',
|
640 |
+
'n': '𝗻',
|
641 |
+
'o': '𝗼',
|
642 |
+
'p': '𝗽',
|
643 |
+
'q': '𝗾',
|
644 |
+
'r': '𝗿',
|
645 |
+
's': '𝘀',
|
646 |
+
't': '𝘁',
|
647 |
+
'u': '𝘂',
|
648 |
+
'v': '𝘃',
|
649 |
+
'w': '𝘄',
|
650 |
+
'x': '𝘅',
|
651 |
+
'y': '𝘆',
|
652 |
+
'z': '𝘇',
|
653 |
+
'A': '𝗔',
|
654 |
+
'B': '𝗕',
|
655 |
+
'C': '𝗖',
|
656 |
+
'D': '𝗗',
|
657 |
+
'E': '𝗘',
|
658 |
+
'F': '𝗙',
|
659 |
+
'G': '𝗚',
|
660 |
+
'H': '𝗛',
|
661 |
+
'I': '𝗜',
|
662 |
+
'J': '𝗝',
|
663 |
+
'K': '𝗞',
|
664 |
+
'L': '𝗟',
|
665 |
+
'M': '𝗠',
|
666 |
+
'N': '𝗡',
|
667 |
+
'O': '𝗢',
|
668 |
+
'P': '𝗣',
|
669 |
+
'Q': '𝗤',
|
670 |
+
'R': '𝗥',
|
671 |
+
'S': '𝗦',
|
672 |
+
'T': '𝗧',
|
673 |
+
'U': '𝗨',
|
674 |
+
'V': '𝗩',
|
675 |
+
'W': '𝗪',
|
676 |
+
'X': '𝗫',
|
677 |
+
'Y': '𝗬',
|
678 |
+
'Z': '𝗭',
|
679 |
+
'0': '𝟬',
|
680 |
+
'1': '𝟭',
|
681 |
+
'2': '𝟮',
|
682 |
+
'3': '𝟯',
|
683 |
+
'4': '𝟰',
|
684 |
+
'5': '𝟱',
|
685 |
+
'6': '𝟲',
|
686 |
+
'7': '𝟳',
|
687 |
+
'8': '𝟴',
|
688 |
+
'9': '𝟵'
|
689 |
+
}
|
690 |
+
for i, j in style.items():
|
691 |
+
text = text.replace(i, j)
|
692 |
+
return text
|
693 |
+
|
694 |
+
def slant_san(text):
|
695 |
+
style = {
|
696 |
+
'a': '𝙖',
|
697 |
+
'b': '𝙗',
|
698 |
+
'c': '𝙘',
|
699 |
+
'd': '𝙙',
|
700 |
+
'e': '𝙚',
|
701 |
+
'f': '𝙛',
|
702 |
+
'g': '𝙜',
|
703 |
+
'h': '𝙝',
|
704 |
+
'i': '𝙞',
|
705 |
+
'j': '𝙟',
|
706 |
+
'k': '𝙠',
|
707 |
+
'l': '𝙡',
|
708 |
+
'm': '𝙢',
|
709 |
+
'n': '𝙣',
|
710 |
+
'o': '𝙤',
|
711 |
+
'p': '𝙥',
|
712 |
+
'q': '𝙦',
|
713 |
+
'r': '𝙧',
|
714 |
+
's': '𝙨',
|
715 |
+
't': '𝙩',
|
716 |
+
'u': '𝙪',
|
717 |
+
'v': '𝙫',
|
718 |
+
'w': '𝙬',
|
719 |
+
'x': '𝙭',
|
720 |
+
'y': '𝙮',
|
721 |
+
'z': '𝙯',
|
722 |
+
'A': '𝘼',
|
723 |
+
'B': '𝘽',
|
724 |
+
'C': '𝘾',
|
725 |
+
'D': '𝘿',
|
726 |
+
'E': '𝙀',
|
727 |
+
'F': '𝙁',
|
728 |
+
'G': '𝙂',
|
729 |
+
'H': '𝙃',
|
730 |
+
'I': '𝙄',
|
731 |
+
'J': '𝙅',
|
732 |
+
'K': '𝙆',
|
733 |
+
'L': '𝙇',
|
734 |
+
'M': '𝙈',
|
735 |
+
'N': '𝙉',
|
736 |
+
'O': '𝙊',
|
737 |
+
'P': '𝙋',
|
738 |
+
'Q': '𝙌',
|
739 |
+
'R': '𝙍',
|
740 |
+
'S': '𝙎',
|
741 |
+
'T': '𝙏',
|
742 |
+
'U': '𝙐',
|
743 |
+
'V': '𝙑',
|
744 |
+
'W': '𝙒',
|
745 |
+
'X': '𝙓',
|
746 |
+
'Y': '𝙔',
|
747 |
+
'Z': '𝙕'
|
748 |
+
}
|
749 |
+
for i, j in style.items():
|
750 |
+
text = text.replace(i, j)
|
751 |
+
return text
|
752 |
+
|
753 |
+
def slant(text):
|
754 |
+
style = {
|
755 |
+
'a': '𝘢',
|
756 |
+
'b': '𝘣',
|
757 |
+
'c': '𝘤',
|
758 |
+
'd': '𝘥',
|
759 |
+
'e': '𝘦',
|
760 |
+
'f': '𝘧',
|
761 |
+
'g': '𝘨',
|
762 |
+
'h': '𝘩',
|
763 |
+
'i': '𝘪',
|
764 |
+
'j': '𝘫',
|
765 |
+
'k': '𝘬',
|
766 |
+
'l': '𝘭',
|
767 |
+
'm': '𝘮',
|
768 |
+
'n': '𝘯',
|
769 |
+
'o': '𝘰',
|
770 |
+
'p': '𝘱',
|
771 |
+
'q': '𝘲',
|
772 |
+
'r': '𝘳',
|
773 |
+
's': '𝘴',
|
774 |
+
't': '𝘵',
|
775 |
+
'u': '𝘶',
|
776 |
+
'v': '𝘷',
|
777 |
+
'w': '𝘸',
|
778 |
+
'x': '𝘹',
|
779 |
+
'y': '𝘺',
|
780 |
+
'z': '𝘻',
|
781 |
+
'A': '𝘈',
|
782 |
+
'B': '𝘉',
|
783 |
+
'C': '𝘊',
|
784 |
+
'D': '𝘋',
|
785 |
+
'E': '𝘌',
|
786 |
+
'F': '𝘍',
|
787 |
+
'G': '𝘎',
|
788 |
+
'H': '𝘏',
|
789 |
+
'I': '𝘐',
|
790 |
+
'J': '𝘑',
|
791 |
+
'K': '𝘒',
|
792 |
+
'L': '𝘓',
|
793 |
+
'M': '𝘔',
|
794 |
+
'N': '𝘕',
|
795 |
+
'O': '𝘖',
|
796 |
+
'P': '𝘗',
|
797 |
+
'Q': '𝘘',
|
798 |
+
'R': '𝘙',
|
799 |
+
'S': '𝘚',
|
800 |
+
'T': '𝘛',
|
801 |
+
'U': '𝘜',
|
802 |
+
'V': '𝘝',
|
803 |
+
'W': '𝘞',
|
804 |
+
'X': '𝘟',
|
805 |
+
'Y': '𝘠',
|
806 |
+
'Z': '𝘡'
|
807 |
+
}
|
808 |
+
for i, j in style.items():
|
809 |
+
text = text.replace(i, j)
|
810 |
+
return text
|
811 |
+
|
812 |
+
def sim(text):
|
813 |
+
style = {
|
814 |
+
'a': '𝖺',
|
815 |
+
'b': '𝖻',
|
816 |
+
'c': '𝖼',
|
817 |
+
'd': '𝖽',
|
818 |
+
'e': '𝖾',
|
819 |
+
'f': '𝖿',
|
820 |
+
'g': '𝗀',
|
821 |
+
'h': '𝗁',
|
822 |
+
'i': '𝗂',
|
823 |
+
'j': '𝗃',
|
824 |
+
'k': '𝗄',
|
825 |
+
'l': '𝗅',
|
826 |
+
'm': '𝗆',
|
827 |
+
'n': '𝗇',
|
828 |
+
'o': '𝗈',
|
829 |
+
'p': '𝗉',
|
830 |
+
'q': '𝗊',
|
831 |
+
'r': '𝗋',
|
832 |
+
's': '𝗌',
|
833 |
+
't': '𝗍',
|
834 |
+
'u': '𝗎',
|
835 |
+
'v': '𝗏',
|
836 |
+
'w': '𝗐',
|
837 |
+
'x': '𝗑',
|
838 |
+
'y': '𝗒',
|
839 |
+
'z': '𝗓',
|
840 |
+
'A': '𝖠',
|
841 |
+
'B': '𝖡',
|
842 |
+
'C': '𝖢',
|
843 |
+
'D': '𝖣',
|
844 |
+
'E': '𝖤',
|
845 |
+
'F': '𝖥',
|
846 |
+
'G': '𝖦',
|
847 |
+
'H': '𝖧',
|
848 |
+
'I': '𝖨',
|
849 |
+
'J': '𝖩',
|
850 |
+
'K': '𝖪',
|
851 |
+
'L': '𝖫',
|
852 |
+
'M': '𝖬',
|
853 |
+
'N': '𝖭',
|
854 |
+
'O': '𝖮',
|
855 |
+
'P': '𝖯',
|
856 |
+
'Q': '𝖰',
|
857 |
+
'R': '𝖱',
|
858 |
+
'S': '𝖲',
|
859 |
+
'T': '𝖳',
|
860 |
+
'U': '𝖴',
|
861 |
+
'V': '𝖵',
|
862 |
+
'W': '𝖶',
|
863 |
+
'X': '𝖷',
|
864 |
+
'Y': '𝖸',
|
865 |
+
'Z': '𝖹'
|
866 |
+
}
|
867 |
+
for i, j in style.items():
|
868 |
+
text = text.replace(i, j)
|
869 |
+
return text
|
870 |
+
|
871 |
+
def circles(text):
|
872 |
+
style = {
|
873 |
+
'a': 'Ⓐ︎',
|
874 |
+
'b': 'Ⓑ︎',
|
875 |
+
'c': 'Ⓒ︎',
|
876 |
+
'd': 'Ⓓ︎',
|
877 |
+
'e': 'Ⓔ︎',
|
878 |
+
'f': 'Ⓕ︎',
|
879 |
+
'g': 'Ⓖ︎',
|
880 |
+
'h': 'Ⓗ︎',
|
881 |
+
'i': 'Ⓘ︎',
|
882 |
+
'j': 'Ⓙ︎',
|
883 |
+
'k': 'Ⓚ︎',
|
884 |
+
'l': 'Ⓛ︎',
|
885 |
+
'm': 'Ⓜ︎',
|
886 |
+
'n': 'Ⓝ︎',
|
887 |
+
'o': 'Ⓞ︎',
|
888 |
+
'p': 'Ⓟ︎',
|
889 |
+
'q': 'Ⓠ︎',
|
890 |
+
'r': 'Ⓡ︎',
|
891 |
+
's': 'Ⓢ︎',
|
892 |
+
't': 'Ⓣ︎',
|
893 |
+
'u': 'Ⓤ︎',
|
894 |
+
'v': 'Ⓥ︎',
|
895 |
+
'w': 'Ⓦ︎',
|
896 |
+
'x': 'Ⓧ︎',
|
897 |
+
'y': 'Ⓨ︎',
|
898 |
+
'z': 'Ⓩ︎',
|
899 |
+
'A': 'Ⓐ︎',
|
900 |
+
'B': 'Ⓑ︎',
|
901 |
+
'C': 'Ⓒ︎',
|
902 |
+
'D': 'Ⓓ︎',
|
903 |
+
'E': 'Ⓔ︎',
|
904 |
+
'F': 'Ⓕ︎',
|
905 |
+
'G': 'Ⓖ︎',
|
906 |
+
'H': 'Ⓗ︎',
|
907 |
+
'I': 'Ⓘ︎',
|
908 |
+
'J': 'Ⓙ︎',
|
909 |
+
'K': 'Ⓚ︎',
|
910 |
+
'L': 'Ⓛ︎',
|
911 |
+
'M': 'Ⓜ︎',
|
912 |
+
'N': 'Ⓝ︎',
|
913 |
+
'O': 'Ⓞ︎',
|
914 |
+
'P': 'Ⓟ︎',
|
915 |
+
'Q': 'Ⓠ︎',
|
916 |
+
'R': 'Ⓡ︎',
|
917 |
+
'S': 'Ⓢ︎',
|
918 |
+
'T': 'Ⓣ︎',
|
919 |
+
'U': 'Ⓤ︎',
|
920 |
+
'V': 'Ⓥ︎',
|
921 |
+
'W': 'Ⓦ︎',
|
922 |
+
'X': 'Ⓧ︎',
|
923 |
+
'Y': 'Ⓨ︎',
|
924 |
+
'Z': 'Ⓩ︎',
|
925 |
+
'0': '⓪',
|
926 |
+
'1': '①',
|
927 |
+
'2': '②',
|
928 |
+
'3': '③',
|
929 |
+
'4': '④',
|
930 |
+
'5': '⑤',
|
931 |
+
'6': '⑥',
|
932 |
+
'7': '⑦',
|
933 |
+
'8': '⑧',
|
934 |
+
'9': '⑨'
|
935 |
+
}
|
936 |
+
for i, j in style.items():
|
937 |
+
text = text.replace(i, j)
|
938 |
+
return text
|
939 |
+
|
940 |
+
def dark_circle(text):
|
941 |
+
style = {
|
942 |
+
'a': '🅐︎',
|
943 |
+
'b': '🅑︎',
|
944 |
+
'c': '🅒︎',
|
945 |
+
'd': '🅓︎',
|
946 |
+
'e': '🅔︎',
|
947 |
+
'f': '🅕︎',
|
948 |
+
'g': '🅖︎',
|
949 |
+
'h': '🅗︎',
|
950 |
+
'i': '🅘︎',
|
951 |
+
'j': '🅙︎',
|
952 |
+
'k': '🅚︎',
|
953 |
+
'l': '🅛︎',
|
954 |
+
'm': '🅜︎',
|
955 |
+
'n': '🅝︎',
|
956 |
+
'o': '🅞︎',
|
957 |
+
'p': '🅟︎',
|
958 |
+
'q': '🅠︎',
|
959 |
+
'r': '🅡︎',
|
960 |
+
's': '🅢︎',
|
961 |
+
't': '🅣︎',
|
962 |
+
'u': '🅤︎',
|
963 |
+
'v': '🅥︎',
|
964 |
+
'w': '🅦︎',
|
965 |
+
'x': '🅧︎',
|
966 |
+
'y': '🅨︎',
|
967 |
+
'z': '🅩︎',
|
968 |
+
'A': '🅐︎',
|
969 |
+
'B': '🅑︎',
|
970 |
+
'C': '🅒︎',
|
971 |
+
'D': '🅓︎',
|
972 |
+
'E': '🅔︎',
|
973 |
+
'F': '🅕︎',
|
974 |
+
'G': '🅖︎',
|
975 |
+
'H': '🅗︎',
|
976 |
+
'I': '🅘︎',
|
977 |
+
'J': '🅙︎',
|
978 |
+
'K': '🅚︎',
|
979 |
+
'L': '🅛︎',
|
980 |
+
'M': '🅜︎',
|
981 |
+
'N': '🅝︎',
|
982 |
+
'O': '🅞︎',
|
983 |
+
'P': '🅟︎',
|
984 |
+
'Q': '🅠︎',
|
985 |
+
'R': '🅡︎',
|
986 |
+
'S': '🅢︎',
|
987 |
+
'T': '🅣︎',
|
988 |
+
'U': '🅤︎',
|
989 |
+
'V': '🅥︎',
|
990 |
+
'W': '🅦︎',
|
991 |
+
'X': '🅧︎',
|
992 |
+
'Y': '🅨︎',
|
993 |
+
'Z': '🅩',
|
994 |
+
'0': '⓿',
|
995 |
+
'1': '➊',
|
996 |
+
'2': '➋',
|
997 |
+
'3': '➌',
|
998 |
+
'4': '➍',
|
999 |
+
'5': '➎',
|
1000 |
+
'6': '➏',
|
1001 |
+
'7': '➐',
|
1002 |
+
'8': '➑',
|
1003 |
+
'9': '➒'
|
1004 |
+
}
|
1005 |
+
for i, j in style.items():
|
1006 |
+
text = text.replace(i, j)
|
1007 |
+
return text
|
1008 |
+
|
1009 |
+
def gothic(text):
|
1010 |
+
style = {
|
1011 |
+
'a': '𝔞',
|
1012 |
+
'b': '𝔟',
|
1013 |
+
'c': '𝔠',
|
1014 |
+
'd': '𝔡',
|
1015 |
+
'e': '𝔢',
|
1016 |
+
'f': '𝔣',
|
1017 |
+
'g': '𝔤',
|
1018 |
+
'h': '𝔥',
|
1019 |
+
'i': '𝔦',
|
1020 |
+
'j': '𝔧',
|
1021 |
+
'k': '𝔨',
|
1022 |
+
'l': '𝔩',
|
1023 |
+
'm': '𝔪',
|
1024 |
+
'n': '𝔫',
|
1025 |
+
'o': '𝔬',
|
1026 |
+
'p': '𝔭',
|
1027 |
+
'q': '𝔮',
|
1028 |
+
'r': '𝔯',
|
1029 |
+
's': '𝔰',
|
1030 |
+
't': '𝔱',
|
1031 |
+
'u': '𝔲',
|
1032 |
+
'v': '𝔳',
|
1033 |
+
'w': '𝔴',
|
1034 |
+
'x': '𝔵',
|
1035 |
+
'y': '𝔶',
|
1036 |
+
'z': '𝔷',
|
1037 |
+
'A': '𝔄',
|
1038 |
+
'B': '𝔅',
|
1039 |
+
'C': 'ℭ',
|
1040 |
+
'D': '𝔇',
|
1041 |
+
'E': '𝔈',
|
1042 |
+
'F': '𝔉',
|
1043 |
+
'G': '𝔊',
|
1044 |
+
'H': 'ℌ',
|
1045 |
+
'I': 'ℑ',
|
1046 |
+
'J': '𝔍',
|
1047 |
+
'K': '𝔎',
|
1048 |
+
'L': '𝔏',
|
1049 |
+
'M': '𝔐',
|
1050 |
+
'N': '𝔑',
|
1051 |
+
'O': '𝔒',
|
1052 |
+
'P': '𝔓',
|
1053 |
+
'Q': '𝔔',
|
1054 |
+
'R': 'ℜ',
|
1055 |
+
'S': '𝔖',
|
1056 |
+
'T': '𝔗',
|
1057 |
+
'U': '𝔘',
|
1058 |
+
'V': '𝔙',
|
1059 |
+
'W': '𝔚',
|
1060 |
+
'X': '𝔛',
|
1061 |
+
'Y': '𝔜',
|
1062 |
+
'Z': 'ℨ'
|
1063 |
+
}
|
1064 |
+
for i, j in style.items():
|
1065 |
+
text = text.replace(i, j)
|
1066 |
+
return text
|
1067 |
+
|
1068 |
+
|
1069 |
+
def bold_gothic(text):
|
1070 |
+
style = {
|
1071 |
+
'a': '𝖆',
|
1072 |
+
'b': '𝖇',
|
1073 |
+
'c': '𝖈',
|
1074 |
+
'd': '𝖉',
|
1075 |
+
'e': '𝖊',
|
1076 |
+
'f': '𝖋',
|
1077 |
+
'g': '𝖌',
|
1078 |
+
'h': '𝖍',
|
1079 |
+
'i': '𝖎',
|
1080 |
+
'j': '𝖏',
|
1081 |
+
'k': '𝖐',
|
1082 |
+
'l': '𝖑',
|
1083 |
+
'm': '𝖒',
|
1084 |
+
'n': '𝖓',
|
1085 |
+
'o': '𝖔',
|
1086 |
+
'p': '𝖕',
|
1087 |
+
'q': '𝖖',
|
1088 |
+
'r': '𝖗',
|
1089 |
+
's': '𝖘',
|
1090 |
+
't': '𝖙',
|
1091 |
+
'u': '𝖚',
|
1092 |
+
'v': '𝖛',
|
1093 |
+
'w': '𝖜',
|
1094 |
+
'x': '𝖝',
|
1095 |
+
'y': '𝖞',
|
1096 |
+
'z': '𝖟',
|
1097 |
+
'A': '𝕬',
|
1098 |
+
'B': '𝕭',
|
1099 |
+
'C': '𝕮',
|
1100 |
+
'D': '𝕺',
|
1101 |
+
'E': '𝕰',
|
1102 |
+
'F': '𝕱',
|
1103 |
+
'G': '𝕲',
|
1104 |
+
'H': '𝕳',
|
1105 |
+
'I': '𝕴',
|
1106 |
+
'J': '𝕵',
|
1107 |
+
'K': '𝕶',
|
1108 |
+
'L': '𝕷',
|
1109 |
+
'M': '𝕸',
|
1110 |
+
'N': '𝕹',
|
1111 |
+
'O': '𝕺',
|
1112 |
+
'P': '𝕻',
|
1113 |
+
'Q': '𝕼',
|
1114 |
+
'R': '𝕽',
|
1115 |
+
'S': '𝕾',
|
1116 |
+
'T': '𝕿',
|
1117 |
+
'U': '𝖀',
|
1118 |
+
'V': '𝖁',
|
1119 |
+
'W': '𝖂',
|
1120 |
+
'X': '𝖃',
|
1121 |
+
'Y': '𝖄',
|
1122 |
+
'Z': '𝖅'
|
1123 |
+
}
|
1124 |
+
for i, j in style.items():
|
1125 |
+
text = text.replace(i, j)
|
1126 |
+
return text
|
1127 |
+
|
1128 |
+
def cloud(text):
|
1129 |
+
style = {
|
1130 |
+
'a': 'a͜͡',
|
1131 |
+
'b': 'b͜͡',
|
1132 |
+
'c': 'c͜͡',
|
1133 |
+
'd': 'd͜͡',
|
1134 |
+
'e': 'e͜͡',
|
1135 |
+
'f': 'f͜͡',
|
1136 |
+
'g': 'g͜͡',
|
1137 |
+
'h': 'h͜͡',
|
1138 |
+
'i': 'i͜͡',
|
1139 |
+
'j': 'j͜͡',
|
1140 |
+
'k': 'k͜͡',
|
1141 |
+
'l': 'l͜͡',
|
1142 |
+
'm': 'm͜͡',
|
1143 |
+
'n': 'n͜͡',
|
1144 |
+
'o': 'o͜͡',
|
1145 |
+
'p': 'p͜͡',
|
1146 |
+
'q': 'q͜͡',
|
1147 |
+
'r': 'r͜͡',
|
1148 |
+
's': 's͜͡',
|
1149 |
+
't': 't͜͡',
|
1150 |
+
'u': 'u͜͡',
|
1151 |
+
'v': 'v͜͡',
|
1152 |
+
'w': 'w͜͡',
|
1153 |
+
'x': 'x͜͡',
|
1154 |
+
'y': 'y͜͡',
|
1155 |
+
'z': 'z͜͡',
|
1156 |
+
'A': 'A͜͡',
|
1157 |
+
'B': 'B͜͡',
|
1158 |
+
'C': 'C͜͡',
|
1159 |
+
'D': 'D͜͡',
|
1160 |
+
'E': 'E͜͡',
|
1161 |
+
'F': 'F͜͡',
|
1162 |
+
'G': 'G͜͡',
|
1163 |
+
'H': 'H͜͡',
|
1164 |
+
'I': 'I͜͡',
|
1165 |
+
'J': 'J͜͡',
|
1166 |
+
'K': 'K͜͡',
|
1167 |
+
'L': 'L͜͡',
|
1168 |
+
'M': 'M͜͡',
|
1169 |
+
'N': 'N͜͡',
|
1170 |
+
'O': 'O͜͡',
|
1171 |
+
'P': 'P͜͡',
|
1172 |
+
'Q': 'Q͜͡',
|
1173 |
+
'R': 'R͜͡',
|
1174 |
+
'S': 'S͜͡',
|
1175 |
+
'T': 'T͜͡',
|
1176 |
+
'U': 'U͜͡',
|
1177 |
+
'V': 'V͜͡',
|
1178 |
+
'W': 'W͜͡',
|
1179 |
+
'X': 'X͜͡',
|
1180 |
+
'Y': 'Y͜͡',
|
1181 |
+
'Z': 'Z͜͡'
|
1182 |
+
}
|
1183 |
+
for i, j in style.items():
|
1184 |
+
text = text.replace(i, j)
|
1185 |
+
return text
|
1186 |
+
|
1187 |
+
def happy(text):
|
1188 |
+
style = {
|
1189 |
+
'a': 'ă̈',
|
1190 |
+
'b': 'b̆̈',
|
1191 |
+
'c': 'c̆̈',
|
1192 |
+
'd': 'd̆̈',
|
1193 |
+
'e': 'ĕ̈',
|
1194 |
+
'f': 'f̆̈',
|
1195 |
+
'g': 'ğ̈',
|
1196 |
+
'h': 'h̆̈',
|
1197 |
+
'i': 'ĭ̈',
|
1198 |
+
'j': 'j̆̈',
|
1199 |
+
'k': 'k̆̈',
|
1200 |
+
'l': 'l̆̈',
|
1201 |
+
'm': 'm̆̈',
|
1202 |
+
'n': 'n̆̈',
|
1203 |
+
'o': 'ŏ̈',
|
1204 |
+
'p': 'p̆̈',
|
1205 |
+
'q': 'q̆̈',
|
1206 |
+
'r': 'r̆̈',
|
1207 |
+
's': 's̆̈',
|
1208 |
+
't': 't̆̈',
|
1209 |
+
'u': 'ŭ̈',
|
1210 |
+
'v': 'v̆̈',
|
1211 |
+
'w': 'w̆̈',
|
1212 |
+
'x': 'x̆̈',
|
1213 |
+
'y': 'y̆̈',
|
1214 |
+
'z': 'z̆̈',
|
1215 |
+
'A': 'Ă̈',
|
1216 |
+
'B': 'B̆̈',
|
1217 |
+
'C': 'C̆̈',
|
1218 |
+
'D': 'D̆̈',
|
1219 |
+
'E': 'Ĕ̈',
|
1220 |
+
'F': 'F̆̈',
|
1221 |
+
'G': 'Ğ̈',
|
1222 |
+
'H': 'H̆̈',
|
1223 |
+
'I': 'Ĭ̈',
|
1224 |
+
'J': 'J̆̈',
|
1225 |
+
'K': 'K̆̈',
|
1226 |
+
'L': 'L̆̈',
|
1227 |
+
'M': 'M̆̈',
|
1228 |
+
'N': 'N̆̈',
|
1229 |
+
'O': 'Ŏ̈',
|
1230 |
+
'P': 'P̆̈',
|
1231 |
+
'Q': 'Q̆̈',
|
1232 |
+
'R': 'R̆̈',
|
1233 |
+
'S': 'S̆̈',
|
1234 |
+
'T': 'T̆̈',
|
1235 |
+
'U': 'Ŭ̈',
|
1236 |
+
'V': 'V̆̈',
|
1237 |
+
'W': 'W̆̈',
|
1238 |
+
'X': 'X̆̈',
|
1239 |
+
'Y': 'Y̆̈',
|
1240 |
+
'Z': 'Z̆̈'
|
1241 |
+
}
|
1242 |
+
for i, j in style.items():
|
1243 |
+
text = text.replace(i, j)
|
1244 |
+
return text
|
1245 |
+
|
1246 |
+
def sad(text):
|
1247 |
+
style = {
|
1248 |
+
'a': 'ȃ̈',
|
1249 |
+
'b': 'b̑̈',
|
1250 |
+
'c': 'c̑̈',
|
1251 |
+
'd': 'd̑̈',
|
1252 |
+
'e': 'ȇ̈',
|
1253 |
+
'f': 'f̑̈',
|
1254 |
+
'g': 'g̑̈',
|
1255 |
+
'h': 'h̑̈',
|
1256 |
+
'i': 'ȋ̈',
|
1257 |
+
'j': 'j̑̈',
|
1258 |
+
'k': 'k̑̈',
|
1259 |
+
'l': 'l̑̈',
|
1260 |
+
'm': 'm̑̈',
|
1261 |
+
'n': 'n̑̈',
|
1262 |
+
'o': 'ȏ̈',
|
1263 |
+
'p': 'p̑̈',
|
1264 |
+
'q': 'q̑̈',
|
1265 |
+
'r': 'ȓ̈',
|
1266 |
+
's': 's̑̈',
|
1267 |
+
't': 't̑̈',
|
1268 |
+
'u': 'ȗ̈',
|
1269 |
+
'v': 'v̑̈',
|
1270 |
+
'w': 'w̑̈',
|
1271 |
+
'x': 'x̑̈',
|
1272 |
+
'y': 'y̑̈',
|
1273 |
+
'z': 'z̑̈',
|
1274 |
+
'A': 'Ȃ̈',
|
1275 |
+
'B': 'B̑̈',
|
1276 |
+
'C': 'C̑̈',
|
1277 |
+
'D': 'D̑̈',
|
1278 |
+
'E': 'Ȇ̈',
|
1279 |
+
'F': 'F̑̈',
|
1280 |
+
'G': 'G̑̈',
|
1281 |
+
'H': 'H̑̈',
|
1282 |
+
'I': 'Ȋ̈',
|
1283 |
+
'J': 'J̑̈',
|
1284 |
+
'K': 'K̑̈',
|
1285 |
+
'L': 'L̑̈',
|
1286 |
+
'M': 'M̑̈',
|
1287 |
+
'N': 'N̑̈',
|
1288 |
+
'O': 'Ȏ̈',
|
1289 |
+
'P': 'P̑̈',
|
1290 |
+
'Q': 'Q̑̈',
|
1291 |
+
'R': 'Ȓ̈',
|
1292 |
+
'S': 'S̑̈',
|
1293 |
+
'T': 'T̑̈',
|
1294 |
+
'U': 'Ȗ̈',
|
1295 |
+
'V': 'V̑̈',
|
1296 |
+
'W': 'W̑̈',
|
1297 |
+
'X': 'X̑̈',
|
1298 |
+
'Y': 'Y̑̈',
|
1299 |
+
'Z': 'Z̑̈'
|
1300 |
+
}
|
1301 |
+
for i, j in style.items():
|
1302 |
+
text = text.replace(i, j)
|
1303 |
+
return text
|
1304 |
+
|
1305 |
+
def special(text):
|
1306 |
+
style = {
|
1307 |
+
'a': '🇦 ',
|
1308 |
+
'b': '🇧 ',
|
1309 |
+
'c': '🇨 ',
|
1310 |
+
'd': '🇩 ',
|
1311 |
+
'e': '🇪 ',
|
1312 |
+
'f': '🇫 ',
|
1313 |
+
'g': '🇬 ',
|
1314 |
+
'h': '🇭 ',
|
1315 |
+
'i': '🇮 ',
|
1316 |
+
'j': '🇯 ',
|
1317 |
+
'k': '🇰 ',
|
1318 |
+
'l': '🇱 ',
|
1319 |
+
'm': '🇲 ',
|
1320 |
+
'n': '🇳 ',
|
1321 |
+
'o': '🇴 ',
|
1322 |
+
'p': '🇵 ',
|
1323 |
+
'q': '🇶 ',
|
1324 |
+
'r': '🇷 ',
|
1325 |
+
's': '🇸 ',
|
1326 |
+
't': '🇹 ',
|
1327 |
+
'u': '🇺 ',
|
1328 |
+
'v': '🇻 ',
|
1329 |
+
'w': '🇼 ',
|
1330 |
+
'x': '🇽 ',
|
1331 |
+
'y': '🇾 ',
|
1332 |
+
'z': '🇿 ',
|
1333 |
+
'A': '🇦 ',
|
1334 |
+
'B': '🇧 ',
|
1335 |
+
'C': '🇨 ',
|
1336 |
+
'D': '🇩 ',
|
1337 |
+
'E': '🇪 ',
|
1338 |
+
'F': '🇫 ',
|
1339 |
+
'G': '🇬 ',
|
1340 |
+
'H': '🇭 ',
|
1341 |
+
'I': '🇮 ',
|
1342 |
+
'J': '🇯 ',
|
1343 |
+
'K': '🇰 ',
|
1344 |
+
'L': '🇱 ',
|
1345 |
+
'M': '🇲 ',
|
1346 |
+
'N': '🇳 ',
|
1347 |
+
'O': '🇴 ',
|
1348 |
+
'P': '🇵 ',
|
1349 |
+
'Q': '🇶 ',
|
1350 |
+
'R': '🇷 ',
|
1351 |
+
'S': '🇸 ',
|
1352 |
+
'T': '🇹 ',
|
1353 |
+
'U': '🇺 ',
|
1354 |
+
'V': '🇻 ',
|
1355 |
+
'W': '🇼 ',
|
1356 |
+
'X': '🇽 ',
|
1357 |
+
'Y': '🇾 ',
|
1358 |
+
'Z': '🇿 '
|
1359 |
+
}
|
1360 |
+
for i, j in style.items():
|
1361 |
+
text = text.replace(i, j)
|
1362 |
+
return text
|
1363 |
+
|
1364 |
+
def square(text):
|
1365 |
+
style = {
|
1366 |
+
'a': '🄰',
|
1367 |
+
'b': '🄱',
|
1368 |
+
'c': '🄲',
|
1369 |
+
'd': '🄳',
|
1370 |
+
'e': '🄴',
|
1371 |
+
'f': '🄵',
|
1372 |
+
'g': '🄶',
|
1373 |
+
'h': '🄷',
|
1374 |
+
'i': '🄸',
|
1375 |
+
'j': '🄹',
|
1376 |
+
'k': '🄺',
|
1377 |
+
'l': '🄻',
|
1378 |
+
'm': '🄼',
|
1379 |
+
'n': '🄽',
|
1380 |
+
'o': '🄾',
|
1381 |
+
'p': '🄿',
|
1382 |
+
'q': '🅀',
|
1383 |
+
'r': '🅁',
|
1384 |
+
's': '🅂',
|
1385 |
+
't': '🅃',
|
1386 |
+
'u': '🅄',
|
1387 |
+
'v': '🅅',
|
1388 |
+
'w': '🅆',
|
1389 |
+
'x': '🅇',
|
1390 |
+
'y': '🅈',
|
1391 |
+
'z': '🅉',
|
1392 |
+
'A': '🄰',
|
1393 |
+
'B': '🄱',
|
1394 |
+
'C': '🄲',
|
1395 |
+
'D': '🄳',
|
1396 |
+
'E': '🄴',
|
1397 |
+
'F': '🄵',
|
1398 |
+
'G': '🄶',
|
1399 |
+
'H': '🄷',
|
1400 |
+
'I': '🄸',
|
1401 |
+
'J': '🄹',
|
1402 |
+
'K': '🄺',
|
1403 |
+
'L': '🄻',
|
1404 |
+
'M': '🄼',
|
1405 |
+
'N': '🄽',
|
1406 |
+
'O': '🄾',
|
1407 |
+
'P': '🄿',
|
1408 |
+
'Q': '🅀',
|
1409 |
+
'R': '🅁',
|
1410 |
+
'S': '🅂',
|
1411 |
+
'T': '🅃',
|
1412 |
+
'U': '🅄',
|
1413 |
+
'V': '🅅',
|
1414 |
+
'W': '🅆',
|
1415 |
+
'X': '🅇',
|
1416 |
+
'Y': '🅈',
|
1417 |
+
'Z': '🅉'
|
1418 |
+
}
|
1419 |
+
for i, j in style.items():
|
1420 |
+
text = text.replace(i, j)
|
1421 |
+
return text
|
1422 |
+
|
1423 |
+
def dark_square(text):
|
1424 |
+
style = {
|
1425 |
+
'a': '🅰︎',
|
1426 |
+
'b': '🅱︎',
|
1427 |
+
'c': '🅲︎',
|
1428 |
+
'd': '🅳︎',
|
1429 |
+
'e': '🅴︎',
|
1430 |
+
'f': '🅵︎',
|
1431 |
+
'g': '🅶︎',
|
1432 |
+
'h': '🅷︎',
|
1433 |
+
'i': '🅸︎',
|
1434 |
+
'j': '🅹︎',
|
1435 |
+
'k': '🅺︎',
|
1436 |
+
'l': '🅻︎',
|
1437 |
+
'm': '🅼︎',
|
1438 |
+
'n': '🅽︎',
|
1439 |
+
'o': '🅾︎',
|
1440 |
+
'p': '🅿︎',
|
1441 |
+
'q': '🆀︎',
|
1442 |
+
'r': '🆁︎',
|
1443 |
+
's': '🆂︎',
|
1444 |
+
't': '🆃︎',
|
1445 |
+
'u': '🆄︎',
|
1446 |
+
'v': '🆅︎',
|
1447 |
+
'w': '🆆︎',
|
1448 |
+
'x': '🆇︎',
|
1449 |
+
'y': '🆈︎',
|
1450 |
+
'z': '🆉︎',
|
1451 |
+
'A': '🅰︎',
|
1452 |
+
'B': '🅱︎',
|
1453 |
+
'C': '🅲︎',
|
1454 |
+
'D': '🅳︎',
|
1455 |
+
'E': '🅴︎',
|
1456 |
+
'F': '🅵︎',
|
1457 |
+
'G': '🅶︎',
|
1458 |
+
'H': '🅷︎',
|
1459 |
+
'I': '🅸︎',
|
1460 |
+
'J': '🅹︎',
|
1461 |
+
'K': '🅺︎',
|
1462 |
+
'L': '🅻︎',
|
1463 |
+
'M': '🅼︎',
|
1464 |
+
'N': '🅽︎',
|
1465 |
+
'O': '🅾︎',
|
1466 |
+
'P': '🅿︎',
|
1467 |
+
'Q': '🆀︎',
|
1468 |
+
'R': '🆁︎',
|
1469 |
+
'S': '🆂︎',
|
1470 |
+
'T': '🆃︎',
|
1471 |
+
'U': '🆄︎',
|
1472 |
+
'V': '🆅︎',
|
1473 |
+
'W': '🆆︎',
|
1474 |
+
'X': '🆇︎',
|
1475 |
+
'Y': '🆈︎',
|
1476 |
+
'Z': '🆉︎'
|
1477 |
+
}
|
1478 |
+
for i, j in style.items():
|
1479 |
+
text = text.replace(i, j)
|
1480 |
+
return text
|
1481 |
+
|
1482 |
+
def andalucia(text):
|
1483 |
+
style = {
|
1484 |
+
'a': 'ꪖ',
|
1485 |
+
'b': '᥇',
|
1486 |
+
'c': 'ᥴ',
|
1487 |
+
'd': 'ᦔ',
|
1488 |
+
'e': 'ꫀ',
|
1489 |
+
'f': 'ᠻ',
|
1490 |
+
'g': 'ᧁ',
|
1491 |
+
'h': 'ꫝ',
|
1492 |
+
'i': '𝓲',
|
1493 |
+
'j': '𝓳',
|
1494 |
+
'k': '𝘬',
|
1495 |
+
'l': 'ꪶ',
|
1496 |
+
'm': 'ꪑ',
|
1497 |
+
'n': 'ꪀ',
|
1498 |
+
'o': 'ꪮ',
|
1499 |
+
'p': 'ρ',
|
1500 |
+
'q': '𝘲',
|
1501 |
+
'r': '𝘳',
|
1502 |
+
's': '𝘴',
|
1503 |
+
't': '𝓽',
|
1504 |
+
'u': 'ꪊ',
|
1505 |
+
'v': 'ꪜ',
|
1506 |
+
'w': '᭙',
|
1507 |
+
'x': '᥊',
|
1508 |
+
'y': 'ꪗ',
|
1509 |
+
'z': 'ɀ',
|
1510 |
+
'A': 'ꪖ',
|
1511 |
+
'B': '᥇',
|
1512 |
+
'C': 'ᥴ',
|
1513 |
+
'D': 'ᦔ',
|
1514 |
+
'E': 'ꫀ',
|
1515 |
+
'F': 'ᠻ',
|
1516 |
+
'G': 'ᧁ',
|
1517 |
+
'H': 'ꫝ',
|
1518 |
+
'I': '𝓲',
|
1519 |
+
'J': '𝓳',
|
1520 |
+
'K': '𝘬',
|
1521 |
+
'L': 'ꪶ',
|
1522 |
+
'M': 'ꪑ',
|
1523 |
+
'N': 'ꪀ',
|
1524 |
+
'O': 'ꪮ',
|
1525 |
+
'P': 'ρ',
|
1526 |
+
'Q': '𝘲',
|
1527 |
+
'R': '𝘳',
|
1528 |
+
'S': '𝘴',
|
1529 |
+
'T': '𝓽',
|
1530 |
+
'U': 'ꪊ',
|
1531 |
+
'V': 'ꪜ',
|
1532 |
+
'W': '᭙',
|
1533 |
+
'X': '᥊',
|
1534 |
+
'Y': 'ꪗ',
|
1535 |
+
'Z': 'ɀ'
|
1536 |
+
}
|
1537 |
+
for i, j in style.items():
|
1538 |
+
text = text.replace(i, j)
|
1539 |
+
return text
|
1540 |
+
|
1541 |
+
def manga(text):
|
1542 |
+
style = {
|
1543 |
+
'a': '卂',
|
1544 |
+
'b': '乃',
|
1545 |
+
'c': '匚',
|
1546 |
+
'd': 'ᗪ',
|
1547 |
+
'e': '乇',
|
1548 |
+
'f': '千',
|
1549 |
+
'g': 'ᘜ',
|
1550 |
+
'h': '卄',
|
1551 |
+
'i': '|',
|
1552 |
+
'j': 'フ',
|
1553 |
+
'k': 'Ҝ',
|
1554 |
+
'l': 'ㄥ',
|
1555 |
+
'm': '爪',
|
1556 |
+
'n': '几',
|
1557 |
+
'o': 'ㄖ',
|
1558 |
+
'p': '卩',
|
1559 |
+
'q': 'Ҩ',
|
1560 |
+
'r': '尺',
|
1561 |
+
's': '丂',
|
1562 |
+
't': 'ㄒ',
|
1563 |
+
'u': 'ㄩ',
|
1564 |
+
'v': 'ᐯ',
|
1565 |
+
'w': '山',
|
1566 |
+
'x': '乂',
|
1567 |
+
'y': 'ㄚ',
|
1568 |
+
'z': '乙',
|
1569 |
+
'A': '卂',
|
1570 |
+
'B': '乃',
|
1571 |
+
'C': '匚',
|
1572 |
+
'D': 'ᗪ',
|
1573 |
+
'E': '乇',
|
1574 |
+
'F': '千',
|
1575 |
+
'G': 'ᘜ',
|
1576 |
+
'H': '卄',
|
1577 |
+
'I': '|',
|
1578 |
+
'J': 'フ',
|
1579 |
+
'K': 'Ҝ',
|
1580 |
+
'L': 'ㄥ',
|
1581 |
+
'M': '爪',
|
1582 |
+
'N': '几',
|
1583 |
+
'O': 'ㄖ',
|
1584 |
+
'P': '卩',
|
1585 |
+
'Q': 'Ҩ',
|
1586 |
+
'R': '尺',
|
1587 |
+
'S': '丂',
|
1588 |
+
'T': 'ㄒ',
|
1589 |
+
'U': 'ㄩ',
|
1590 |
+
'V': 'ᐯ',
|
1591 |
+
'W': '山',
|
1592 |
+
'X': '乂',
|
1593 |
+
'Y': 'ㄚ',
|
1594 |
+
'Z': '乙'
|
1595 |
+
}
|
1596 |
+
for i, j in style.items():
|
1597 |
+
text = text.replace(i, j)
|
1598 |
+
return text
|
1599 |
+
|
1600 |
+
def stinky(text):
|
1601 |
+
style = {
|
1602 |
+
'a': 'a̾',
|
1603 |
+
'b': 'b̾',
|
1604 |
+
'c': 'c̾',
|
1605 |
+
'd': 'd̾',
|
1606 |
+
'e': 'e̾',
|
1607 |
+
'f': 'f̾',
|
1608 |
+
'g': 'g̾',
|
1609 |
+
'h': 'h̾',
|
1610 |
+
'i': 'i̾',
|
1611 |
+
'j': 'j̾',
|
1612 |
+
'k': 'k̾',
|
1613 |
+
'l': 'l̾',
|
1614 |
+
'm': 'm̾',
|
1615 |
+
'n': 'n̾',
|
1616 |
+
'o': 'o̾',
|
1617 |
+
'p': 'p̾',
|
1618 |
+
'q': 'q̾',
|
1619 |
+
'r': 'r̾',
|
1620 |
+
's': 's̾',
|
1621 |
+
't': 't̾',
|
1622 |
+
'u': 'u̾',
|
1623 |
+
'v': 'v̾',
|
1624 |
+
'w': 'w̾',
|
1625 |
+
'x': 'x̾',
|
1626 |
+
'y': 'y̾',
|
1627 |
+
'z': 'z̾',
|
1628 |
+
'A': 'A̾',
|
1629 |
+
'B': 'B̾',
|
1630 |
+
'C': 'C̾',
|
1631 |
+
'D': 'D̾',
|
1632 |
+
'E': 'E̾',
|
1633 |
+
'F': 'F̾',
|
1634 |
+
'G': 'G̾',
|
1635 |
+
'H': 'H̾',
|
1636 |
+
'I': 'I̾',
|
1637 |
+
'J': 'J̾',
|
1638 |
+
'K': 'K̾',
|
1639 |
+
'L': 'L̾',
|
1640 |
+
'M': 'M̾',
|
1641 |
+
'N': 'N̾',
|
1642 |
+
'O': 'O̾',
|
1643 |
+
'P': 'P̾',
|
1644 |
+
'Q': 'Q̾',
|
1645 |
+
'R': 'R̾',
|
1646 |
+
'S': 'S̾',
|
1647 |
+
'T': 'T̾',
|
1648 |
+
'U': 'U̾',
|
1649 |
+
'V': 'V̾',
|
1650 |
+
'W': 'W̾',
|
1651 |
+
'X': 'X̾',
|
1652 |
+
'Y': 'Y̾',
|
1653 |
+
'Z': 'Z̾'
|
1654 |
+
}
|
1655 |
+
for i, j in style.items():
|
1656 |
+
text = text.replace(i, j)
|
1657 |
+
return text
|
1658 |
+
|
1659 |
+
def bubbles(text):
|
1660 |
+
style = {
|
1661 |
+
'a': 'ḁͦ',
|
1662 |
+
'b': 'b̥ͦ',
|
1663 |
+
'c': 'c̥ͦ',
|
1664 |
+
'd': 'd̥ͦ',
|
1665 |
+
'e': 'e̥ͦ',
|
1666 |
+
'f': 'f̥ͦ',
|
1667 |
+
'g': 'g̥ͦ',
|
1668 |
+
'h': 'h̥ͦ',
|
1669 |
+
'i': 'i̥ͦ',
|
1670 |
+
'j': 'j̥ͦ',
|
1671 |
+
'k': 'k̥ͦ',
|
1672 |
+
'l': 'l̥ͦ',
|
1673 |
+
'm': 'm̥ͦ',
|
1674 |
+
'n': 'n̥ͦ',
|
1675 |
+
'o': 'o̥ͦ',
|
1676 |
+
'p': 'p̥ͦ',
|
1677 |
+
'q': 'q̥ͦ',
|
1678 |
+
'r': 'r̥ͦ',
|
1679 |
+
's': 's̥ͦ',
|
1680 |
+
't': 't̥ͦ',
|
1681 |
+
'u': 'u̥ͦ',
|
1682 |
+
'v': 'v̥ͦ',
|
1683 |
+
'w': 'w̥ͦ',
|
1684 |
+
'x': 'x̥ͦ',
|
1685 |
+
'y': 'y̥ͦ',
|
1686 |
+
'z': 'z̥ͦ',
|
1687 |
+
'A': 'Ḁͦ',
|
1688 |
+
'B': 'B̥ͦ',
|
1689 |
+
'C': 'C̥ͦ',
|
1690 |
+
'D': 'D̥ͦ',
|
1691 |
+
'E': 'E̥ͦ',
|
1692 |
+
'F': 'F̥ͦ',
|
1693 |
+
'G': 'G̥ͦ',
|
1694 |
+
'H': 'H̥ͦ',
|
1695 |
+
'I': 'I̥ͦ',
|
1696 |
+
'J': 'J̥ͦ',
|
1697 |
+
'K': 'K̥ͦ',
|
1698 |
+
'L': 'L̥ͦ',
|
1699 |
+
'M': 'M̥ͦ',
|
1700 |
+
'N': 'N̥ͦ',
|
1701 |
+
'O': 'O̥ͦ',
|
1702 |
+
'P': 'P̥ͦ',
|
1703 |
+
'Q': 'Q̥ͦ',
|
1704 |
+
'R': 'R̥ͦ',
|
1705 |
+
'S': 'S̥ͦ',
|
1706 |
+
'T': 'T̥ͦ',
|
1707 |
+
'U': 'U̥ͦ',
|
1708 |
+
'V': 'V̥ͦ',
|
1709 |
+
'W': 'W̥ͦ',
|
1710 |
+
'X': 'X̥ͦ',
|
1711 |
+
'Y': 'Y̥ͦ',
|
1712 |
+
'Z': 'Z̥ͦ'
|
1713 |
+
}
|
1714 |
+
for i, j in style.items():
|
1715 |
+
text = text.replace(i, j)
|
1716 |
+
return text
|
1717 |
+
|
1718 |
+
def underline(text):
|
1719 |
+
style = {
|
1720 |
+
'a': 'a͟',
|
1721 |
+
'b': 'b͟',
|
1722 |
+
'c': 'c͟',
|
1723 |
+
'd': 'd͟',
|
1724 |
+
'e': 'e͟',
|
1725 |
+
'f': 'f͟',
|
1726 |
+
'g': 'g͟',
|
1727 |
+
'h': 'h͟',
|
1728 |
+
'i': 'i͟',
|
1729 |
+
'j': 'j͟',
|
1730 |
+
'k': 'k͟',
|
1731 |
+
'l': 'l͟',
|
1732 |
+
'm': 'm͟',
|
1733 |
+
'n': 'n͟',
|
1734 |
+
'o': 'o͟',
|
1735 |
+
'p': 'p͟',
|
1736 |
+
'q': 'q͟',
|
1737 |
+
'r': 'r͟',
|
1738 |
+
's': 's͟',
|
1739 |
+
't': 't͟',
|
1740 |
+
'u': 'u͟',
|
1741 |
+
'v': 'v͟',
|
1742 |
+
'w': 'w͟',
|
1743 |
+
'x': 'x͟',
|
1744 |
+
'y': 'y͟',
|
1745 |
+
'z': 'z͟',
|
1746 |
+
'A': 'A͟',
|
1747 |
+
'B': 'B͟',
|
1748 |
+
'C': 'C͟',
|
1749 |
+
'D': 'D͟',
|
1750 |
+
'E': 'E͟',
|
1751 |
+
'F': 'F͟',
|
1752 |
+
'G': 'G͟',
|
1753 |
+
'H': 'H͟',
|
1754 |
+
'I': 'I͟',
|
1755 |
+
'J': 'J͟',
|
1756 |
+
'K': 'K͟',
|
1757 |
+
'L': 'L͟',
|
1758 |
+
'M': 'M͟',
|
1759 |
+
'N': 'N͟',
|
1760 |
+
'O': 'O͟',
|
1761 |
+
'P': 'P͟',
|
1762 |
+
'Q': 'Q͟',
|
1763 |
+
'R': 'R͟',
|
1764 |
+
'S': 'S͟',
|
1765 |
+
'T': 'T͟',
|
1766 |
+
'U': 'U͟',
|
1767 |
+
'V': 'V͟',
|
1768 |
+
'W': 'W͟',
|
1769 |
+
'X': 'X͟',
|
1770 |
+
'Y': 'Y͟',
|
1771 |
+
'Z': 'Z͟'
|
1772 |
+
}
|
1773 |
+
for i, j in style.items():
|
1774 |
+
text = text.replace(i, j)
|
1775 |
+
return text
|
1776 |
+
|
1777 |
+
def ladybug(text):
|
1778 |
+
style = {
|
1779 |
+
'a': 'ꍏ',
|
1780 |
+
'b': 'ꌃ',
|
1781 |
+
'c': 'ꏳ',
|
1782 |
+
'd': 'ꀷ',
|
1783 |
+
'e': 'ꏂ',
|
1784 |
+
'f': 'ꎇ',
|
1785 |
+
'g': 'ꁅ',
|
1786 |
+
'h': 'ꀍ',
|
1787 |
+
'i': 'ꀤ',
|
1788 |
+
'j': '꒻',
|
1789 |
+
'k': 'ꀘ',
|
1790 |
+
'l': '꒒',
|
1791 |
+
'm': 'ꎭ',
|
1792 |
+
'n': 'ꈤ',
|
1793 |
+
'o': 'ꂦ',
|
1794 |
+
'p': 'ᖘ',
|
1795 |
+
'q': 'ꆰ',
|
1796 |
+
'r': 'ꋪ',
|
1797 |
+
's': 'ꌚ',
|
1798 |
+
't': '꓄',
|
1799 |
+
'u': 'ꀎ',
|
1800 |
+
'v': '꒦',
|
1801 |
+
'w': 'ꅐ',
|
1802 |
+
'x': 'ꉧ',
|
1803 |
+
'y': 'ꌩ',
|
1804 |
+
'z': 'ꁴ',
|
1805 |
+
'A': 'ꍏ',
|
1806 |
+
'B': 'ꌃ',
|
1807 |
+
'C': 'ꏳ',
|
1808 |
+
'D': 'ꀷ',
|
1809 |
+
'E': 'ꏂ',
|
1810 |
+
'F': 'ꎇ',
|
1811 |
+
'G': 'ꁅ',
|
1812 |
+
'H': 'ꀍ',
|
1813 |
+
'I': 'ꀤ',
|
1814 |
+
'J': '꒻',
|
1815 |
+
'K': 'ꀘ',
|
1816 |
+
'L': '꒒',
|
1817 |
+
'M': 'ꎭ',
|
1818 |
+
'N': 'ꈤ',
|
1819 |
+
'O': 'ꂦ',
|
1820 |
+
'P': 'ᖘ',
|
1821 |
+
'Q': 'ꆰ',
|
1822 |
+
'R': 'ꋪ',
|
1823 |
+
'S': 'ꌚ',
|
1824 |
+
'T': '꓄',
|
1825 |
+
'U': 'ꀎ',
|
1826 |
+
'V': '꒦',
|
1827 |
+
'W': 'ꅐ',
|
1828 |
+
'X': 'ꉧ',
|
1829 |
+
'Y': 'ꌩ',
|
1830 |
+
'Z': 'ꁴ'
|
1831 |
+
}
|
1832 |
+
for i, j in style.items():
|
1833 |
+
text = text.replace(i, j)
|
1834 |
+
return text
|
1835 |
+
|
1836 |
+
def rays(text):
|
1837 |
+
style = {
|
1838 |
+
'a': 'a҉',
|
1839 |
+
'b': 'b҉',
|
1840 |
+
'c': 'c҉',
|
1841 |
+
'd': 'd҉',
|
1842 |
+
'e': 'e҉',
|
1843 |
+
'f': 'f҉',
|
1844 |
+
'g': 'g҉',
|
1845 |
+
'h': 'h҉',
|
1846 |
+
'i': 'i҉',
|
1847 |
+
'j': 'j҉',
|
1848 |
+
'k': 'k҉',
|
1849 |
+
'l': 'l҉',
|
1850 |
+
'm': 'm҉',
|
1851 |
+
'n': 'n҉',
|
1852 |
+
'o': 'o҉',
|
1853 |
+
'p': 'p҉',
|
1854 |
+
'q': 'q҉',
|
1855 |
+
'r': 'r҉',
|
1856 |
+
's': 's҉',
|
1857 |
+
't': 't҉',
|
1858 |
+
'u': 'u҉',
|
1859 |
+
'v': 'v҉',
|
1860 |
+
'w': 'w҉',
|
1861 |
+
'x': 'x҉',
|
1862 |
+
'y': 'y҉',
|
1863 |
+
'z': 'z҉',
|
1864 |
+
'A': 'A҉',
|
1865 |
+
'B': 'B҉',
|
1866 |
+
'C': 'C҉',
|
1867 |
+
'D': 'D҉',
|
1868 |
+
'E': 'E҉',
|
1869 |
+
'F': 'F҉',
|
1870 |
+
'G': 'G҉',
|
1871 |
+
'H': 'H҉',
|
1872 |
+
'I': 'I҉',
|
1873 |
+
'J': 'J҉',
|
1874 |
+
'K': 'K҉',
|
1875 |
+
'L': 'L҉',
|
1876 |
+
'M': 'M҉',
|
1877 |
+
'N': 'N҉',
|
1878 |
+
'O': 'O҉',
|
1879 |
+
'P': 'P҉',
|
1880 |
+
'Q': 'Q҉',
|
1881 |
+
'R': 'R҉',
|
1882 |
+
'S': 'S҉',
|
1883 |
+
'T': 'T҉',
|
1884 |
+
'U': 'U҉',
|
1885 |
+
'V': 'V҉',
|
1886 |
+
'W': 'W҉',
|
1887 |
+
'X': 'X҉',
|
1888 |
+
'Y': 'Y҉',
|
1889 |
+
'Z': 'Z҉'
|
1890 |
+
}
|
1891 |
+
for i, j in style.items():
|
1892 |
+
text = text.replace(i, j)
|
1893 |
+
return text
|
1894 |
+
|
1895 |
+
def birds(text):
|
1896 |
+
style = {
|
1897 |
+
'a': 'a҈',
|
1898 |
+
'b': 'b҈',
|
1899 |
+
'c': 'c҈',
|
1900 |
+
'd': 'd҈',
|
1901 |
+
'e': 'e҈',
|
1902 |
+
'f': 'f҈',
|
1903 |
+
'g': 'g҈',
|
1904 |
+
'h': 'h҈',
|
1905 |
+
'i': 'i҈',
|
1906 |
+
'j': 'j҈',
|
1907 |
+
'k': 'k҈',
|
1908 |
+
'l': 'l҈',
|
1909 |
+
'm': 'm҈',
|
1910 |
+
'n': 'n҈',
|
1911 |
+
'o': 'o҈',
|
1912 |
+
'p': 'p҈',
|
1913 |
+
'q': 'q҈',
|
1914 |
+
'r': 'r҈',
|
1915 |
+
's': 's҈',
|
1916 |
+
't': 't҈',
|
1917 |
+
'u': 'u҈',
|
1918 |
+
'v': 'v҈',
|
1919 |
+
'w': 'w҈',
|
1920 |
+
'x': 'x҈',
|
1921 |
+
'y': 'y҈',
|
1922 |
+
'z': 'z҈',
|
1923 |
+
'A': 'A҈',
|
1924 |
+
'B': 'B҈',
|
1925 |
+
'C': 'C҈',
|
1926 |
+
'D': 'D҈',
|
1927 |
+
'E': 'E҈',
|
1928 |
+
'F': 'F҈',
|
1929 |
+
'G': 'G҈',
|
1930 |
+
'H': 'H҈',
|
1931 |
+
'I': 'I҈',
|
1932 |
+
'J': 'J҈',
|
1933 |
+
'K': 'K҈',
|
1934 |
+
'L': 'L҈',
|
1935 |
+
'M': 'M҈',
|
1936 |
+
'N': 'N҈',
|
1937 |
+
'O': 'O҈',
|
1938 |
+
'P': 'P҈',
|
1939 |
+
'Q': 'Q҈',
|
1940 |
+
'R': 'R҈',
|
1941 |
+
'S': 'S҈',
|
1942 |
+
'T': 'T҈',
|
1943 |
+
'U': 'U҈',
|
1944 |
+
'V': 'V҈',
|
1945 |
+
'W': 'W҈',
|
1946 |
+
'X': 'X҈',
|
1947 |
+
'Y': 'Y҈',
|
1948 |
+
'Z': 'Z҈'
|
1949 |
+
}
|
1950 |
+
for i, j in style.items():
|
1951 |
+
text = text.replace(i, j)
|
1952 |
+
return text
|
1953 |
+
|
1954 |
+
def slash(text):
|
1955 |
+
style = {
|
1956 |
+
'a': 'a̸',
|
1957 |
+
'b': 'b̸',
|
1958 |
+
'c': 'c̸',
|
1959 |
+
'd': 'd̸',
|
1960 |
+
'e': 'e̸',
|
1961 |
+
'f': 'f̸',
|
1962 |
+
'g': 'g̸',
|
1963 |
+
'h': 'h̸',
|
1964 |
+
'i': 'i̸',
|
1965 |
+
'j': 'j̸',
|
1966 |
+
'k': 'k̸',
|
1967 |
+
'l': 'l̸',
|
1968 |
+
'm': 'm̸',
|
1969 |
+
'n': 'n̸',
|
1970 |
+
'o': 'o̸',
|
1971 |
+
'p': 'p̸',
|
1972 |
+
'q': 'q̸',
|
1973 |
+
'r': 'r̸',
|
1974 |
+
's': 's̸',
|
1975 |
+
't': 't̸',
|
1976 |
+
'u': 'u̸',
|
1977 |
+
'v': 'v̸',
|
1978 |
+
'w': 'w̸',
|
1979 |
+
'x': 'x̸',
|
1980 |
+
'y': 'y̸',
|
1981 |
+
'z': 'z̸',
|
1982 |
+
'A': 'A̸',
|
1983 |
+
'B': 'B̸',
|
1984 |
+
'C': 'C̸',
|
1985 |
+
'D': 'D̸',
|
1986 |
+
'E': 'E̸',
|
1987 |
+
'F': 'F̸',
|
1988 |
+
'G': 'G̸',
|
1989 |
+
'H': 'H̸',
|
1990 |
+
'I': 'I̸',
|
1991 |
+
'J': 'J̸',
|
1992 |
+
'K': 'K̸',
|
1993 |
+
'L': 'L̸',
|
1994 |
+
'M': 'M̸',
|
1995 |
+
'N': 'N̸',
|
1996 |
+
'O': 'O̸',
|
1997 |
+
'P': 'P̸',
|
1998 |
+
'Q': 'Q̸',
|
1999 |
+
'R': 'R̸',
|
2000 |
+
'S': 'S̸',
|
2001 |
+
'T': 'T̸',
|
2002 |
+
'U': 'U̸',
|
2003 |
+
'V': 'V̸',
|
2004 |
+
'W': 'W̸',
|
2005 |
+
'X': 'X̸',
|
2006 |
+
'Y': 'Y̸',
|
2007 |
+
'Z': 'Z̸'
|
2008 |
+
}
|
2009 |
+
for i, j in style.items():
|
2010 |
+
text = text.replace(i, j)
|
2011 |
+
return text
|
2012 |
+
|
2013 |
+
def stop(text):
|
2014 |
+
style = {
|
2015 |
+
'a': 'a⃠',
|
2016 |
+
'b': 'b⃠',
|
2017 |
+
'c': 'c⃠',
|
2018 |
+
'd': 'd⃠',
|
2019 |
+
'e': 'e⃠',
|
2020 |
+
'f': 'f⃠',
|
2021 |
+
'g': 'g⃠',
|
2022 |
+
'h': 'h⃠',
|
2023 |
+
'i': 'i⃠',
|
2024 |
+
'j': 'j⃠',
|
2025 |
+
'k': 'k⃠',
|
2026 |
+
'l': 'l⃠',
|
2027 |
+
'm': 'm⃠',
|
2028 |
+
'n': 'n⃠',
|
2029 |
+
'o': 'o⃠',
|
2030 |
+
'p': 'p⃠',
|
2031 |
+
'q': 'q⃠',
|
2032 |
+
'r': 'r⃠',
|
2033 |
+
's': 's⃠',
|
2034 |
+
't': 't⃠',
|
2035 |
+
'u': 'u⃠',
|
2036 |
+
'v': 'v⃠',
|
2037 |
+
'w': 'w⃠',
|
2038 |
+
'x': 'x⃠',
|
2039 |
+
'y': 'y⃠',
|
2040 |
+
'z': 'z⃠',
|
2041 |
+
'A': 'A⃠',
|
2042 |
+
'B': 'B⃠',
|
2043 |
+
'C': 'C⃠',
|
2044 |
+
'D': 'D⃠',
|
2045 |
+
'E': 'E⃠',
|
2046 |
+
'F': 'F⃠',
|
2047 |
+
'G': 'G⃠',
|
2048 |
+
'H': 'H⃠',
|
2049 |
+
'I': 'I⃠',
|
2050 |
+
'J': 'J⃠',
|
2051 |
+
'K': 'K⃠',
|
2052 |
+
'L': 'L⃠',
|
2053 |
+
'M': 'M⃠',
|
2054 |
+
'N': 'N⃠',
|
2055 |
+
'O': 'O⃠',
|
2056 |
+
'P': 'P⃠',
|
2057 |
+
'Q': 'Q⃠',
|
2058 |
+
'R': 'R⃠',
|
2059 |
+
'S': 'S⃠',
|
2060 |
+
'T': 'T⃠',
|
2061 |
+
'U': 'U⃠',
|
2062 |
+
'V': 'V⃠',
|
2063 |
+
'W': 'W⃠',
|
2064 |
+
'X': 'X⃠',
|
2065 |
+
'Y': 'Y⃠',
|
2066 |
+
'Z': 'Z⃠'
|
2067 |
+
}
|
2068 |
+
for i, j in style.items():
|
2069 |
+
text = text.replace(i, j)
|
2070 |
+
return text
|
2071 |
+
|
2072 |
+
def skyline(text):
|
2073 |
+
style = {
|
2074 |
+
'a': 'a̺͆',
|
2075 |
+
'b': 'b̺͆',
|
2076 |
+
'c': 'c̺͆',
|
2077 |
+
'd': 'd̺͆',
|
2078 |
+
'e': 'e̺͆',
|
2079 |
+
'f': 'f̺͆',
|
2080 |
+
'g': 'g̺͆',
|
2081 |
+
'h': 'h̺͆',
|
2082 |
+
'i': 'i̺͆',
|
2083 |
+
'j': 'j̺͆',
|
2084 |
+
'k': 'k̺͆',
|
2085 |
+
'l': 'l̺͆',
|
2086 |
+
'm': 'm̺͆',
|
2087 |
+
'n': 'n̺͆',
|
2088 |
+
'o': 'o̺͆',
|
2089 |
+
'p': 'p̺͆',
|
2090 |
+
'q': 'q̺͆',
|
2091 |
+
'r': 'r̺͆',
|
2092 |
+
's': 's̺͆',
|
2093 |
+
't': 't̺͆',
|
2094 |
+
'u': 'u̺͆',
|
2095 |
+
'v': 'v̺͆',
|
2096 |
+
'w': 'w̺͆',
|
2097 |
+
'x': 'x̺͆',
|
2098 |
+
'y': 'y̺͆',
|
2099 |
+
'z': 'z̺͆',
|
2100 |
+
'A': 'A̺͆',
|
2101 |
+
'B': 'B̺͆',
|
2102 |
+
'C': 'C̺͆',
|
2103 |
+
'D': 'D̺͆',
|
2104 |
+
'E': 'E̺͆',
|
2105 |
+
'F': 'F̺͆',
|
2106 |
+
'G': 'G̺͆',
|
2107 |
+
'H': 'H̺͆',
|
2108 |
+
'I': 'I̺͆',
|
2109 |
+
'J': 'J̺͆',
|
2110 |
+
'K': 'K̺͆',
|
2111 |
+
'L': 'L̺͆',
|
2112 |
+
'M': 'M̺͆',
|
2113 |
+
'N': 'N̺͆',
|
2114 |
+
'O': 'O̺͆',
|
2115 |
+
'P': 'P̺͆',
|
2116 |
+
'Q': 'Q̺͆',
|
2117 |
+
'R': 'R̺͆',
|
2118 |
+
'S': 'S̺͆',
|
2119 |
+
'T': 'T̺͆',
|
2120 |
+
'U': 'U̺͆',
|
2121 |
+
'V': 'V̺͆',
|
2122 |
+
'W': 'W̺͆',
|
2123 |
+
'X': 'X̺͆',
|
2124 |
+
'Y': 'Y̺͆',
|
2125 |
+
'Z': 'Z̺͆'
|
2126 |
+
}
|
2127 |
+
for i, j in style.items():
|
2128 |
+
text = text.replace(i, j)
|
2129 |
+
return text
|
2130 |
+
|
2131 |
+
def arrows(text):
|
2132 |
+
style = {
|
2133 |
+
'a': 'a͎',
|
2134 |
+
'b': 'b͎',
|
2135 |
+
'c': 'c͎',
|
2136 |
+
'd': 'd͎',
|
2137 |
+
'e': 'e͎',
|
2138 |
+
'f': 'f͎',
|
2139 |
+
'g': 'g͎',
|
2140 |
+
'h': 'h͎',
|
2141 |
+
'i': 'i͎',
|
2142 |
+
'j': 'j͎',
|
2143 |
+
'k': 'k͎',
|
2144 |
+
'l': 'l͎',
|
2145 |
+
'm': 'm͎',
|
2146 |
+
'n': 'n͎',
|
2147 |
+
'o': 'o͎',
|
2148 |
+
'p': 'p͎',
|
2149 |
+
'q': 'q͎',
|
2150 |
+
'r': 'r͎',
|
2151 |
+
's': 's͎',
|
2152 |
+
't': 't͎',
|
2153 |
+
'u': 'u͎',
|
2154 |
+
'v': 'v͎',
|
2155 |
+
'w': 'w͎',
|
2156 |
+
'x': 'x͎',
|
2157 |
+
'y': 'y͎',
|
2158 |
+
'z': 'z͎',
|
2159 |
+
'A': 'A͎',
|
2160 |
+
'B': 'B͎',
|
2161 |
+
'C': 'C͎',
|
2162 |
+
'D': 'D͎',
|
2163 |
+
'E': 'E͎',
|
2164 |
+
'F': 'F͎',
|
2165 |
+
'G': 'G͎',
|
2166 |
+
'H': 'H͎',
|
2167 |
+
'I': 'I͎',
|
2168 |
+
'J': 'J͎',
|
2169 |
+
'K': 'K͎',
|
2170 |
+
'L': 'L͎',
|
2171 |
+
'M': 'M͎',
|
2172 |
+
'N': 'N͎',
|
2173 |
+
'O': 'O͎',
|
2174 |
+
'P': 'P͎',
|
2175 |
+
'Q': 'Q͎',
|
2176 |
+
'R': 'R͎',
|
2177 |
+
'S': 'S͎',
|
2178 |
+
'T': 'T͎',
|
2179 |
+
'U': 'U͎',
|
2180 |
+
'V': 'V͎',
|
2181 |
+
'W': 'W͎',
|
2182 |
+
'X': 'X͎',
|
2183 |
+
'Y': 'Y͎',
|
2184 |
+
'Z': 'Z͎'
|
2185 |
+
}
|
2186 |
+
for i, j in style.items():
|
2187 |
+
text = text.replace(i, j)
|
2188 |
+
return text
|
2189 |
+
|
2190 |
+
def rvnes(text):
|
2191 |
+
style = {
|
2192 |
+
'a': 'ል',
|
2193 |
+
'b': 'ጌ',
|
2194 |
+
'c': 'ር',
|
2195 |
+
'd': 'ዕ',
|
2196 |
+
'e': 'ቿ',
|
2197 |
+
'f': 'ቻ',
|
2198 |
+
'g': 'ኗ',
|
2199 |
+
'h': 'ዘ',
|
2200 |
+
'i': 'ጎ',
|
2201 |
+
'j': 'ጋ',
|
2202 |
+
'k': 'ጕ',
|
2203 |
+
'l': 'ረ',
|
2204 |
+
'm': 'ጠ',
|
2205 |
+
'n': 'ክ',
|
2206 |
+
'o': 'ዐ',
|
2207 |
+
'p': 'የ',
|
2208 |
+
'q': 'ዒ',
|
2209 |
+
'r': 'ዪ',
|
2210 |
+
's': 'ነ',
|
2211 |
+
't': 'ፕ',
|
2212 |
+
'u': 'ሁ',
|
2213 |
+
'v': 'ሀ',
|
2214 |
+
'w': 'ሠ',
|
2215 |
+
'x': 'ሸ',
|
2216 |
+
'y': 'ሃ',
|
2217 |
+
'z': 'ጊ',
|
2218 |
+
'A': 'ል',
|
2219 |
+
'B': 'ጌ',
|
2220 |
+
'C': 'ር',
|
2221 |
+
'D': 'ዕ',
|
2222 |
+
'E': 'ቿ',
|
2223 |
+
'F': 'ቻ',
|
2224 |
+
'G': 'ኗ',
|
2225 |
+
'H': 'ዘ',
|
2226 |
+
'I': 'ጎ',
|
2227 |
+
'J': 'ጋ',
|
2228 |
+
'K': 'ጕ',
|
2229 |
+
'L': 'ረ',
|
2230 |
+
'M': 'ጠ',
|
2231 |
+
'N': 'ክ',
|
2232 |
+
'O': 'ዐ',
|
2233 |
+
'P': 'የ',
|
2234 |
+
'Q': 'ዒ',
|
2235 |
+
'R': 'ዪ',
|
2236 |
+
'S': 'ነ',
|
2237 |
+
'T': 'ፕ',
|
2238 |
+
'U': 'ሁ',
|
2239 |
+
'V': 'ሀ',
|
2240 |
+
'W': 'ሠ',
|
2241 |
+
'X': 'ሸ',
|
2242 |
+
'Y': 'ሃ',
|
2243 |
+
'Z': 'ጊ'
|
2244 |
+
}
|
2245 |
+
for i, j in style.items():
|
2246 |
+
text = text.replace(i, j)
|
2247 |
+
return text
|
2248 |
+
|
2249 |
+
def strike(text):
|
2250 |
+
style = {
|
2251 |
+
'a': 'a̶',
|
2252 |
+
'b': 'b̶',
|
2253 |
+
'c': 'c̶',
|
2254 |
+
'd': 'd̶',
|
2255 |
+
'e': 'e̶',
|
2256 |
+
'f': 'f̶',
|
2257 |
+
'g': 'g̶',
|
2258 |
+
'h': 'h̶',
|
2259 |
+
'i': 'i̶',
|
2260 |
+
'j': 'j̶',
|
2261 |
+
'k': 'k̶',
|
2262 |
+
'l': 'l̶',
|
2263 |
+
'm': 'm̶',
|
2264 |
+
'n': 'n̶',
|
2265 |
+
'o': 'o̶',
|
2266 |
+
'p': 'p̶',
|
2267 |
+
'q': 'q̶',
|
2268 |
+
'r': 'r̶',
|
2269 |
+
's': 's̶',
|
2270 |
+
't': 't̶',
|
2271 |
+
'u': 'u̶',
|
2272 |
+
'v': 'v̶',
|
2273 |
+
'w': 'w̶',
|
2274 |
+
'x': 'x̶',
|
2275 |
+
'y': 'y̶',
|
2276 |
+
'z': 'z̶',
|
2277 |
+
'A': 'A̶',
|
2278 |
+
'B': 'B̶',
|
2279 |
+
'C': 'C̶',
|
2280 |
+
'D': 'D̶',
|
2281 |
+
'E': 'E̶',
|
2282 |
+
'F': 'F̶',
|
2283 |
+
'G': 'G̶',
|
2284 |
+
'H': 'H̶',
|
2285 |
+
'I': 'I̶',
|
2286 |
+
'J': 'J̶',
|
2287 |
+
'K': 'K̶',
|
2288 |
+
'L': 'L̶',
|
2289 |
+
'M': 'M̶',
|
2290 |
+
'N': 'N̶',
|
2291 |
+
'O': 'O̶',
|
2292 |
+
'P': 'P̶',
|
2293 |
+
'Q': 'Q̶',
|
2294 |
+
'R': 'R̶',
|
2295 |
+
'S': 'S̶',
|
2296 |
+
'T': 'T̶',
|
2297 |
+
'U': 'U̶',
|
2298 |
+
'V': 'V̶',
|
2299 |
+
'W': 'W̶',
|
2300 |
+
'X': 'X̶',
|
2301 |
+
'Y': 'Y̶',
|
2302 |
+
'Z': 'Z̶'
|
2303 |
+
}
|
2304 |
+
for i, j in style.items():
|
2305 |
+
text = text.replace(i, j)
|
2306 |
+
return text
|
2307 |
+
|
2308 |
+
def frozen(text):
|
2309 |
+
style = {
|
2310 |
+
'a': 'a༙',
|
2311 |
+
'b': 'b༙',
|
2312 |
+
'c': 'c༙',
|
2313 |
+
'd': 'd༙',
|
2314 |
+
'e': 'e༙',
|
2315 |
+
'f': 'f༙',
|
2316 |
+
'g': 'g༙',
|
2317 |
+
'h': 'h༙',
|
2318 |
+
'i': 'i༙',
|
2319 |
+
'j': 'j༙',
|
2320 |
+
'k': 'k༙',
|
2321 |
+
'l': 'l༙',
|
2322 |
+
'm': 'm༙',
|
2323 |
+
'n': 'n༙',
|
2324 |
+
'o': 'o༙',
|
2325 |
+
'p': 'p༙',
|
2326 |
+
'q': 'q༙',
|
2327 |
+
'r': 'r༙',
|
2328 |
+
's': 's༙',
|
2329 |
+
't': 't༙',
|
2330 |
+
'u': 'u༙',
|
2331 |
+
'v': 'v༙',
|
2332 |
+
'w': 'w༙',
|
2333 |
+
'x': 'x༙',
|
2334 |
+
'y': 'y༙',
|
2335 |
+
'z': 'z༙',
|
2336 |
+
'A': 'A༙',
|
2337 |
+
'B': 'B༙',
|
2338 |
+
'C': 'C༙',
|
2339 |
+
'D': 'D༙',
|
2340 |
+
'E': 'E༙',
|
2341 |
+
'F': 'F༙',
|
2342 |
+
'G': 'G༙',
|
2343 |
+
'H': 'H༙',
|
2344 |
+
'I': 'I༙',
|
2345 |
+
'J': 'J༙',
|
2346 |
+
'K': 'K༙',
|
2347 |
+
'L': 'L༙',
|
2348 |
+
'M': 'M༙',
|
2349 |
+
'N': 'N༙',
|
2350 |
+
'O': 'O༙',
|
2351 |
+
'P': 'P༙',
|
2352 |
+
'Q': 'Q༙',
|
2353 |
+
'R': 'R༙',
|
2354 |
+
'S': 'S༙',
|
2355 |
+
'T': 'T༙',
|
2356 |
+
'U': 'U༙',
|
2357 |
+
'V': 'V༙',
|
2358 |
+
'W': 'W༙',
|
2359 |
+
'X': 'X༙',
|
2360 |
+
'Y': 'Y༙',
|
2361 |
+
'Z': 'Z༙'
|
2362 |
+
}
|
2363 |
+
for i, j in style.items():
|
2364 |
+
text = text.replace(i, j)
|
2365 |
+
return text
|
info.py
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import re, time
|
2 |
+
from os import environ
|
3 |
+
from Script import script
|
4 |
+
|
5 |
+
id_pattern = re.compile(r'^.\d+$')
|
6 |
+
|
7 |
+
def is_enabled(value, default):
|
8 |
+
if value.strip().lower() in ["on", "true", "yes", "1", "enable", "y"]: return True
|
9 |
+
elif value.strip().lower() in ["off", "false", "no", "0", "disable", "n"]: return False
|
10 |
+
else: return default
|
11 |
+
|
12 |
+
|
13 |
+
# PyroClient Setup
|
14 |
+
API_ID = int(environ['API_ID'])
|
15 |
+
API_HASH = environ['API_HASH']
|
16 |
+
BOT_TOKEN = environ['BOT_TOKEN']
|
17 |
+
|
18 |
+
# Bot settings
|
19 |
+
WEB_SUPPORT = bool(environ.get("WEBHOOK", 'True')) # for web support on/off
|
20 |
+
PICS = (environ.get('PICS' ,'https://graph.org/file/01ddfcb1e8203879a63d7.jpg https://graph.org/file/d69995d9846fd4ad632b8.jpg https://graph.org/file/a125497b6b85a1d774394.jpg https://graph.org/file/43d26c54d37f4afb830f7.jpg https://graph.org/file/60c1adffc7cc2015f771c.jpg https://graph.org/file/d7b520240b00b7f083a24.jpg https://graph.org/file/0f336b0402db3f2a20037.jpg https://graph.org/file/39cc4e15cad4519d8e932.jpg https://graph.org/file/d59a1108b1ed1c6c6c144.jpg https://te.legra.ph/file/3a4a79f8d5955e64cbb8e.jpg https://graph.org/file/d69995d9846fd4ad632b8.jpg')).split()
|
21 |
+
UPTIME = time.time()
|
22 |
+
|
23 |
+
# Admins, Channels & Users
|
24 |
+
CACHE_TIME = int(environ.get('CACHE_TIME', 300))
|
25 |
+
ADMINS = [int(admin) if id_pattern.search(admin) else admin for admin in environ.get('ADMINS', '').split()]
|
26 |
+
CHANNELS = [int(ch) if id_pattern.search(ch) else ch for ch in environ.get('CHANNELS', '0').split()]
|
27 |
+
auth_users = [int(user) if id_pattern.search(user) else user for user in environ.get('AUTH_USERS', '').split()]
|
28 |
+
AUTH_USERS = (auth_users + ADMINS) if auth_users else []
|
29 |
+
auth_channel = environ.get('AUTH_CHANNEL')
|
30 |
+
auth_grp = environ.get('AUTH_GROUP')
|
31 |
+
AUTH_CHANNEL = int(auth_channel) if auth_channel and id_pattern.search(auth_channel) else None
|
32 |
+
AUTH_GROUPS = [int(ch) for ch in auth_grp.split()] if auth_grp else None
|
33 |
+
|
34 |
+
# MongoDB information
|
35 |
+
DATABASE_URL = environ.get('DATABASE_URL', "")
|
36 |
+
DATABASE_NAME = environ.get('DATABASE_NAME', "Cluster0")
|
37 |
+
FILE_DB_URL = environ.get("FILE_DB_URL", DATABASE_URL)
|
38 |
+
FILE_DB_NAME = environ.get("FILE_DB_NAME", DATABASE_NAME)
|
39 |
+
COLLECTION_NAME = environ.get('COLLECTION_NAME', 'Telegram_files')
|
40 |
+
|
41 |
+
# Filters Configuration
|
42 |
+
MAX_RIST_BTNS = int(environ.get('MAX_RIST_BTNS', "10"))
|
43 |
+
START_MESSAGE = environ.get('START_MESSAGE', script.START_TXT)
|
44 |
+
BUTTON_LOCK_TEXT = environ.get("BUTTON_LOCK_TEXT", script.BUTTON_LOCK_TEXT)
|
45 |
+
FORCE_SUB_TEXT = environ.get('FORCE_SUB_TEXT', script.FORCE_SUB_TEXT)
|
46 |
+
|
47 |
+
WELCOM_PIC = environ.get("WELCOM_PIC", "")
|
48 |
+
WELCOM_TEXT = environ.get("WELCOM_TEXT", script.WELCOM_TEXT)
|
49 |
+
PMFILTER = is_enabled(environ.get('PMFILTER', "True"), True)
|
50 |
+
G_FILTER = is_enabled(environ.get("G_FILTER", "True"), True)
|
51 |
+
BUTTON_LOCK = is_enabled(environ.get("BUTTON_LOCK", "True"), True)
|
52 |
+
RemoveBG_API = environ.get("RemoveBG_API", "")
|
53 |
+
|
54 |
+
# url shortner
|
55 |
+
SHORT_URL = environ.get("SHORT_URL")
|
56 |
+
SHORT_API = environ.get("SHORT_API")
|
57 |
+
|
58 |
+
# Others
|
59 |
+
IMDB_DELET_TIME = int(environ.get('IMDB_DELET_TIME', "300"))
|
60 |
+
LOG_CHANNEL = int(environ.get('LOG_CHANNEL', 0))
|
61 |
+
SUPPORT_CHAT = environ.get('SUPPORT_CHAT', 'MKN_BOTZ_DISCUSSION_GROUP')
|
62 |
+
P_TTI_SHOW_OFF = is_enabled(environ.get('P_TTI_SHOW_OFF', "True"), True)
|
63 |
+
PM_IMDB = is_enabled(environ.get('PM_IMDB', "True"), True)
|
64 |
+
IMDB = is_enabled(environ.get('IMDB', "True"), True)
|
65 |
+
SINGLE_BUTTON = is_enabled(environ.get('SINGLE_BUTTON', "True"), True)
|
66 |
+
CUSTOM_FILE_CAPTION = environ.get("CUSTOM_FILE_CAPTION", "{file_name}")
|
67 |
+
BATCH_FILE_CAPTION = environ.get("BATCH_FILE_CAPTION", None)
|
68 |
+
IMDB_TEMPLATE = environ.get("IMDB_TEMPLATE", script.IMDB_TEMPLATE)
|
69 |
+
LONG_IMDB_DESCRIPTION = is_enabled(environ.get("LONG_IMDB_DESCRIPTION", "False"), False)
|
70 |
+
SPELL_CHECK_REPLY = is_enabled(environ.get("SPELL_CHECK_REPLY", "True"), True)
|
71 |
+
MAX_LIST_ELM = environ.get("MAX_LIST_ELM", None)
|
72 |
+
FILE_STORE_CHANNEL = [int(ch) for ch in (environ.get('FILE_STORE_CHANNEL', '')).split()]
|
73 |
+
MELCOW_NEW_USERS = is_enabled(environ.get('MELCOW_NEW_USERS', "True"), True)
|
74 |
+
PROTECT_CONTENT = is_enabled(environ.get('PROTECT_CONTENT', "False"), False)
|
75 |
+
PUBLIC_FILE_STORE = is_enabled(environ.get('PUBLIC_FILE_STORE', "True"), True)
|
76 |
+
LOG_MSG = "{} Iꜱ Rᴇsᴛᴀʀᴛᴇᴅ....✨\n\n🗓️ Dᴀᴛᴇ : {}\n⏰ Tɪᴍᴇ : {}\n\n🖥️ Rᴇᴏᴩ: {}\n🉐 Vᴇʀsɪᴏɴ: {}\n🧾 Lɪᴄᴇɴꜱᴇ: {}\n©️ Cᴏᴩʏʀɪɢʜᴛ: {}"
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
|
logging.conf
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[loggers]
|
2 |
+
keys=root
|
3 |
+
|
4 |
+
[handlers]
|
5 |
+
keys=consoleHandler,fileHandler
|
6 |
+
|
7 |
+
[formatters]
|
8 |
+
keys=consoleFormatter,fileFormatter
|
9 |
+
|
10 |
+
[logger_root]
|
11 |
+
level=DEBUG
|
12 |
+
handlers=consoleHandler,fileHandler
|
13 |
+
|
14 |
+
[handler_consoleHandler]
|
15 |
+
class=StreamHandler
|
16 |
+
level=INFO
|
17 |
+
formatter=consoleFormatter
|
18 |
+
args=(sys.stdout,)
|
19 |
+
|
20 |
+
[handler_fileHandler]
|
21 |
+
class=FileHandler
|
22 |
+
level=INFO
|
23 |
+
formatter=fileFormatter
|
24 |
+
args=('BotLog.txt','w',)
|
25 |
+
|
26 |
+
[formatter_consoleFormatter]
|
27 |
+
format=%(asctime)s - %(lineno)d - %(name)s - %(module)s - %(levelname)s - %(message)s
|
28 |
+
datefmt=%I:%M:%S %p
|
29 |
+
|
30 |
+
[formatter_fileFormatter]
|
31 |
+
format=[%(asctime)s:%(name)s:%(lineno)d:%(levelname)s] %(message)s
|
32 |
+
datefmt=%m/%d/%Y %I:%M:%S %p
|
33 |
+
|
plugins/ExtraMods/carbon.py
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram import Client, filters
|
2 |
+
from pyrogram.types import *
|
3 |
+
from aiohttp import ClientSession
|
4 |
+
from telegraph import upload_file
|
5 |
+
from io import BytesIO
|
6 |
+
|
7 |
+
ai_client = ClientSession()
|
8 |
+
|
9 |
+
async def make_carbon(code, tele=False):
|
10 |
+
url = "https://carbonara.solopov.dev/api/cook"
|
11 |
+
async with ai_client.post(url, json={"code": code}) as resp:
|
12 |
+
image = BytesIO(await resp.read())
|
13 |
+
image.name = "carbon.png"
|
14 |
+
if tele:
|
15 |
+
uf = upload_file(image)
|
16 |
+
image.close()
|
17 |
+
return f"https://graph.org{uf[0]}"
|
18 |
+
return image
|
19 |
+
|
20 |
+
|
21 |
+
@Client.on_message(filters.command("carbon"))
|
22 |
+
async def carbon_func(b, message):
|
23 |
+
if not message.reply_to_message:
|
24 |
+
return await message.reply_text("ʀᴇᴘʟʏ ᴛᴏ ᴀ ᴛᴇxᴛ ᴍᴇssᴀɢᴇ ᴛᴏ ᴍᴀᴋᴇ ᴄᴀʀʙᴏɴ.")
|
25 |
+
if not message.reply_to_message.text:
|
26 |
+
return await message.reply_text("ʀᴇᴘʟʏ ᴛᴏ ᴀ ᴛᴇxᴛ ᴍᴇssᴀɢᴇ ᴛᴏ ᴍᴀᴋᴇ ᴄᴀʀʙᴏɴ.")
|
27 |
+
user_id = message.from_user.id
|
28 |
+
m = await message.reply_text("ᴘʀᴏᴄᴇssɪɴɢ...")
|
29 |
+
carbon = await make_carbon(message.reply_to_message.text)
|
30 |
+
await m.edit("ᴜᴘʟᴏᴀᴅɪɴɢ..")
|
31 |
+
await message.reply_photo(
|
32 |
+
photo=carbon,
|
33 |
+
caption="**ᴍᴀᴅᴇ ʙʏ: @mkn_bots_updates**",
|
34 |
+
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("ꜱᴜᴩᴩᴏʀᴛ ᴜꜱ", url="https://t.me/mkn_bots_updates")]]),
|
35 |
+
)
|
36 |
+
await m.delete()
|
37 |
+
carbon.close()
|
plugins/ExtraMods/font.py
ADDED
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from image.font_string import Fonts
|
3 |
+
from pyrogram import Client, filters
|
4 |
+
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
5 |
+
|
6 |
+
|
7 |
+
@Client.on_message(filters.private & filters.command(["font"]))
|
8 |
+
async def style_buttons(c, m, cb=False):
|
9 |
+
buttons = [[
|
10 |
+
InlineKeyboardButton('𝚃𝚢𝚙𝚎𝚠𝚛𝚒𝚝𝚎𝚛', callback_data='style+typewriter'),
|
11 |
+
InlineKeyboardButton('𝕆𝕦𝕥𝕝𝕚𝕟𝕖', callback_data='style+outline'),
|
12 |
+
InlineKeyboardButton('𝐒𝐞𝐫𝐢𝐟', callback_data='style+serif'),
|
13 |
+
],[
|
14 |
+
InlineKeyboardButton('𝑺𝒆𝒓𝒊𝒇', callback_data='style+bold_cool'),
|
15 |
+
InlineKeyboardButton('𝑆𝑒𝑟𝑖𝑓', callback_data='style+cool'),
|
16 |
+
InlineKeyboardButton('Sᴍᴀʟʟ Cᴀᴘs', callback_data='style+small_cap'),
|
17 |
+
],[
|
18 |
+
InlineKeyboardButton('𝓈𝒸𝓇𝒾𝓅𝓉', callback_data='style+script'),
|
19 |
+
InlineKeyboardButton('𝓼𝓬𝓻𝓲𝓹𝓽', callback_data='style+script_bolt'),
|
20 |
+
InlineKeyboardButton('ᵗⁱⁿʸ', callback_data='style+tiny'),
|
21 |
+
],[
|
22 |
+
InlineKeyboardButton('ᑕOᗰIᑕ', callback_data='style+comic'),
|
23 |
+
InlineKeyboardButton('𝗦𝗮𝗻𝘀', callback_data='style+sans'),
|
24 |
+
InlineKeyboardButton('𝙎𝙖𝙣𝙨', callback_data='style+slant_sans'),
|
25 |
+
],[
|
26 |
+
InlineKeyboardButton('𝘚𝘢𝘯𝘴', callback_data='style+slant'),
|
27 |
+
InlineKeyboardButton('𝖲𝖺𝗇𝗌', callback_data='style+sim'),
|
28 |
+
InlineKeyboardButton('Ⓒ︎Ⓘ︎Ⓡ︎Ⓒ︎Ⓛ︎Ⓔ︎Ⓢ︎', callback_data='style+circles')
|
29 |
+
],[
|
30 |
+
InlineKeyboardButton('🅒︎🅘︎🅡︎🅒︎🅛︎🅔︎🅢︎', callback_data='style+circle_dark'),
|
31 |
+
InlineKeyboardButton('𝔊𝔬𝔱𝔥𝔦𝔠', callback_data='style+gothic'),
|
32 |
+
InlineKeyboardButton('𝕲𝖔𝖙𝖍𝖎𝖈', callback_data='style+gothic_bolt'),
|
33 |
+
],[
|
34 |
+
InlineKeyboardButton('C͜͡l͜͡o͜͡u͜͡d͜͡s͜͡', callback_data='style+cloud'),
|
35 |
+
InlineKeyboardButton('H̆̈ă̈p̆̈p̆̈y̆̈', callback_data='style+happy'),
|
36 |
+
InlineKeyboardButton('S̑̈ȃ̈d̑̈', callback_data='style+sad'),
|
37 |
+
],[
|
38 |
+
InlineKeyboardButton('Next ➡️', callback_data="nxt")
|
39 |
+
]]
|
40 |
+
if not cb:
|
41 |
+
if ' ' in m.text:
|
42 |
+
title = m.text.split(" ", 1)[1]
|
43 |
+
await m.reply_text(title, reply_markup=InlineKeyboardMarkup(buttons), reply_to_message_id=m.id)
|
44 |
+
else:
|
45 |
+
await m.reply_text(text="Ente Any Text Eg:- `/font [text]`")
|
46 |
+
else:
|
47 |
+
await m.answer()
|
48 |
+
await m.message.edit_reply_markup(InlineKeyboardMarkup(buttons))
|
49 |
+
|
50 |
+
|
51 |
+
@Client.on_callback_query(filters.regex('^nxt'))
|
52 |
+
async def nxt(c, m):
|
53 |
+
if m.data == "nxt":
|
54 |
+
buttons = [[
|
55 |
+
InlineKeyboardButton('🇸 🇵 🇪 🇨 🇮 🇦 🇱 ', callback_data='style+special'),
|
56 |
+
InlineKeyboardButton('🅂🅀🅄🄰🅁🄴🅂', callback_data='style+squares'),
|
57 |
+
InlineKeyboardButton('🆂︎🆀︎🆄︎🅰︎🆁︎🅴︎🆂︎', callback_data='style+squares_bold'),
|
58 |
+
],[
|
59 |
+
InlineKeyboardButton('ꪖꪀᦔꪖꪶꪊᥴ𝓲ꪖ', callback_data='style+andalucia'),
|
60 |
+
InlineKeyboardButton('爪卂几ᘜ卂', callback_data='style+manga'),
|
61 |
+
InlineKeyboardButton('S̾t̾i̾n̾k̾y̾', callback_data='style+stinky'),
|
62 |
+
],[
|
63 |
+
InlineKeyboardButton('B̥ͦu̥ͦb̥ͦb̥ͦl̥ͦe̥ͦs̥ͦ', callback_data='style+bubbles'),
|
64 |
+
InlineKeyboardButton('U͟n͟d͟e͟r͟l͟i͟n͟e͟', callback_data='style+underline'),
|
65 |
+
InlineKeyboardButton('꒒ꍏꀷꌩꌃꀎꁅ', callback_data='style+ladybug'),
|
66 |
+
],[
|
67 |
+
InlineKeyboardButton('R҉a҉y҉s҉', callback_data='style+rays'),
|
68 |
+
InlineKeyboardButton('B҈i҈r҈d҈s҈', callback_data='style+birds'),
|
69 |
+
InlineKeyboardButton('S̸l̸a̸s̸h̸', callback_data='style+slash'),
|
70 |
+
],[
|
71 |
+
InlineKeyboardButton('s⃠t⃠o⃠p⃠', callback_data='style+stop'),
|
72 |
+
InlineKeyboardButton('S̺͆k̺͆y̺͆l̺͆i̺͆n̺͆e̺͆', callback_data='style+skyline'),
|
73 |
+
InlineKeyboardButton('A͎r͎r͎o͎w͎s͎', callback_data='style+arrows'),
|
74 |
+
],[
|
75 |
+
InlineKeyboardButton('ዪሀክቿነ', callback_data='style+qvnes'),
|
76 |
+
InlineKeyboardButton('S̶t̶r̶i̶k̶e̶', callback_data='style+strike'),
|
77 |
+
InlineKeyboardButton('F༙r༙o༙z༙e༙n༙', callback_data='style+frozen')
|
78 |
+
],[
|
79 |
+
InlineKeyboardButton('⬅️ Back', callback_data='nxt+0')
|
80 |
+
]]
|
81 |
+
await m.answer()
|
82 |
+
await m.message.edit_reply_markup(InlineKeyboardMarkup(buttons))
|
83 |
+
else:
|
84 |
+
await style_buttons(c, m, cb=True)
|
85 |
+
|
86 |
+
|
87 |
+
@Client.on_callback_query(filters.regex('^style'))
|
88 |
+
async def style(c, m):
|
89 |
+
await m.answer()
|
90 |
+
cmd, style = m.data.split('+')
|
91 |
+
|
92 |
+
if style == 'typewriter':
|
93 |
+
cls = Fonts.typewriter
|
94 |
+
if style == 'outline':
|
95 |
+
cls = Fonts.outline
|
96 |
+
if style == 'serif':
|
97 |
+
cls = Fonts.serief
|
98 |
+
if style == 'bold_cool':
|
99 |
+
cls = Fonts.bold_cool
|
100 |
+
if style == 'cool':
|
101 |
+
cls = Fonts.cool
|
102 |
+
if style == 'small_cap':
|
103 |
+
cls = Fonts.smallcap
|
104 |
+
if style == 'script':
|
105 |
+
cls = Fonts.script
|
106 |
+
if style == 'script_bolt':
|
107 |
+
cls = Fonts.bold_script
|
108 |
+
if style == 'tiny':
|
109 |
+
cls = Fonts.tiny
|
110 |
+
if style == 'comic':
|
111 |
+
cls = Fonts.comic
|
112 |
+
if style == 'sans':
|
113 |
+
cls = Fonts.san
|
114 |
+
if style == 'slant_sans':
|
115 |
+
cls = Fonts.slant_san
|
116 |
+
if style == 'slant':
|
117 |
+
cls = Fonts.slant
|
118 |
+
if style == 'sim':
|
119 |
+
cls = Fonts.sim
|
120 |
+
if style == 'circles':
|
121 |
+
cls = Fonts.circles
|
122 |
+
if style == 'circle_dark':
|
123 |
+
cls = Fonts.dark_circle
|
124 |
+
if style == 'gothic':
|
125 |
+
cls = Fonts.gothic
|
126 |
+
if style == 'gothic_bolt':
|
127 |
+
cls = Fonts.bold_gothic
|
128 |
+
if style == 'cloud':
|
129 |
+
cls = Fonts.cloud
|
130 |
+
if style == 'happy':
|
131 |
+
cls = Fonts.happy
|
132 |
+
if style == 'sad':
|
133 |
+
cls = Fonts.sad
|
134 |
+
if style == 'special':
|
135 |
+
cls = Fonts.special
|
136 |
+
if style == 'squares':
|
137 |
+
cls = Fonts.square
|
138 |
+
if style == 'squares_bold':
|
139 |
+
cls = Fonts.dark_square
|
140 |
+
if style == 'andalucia':
|
141 |
+
cls = Fonts.andalucia
|
142 |
+
if style == 'manga':
|
143 |
+
cls = Fonts.manga
|
144 |
+
if style == 'stinky':
|
145 |
+
cls = Fonts.stinky
|
146 |
+
if style == 'bubbles':
|
147 |
+
cls = Fonts.bubbles
|
148 |
+
if style == 'underline':
|
149 |
+
cls = Fonts.underline
|
150 |
+
if style == 'ladybug':
|
151 |
+
cls = Fonts.ladybug
|
152 |
+
if style == 'rays':
|
153 |
+
cls = Fonts.rays
|
154 |
+
if style == 'birds':
|
155 |
+
cls = Fonts.birds
|
156 |
+
if style == 'slash':
|
157 |
+
cls = Fonts.slash
|
158 |
+
if style == 'stop':
|
159 |
+
cls = Fonts.stop
|
160 |
+
if style == 'skyline':
|
161 |
+
cls = Fonts.skyline
|
162 |
+
if style == 'arrows':
|
163 |
+
cls = Fonts.arrows
|
164 |
+
if style == 'qvnes':
|
165 |
+
cls = Fonts.rvnes
|
166 |
+
if style == 'strike':
|
167 |
+
cls = Fonts.strike
|
168 |
+
if style == 'frozen':
|
169 |
+
cls = Fonts.frozen
|
170 |
+
|
171 |
+
r, oldtxt = m.message.reply_to_message.text.split(None, 1)
|
172 |
+
new_text = cls(oldtxt)
|
173 |
+
try:
|
174 |
+
await m.message.edit_text(f"`{new_text}`\n\n👆 Click To Copy", reply_markup=m.message.reply_markup)
|
175 |
+
except Exception as e:
|
176 |
+
print(e)
|
177 |
+
|
178 |
+
|
179 |
+
|
plugins/ExtraMods/group_manager.py
ADDED
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram.types import *
|
2 |
+
from pyrogram.errors import FloodWait
|
3 |
+
from pyrogram import Client, filters, enums
|
4 |
+
from pyrogram.errors.exceptions.forbidden_403 import ChatWriteForbidden
|
5 |
+
from pyrogram.errors.exceptions.bad_request_400 import ChatAdminRequired, UserAdminInvalid
|
6 |
+
|
7 |
+
from utils import extract_time, extract_user, admin_check, admin_filter
|
8 |
+
from info import ADMINS
|
9 |
+
from Script import script
|
10 |
+
from time import time
|
11 |
+
import asyncio
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
@Client.on_message(filters.command("ban"))
|
16 |
+
async def ban_user(_, message):
|
17 |
+
is_admin = await admin_check(message)
|
18 |
+
if not is_admin: return
|
19 |
+
user_id, user_first_name = extract_user(message)
|
20 |
+
try: await message.chat.ban_member(user_id=user_id)
|
21 |
+
except Exception as error: await message.reply_text(str(error))
|
22 |
+
else:
|
23 |
+
if str(user_id).lower().startswith("@"):
|
24 |
+
await message.reply_text(f"Someone else is dusting off..! \n{user_first_name} \nIs forbidden.")
|
25 |
+
else:
|
26 |
+
await message.reply_text(f"Someone else is dusting off..! \n<a href='tg://user?id={user_id}'>{user_first_name}</a> Is forbidden")
|
27 |
+
|
28 |
+
|
29 |
+
@Client.on_message(filters.command("tban"))
|
30 |
+
async def temp_ban_user(_, message):
|
31 |
+
is_admin = await admin_check(message)
|
32 |
+
if not is_admin: return
|
33 |
+
if not len(message.command) > 1: return
|
34 |
+
user_id, user_first_name = extract_user(message)
|
35 |
+
until_date_val = extract_time(message.command[1])
|
36 |
+
if until_date_val is None: return await message.reply_text(text=f"Invalid time type specified. \nExpected m, h, or d, Got it: {message.command[1][-1]}")
|
37 |
+
try: await message.chat.ban_member(user_id=user_id, until_date=until_date_val)
|
38 |
+
except Exception as error: await message.reply_text(str(error))
|
39 |
+
else:
|
40 |
+
if str(user_id).lower().startswith("@"):
|
41 |
+
await message.reply_text(f"Someone else is dusting off..!\n{user_first_name}\nbanned for {message.command[1]}!")
|
42 |
+
else:
|
43 |
+
await message.reply_text(f"Someone else is dusting off..!\n<a href='tg://user?id={user_id}'>Lavane</a>\n banned for {message.command[1]}!")
|
44 |
+
|
45 |
+
|
46 |
+
@Client.on_message(filters.command(["unban", "unmute"]))
|
47 |
+
async def un_ban_user(_, message):
|
48 |
+
is_admin = await admin_check(message)
|
49 |
+
if not is_admin: return
|
50 |
+
user_id, user_first_name = extract_user(message)
|
51 |
+
try: await message.chat.unban_member(user_id=user_id)
|
52 |
+
except Exception as error: await message.reply_text(str(error))
|
53 |
+
else:
|
54 |
+
if str(user_id).lower().startswith("@"):
|
55 |
+
await message.reply_text(f"Okay, changed ... now {user_first_name} To You can join the group!")
|
56 |
+
else:
|
57 |
+
await message.reply_text(f"Okay, changed ... now <a href='tg://user?id={user_id}'>{user_first_name}</a> To You can join the group!")
|
58 |
+
|
59 |
+
|
60 |
+
@Client.on_message(filters.command("mute"))
|
61 |
+
async def mute_user(_, message):
|
62 |
+
is_admin = await admin_check(message)
|
63 |
+
if not is_admin: return
|
64 |
+
user_id, user_first_name = extract_user(message)
|
65 |
+
try: await message.chat.restrict_member(user_id=user_id, permissions=ChatPermissions())
|
66 |
+
except Exception as error: await message.reply_text(str(error))
|
67 |
+
else:
|
68 |
+
if str(user_id).lower().startswith("@"):
|
69 |
+
await message.reply_text(f"👍🏻 {user_first_name} Lavender's mouth is shut! 🤐")
|
70 |
+
else:
|
71 |
+
await message.reply_text(f"👍🏻 <a href='tg://user?id={user_id}'>Of lavender</a> The mouth is closed! 🤐")
|
72 |
+
|
73 |
+
|
74 |
+
@Client.on_message(filters.command("tmute"))
|
75 |
+
async def temp_mute_user(_, message):
|
76 |
+
is_admin = await admin_check(message)
|
77 |
+
if not is_admin: return
|
78 |
+
if not len(message.command) > 1: return
|
79 |
+
user_id, user_first_name = extract_user(message)
|
80 |
+
until_date_val = extract_time(message.command[1])
|
81 |
+
if until_date_val is None:
|
82 |
+
return await message.reply_text(f"Invalid time type specified. Expected m, h, or d, Got it: {message.command[1][-1]}")
|
83 |
+
try:
|
84 |
+
await message.chat.restrict_member(user_id=user_id, permissions=ChatPermissions(), until_date=until_date_val)
|
85 |
+
except Exception as error:
|
86 |
+
await message.reply_text(str(error))
|
87 |
+
else:
|
88 |
+
if str(user_id).lower().startswith("@"):
|
89 |
+
await message.reply_text(f"Be quiet for a while! 😠 {user_first_name} muted for {message.command[1]}!")
|
90 |
+
else:
|
91 |
+
await message.reply_text(f"Be quiet for a while! 😠 <a href='tg://user?id={user_id}'>Of lavender</a> Mouth muted for {message.command[1]}!")
|
92 |
+
|
93 |
+
|
94 |
+
@Client.on_message(filters.command("pin") & filters.create(admin_filter))
|
95 |
+
async def pin(_, message: Message):
|
96 |
+
if not message.reply_to_message: return
|
97 |
+
await message.reply_to_message.pin()
|
98 |
+
|
99 |
+
|
100 |
+
@Client.on_message(filters.command("unpin") & filters.create(admin_filter))
|
101 |
+
async def unpin(_, message: Message):
|
102 |
+
if not message.reply_to_message: return
|
103 |
+
await message.reply_to_message.unpin()
|
104 |
+
|
105 |
+
|
106 |
+
|
107 |
+
@Client.on_message(filters.command("purge") & (filters.group | filters.channel))
|
108 |
+
async def purge(client, message):
|
109 |
+
if message.chat.type not in ((enums.ChatType.SUPERGROUP, enums.ChatType.CHANNEL)): return
|
110 |
+
is_admin = await admin_check(message)
|
111 |
+
if not is_admin: return
|
112 |
+
status_message = await message.reply_text("...", quote=True)
|
113 |
+
await message.delete()
|
114 |
+
message_ids = []
|
115 |
+
count_del_etion_s = 0
|
116 |
+
if message.reply_to_message:
|
117 |
+
for a_s_message_id in range(message.reply_to_message.id, message.id):
|
118 |
+
message_ids.append(a_s_message_id)
|
119 |
+
if len(message_ids) == "100":
|
120 |
+
await client.delete_messages(chat_id=message.chat.id, message_ids=message_ids, revoke=True)
|
121 |
+
count_del_etion_s += len(message_ids)
|
122 |
+
message_ids = []
|
123 |
+
if len(message_ids) > 0:
|
124 |
+
await client.delete_messages(chat_id=message.chat.id, message_ids=message_ids, revoke=True)
|
125 |
+
count_del_etion_s += len(message_ids)
|
126 |
+
await status_message.edit_text(f"deleted {count_del_etion_s} messages")
|
127 |
+
await status_message.delete()
|
128 |
+
|
129 |
+
|
130 |
+
@Client.on_message(filters.group & filters.command('inkick'))
|
131 |
+
async def inkick(client, message):
|
132 |
+
user = await client.get_chat_member(message.chat.id, message.from_user.id)
|
133 |
+
if user.status not in (enums.ChatMemberStatus.ADMINISTRATOR, enums.ChatMemberStatus.OWNER):
|
134 |
+
note = await message.reply_text(script.CREATOR_REQUIRED)
|
135 |
+
await asyncio.sleep(3)
|
136 |
+
await note.delete()
|
137 |
+
return await message.delete()
|
138 |
+
if len(message.command) > 1:
|
139 |
+
input_str = message.command
|
140 |
+
sent_message = await message.reply_text(script.START_KICK)
|
141 |
+
await asyncio.sleep(2)
|
142 |
+
await message.delete()
|
143 |
+
count = 0
|
144 |
+
for member in client.get_chat_members(message.chat.id):
|
145 |
+
if member.user.status in input_str and not member.status in (enums.ChatMemberStatus.ADMINISTRATOR, enums.ChatMemberStatus.OWNER):
|
146 |
+
try:
|
147 |
+
client.ban_chat_member(message.chat.id, member.user.id, int(time() + 45))
|
148 |
+
count += 1
|
149 |
+
except (ChatAdminRequired, UserAdminInvalid):
|
150 |
+
await sent_message.edit(script.ADMIN_REQUIRED)
|
151 |
+
await client.leave_chat(message.chat.id)
|
152 |
+
break
|
153 |
+
except FloodWait as e:
|
154 |
+
await asyncio.sleep(e.value)
|
155 |
+
try:
|
156 |
+
await sent_message.edit(script.KICKED.format(count))
|
157 |
+
except ChatWriteForbidden: pass
|
158 |
+
else:
|
159 |
+
await message.reply_text(script.INPUT_REQUIRED)
|
160 |
+
|
161 |
+
|
162 |
+
@Client.on_message(filters.group & filters.command('dkick'))
|
163 |
+
async def dkick(client, message):
|
164 |
+
user = await client.get_chat_member(message.chat.id, message.from_user.id)
|
165 |
+
if user.status not in (enums.ChatMemberStatus.ADMINISTRATOR, enums.ChatMemberStatus.OWNER):
|
166 |
+
note = await message.reply_text(script.CREATOR_REQUIRED)
|
167 |
+
await asyncio.sleep(3)
|
168 |
+
await note.delete()
|
169 |
+
return await message.delete()
|
170 |
+
sent_message = await message.reply_text(script.START_KICK)
|
171 |
+
await message.delete()
|
172 |
+
count = 0
|
173 |
+
for member in client.get_chat_members(message.chat.id):
|
174 |
+
if member.user.is_deleted and not member.status in (enums.ChatMemberStatus.ADMINISTRATOR, enums.ChatMemberStatus.OWNER):
|
175 |
+
try:
|
176 |
+
await client.ban_chat_member(message.chat.id, member.user.id, int(time() + 45))
|
177 |
+
count += 1
|
178 |
+
except (ChatAdminRequired, UserAdminInvalid):
|
179 |
+
await sent_message.edit(script.ADMIN_REQUIRED)
|
180 |
+
await client.leave_chat(message.chat.id)
|
181 |
+
break
|
182 |
+
except FloodWait as e:
|
183 |
+
await asyncio.sleep(e.value)
|
184 |
+
try:
|
185 |
+
await sent_message.edit(script.DKICK.format(count))
|
186 |
+
except ChatWriteForbidden: pass
|
187 |
+
|
188 |
+
|
189 |
+
@Client.on_message((filters.channel | filters.group) & filters.command('instatus'))
|
190 |
+
async def instatus(client, message):
|
191 |
+
user = await client.get_chat_member(message.chat.id, message.from_user.id)
|
192 |
+
if user.status not in (enums.ChatMemberStatus.ADMINISTRATOR, enums.ChatMemberStatus.OWNER, ADMINS):
|
193 |
+
note = await message.reply("you are not administrator in this chat")
|
194 |
+
await asyncio.sleep(3)
|
195 |
+
await message.delete()
|
196 |
+
return await note.delete()
|
197 |
+
sent_message = await message.reply_text("🔁 Processing.....")
|
198 |
+
recently = 0
|
199 |
+
within_week = 0
|
200 |
+
within_month = 0
|
201 |
+
long_time_ago = 0
|
202 |
+
deleted_acc = 0
|
203 |
+
uncached = 0
|
204 |
+
bot = 0
|
205 |
+
for member in client.get_chat_members(message.chat.id):
|
206 |
+
if member.user.is_deleted: deleted_acc += 1
|
207 |
+
elif member.user.is_bot: bot += 1
|
208 |
+
elif member.user.status == enums.UserStatus.RECENTLY: recently += 1
|
209 |
+
elif member.user.status == enums.UserStatus.LAST_WEEK: within_week += 1
|
210 |
+
elif member.user.status == enums.UserStatus.LAST_MONTH: within_month += 1
|
211 |
+
elif member.user.status == enums.UserStatus.LONG_AGO: long_time_ago += 1
|
212 |
+
else: uncached += 1
|
213 |
+
if message.chat.type == enums.ChatType.CHANNEL:
|
214 |
+
await sent_message.edit(f"{message.chat.title}\nChat Member Status\n\nRecently - {recently}\nWithin Week - {within_week}\nWithin Month - {within_month}\nLong Time Ago - {long_time_ago}\n\nDeleted Account - {deleted_acc}\nBot - {bot}\nUnCached - {uncached}")
|
215 |
+
elif message.chat.type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
|
216 |
+
await sent_message.edit(f"{message.chat.title}\nChat Member Status\n\nRecently - {recently}\nWithin Week - {within_week}\nWithin Month - {within_month}\nLong Time Ago - {long_time_ago}\n\nDeleted Account - {deleted_acc}\nBot - {bot}\nUnCached - {uncached}")
|
217 |
+
|
218 |
+
|
219 |
+
|
220 |
+
|
221 |
+
|
222 |
+
|
plugins/ExtraMods/json.py
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from pyrogram import Client, filters
|
3 |
+
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, Message, CallbackQuery
|
4 |
+
|
5 |
+
@Client.on_message(filters.command(["json", 'js']))
|
6 |
+
async def jsonify(_, message):
|
7 |
+
the_real_message = None
|
8 |
+
reply_to_id = None
|
9 |
+
pk = InlineKeyboardMarkup([[InlineKeyboardButton(text="𝙲𝙻𝙾𝚂𝙴", callback_data="close_data")]])
|
10 |
+
|
11 |
+
if message.reply_to_message:
|
12 |
+
the_real_message = message.reply_to_message
|
13 |
+
else:
|
14 |
+
the_real_message = message
|
15 |
+
|
16 |
+
try:
|
17 |
+
await message.reply_text(f"<code>{the_real_message}</code>", reply_markup=pk, quote=True)
|
18 |
+
except Exception as e:
|
19 |
+
with open("json.text", "w+", encoding="utf8") as out_file:
|
20 |
+
out_file.write(str(the_real_message))
|
21 |
+
await message.reply_document(
|
22 |
+
document="json.text",
|
23 |
+
caption=str(e),
|
24 |
+
disable_notification=True,
|
25 |
+
quote=True,
|
26 |
+
reply_markup=reply_markup
|
27 |
+
)
|
28 |
+
os.remove("json.text")
|
29 |
+
|
30 |
+
|
31 |
+
@Client.on_message(filters.command("written"))
|
32 |
+
async def create_file(c, message):
|
33 |
+
content = message.reply_to_message.text
|
34 |
+
file_name = message.text.split(" ", 1)[1]
|
35 |
+
try:
|
36 |
+
with open(str(file_name), "w+") as out:
|
37 |
+
out.write(str(content))
|
38 |
+
await message.reply_document(
|
39 |
+
document=str(file_name),
|
40 |
+
caption="out put file"
|
41 |
+
)
|
42 |
+
os.remove(str(file_name))
|
43 |
+
except Exception as e:
|
44 |
+
await message.reply(e)
|
45 |
+
|
46 |
+
|
47 |
+
|
48 |
+
|
plugins/ExtraMods/lyrics.py
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram import Client, filters
|
2 |
+
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
3 |
+
import requests, os
|
4 |
+
|
5 |
+
|
6 |
+
API = "https://apis.xditya.me/lyrics?song="
|
7 |
+
|
8 |
+
@Client.on_message(filters.text & filters.command(["lyrics"]))
|
9 |
+
async def sng(bot, message):
|
10 |
+
if not message.reply_to_message:
|
11 |
+
await message.reply_text("Pʟᴇᴀꜱᴇ Rᴇᴩʟʏ To A Mᴇꜱꜱᴀɢᴇ")
|
12 |
+
else:
|
13 |
+
mee = await message.reply_text("`Sᴇᴀʀᴄʜɪɴɢ 🔎`")
|
14 |
+
song = message.reply_to_message.text
|
15 |
+
chat_id = message.from_user.id
|
16 |
+
rpl = lyrics(song)
|
17 |
+
await mee.delete()
|
18 |
+
try:
|
19 |
+
await mee.delete()
|
20 |
+
await bot.send_message(chat_id, text = rpl, reply_to_message_id = message.id, reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("ᴜᴘᴅᴀᴛᴇs", url = f"t.me/mkn_bots_updates")]]))
|
21 |
+
except Exception as e:
|
22 |
+
await message.reply_text(f"I Cᴀɴ'ᴛ Fɪɴᴅ A Sᴏɴɢ Wɪᴛʜ `{song}`", quote = True, reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("ᴜᴘᴅᴀᴛᴇs", url = f"t.me/mkn_bots_updates")]]))
|
23 |
+
|
24 |
+
|
25 |
+
def search(song):
|
26 |
+
r = requests.get(API + song)
|
27 |
+
find = r.json()
|
28 |
+
return find
|
29 |
+
|
30 |
+
def lyrics(song):
|
31 |
+
fin = search(song)
|
32 |
+
text = f'**🎶 Sᴜᴄᴄᴇꜱꜰᴜʟʟy Exᴛʀᴀᴄᴛᴇᴅ Lyɪʀɪᴄꜱ Oꜰ {song}**\n\n'
|
33 |
+
text += f'`{fin["lyrics"]}`'
|
34 |
+
text += '\n\n\n**Mᴀᴅᴇ Bʏ AI**'
|
35 |
+
return text
|
36 |
+
|
37 |
+
|
38 |
+
|
plugins/ExtraMods/password.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import random, os
|
2 |
+
from pyrogram import Client, filters, enums
|
3 |
+
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
4 |
+
|
5 |
+
|
6 |
+
@Client.on_message(filters.command(["genpassword", 'genpw']))
|
7 |
+
async def password(bot, update):
|
8 |
+
message = await update.reply_text(text="`Pʀᴏᴄᴇꜱꜱɪɴɢ..`")
|
9 |
+
password = "abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()_+".lower()
|
10 |
+
if len(update.command) > 1:
|
11 |
+
qw = update.text.split(" ", 1)[1]
|
12 |
+
else:
|
13 |
+
ST = ["5", "7", "6", "9", "10", "12", "14", "8", "13"]
|
14 |
+
qw = random.choice(ST)
|
15 |
+
limit = int(qw)
|
16 |
+
random_value = "".join(random.sample(password, limit))
|
17 |
+
txt = f"<b>Lɪᴍɪᴛ:</b> {str(limit)} \n<b>Pᴀꜱꜱᴡᴏʀᴅ: <code>{random_value}</code>"
|
18 |
+
btn = InlineKeyboardMarkup([[InlineKeyboardButton('Mᴋɴ Bᴏᴛᴢ™️', url='https://t.me/mkn_bots_updates')]])
|
19 |
+
await message.edit_text(text=txt, reply_markup=btn, parse_mode=enums.ParseMode.HTML)
|
plugins/ExtraMods/paste.py
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os, re, json, aiohttp, requests
|
2 |
+
from pyrogram import Client, filters
|
3 |
+
|
4 |
+
#Headers
|
5 |
+
headers = {
|
6 |
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36",
|
7 |
+
"content-type": "application/json",
|
8 |
+
}
|
9 |
+
|
10 |
+
#Pastebins
|
11 |
+
async def p_paste(message, extension=None):
|
12 |
+
siteurl = "https://pasty.lus.pm/api/v1/pastes"
|
13 |
+
data = {"content": message}
|
14 |
+
try:
|
15 |
+
response = requests.post(url=siteurl, data=json.dumps(data), headers=headers)
|
16 |
+
except Exception as e:
|
17 |
+
return {"error": str(e)}
|
18 |
+
if response.ok:
|
19 |
+
response = response.json()
|
20 |
+
purl = (
|
21 |
+
f"https://pasty.lus.pm/{response['id']}.{extension}"
|
22 |
+
if extension
|
23 |
+
else f"https://pasty.lus.pm/{response['id']}.txt"
|
24 |
+
)
|
25 |
+
return {
|
26 |
+
"url": purl,
|
27 |
+
"raw": f"https://pasty.lus.pm/{response['id']}/raw",
|
28 |
+
"bin": "Pasty",
|
29 |
+
}
|
30 |
+
return {"error": "UNABLE TO REACH pasty.lus.pm"}
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
@Client.on_message(filters.command(["tgpaste", "pasty", "paste"]))
|
35 |
+
async def pasty(client, message):
|
36 |
+
pablo = await message.reply_text("`Pʟᴇᴀꜱᴇ Wᴀɪᴛ...`")
|
37 |
+
tex_t = message.text
|
38 |
+
if ' ' in message.text:
|
39 |
+
message_s = message.text.split(" ", 1)[1]
|
40 |
+
elif message.reply_to_message:
|
41 |
+
message_s = message.reply_to_message.text
|
42 |
+
else:
|
43 |
+
await message.reply("Sᴏʀʀʏ No Iɴ Pᴜᴛ. Pʟᴇᴀꜱᴇ Rᴇᴩʟʏ To A Tᴇxᴛ Oʀ /paste Wɪᴛʜ Tᴇxᴛ")
|
44 |
+
if not tex_t:
|
45 |
+
if not message.reply_to_message:
|
46 |
+
await pablo.edit("Oɴʟʏ Tᴇxᴛ Aɴᴅ Dᴏᴄᴜᴍᴇɴᴛs Aʀᴇ Sᴜᴘᴘᴏʀᴛᴇᴅ")
|
47 |
+
return
|
48 |
+
if not message.reply_to_message.text:
|
49 |
+
file = await message.reply_to_message.download()
|
50 |
+
m_list = open(file, "r").read()
|
51 |
+
message_s = m_list
|
52 |
+
os.remove(file)
|
53 |
+
elif message.reply_to_message.text:
|
54 |
+
message_s = message.reply_to_message.text
|
55 |
+
|
56 |
+
ext = "py"
|
57 |
+
x = await p_paste(message_s, ext)
|
58 |
+
p_link = x["url"]
|
59 |
+
p_raw = x["raw"]
|
60 |
+
|
61 |
+
pasted = f"**Sᴜᴄᴄᴇssғᴜʟʟʏ Pᴀsᴛᴇ Tᴏ Pᴀsᴛʏ**\n\n**Lɪɴᴋ:** • [CʟɪᴄᴋHᴇʀᴇ]({p_link})\n\n**Rᴀᴡ Lɪɴᴋ:** • [CʟɪᴄᴋHᴇʀᴇ]({p_raw})"
|
62 |
+
await pablo.edit(pasted, disable_web_page_preview=True)
|
plugins/ExtraMods/photo.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
2 |
+
from pyrogram import Client, filters
|
3 |
+
|
4 |
+
|
5 |
+
@Client.on_message(filters.photo & filters.private)
|
6 |
+
async def photo_handler(client, message):
|
7 |
+
buttons = [[
|
8 |
+
InlineKeyboardButton(text="𝖡𝗋𝗂𝗀𝗍𝗁", callback_data="bright"),
|
9 |
+
InlineKeyboardButton(text="𝖬𝗂𝗑𝖾𝖽", callback_data="mix"),
|
10 |
+
InlineKeyboardButton(text="𝖡 & 𝖶", callback_data="b|w"),
|
11 |
+
],[
|
12 |
+
InlineKeyboardButton(text="𝖢𝗂𝗋𝖼𝗅𝖾", callback_data="circle"),
|
13 |
+
InlineKeyboardButton(text="𝖡𝗅𝗎𝗋", callback_data="blur"),
|
14 |
+
InlineKeyboardButton(text="𝖡𝗈𝗋𝖽𝖾𝗋", callback_data="border"),
|
15 |
+
],[
|
16 |
+
InlineKeyboardButton(text="𝖲𝗍𝗂𝖼𝗄𝖾𝗋", callback_data="stick"),
|
17 |
+
InlineKeyboardButton(text="𝖱𝗈𝗍𝖺𝗍𝖾", callback_data="rotate"),
|
18 |
+
InlineKeyboardButton(text="𝖢𝗈𝗇𝗍𝗋𝖺𝗌𝗍", callback_data="contrast"),
|
19 |
+
],[
|
20 |
+
InlineKeyboardButton(text="𝖲𝖾𝗉𝗂𝖺", callback_data="sepia"),
|
21 |
+
InlineKeyboardButton(text="𝖯𝖾𝗇𝖼𝗂𝗅", callback_data="pencil"),
|
22 |
+
InlineKeyboardButton(text="𝖢𝖺𝗋𝗍𝗈𝗈𝗇", callback_data="cartoon"),
|
23 |
+
],[
|
24 |
+
InlineKeyboardButton(text="𝖨𝗇𝗏𝖾𝗋𝗍", callback_data="inverted"),
|
25 |
+
InlineKeyboardButton(text="𝖦𝗅𝗂𝗍𝖼𝗁", callback_data="glitch"),
|
26 |
+
InlineKeyboardButton(text="𝖱𝖾𝗆𝗈𝗏𝖾 𝖡𝖦", callback_data="removebg"),
|
27 |
+
],[
|
28 |
+
InlineKeyboardButton(text="𝖢𝗅𝗈𝗌𝖾", callback_data="close_data"),
|
29 |
+
]]
|
30 |
+
try:
|
31 |
+
await message.reply(text="Select Your Required Mode From Below", quote=True, reply_markup=InlineKeyboardMarkup(buttons))
|
32 |
+
except Exception as e:
|
33 |
+
print(e)
|
34 |
+
if "USER_IS_BLOCKED" in str(e): return
|
35 |
+
try: await message.reply_text(f"{e} \nSomething Went Wrong!", quote=True)
|
36 |
+
except Exception: return
|
plugins/ExtraMods/share_text.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from pyrogram import Client, filters
|
3 |
+
from urllib.parse import quote
|
4 |
+
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
5 |
+
|
6 |
+
@Client.on_message(filters.command(["share_text", "share", "sharetext",]))
|
7 |
+
async def share_text(client, message):
|
8 |
+
reply = message.reply_to_message
|
9 |
+
reply_id = message.reply_to_message.id if message.reply_to_message else message.id
|
10 |
+
input_split = message.text.split(None, 1)
|
11 |
+
if len(input_split) == 2:
|
12 |
+
input_text = input_split[1]
|
13 |
+
elif reply and (reply.text or reply.caption):
|
14 |
+
input_text = reply.text or reply.caption
|
15 |
+
else:
|
16 |
+
await message.reply_text(
|
17 |
+
text=f"**Notice:**\n\n1. Reply Any Messages.\n2. No Media Support\n\n**Any Question Join Support Chat**",
|
18 |
+
reply_to_message_id=reply_id,
|
19 |
+
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("Support Chat", url=f"https://t.me/MKN_BOTZ_DISCUSSION_GROUP")]])
|
20 |
+
)
|
21 |
+
return
|
22 |
+
await message.reply_text(
|
23 |
+
text=f"**Here is Your Sharing Text 👇**\n\nhttps://t.me/share/url?url=" + quote(input_text),
|
24 |
+
reply_to_message_id=reply_id,
|
25 |
+
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("♂️ Share", url=f"https://t.me/share/url?url={quote(input_text)}")]])
|
26 |
+
)
|
plugins/ExtraMods/telegraph.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os, asyncio
|
2 |
+
from pyrogram import Client, filters
|
3 |
+
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, Message, CallbackQuery
|
4 |
+
from telegraph import upload_file
|
5 |
+
from utils import get_file_id
|
6 |
+
|
7 |
+
|
8 |
+
@Client.on_message(filters.command("telegraph") & filters.private)
|
9 |
+
async def telegraph_upload(bot, update):
|
10 |
+
# Service Stopped
|
11 |
+
return await update.reply("🥲 This service is stopped due to https://t.me/durov/343")
|
12 |
+
|
13 |
+
replied = update.reply_to_message
|
14 |
+
if not replied:
|
15 |
+
return await update.reply_text("Rᴇᴘʟʏ Tᴏ A Pʜᴏᴛᴏ Oʀ Vɪᴅᴇᴏ Uɴᴅᴇʀ 5ᴍʙ")
|
16 |
+
file_info = get_file_id(replied)
|
17 |
+
if not file_info:
|
18 |
+
return await update.reply_text("Not Supported!")
|
19 |
+
text = await update.reply_text(text="<code>Downloading To My Server ...</code>", disable_web_page_preview=True)
|
20 |
+
media = await update.reply_to_message.download()
|
21 |
+
await text.edit_text(text="<code>Downloading Completed. Now I am Uploading to telegra.ph Link ...</code>", disable_web_page_preview=True)
|
22 |
+
try:
|
23 |
+
response = upload_file(media)
|
24 |
+
except Exception as error:
|
25 |
+
print(error)
|
26 |
+
await text.edit_text(text=f"Error :- {error}", disable_web_page_preview=True)
|
27 |
+
return
|
28 |
+
try:
|
29 |
+
os.remove(media)
|
30 |
+
except Exception as error:
|
31 |
+
print(error)
|
32 |
+
return
|
33 |
+
await text.edit_text(
|
34 |
+
text=f"<b>Link :-</b>\n\n<code>https://graph.org{response[0]}</code>",
|
35 |
+
disable_web_page_preview=True,
|
36 |
+
reply_markup=InlineKeyboardMarkup( [[
|
37 |
+
InlineKeyboardButton(text="Open Link", url=f"https://graph.org{response[0]}"),
|
38 |
+
InlineKeyboardButton(text="Share Link", url=f"https://telegram.me/share/url?url=https://graph.org{response[0]}")
|
39 |
+
],[
|
40 |
+
InlineKeyboardButton(text="✗ Close ✗", callback_data="close")
|
41 |
+
]])
|
42 |
+
)
|
43 |
+
|
plugins/ExtraMods/tts.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import traceback
|
3 |
+
from asyncio import get_running_loop
|
4 |
+
from io import BytesIO
|
5 |
+
|
6 |
+
from googletrans import Translator
|
7 |
+
from gtts import gTTS
|
8 |
+
from pyrogram import Client, filters
|
9 |
+
from pyrogram.types import Message
|
10 |
+
|
11 |
+
|
12 |
+
def convert(text):
|
13 |
+
audio = BytesIO()
|
14 |
+
i = Translator().translate(text, dest="en")
|
15 |
+
lang = i.src
|
16 |
+
tts = gTTS(text, lang=lang)
|
17 |
+
audio.name = lang + ".mp3"
|
18 |
+
tts.write_to_fp(audio)
|
19 |
+
return audio
|
20 |
+
|
21 |
+
|
22 |
+
@Client.on_message(filters.command("tts"))
|
23 |
+
async def text_to_speech(_, message: Message):
|
24 |
+
if not message.reply_to_message:
|
25 |
+
return await message.reply_text("Reply To Some Text FFS.")
|
26 |
+
if not message.reply_to_message.text:
|
27 |
+
return await message.reply_text("Reply To Some TextFFS.")
|
28 |
+
m = await message.reply_text("Processing")
|
29 |
+
text = message.reply_to_message.text
|
30 |
+
try:
|
31 |
+
loop = get_running_loop()
|
32 |
+
audio = await loop.run_in_executor(None, convert, text)
|
33 |
+
await message.reply_audio(audio)
|
34 |
+
await m.delete()
|
35 |
+
audio.close()
|
36 |
+
except Exception as e:
|
37 |
+
await m.edit(e)
|
38 |
+
e = traceback.format_exc()
|
39 |
+
print(e)
|
40 |
+
|
41 |
+
|
42 |
+
|
plugins/ExtraMods/yt_dl.py
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from __future__ import unicode_literals
|
2 |
+
|
3 |
+
import os, requests, asyncio, math, time, wget
|
4 |
+
from pyrogram import filters, Client
|
5 |
+
from pyrogram.types import Message
|
6 |
+
|
7 |
+
from youtube_search import YoutubeSearch
|
8 |
+
from youtubesearchpython import SearchVideos
|
9 |
+
from yt_dlp import YoutubeDL
|
10 |
+
|
11 |
+
|
12 |
+
@Client.on_message(filters.command(['song', 'mp3']) & filters.private)
|
13 |
+
async def song(client, message):
|
14 |
+
user_id = message.from_user.id
|
15 |
+
user_name = message.from_user.first_name
|
16 |
+
rpk = "["+user_name+"](tg://user?id="+str(user_id)+")"
|
17 |
+
query = ''
|
18 |
+
for i in message.command[1:]:
|
19 |
+
query += ' ' + str(i)
|
20 |
+
print(query)
|
21 |
+
m = await message.reply(f"**ѕєαrchíng чσur ѕσng...!\n {query}**")
|
22 |
+
ydl_opts = {"format": "bestaudio[ext=m4a]"}
|
23 |
+
try:
|
24 |
+
results = YoutubeSearch(query, max_results=1).to_dict()
|
25 |
+
link = f"https://youtube.com{results[0]['url_suffix']}"
|
26 |
+
title = results[0]["title"][:40]
|
27 |
+
thumbnail = results[0]["thumbnails"][0]
|
28 |
+
thumb_name = f'thumb{title}.jpg'
|
29 |
+
thumb = requests.get(thumbnail, allow_redirects=True)
|
30 |
+
open(thumb_name, 'wb').write(thumb.content)
|
31 |
+
performer = f"[Mᴋɴ Bᴏᴛᴢ™]"
|
32 |
+
duration = results[0]["duration"]
|
33 |
+
url_suffix = results[0]["url_suffix"]
|
34 |
+
views = results[0]["views"]
|
35 |
+
except Exception as e:
|
36 |
+
print(str(e))
|
37 |
+
return await m.edit("**𝙵𝙾𝚄𝙽𝙳 𝙽𝙾𝚃𝙷𝙸𝙽𝙶 𝙿𝙻𝙴𝙰𝚂𝙴 𝙲𝙾𝚁𝚁𝙴𝙲𝚃 𝚃𝙷𝙴 𝚂𝙿𝙴𝙻𝙻𝙸𝙽𝙶 𝙾𝚁 𝙲𝙷𝙴𝙲𝙺 𝚃𝙷𝙴 𝙻𝙸𝙽𝙺**")
|
38 |
+
|
39 |
+
await m.edit("**dσwnlσαdíng чσur ѕσng...!**")
|
40 |
+
try:
|
41 |
+
with YoutubeDL(ydl_opts) as ydl:
|
42 |
+
info_dict = ydl.extract_info(link, download=False)
|
43 |
+
audio_file = ydl.prepare_filename(info_dict)
|
44 |
+
ydl.process_info(info_dict)
|
45 |
+
|
46 |
+
cap = "**BY›› [Mᴋɴ Bᴏᴛᴢ™](https://t.me/mkn_bots_updates)**"
|
47 |
+
secmul, dur, dur_arr = 1, 0, duration.split(':')
|
48 |
+
for i in range(len(dur_arr)-1, -1, -1):
|
49 |
+
dur += (int(dur_arr[i]) * secmul)
|
50 |
+
secmul *= 60
|
51 |
+
await message.reply_audio(
|
52 |
+
audio_file,
|
53 |
+
caption=cap,
|
54 |
+
quote=False,
|
55 |
+
title=title,
|
56 |
+
duration=dur,
|
57 |
+
performer=performer,
|
58 |
+
thumb=thumb_name
|
59 |
+
)
|
60 |
+
await m.delete()
|
61 |
+
except Exception as e:
|
62 |
+
await m.edit("**🚫 𝙴𝚁𝚁𝙾𝚁 🚫**")
|
63 |
+
print(e)
|
64 |
+
try:
|
65 |
+
os.remove(audio_file)
|
66 |
+
os.remove(thumb_name)
|
67 |
+
except Exception as e:
|
68 |
+
print(e)
|
69 |
+
|
70 |
+
def get_text(message: Message) -> [None,str]:
|
71 |
+
text_to_return = message.text
|
72 |
+
if message.text is None:
|
73 |
+
return None
|
74 |
+
if " " not in text_to_return:
|
75 |
+
return None
|
76 |
+
try:
|
77 |
+
return message.text.split(None, 1)[1]
|
78 |
+
except IndexError:
|
79 |
+
return None
|
80 |
+
|
81 |
+
|
82 |
+
@Client.on_message(filters.command(["video", "mp4"]))
|
83 |
+
async def vsong(client, message: Message):
|
84 |
+
urlissed = get_text(message)
|
85 |
+
pablo = await client.send_message(message.chat.id, f"**𝙵𝙸𝙽𝙳𝙸𝙽𝙶 𝚈𝙾𝚄𝚁 𝚅𝙸𝙳𝙴𝙾** `{urlissed}`")
|
86 |
+
if not urlissed:
|
87 |
+
return await pablo.edit("Invalid Command Syntax Please Check help Menu To Know More!")
|
88 |
+
search = SearchVideos(f"{urlissed}", offset=1, mode="dict", max_results=1)
|
89 |
+
mi = search.result()
|
90 |
+
mio = mi["search_result"]
|
91 |
+
mo = mio[0]["link"]
|
92 |
+
thum = mio[0]["title"]
|
93 |
+
fridayz = mio[0]["id"]
|
94 |
+
mio[0]["channel"]
|
95 |
+
kekme = f"https://img.youtube.com/vi/{fridayz}/hqdefault.jpg"
|
96 |
+
await asyncio.sleep(0.6)
|
97 |
+
url = mo
|
98 |
+
sedlyf = wget.download(kekme)
|
99 |
+
opts = {
|
100 |
+
"format": "best",
|
101 |
+
"addmetadata": True,
|
102 |
+
"key": "FFmpegMetadata",
|
103 |
+
"prefer_ffmpeg": True,
|
104 |
+
"geo_bypass": True,
|
105 |
+
"nocheckcertificate": True,
|
106 |
+
"postprocessors": [{"key": "FFmpegVideoConvertor", "preferedformat": "mp4"}],
|
107 |
+
"outtmpl": "%(id)s.mp4",
|
108 |
+
"logtostderr": False,
|
109 |
+
"quiet": True,
|
110 |
+
}
|
111 |
+
try:
|
112 |
+
with YoutubeDL(opts) as ytdl:
|
113 |
+
ytdl_data = ytdl.extract_info(url, download=True)
|
114 |
+
except Exception as e:
|
115 |
+
return await pablo.edit_text(f"**𝙳𝚘𝚠𝚗𝚕𝚘𝚊𝚍 𝙵𝚊𝚒𝚕𝚎𝚍 𝙿𝚕𝚎𝚊𝚜𝚎 𝚃𝚛𝚢 𝙰𝚐𝚊𝚒𝚗..♥️** \n**Error :** `{str(e)}`")
|
116 |
+
|
117 |
+
file_stark = f"{ytdl_data['id']}.mp4"
|
118 |
+
capy = f"""**𝚃𝙸𝚃𝙻𝙴 :** [{thum}]({mo})\n**𝚁𝙴𝚀𝚄𝙴𝚂𝚃𝙴𝙳 𝙱𝚈 :** {message.from_user.mention}"""
|
119 |
+
|
120 |
+
await client.send_video(
|
121 |
+
message.chat.id,
|
122 |
+
video=open(file_stark, "rb"),
|
123 |
+
duration=int(ytdl_data["duration"]),
|
124 |
+
file_name=str(ytdl_data["title"]),
|
125 |
+
thumb=sedlyf,
|
126 |
+
caption=capy,
|
127 |
+
supports_streaming=True,
|
128 |
+
reply_to_message_id=message.id
|
129 |
+
)
|
130 |
+
await pablo.delete()
|
131 |
+
for files in (sedlyf, file_stark):
|
132 |
+
if files and os.path.exists(files):
|
133 |
+
os.remove(files)
|
plugins/admin_control.py
ADDED
@@ -0,0 +1,387 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram import Client, filters, enums
|
2 |
+
from pyrogram.errors import ChatAdminRequired
|
3 |
+
from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery
|
4 |
+
from pyrogram.errors.exceptions.bad_request_400 import MessageTooLong, PeerIdInvalid, UserNotParticipant, MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty
|
5 |
+
|
6 |
+
from info import ADMINS, LOG_CHANNEL, SUPPORT_CHAT, WELCOM_PIC, WELCOM_TEXT, IMDB_TEMPLATE
|
7 |
+
from utils import get_size, temp, extract_user, get_file_id, get_poster, humanbytes
|
8 |
+
from database.users_chats_db import db
|
9 |
+
from database.ia_filterdb import Media
|
10 |
+
from datetime import datetime
|
11 |
+
from Script import script
|
12 |
+
import logging, re, asyncio, time, shutil, psutil, os, sys
|
13 |
+
|
14 |
+
logger = logging.getLogger(__name__)
|
15 |
+
logger.setLevel(logging.ERROR)
|
16 |
+
|
17 |
+
|
18 |
+
@Client.on_message(filters.new_chat_members & filters.group)
|
19 |
+
async def savegroup_and_welcome(bot, message):
|
20 |
+
r_j_check = [u.id for u in message.new_chat_members]
|
21 |
+
if bot.id in r_j_check:
|
22 |
+
if not await db.get_chat(message.chat.id):
|
23 |
+
total=await bot.get_chat_members_count(message.chat.id)
|
24 |
+
r_j = message.from_user.mention if message.from_user else "Anonymous"
|
25 |
+
await bot.send_message(LOG_CHANNEL, script.LOG_TEXT_G.format(a=message.chat.title, b=message.chat.id, c=message.chat.username, d=total, e=r_j, f=bot.mention))
|
26 |
+
await db.add_chat(message.chat.id, message.chat.title, message.chat.username)
|
27 |
+
if message.chat.id in temp.BANNED_CHATS:
|
28 |
+
buttons = [[InlineKeyboardButton('Sᴜᴩᴩᴏʀᴛ', url=f'https://t.me/{SUPPORT_CHAT}')]]
|
29 |
+
k = await message.reply("CHAT NOT ALLOWED 🐞\n\nMʏ Aᴅᴍɪɴs Hᴀs Rᴇsᴛʀɪᴄᴛᴇᴅ Mᴇ Fʀᴏᴍ Wᴏʀᴋɪɴɢ Hᴇʀᴇ ! Iғ Yᴏᴜ Wᴀɴᴛ Tᴏ Kɴᴏᴡ Mᴏʀᴇ Aʙᴏᴜᴛ Iᴛ Cᴏɴᴛᴀᴄᴛ Sᴜᴘᴘᴏʀᴛ", reply_markup=InlineKeyboardMarkup(buttons))
|
30 |
+
try: await k.pin()
|
31 |
+
except: pass
|
32 |
+
return await bot.leave_chat(message.chat.id)
|
33 |
+
|
34 |
+
buttons = [[InlineKeyboardButton('Hᴇʟᴩ', url=f"https://t.me/{temp.U_NAME}?start=help")]]
|
35 |
+
await message.reply(text="❤️ Tʜᴀɴᴋs Tᴏ Aᴅᴅ Mᴇ Tᴏ Yᴏᴜ'ʀ Gʀᴏᴜᴘ.\n» Dᴏɴ'ᴛ Fᴏʀɢᴇᴛ Tᴏ Mᴀᴋᴇ Mᴇ Aᴅᴍɪɴ.\n» Is Aɴʏ Dᴏᴜʙᴛ's Aʙᴏᴜᴛ Usɪɴɢ Mᴇ Cʟɪᴄᴋ Bᴇʟᴏᴡ Bᴜᴛᴛᴏɴ...✨", reply_markup=InlineKeyboardMarkup(buttons))
|
36 |
+
else:
|
37 |
+
for u in message.new_chat_members:
|
38 |
+
if (temp.MELCOW).get('welcome') is not None:
|
39 |
+
try: await (temp.MELCOW['welcome']).delete()
|
40 |
+
except: pass
|
41 |
+
if WELCOM_PIC: temp.MELCOW['welcome'] = await message.reply_photo(photo=WELCOM_PIC, caption=WELCOM_TEXT.format(user=u.mention, chat=message.chat.title))
|
42 |
+
else: temp.MELCOW['welcome'] = await message.reply_text(text=WELCOM_TEXT.format(user=u.mention, chat=message.chat.title))
|
43 |
+
|
44 |
+
|
45 |
+
@Client.on_message(filters.command('leave') & filters.user(ADMINS))
|
46 |
+
async def leave_a_chat(bot, message):
|
47 |
+
if len(message.command) == 1: return await message.reply('Gɪᴠᴇ Mᴇ A Cʜᴀᴛ Iᴅ')
|
48 |
+
chat = message.command[1]
|
49 |
+
try: chat = int(chat)
|
50 |
+
except: chat = chat
|
51 |
+
try:
|
52 |
+
buttons = [[InlineKeyboardButton('Sᴜᴩᴩᴏʀᴛ', url=f'https://t.me/{SUPPORT_CHAT}')]]
|
53 |
+
await bot.send_message(chat_id=chat, text='<b>Hᴇʟʟᴏ Fʀɪᴇɴᴅs, \nMʏ Aᴅᴍɪɴ Hᴀs Tᴏʟᴅ Mᴇ Tᴏ Lᴇᴀᴠᴇ Fʀᴏᴍ Gʀᴏᴜᴘ Sᴏ I Gᴏ! Iғ Yᴏᴜ Wᴀɴɴᴀ Aᴅᴅ Mᴇ Aɢᴀɪɴ Cᴏɴᴛᴀᴄᴛ Mʏ Sᴜᴘᴘᴏʀᴛ Gʀᴏᴜᴘ</b>', reply_markup=InlineKeyboardMarkup(buttons))
|
54 |
+
await bot.leave_chat(chat)
|
55 |
+
except Exception as e:
|
56 |
+
await message.reply(f'Eʀʀᴏʀ: {e}')
|
57 |
+
|
58 |
+
@Client.on_message(filters.command('disable') & filters.user(ADMINS))
|
59 |
+
async def disable_chat(bot, message):
|
60 |
+
if len(message.command) == 1: return await message.reply('Gɪᴠᴇ Mᴇ A Cʜᴀᴛ Iᴅ')
|
61 |
+
r = message.text.split(None)
|
62 |
+
if len(r) > 2:
|
63 |
+
reason = message.text.split(None, 2)[2]
|
64 |
+
chat = message.text.split(None, 2)[1]
|
65 |
+
else:
|
66 |
+
chat = message.command[1]
|
67 |
+
reason = "No Reason Provided"
|
68 |
+
try:
|
69 |
+
chat_ = int(chat)
|
70 |
+
except:
|
71 |
+
return await message.reply('Gɪᴠᴇ Mᴇ A Vᴀʟɪᴅ Cʜᴀᴛ ID')
|
72 |
+
cha_t = await db.get_chat(int(chat_))
|
73 |
+
if not cha_t:
|
74 |
+
return await message.reply("Cʜᴀᴛ Nᴏᴛ Fᴏᴜɴᴅ Iɴ DB")
|
75 |
+
if cha_t['is_disabled']:
|
76 |
+
return await message.reply(f"Tʜɪꜱ Cʜᴀᴛ Is Aʟʀᴇᴅʏ Dɪꜱᴀʙʟᴇᴅ:\nRᴇᴀꜱᴏɴ: <code> {cha_t['reason']} </code>")
|
77 |
+
await db.disable_chat(int(chat_), reason)
|
78 |
+
temp.BANNED_CHATS.append(int(chat_))
|
79 |
+
await message.reply('Cʜᴀᴛ Sᴜᴄᴄᴇꜱꜰᴜʟʟʏ Dɪꜱᴀʙʟᴇᴅ')
|
80 |
+
try:
|
81 |
+
buttons = [[InlineKeyboardButton('Sᴜᴩᴩᴏʀᴛ', url=f'https://t.me/{SUPPORT_CHAT}')]]
|
82 |
+
await bot.send_message(chat_id=chat_, text=f'<b>Hᴇʟʟᴏ Fʀɪᴇɴᴅs, \n���ʏ Aᴅᴍɪɴ Hᴀs Tᴏʟᴅ Mᴇ Tᴏ Lᴇᴀᴠᴇ Fʀᴏᴍ Gʀᴏᴜᴘ Sᴏ I Gᴏ! Iғ Yᴏᴜ Wᴀɴɴᴀ Aᴅᴅ Mᴇ Aɢᴀɪɴ Cᴏɴᴛᴀᴄᴛ Mʏ Sᴜᴘᴘᴏʀᴛ Gʀᴏᴜᴘ.</b> \nRᴇᴀꜱᴏɴ : <code>{reason}</code>', reply_markup=InlineKeyboardMarkup(buttons))
|
83 |
+
await bot.leave_chat(chat_)
|
84 |
+
except Exception as e:
|
85 |
+
await message.reply(f"Eʀʀᴏʀ: {e}")
|
86 |
+
|
87 |
+
|
88 |
+
@Client.on_message(filters.command('enable') & filters.user(ADMINS))
|
89 |
+
async def re_enable_chat(bot, message):
|
90 |
+
if len(message.command) == 1: return await message.reply('Gɪᴠᴇ Mᴇ A Cʜᴀᴛ Iᴅ')
|
91 |
+
chat = message.command[1]
|
92 |
+
try: chat_ = int(chat)
|
93 |
+
except: return await message.reply('Gɪᴠᴇ Mᴇ A Vᴀʟɪᴅ Cʜᴀᴛ ID')
|
94 |
+
sts = await db.get_chat(int(chat))
|
95 |
+
if not sts: return await message.reply("Cʜᴀᴛ Nᴏᴛ Fᴏᴜɴᴅ Iɴ DB")
|
96 |
+
if not sts.get('is_disabled'):
|
97 |
+
return await message.reply('Tʜɪꜱ Cʜᴀᴛ Iꜱ Nᴏᴛ Yᴇᴛ Dɪꜱᴀʙʟᴇᴅ')
|
98 |
+
await db.re_enable_chat(int(chat_))
|
99 |
+
temp.BANNED_CHATS.remove(int(chat_))
|
100 |
+
await message.reply("Cʜᴀᴛ Sᴜᴄᴄᴇꜱꜰᴜʟʟʏ Rᴇ-Eɴᴀʙʟᴇᴅ")
|
101 |
+
|
102 |
+
|
103 |
+
@Client.on_message(filters.command('stats') & filters.incoming)
|
104 |
+
async def get_ststs(bot, message):
|
105 |
+
rju = await message.reply('<b>Pʟᴇᴀꜱᴇ Wᴀɪᴛ...</b>')
|
106 |
+
total_users = await db.total_users_count()
|
107 |
+
totl_chats = await db.total_chat_count()
|
108 |
+
files = await Media.count_documents()
|
109 |
+
size = await db.get_db_size()
|
110 |
+
free = 536870912 - size
|
111 |
+
size = get_size(size)
|
112 |
+
free = get_size(free)
|
113 |
+
await rju.edit(script.STATUS_TXT.format(files, total_users, totl_chats, size, free))
|
114 |
+
|
115 |
+
|
116 |
+
@Client.on_message(filters.command('invite') & filters.user(ADMINS))
|
117 |
+
async def gen_invite(bot, message):
|
118 |
+
if len(message.command) == 1: return await message.reply('Gɪᴠᴇ Mᴇ A Cʜᴀᴛ Iᴅ')
|
119 |
+
chat = message.command[1]
|
120 |
+
try: chat = int(chat)
|
121 |
+
except: return await message.reply('Gɪᴠᴇ Mᴇ A Vᴀʟɪᴅ Cʜᴀᴛ ID')
|
122 |
+
try:
|
123 |
+
link = await bot.create_chat_invite_link(chat)
|
124 |
+
except ChatAdminRequired:
|
125 |
+
return await message.reply("Iɴᴠɪᴛᴇ Lɪɴᴋ Gᴇɴᴇʀᴀᴛɪᴏɴ Fᴀɪʟᴇᴅ, Iᴀᴍ Nᴏᴛ Hᴀᴠɪɴɢ Sᴜғғɪᴄɪᴇɴᴛ Rɪɢʜᴛs")
|
126 |
+
except Exception as e:
|
127 |
+
return await message.reply(f'Eʀʀᴏʀ: {e}')
|
128 |
+
await message.reply(f'Hᴇʀᴇ Iꜱ Yᴏᴜʀ Iɴᴠɪᴛᴇ Lɪɴᴋ: {link.invite_link}')
|
129 |
+
|
130 |
+
@Client.on_message(filters.command('ban_user') & filters.user(ADMINS))
|
131 |
+
async def ban_a_user(bot, message):
|
132 |
+
if len(message.command) == 1: return await message.reply('Gɪᴠᴇ Mᴇ A Uꜱᴇʀ Iᴅ / Uꜱᴇʀɴᴀᴍᴇ')
|
133 |
+
r = message.text.split(None)
|
134 |
+
if len(r) > 2:
|
135 |
+
reason = message.text.split(None, 2)[2]
|
136 |
+
chat = message.text.split(None, 2)[1]
|
137 |
+
else:
|
138 |
+
chat = message.command[1]
|
139 |
+
reason = "No reason Provided"
|
140 |
+
try: chat = int(chat)
|
141 |
+
except: pass
|
142 |
+
try: k = await bot.get_users(chat)
|
143 |
+
except PeerIdInvalid: return await message.reply("Tʜɪs Is Aɴ Iɴᴠᴀʟɪᴅ Usᴇʀ, Mᴀᴋᴇ Sᴜʀᴇ Iᴀ Hᴀᴠᴇ Mᴇᴛ Hɪᴍ Bᴇғᴏʀᴇ")
|
144 |
+
except IndexError: return await message.reply("Tʜɪs Mɪɢʜᴛ Bᴇ A Cʜᴀɴɴᴇʟ, Mᴀᴋᴇ Sᴜʀᴇ Iᴛs A Usᴇʀ.")
|
145 |
+
except Exception as e: return await message.reply(f'Eʀʀᴏʀ: {e}')
|
146 |
+
else:
|
147 |
+
jar = await db.get_ban_status(k.id)
|
148 |
+
if jar['is_banned']: return await message.reply(f"{k.mention} Iꜱ Aʟʀᴇᴅʏ Bᴀɴɴᴇᴅ\nRᴇᴀꜱᴏɴ: {jar['ban_reason']}")
|
149 |
+
await db.ban_user(k.id, reason)
|
150 |
+
temp.BANNED_USERS.append(k.id)
|
151 |
+
await message.reply(f"Sᴜᴄᴄᴇꜱꜰᴜʟʟʏ Bᴀɴɴᴇᴅ {k.mention}")
|
152 |
+
|
153 |
+
|
154 |
+
|
155 |
+
@Client.on_message(filters.command('unban_user') & filters.user(ADMINS))
|
156 |
+
async def unban_a_user(bot, message):
|
157 |
+
if len(message.command) == 1: return await message.reply('Gɪᴠᴇ Mᴇ A Uꜱᴇʀ Iᴅ / Uꜱᴇʀɴᴀᴍᴇ')
|
158 |
+
r = message.text.split(None)
|
159 |
+
if len(r) > 2:
|
160 |
+
reason = message.text.split(None, 2)[2]
|
161 |
+
chat = message.text.split(None, 2)[1]
|
162 |
+
else:
|
163 |
+
chat = message.command[1]
|
164 |
+
reason = "No reason Provided"
|
165 |
+
try: chat = int(chat)
|
166 |
+
except: pass
|
167 |
+
try: k = await bot.get_users(chat)
|
168 |
+
except PeerIdInvalid: return await message.reply("Tʜɪs Is Aɴ Iɴᴠᴀʟɪᴅ Usᴇʀ, Mᴀᴋᴇ Sᴜʀᴇ Iᴀ Hᴀᴠᴇ Mᴇᴛ Hɪᴍ Bᴇғᴏʀᴇ")
|
169 |
+
except IndexError: return await message.reply("Tʜɪs Mɪɢʜᴛ Bᴇ A Cʜᴀɴɴᴇʟ, Mᴀᴋᴇ Sᴜʀᴇ Iᴛs A Usᴇʀ.")
|
170 |
+
except Exception as e: return await message.reply(f'Eʀʀᴏʀ: {e}')
|
171 |
+
else:
|
172 |
+
jar = await db.get_ban_status(k.id)
|
173 |
+
if not jar['is_banned']: return await message.reply(f"{k.mention} Iꜱ Nᴏᴛ Yᴇᴛ Bᴀɴɴᴇᴅ")
|
174 |
+
await db.remove_ban(k.id)
|
175 |
+
temp.BANNED_USERS.remove(k.id)
|
176 |
+
await message.reply(f"Sᴜᴄᴄᴇꜱꜰᴜʟʟʏ Uɴʙᴀɴɴᴇᴅ {k.mention}")
|
177 |
+
|
178 |
+
|
179 |
+
|
180 |
+
@Client.on_message(filters.command('users') & filters.user(ADMINS))
|
181 |
+
async def list_users(bot, message):
|
182 |
+
sps = await message.reply('Gᴇᴛᴛɪɴɢ Lɪꜱᴛ Oꜰ Uꜱᴇʀꜱ')
|
183 |
+
users = await db.get_all_users()
|
184 |
+
out = "Uꜱᴇʀꜱ Sᴀᴠᴇᴅ Iɴ DB Aʀᴇ:\n\n"
|
185 |
+
async for user in users:
|
186 |
+
out += f"<a href=tg://user?id={user['id']}>{user['name']}</a>\n"
|
187 |
+
try:
|
188 |
+
await sps.edit_text(out)
|
189 |
+
except MessageTooLong:
|
190 |
+
with open('users.txt', 'w+') as outfile:
|
191 |
+
outfile.write(out)
|
192 |
+
await message.reply_document('users.txt', caption="Lɪꜱᴛ Oꜰ Uꜱᴇʀꜱ")
|
193 |
+
|
194 |
+
@Client.on_message(filters.command('chats') & filters.user(ADMINS))
|
195 |
+
async def list_chats(bot, message):
|
196 |
+
sps = await message.reply('Gᴇᴛᴛɪɴɢ Lɪꜱᴛ Oꜰ Cʜᴀᴛꜱ')
|
197 |
+
chats = await db.get_all_chats()
|
198 |
+
out = "Cʜᴀᴛꜱ Sᴀᴠᴇᴅ Iɴ DB Aʀᴇ:\n\n"
|
199 |
+
async for chat in chats:
|
200 |
+
username = chat['username']
|
201 |
+
username = "private" if not username else "@" + username
|
202 |
+
out += f"**- Tɪᴛʟᴇ:** `{chat['title']}`\n**- ID:** `{chat['id']}`\n**Uꜱᴇʀɴᴀᴍᴇ:** {username}\n"
|
203 |
+
try:
|
204 |
+
await sps.edit_text(out)
|
205 |
+
except MessageTooLong:
|
206 |
+
with open('chats.txt', 'w+') as outfile:
|
207 |
+
outfile.write(out)
|
208 |
+
await message.reply_document('chats.txt', caption="Lɪꜱᴛ Oꜰ Cʜᴀᴛꜱ")
|
209 |
+
|
210 |
+
|
211 |
+
|
212 |
+
@Client.on_message(filters.command('id'))
|
213 |
+
async def show_id(client, message):
|
214 |
+
chat_type = message.chat.type
|
215 |
+
if chat_type == enums.ChatType.PRIVATE:
|
216 |
+
user_id = message.chat.id
|
217 |
+
first = message.from_user.first_name
|
218 |
+
last = message.from_user.last_name or ""
|
219 |
+
username = message.from_user.username
|
220 |
+
dc_id = message.from_user.dc_id or ""
|
221 |
+
await message.reply_text(f"<b>➲ ꜰɪʀꜱᴛ ɴᴀᴍᴇ:</b> {first}\n<b>➲ ʟᴀꜱᴛ ɴᴀᴍᴇ:</b> {last}\n<b>➲ ᴜꜱᴇʀɴᴀᴍᴇ:</b> {username}\n<b>➲ ᴛᴇʟᴇɢʀᴀᴍ ɪᴅ:</b> <code>{user_id}</code>\n<b>➲ ᴅᴄ ɪᴅ:</b> <code>{dc_id}</code>", quote=True)
|
222 |
+
|
223 |
+
elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
|
224 |
+
_id = ""
|
225 |
+
_id += f"<b>➲ ᴄʜᴀᴛ ɪᴅ</b>: <code>{message.chat.id}</code>\n"
|
226 |
+
|
227 |
+
if message.reply_to_message:
|
228 |
+
_id += (
|
229 |
+
"<b>➲ ᴜꜱᴇʀ ɪᴅ</b>: "
|
230 |
+
f"<code>{message.from_user.id if message.from_user else 'Anonymous'}</code>\n"
|
231 |
+
"<b>➲ ʀᴇᴩʟɪᴇᴅ ᴜꜱᴇʀ ɪᴅ</b>: "
|
232 |
+
f"<code>{message.reply_to_message.from_user.id if message.reply_to_message.from_user else 'Anonymous'}</code>\n"
|
233 |
+
)
|
234 |
+
file_info = get_file_id(message.reply_to_message)
|
235 |
+
else:
|
236 |
+
_id += (
|
237 |
+
"<b>➲ ᴜꜱᴇʀ ɪᴅ</b>: "
|
238 |
+
f"<code>{message.from_user.id if message.from_user else 'Anonymous'}</code>\n"
|
239 |
+
)
|
240 |
+
file_info = get_file_id(message)
|
241 |
+
if file_info:
|
242 |
+
_id += (
|
243 |
+
f"<b>{file_info.message_type}</b>: "
|
244 |
+
f"<code>{file_info.file_id}</code>\n"
|
245 |
+
)
|
246 |
+
await message.reply_text(_id, quote=True)
|
247 |
+
|
248 |
+
|
249 |
+
@Client.on_message(filters.command(["info"]))
|
250 |
+
async def user_info(client, message):
|
251 |
+
status_message = await message.reply_text("`ᴩʟᴇᴀꜱᴇ ᴡᴀɪᴛ....`")
|
252 |
+
from_user = None
|
253 |
+
from_user_id, _ = extract_user(message)
|
254 |
+
try:
|
255 |
+
from_user = await client.get_users(from_user_id)
|
256 |
+
except Exception as error:
|
257 |
+
return await status_message.edit(str(error))
|
258 |
+
if from_user is None:
|
259 |
+
return await status_message.edit("ɴᴏ ᴠᴀʟɪᴅ ᴜsᴇʀ_ɪᴅ / ᴍᴇssᴀɢᴇ sᴘᴇᴄɪғɪᴇᴅ")
|
260 |
+
message_out_str = ""
|
261 |
+
message_out_str += f"<b>➲ꜰɪʀꜱᴛ ɴᴀᴍᴇ:</b> {from_user.first_name}\n"
|
262 |
+
last_name = from_user.last_name or "<b>ɴᴏɴᴇ</b>"
|
263 |
+
message_out_str += f"<b>➲ʟᴀꜱᴛ ɴᴀᴍᴇ:</b> {last_name}\n"
|
264 |
+
message_out_str += f"<b>➲ᴛɢ-ɪᴅ:</b> <code>{from_user.id}</code>\n"
|
265 |
+
username = from_user.username or "<b>ɴᴏɴᴇ</b>"
|
266 |
+
dc_id = from_user.dc_id or "[ᴜꜱᴇʀ ᴅᴏꜱᴇ'ᴛ ʜᴀᴠᴇ ᴀ ᴠᴀʟɪᴅ ᴅᴩ]"
|
267 |
+
message_out_str += f"<b>➲ᴅᴄ-ɪᴅ:</b> <code>{dc_id}</code>\n"
|
268 |
+
message_out_str += f"<b>➲ᴜꜱᴇʀɴᴀᴍᴇ:</b> @{username}\n"
|
269 |
+
message_out_str += f"<b>➲ᴜꜱᴇʀ ʟɪɴᴋ:</b> <a href='tg://user?id={from_user.id}'><b>ᴄʟɪᴄᴋ ʜᴇʀᴇ</b></a>\n"
|
270 |
+
if message.chat.type in ((enums.ChatType.SUPERGROUP, enums.ChatType.CHANNEL)):
|
271 |
+
try:
|
272 |
+
chat_member_p = await message.chat.get_member(from_user.id)
|
273 |
+
joined_date = (chat_member_p.joined_date or datetime.now()).strftime("%Y.%m.%d %H:%M:%S")
|
274 |
+
message_out_str += f"<b>➲ᴊᴏɪɴᴇᴅ ᴛʜɪꜱ ᴄʜᴀᴛ ᴏɴ:</b> <code>{joined_date}</code>\n"
|
275 |
+
except UserNotParticipant: pass
|
276 |
+
chat_photo = from_user.photo
|
277 |
+
if chat_photo:
|
278 |
+
local_user_photo = await client.download_media(message=chat_photo.big_file_id)
|
279 |
+
buttons = [[InlineKeyboardButton('ᴄʟᴏꜱᴇ ✘', callback_data='close_data')]]
|
280 |
+
await message.reply_photo(
|
281 |
+
photo=local_user_photo,
|
282 |
+
quote=True,
|
283 |
+
reply_markup=InlineKeyboardMarkup(buttons),
|
284 |
+
caption=message_out_str,
|
285 |
+
parse_mode=enums.ParseMode.HTML,
|
286 |
+
disable_notification=True
|
287 |
+
)
|
288 |
+
os.remove(local_user_photo)
|
289 |
+
else:
|
290 |
+
buttons = [[InlineKeyboardButton('ᴄʟᴏꜱᴇ ✘', callback_data='close_data')]]
|
291 |
+
await message.reply_text(
|
292 |
+
text=message_out_str,
|
293 |
+
reply_markup=InlineKeyboardMarkup(buttons),
|
294 |
+
quote=True,
|
295 |
+
parse_mode=enums.ParseMode.HTML,
|
296 |
+
disable_notification=True
|
297 |
+
)
|
298 |
+
await status_message.delete()
|
299 |
+
|
300 |
+
@Client.on_message(filters.command(["imdb", 'search']))
|
301 |
+
async def imdb_search(client, message):
|
302 |
+
if ' ' in message.text:
|
303 |
+
k = await message.reply('ꜱᴇᴀʀᴄʜɪɴɢ ɪᴍᴅʙ..')
|
304 |
+
r, title = message.text.split(None, 1)
|
305 |
+
movies = await get_poster(title, bulk=True)
|
306 |
+
if not movies:
|
307 |
+
return await message.reply("ɴᴏ ʀᴇꜱᴜʟᴛ ꜰᴏᴜɴᴅ")
|
308 |
+
btn = [[InlineKeyboardButton(f"{movie.get('title')} - {movie.get('year')}", callback_data=f"imdb#{movie.movieID}")] for movie in movies ]
|
309 |
+
await k.edit('Hᴇʀᴇ Is Wʜᴀᴛ I Fᴏᴜɴᴅ Oɴ Iᴍᴅʙ', reply_markup=InlineKeyboardMarkup(btn))
|
310 |
+
else:
|
311 |
+
await message.reply('Gɪᴠᴇ Mᴇ A Mᴏᴠɪᴇ / Sᴇʀɪᴇs Nᴀᴍᴇ')
|
312 |
+
|
313 |
+
|
314 |
+
@Client.on_callback_query(filters.regex('^imdb'))
|
315 |
+
async def imdb_callback(bot: Client, quer_y: CallbackQuery):
|
316 |
+
i, movie = quer_y.data.split('#')
|
317 |
+
imdb = await get_poster(query=movie, id=True)
|
318 |
+
btn = [[InlineKeyboardButton(f"{imdb.get('title')}", url=imdb['url'])]]
|
319 |
+
message = quer_y.message.reply_to_message or quer_y.message
|
320 |
+
if imdb:
|
321 |
+
caption = IMDB_TEMPLATE.format(
|
322 |
+
query = imdb['title'],
|
323 |
+
title = imdb['title'],
|
324 |
+
votes = imdb['votes'],
|
325 |
+
aka = imdb["aka"],
|
326 |
+
seasons = imdb["seasons"],
|
327 |
+
box_office = imdb['box_office'],
|
328 |
+
localized_title = imdb['localized_title'],
|
329 |
+
kind = imdb['kind'],
|
330 |
+
imdb_id = imdb["imdb_id"],
|
331 |
+
cast = imdb["cast"],
|
332 |
+
runtime = imdb["runtime"],
|
333 |
+
countries = imdb["countries"],
|
334 |
+
certificates = imdb["certificates"],
|
335 |
+
languages = imdb["languages"],
|
336 |
+
director = imdb["director"],
|
337 |
+
writer = imdb["writer"],
|
338 |
+
producer = imdb["producer"],
|
339 |
+
composer = imdb["composer"],
|
340 |
+
cinematographer = imdb["cinematographer"],
|
341 |
+
music_team = imdb["music_team"],
|
342 |
+
distributors = imdb["distributors"],
|
343 |
+
release_date = imdb['release_date'],
|
344 |
+
year = imdb['year'],
|
345 |
+
genres = imdb['genres'],
|
346 |
+
poster = imdb['poster'],
|
347 |
+
plot = imdb['plot'],
|
348 |
+
rating = imdb['rating'],
|
349 |
+
url = imdb['url'],
|
350 |
+
**locals()
|
351 |
+
)
|
352 |
+
else:
|
353 |
+
caption = "ɴᴏ ʀᴇꜱᴜʟᴛꜱ"
|
354 |
+
if imdb.get('poster'):
|
355 |
+
try:
|
356 |
+
await quer_y.message.reply_photo(photo=imdb['poster'], caption=caption, reply_markup=InlineKeyboardMarkup(btn))
|
357 |
+
except (MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty):
|
358 |
+
pic = imdb.get('poster')
|
359 |
+
poster = pic.replace('.jpg', "._V1_UX360.jpg")
|
360 |
+
await quer_y.message.reply_photo(photo=poster, caption=caption, reply_markup=InlineKeyboardMarkup(btn))
|
361 |
+
except Exception as e:
|
362 |
+
logger.exception(e)
|
363 |
+
await quer_y.message.reply(caption, reply_markup=InlineKeyboardMarkup(btn), disable_web_page_preview=False)
|
364 |
+
await quer_y.message.delete()
|
365 |
+
else:
|
366 |
+
await quer_y.message.edit(caption, reply_markup=InlineKeyboardMarkup(btn), disable_web_page_preview=False)
|
367 |
+
|
368 |
+
|
369 |
+
@Client.on_message(filters.command('logs') & filters.user(ADMINS))
|
370 |
+
async def log_file(bot, msg):
|
371 |
+
try: await message.reply_document('BotLog.txt')
|
372 |
+
except Exception as e: await message.reply(str(e))
|
373 |
+
|
374 |
+
|
375 |
+
@Client.on_message(filters.command("restart") & filters.user(ADMINS))
|
376 |
+
async def restart_bot(bot, msg):
|
377 |
+
await msg.reply("Rᴇꜱᴛᴀᴛɪɴɢ........")
|
378 |
+
await asyncio.sleep(2)
|
379 |
+
await sts.delete()
|
380 |
+
os.execl(sys.executable, sys.executable, *sys.argv)
|
381 |
+
|
382 |
+
|
383 |
+
|
384 |
+
|
385 |
+
|
386 |
+
|
387 |
+
|
plugins/banned.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup
|
2 |
+
from pyrogram import Client, filters
|
3 |
+
from database.users_chats_db import db
|
4 |
+
from info import SUPPORT_CHAT
|
5 |
+
from utils import temp
|
6 |
+
|
7 |
+
async def banned_users(_, client, message: Message):
|
8 |
+
if message.from_user.is_bot: return
|
9 |
+
return (message.from_user is not None or not message.sender_chat) and (message.from_user.id in temp.BANNED_USERS)
|
10 |
+
|
11 |
+
async def disabled_chat(_, client, message: Message):
|
12 |
+
return message.chat.id in temp.BANNED_CHATS
|
13 |
+
|
14 |
+
@Client.on_message(filters.private & filters.incoming & filters.create(banned_users))
|
15 |
+
async def ban_reply(bot, message):
|
16 |
+
ban = await db.get_ban_status(message.from_user.id)
|
17 |
+
await message.reply(f"Sᴏʀʀʏ Dᴜᴅᴇ, Yᴏᴜ Aʀᴇ Bᴀɴɴᴇᴅ Tᴏ Usᴇ Mᴇ. \nBᴀɴ Rᴇᴀsᴏɴ: {ban['ban_reason']}")
|
18 |
+
|
19 |
+
@Client.on_message(filters.group & filters.incoming & filters.create(disabled_chat))
|
20 |
+
async def grp_bd(bot, message):
|
21 |
+
buttons = [[InlineKeyboardButton('Sᴜᴩᴩᴏʀᴛ', url=f'https://t.me/{SUPPORT_CHAT}')]]
|
22 |
+
chat = await db.get_chat(message.chat.id)
|
23 |
+
k = await message.reply(text=f"CHAT NOT ALLOWED 🐞\n\nMʏ Aᴅᴍɪɴs Hᴀs Rᴇsᴛʀɪᴄᴛᴇᴅ Mᴇ Fʀᴏᴍ Wᴏʀᴋɪɴɢ Hᴇʀᴇ ! Iғ Yᴏᴜ Wᴀɴᴛ Tᴏ Kɴᴏᴡ Mᴏʀᴇ Aʙᴏᴜᴛ Iᴛ Cᴏɴᴛᴀᴄᴛ Sᴜᴘᴘᴏʀᴛ..\nRᴇᴀꜱᴏɴ : <code>{chat['reason']}</code>.", reply_markup=InlineKeyboardMarkup(buttons))
|
24 |
+
try: await k.pin()
|
25 |
+
except: pass
|
26 |
+
await bot.leave_chat(message.chat.id)
|
plugins/broadcast.py
ADDED
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import datetime, time, os, asyncio,logging
|
2 |
+
from pyrogram.errors import InputUserDeactivated, UserNotParticipant, FloodWait, UserIsBlocked, PeerIdInvalid
|
3 |
+
from pyrogram.errors.exceptions.bad_request_400 import MessageTooLong, PeerIdInvalid
|
4 |
+
from pyrogram.types import Message, InlineKeyboardButton
|
5 |
+
from pyrogram import Client, filters, enums
|
6 |
+
from database.users_chats_db import db
|
7 |
+
from info import ADMINS
|
8 |
+
|
9 |
+
|
10 |
+
@Client.on_message(filters.command("broadcast") & filters.user(ADMINS) & filters.reply)
|
11 |
+
async def broadcast(bot, message):
|
12 |
+
users = await db.get_all_users()
|
13 |
+
b_msg = message.reply_to_message
|
14 |
+
sts = await message.reply_text('Bʀᴏᴀᴅᴄᴀsᴛɪɴɢ Yᴏᴜʀ Mᴇssᴀɢᴇs...')
|
15 |
+
start_time = time.time()
|
16 |
+
total_users = await db.total_users_count()
|
17 |
+
done = 0
|
18 |
+
blocked = 0
|
19 |
+
deleted = 0
|
20 |
+
failed =0
|
21 |
+
success = 0
|
22 |
+
async for user in users:
|
23 |
+
pti, sh = await broadcast_messages(int(user['id']), b_msg)
|
24 |
+
if pti:
|
25 |
+
success += 1
|
26 |
+
elif pti == False:
|
27 |
+
if sh == "Blocked":
|
28 |
+
blocked+=1
|
29 |
+
elif sh == "Deleted":
|
30 |
+
deleted += 1
|
31 |
+
elif sh == "Error":
|
32 |
+
failed += 1
|
33 |
+
done += 1
|
34 |
+
if not done % 20:
|
35 |
+
await sts.edit(f"Bʀᴏᴀᴅᴄᴀsᴛ Iɴ Pʀᴏɢʀᴇss:\n\nTᴏᴛᴀʟ Uꜱᴇʀꜱ {total_users}\nCᴏᴍᴩʟᴇᴛᴇᴅ: {done} / {total_users}\nSᴜᴄᴄᴇꜱꜱ: {success}\nBʟᴏᴄᴋᴇᴅ: {blocked}\nDᴇʟᴇᴛᴇᴅ: {deleted}")
|
36 |
+
time_taken = datetime.timedelta(seconds=int(time.time()-start_time))
|
37 |
+
await sts.delete()
|
38 |
+
await bot.send_message(message.chat.id, f"Bʀᴏᴀᴅᴄᴀsᴛ Coᴍᴩʟᴇᴛᴇᴅ:\nTɪᴍᴇ Tᴀᴋᴇᴅ{time_taken} Sᴇᴄ\n\nTᴏᴛᴀʟ Uꜱᴇʀꜱ: {total_users}\nCᴏᴍᴩʟᴇᴛᴇᴅ: {done} / {total_users}\nSucᴄᴇꜱꜱ: {success}\nBʟᴏᴄᴋᴇᴅ: {blocked}\nDᴇʟᴇᴛᴇᴅ: {deleted}")
|
39 |
+
|
40 |
+
|
41 |
+
@Client.on_message(filters.command("clear_junk") & filters.user(ADMINS))
|
42 |
+
async def remove_junkuser__db(bot, message):
|
43 |
+
users = await db.get_all_users()
|
44 |
+
b_msg = message
|
45 |
+
sts = await message.reply_text('IN PROGRESS.......')
|
46 |
+
start_time = time.time()
|
47 |
+
total_users = await db.total_users_count()
|
48 |
+
blocked = 0
|
49 |
+
deleted = 0
|
50 |
+
failed = 0
|
51 |
+
done = 0
|
52 |
+
async for user in users:
|
53 |
+
pti, sh = await clear_junk(int(user['id']), b_msg)
|
54 |
+
if pti == False:
|
55 |
+
if sh == "Blocked":
|
56 |
+
blocked+=1
|
57 |
+
elif sh == "Deleted":
|
58 |
+
deleted += 1
|
59 |
+
elif sh == "Error":
|
60 |
+
failed += 1
|
61 |
+
done += 1
|
62 |
+
if not done % 20:
|
63 |
+
await sts.edit(f"In Progress:\n\nTotal Users {total_users}\nCompleted: {done} / {total_users}\nBlocked: {blocked}\nDeleted: {deleted}")
|
64 |
+
time_taken = datetime.timedelta(seconds=int(time.time()-start_time))
|
65 |
+
await sts.delete()
|
66 |
+
await bot.send_message(message.chat.id, f"Completed:\nCompleted in {time_taken} seconds.\n\nTotal Users {total_users}\nCompleted: {done} / {total_users}\nBlocked: {blocked}\nDeleted: {deleted}")
|
67 |
+
|
68 |
+
|
69 |
+
@Client.on_message(filters.command("group_broadcast") & filters.user(ADMINS) & filters.reply)
|
70 |
+
async def broadcast_group(bot, message):
|
71 |
+
groups = await db.get_all_chats()
|
72 |
+
b_msg = message.reply_to_message
|
73 |
+
sts = await message.reply_text(text='Broadcasting your messages To Groups...')
|
74 |
+
start_time = time.time()
|
75 |
+
total_groups = await db.total_chat_count()
|
76 |
+
done = 0
|
77 |
+
failed = ""
|
78 |
+
success = 0
|
79 |
+
deleted = 0
|
80 |
+
async for group in groups:
|
81 |
+
pti, sh, ex = await broadcast_messages_group(int(group['id']), b_msg)
|
82 |
+
if pti == True:
|
83 |
+
if sh == "Succes":
|
84 |
+
success += 1
|
85 |
+
elif pti == False:
|
86 |
+
if sh == "deleted":
|
87 |
+
deleted+=1
|
88 |
+
failed += ex
|
89 |
+
try:
|
90 |
+
await bot.leave_chat(int(group['id']))
|
91 |
+
except Exception as e:
|
92 |
+
print(f"{e} > {group['id']}")
|
93 |
+
done += 1
|
94 |
+
if not done % 20:
|
95 |
+
await sts.edit(f"Broadcast in progress:\n\nTotal Groups {total_groups}\nCompleted: {done} / {total_groups}\nSuccess: {success}\nDeleted: {deleted}")
|
96 |
+
time_taken = datetime.timedelta(seconds=int(time.time()-start_time))
|
97 |
+
await sts.delete()
|
98 |
+
try:
|
99 |
+
await message.reply_text(f"Broadcast Completed:\nCompleted in {time_taken} seconds.\n\nTotal Groups {total_groups}\nCompleted: {done} / {total_groups}\nSuccess: {success}\nDeleted: {deleted}\n\nFiled Reson:- {failed}")
|
100 |
+
except MessageTooLong:
|
101 |
+
with open('reason.txt', 'w+') as outfile:
|
102 |
+
outfile.write(failed)
|
103 |
+
await message.reply_document('reason.txt', caption=f"Completed:\nCompleted in {time_taken} seconds.\n\nTotal Groups {total_groups}\nCompleted: {done} / {total_groups}\nSuccess: {success}\nDeleted: {deleted}")
|
104 |
+
os.remove("reason.txt")
|
105 |
+
|
106 |
+
|
107 |
+
@Client.on_message(filters.command(["junk_group", "clear_junk_group"]) & filters.user(ADMINS))
|
108 |
+
async def junk_clear_group(bot, message):
|
109 |
+
groups = await db.get_all_chats()
|
110 |
+
b_msg = message
|
111 |
+
sts = await message.reply_text(text='..............')
|
112 |
+
start_time = time.time()
|
113 |
+
total_groups = await db.total_chat_count()
|
114 |
+
done = 0
|
115 |
+
failed = ""
|
116 |
+
deleted = 0
|
117 |
+
async for group in groups:
|
118 |
+
pti, sh, ex = await junk_group(int(group['id']), b_msg)
|
119 |
+
if pti == False:
|
120 |
+
if sh == "deleted":
|
121 |
+
deleted+=1
|
122 |
+
failed += ex
|
123 |
+
try:
|
124 |
+
await bot.leave_chat(int(group['id']))
|
125 |
+
except Exception as e:
|
126 |
+
print(f"{e} > {group['id']}")
|
127 |
+
done += 1
|
128 |
+
if not done % 20:
|
129 |
+
await sts.edit(f"in progress:\n\nTotal Groups {total_groups}\nCompleted: {done} / {total_groups}\nDeleted: {deleted}")
|
130 |
+
time_taken = datetime.timedelta(seconds=int(time.time()-start_time))
|
131 |
+
await sts.delete()
|
132 |
+
try:
|
133 |
+
await bot.send_message(message.chat.id, f"Completed:\nCompleted in {time_taken} seconds.\n\nTotal Groups {total_groups}\nCompleted: {done} / {total_groups}\nDeleted: {deleted}\n\nFiled Reson:- {failed}")
|
134 |
+
except MessageTooLong:
|
135 |
+
with open('junk.txt', 'w+') as outfile:
|
136 |
+
outfile.write(failed)
|
137 |
+
await message.reply_document('junk.txt', caption=f"Completed:\nCompleted in {time_taken} seconds.\n\nTotal Groups {total_groups}\nCompleted: {done} / {total_groups}\nDeleted: {deleted}")
|
138 |
+
os.remove("junk.txt")
|
139 |
+
|
140 |
+
async def broadcast_messages_group(chat_id, message):
|
141 |
+
try:
|
142 |
+
await message.copy(chat_id=chat_id)
|
143 |
+
return True, "Succes", 'mm'
|
144 |
+
except FloodWait as e:
|
145 |
+
await asyncio.sleep(e.value)
|
146 |
+
return await broadcast_messages_group(chat_id, message)
|
147 |
+
except Exception as e:
|
148 |
+
await db.delete_chat(int(chat_id))
|
149 |
+
logging.info(f"{chat_id} - PeerIdInvalid")
|
150 |
+
return False, "deleted", f'{e}\n\n'
|
151 |
+
|
152 |
+
async def junk_group(chat_id, message):
|
153 |
+
try:
|
154 |
+
kk = await message.copy(chat_id=chat_id)
|
155 |
+
await kk.delete(True)
|
156 |
+
return True, "Succes", 'mm'
|
157 |
+
except FloodWait as e:
|
158 |
+
await asyncio.sleep(e.value)
|
159 |
+
return await junk_group(chat_id, message)
|
160 |
+
except Exception as e:
|
161 |
+
await db.delete_chat(int(chat_id))
|
162 |
+
logging.info(f"{chat_id} - PeerIdInvalid")
|
163 |
+
return False, "deleted", f'{e}\n\n'
|
164 |
+
|
165 |
+
|
166 |
+
async def clear_junk(user_id, message):
|
167 |
+
try:
|
168 |
+
key = await message.copy(chat_id=user_id)
|
169 |
+
await key.delete(True)
|
170 |
+
return True, "Success"
|
171 |
+
except FloodWait as e:
|
172 |
+
await asyncio.sleep(e.value)
|
173 |
+
return await clear_junk(user_id, message)
|
174 |
+
except InputUserDeactivated:
|
175 |
+
await db.delete_user(int(user_id))
|
176 |
+
logging.info(f"{user_id}-Removed from Database, since deleted account.")
|
177 |
+
return False, "Deleted"
|
178 |
+
except UserIsBlocked:
|
179 |
+
logging.info(f"{user_id} -Blocked the bot.")
|
180 |
+
return False, "Blocked"
|
181 |
+
except PeerIdInvalid:
|
182 |
+
await db.delete_user(int(user_id))
|
183 |
+
logging.info(f"{user_id} - PeerIdInvalid")
|
184 |
+
return False, "Error"
|
185 |
+
except Exception as e:
|
186 |
+
return False, "Error"
|
187 |
+
|
188 |
+
|
189 |
+
|
190 |
+
async def broadcast_messages(user_id, message):
|
191 |
+
try:
|
192 |
+
await message.copy(chat_id=user_id)
|
193 |
+
return True, "Success"
|
194 |
+
except FloodWait as e:
|
195 |
+
await asyncio.sleep(e.value)
|
196 |
+
return await broadcast_messages(user_id, message)
|
197 |
+
except InputUserDeactivated:
|
198 |
+
await db.delete_user(int(user_id))
|
199 |
+
logging.info(f"{user_id}-Removed from Database, since deleted account.")
|
200 |
+
return False, "Deleted"
|
201 |
+
except UserIsBlocked:
|
202 |
+
logging.info(f"{user_id} -Blocked the bot.")
|
203 |
+
return False, "Blocked"
|
204 |
+
except PeerIdInvalid:
|
205 |
+
await db.delete_user(int(user_id))
|
206 |
+
logging.info(f"{user_id} - PeerIdInvalid")
|
207 |
+
return False, "Error"
|
208 |
+
except Exception as e:
|
209 |
+
return False, "Error"
|
210 |
+
|
211 |
+
|
212 |
+
|
213 |
+
|
214 |
+
|
215 |
+
|
216 |
+
|
217 |
+
|
218 |
+
|
plugins/commands.py
ADDED
@@ -0,0 +1,392 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os, re, json, base64, logging, random, asyncio
|
2 |
+
|
3 |
+
from Script import script
|
4 |
+
from database.users_chats_db import db
|
5 |
+
from pyrogram import Client, filters, enums
|
6 |
+
from pyrogram.errors import ChatAdminRequired, FloodWait
|
7 |
+
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
8 |
+
from database.ia_filterdb import Media, get_file_details, unpack_new_file_id
|
9 |
+
from info import CHANNELS, ADMINS, AUTH_CHANNEL, LOG_CHANNEL, PICS, BATCH_FILE_CAPTION, CUSTOM_FILE_CAPTION, PROTECT_CONTENT, START_MESSAGE, FORCE_SUB_TEXT, SUPPORT_CHAT
|
10 |
+
from utils import get_settings, get_size, is_subscribed, save_group_settings, temp
|
11 |
+
from database.connections_mdb import active_connection
|
12 |
+
|
13 |
+
logger = logging.getLogger(__name__)
|
14 |
+
BATCH_FILES = {}
|
15 |
+
|
16 |
+
@Client.on_message(filters.command("start") & filters.incoming)
|
17 |
+
async def start(client, message):
|
18 |
+
if message.chat.type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
|
19 |
+
buttons = [[
|
20 |
+
InlineKeyboardButton('📢 Uᴩᴅᴀᴛᴇꜱ 📢', url=f'https://t.me/{SUPPORT_CHAT}')
|
21 |
+
],[
|
22 |
+
InlineKeyboardButton('ℹ️ Hᴇʟᴩ ℹ️', url=f"https://t.me/{temp.U_NAME}?start=help")
|
23 |
+
]]
|
24 |
+
await message.reply(START_MESSAGE.format(user=message.from_user.mention if message.from_user else message.chat.title, bot=client.mention), reply_markup=InlineKeyboardMarkup(buttons), disable_web_page_preview=True)
|
25 |
+
await asyncio.sleep(2)
|
26 |
+
if not await db.get_chat(message.chat.id):
|
27 |
+
total = await client.get_chat_members_count(message.chat.id)
|
28 |
+
await client.send_message(LOG_CHANNEL, script.LOG_TEXT_G.format(a=message.chat.title, b=message.chat.id, c=message.chat.username, d=total, f=client.mention, e="Unknown"))
|
29 |
+
await db.add_chat(message.chat.id, message.chat.title, message.chat.username)
|
30 |
+
return
|
31 |
+
if not await db.is_user_exist(message.from_user.id):
|
32 |
+
await db.add_user(message.from_user.id, message.from_user.first_name)
|
33 |
+
await client.send_message(LOG_CHANNEL, script.LOG_TEXT_P.format(message.from_user.id, message.from_user.mention, message.from_user.username, temp.U_NAME))
|
34 |
+
if len(message.command) != 2:
|
35 |
+
buttons = [[
|
36 |
+
InlineKeyboardButton("➕️ Aᴅᴅ Mᴇ Tᴏ Yᴏᴜʀ Cʜᴀᴛ ➕", url=f"http://t.me/{temp.U_NAME}?startgroup=true")
|
37 |
+
],[
|
38 |
+
InlineKeyboardButton("Sᴇᴀʀᴄʜ 🔎", switch_inline_query_current_chat=''),
|
39 |
+
InlineKeyboardButton("Cʜᴀɴɴᴇʟ 🔈", url="https://t.me/mkn_bots_updates")
|
40 |
+
],[
|
41 |
+
InlineKeyboardButton("Hᴇʟᴩ 🕸️", callback_data="help"),
|
42 |
+
InlineKeyboardButton("Aʙᴏᴜᴛ ✨", callback_data="about")
|
43 |
+
]]
|
44 |
+
m = await message.reply_sticker("CAACAgUAAxkBAAEBvlVk7YKnYxIHVnKW2PUwoibIR2ygGAACBAADwSQxMYnlHW4Ls8gQHgQ")
|
45 |
+
await asyncio.sleep(2)
|
46 |
+
await message.reply_photo(photo=random.choice(PICS), caption=START_MESSAGE.format(user=message.from_user.mention, bot=client.mention), reply_markup=InlineKeyboardMarkup(buttons), parse_mode=enums.ParseMode.HTML)
|
47 |
+
return await m.delete()
|
48 |
+
|
49 |
+
if AUTH_CHANNEL and not await is_subscribed(client, message):
|
50 |
+
try:
|
51 |
+
invite_link = await client.create_chat_invite_link(int(AUTH_CHANNEL))
|
52 |
+
except ChatAdminRequired:
|
53 |
+
logger.error("MAKE SURE BOT IS ADMIN IN FORCESUB CHANNEL")
|
54 |
+
return
|
55 |
+
btn = [[InlineKeyboardButton("Jᴏɪɴ Mʏ Cʜᴀɴɴᴇʟ ✨", url=invite_link.invite_link)]]
|
56 |
+
if message.command[1] != "subscribe":
|
57 |
+
try:
|
58 |
+
kk, file_id = message.command[1].split("_", 1)
|
59 |
+
pre = 'checksubp' if kk == 'filep' else 'checksub'
|
60 |
+
btn.append([InlineKeyboardButton("⟳ Tʀʏ Aɢᴀɪɴ", callback_data=f"{pre}#{file_id}")])
|
61 |
+
except (IndexError, ValueError):
|
62 |
+
btn.append([InlineKeyboardButton("⟳ Tʀʏ Aɢᴀɪɴ", url=f"https://t.me/{temp.U_NAME}?start={message.command[1]}")])
|
63 |
+
|
64 |
+
try:
|
65 |
+
return await client.send_message(chat_id=message.from_user.id, text=FORCE_SUB_TEXT, reply_markup=InlineKeyboardMarkup(btn), parse_mode=enums.ParseMode.DEFAULT)
|
66 |
+
except Exception as e:
|
67 |
+
print(f"Force Sub Text Error\n{e}")
|
68 |
+
return await client.send_message(chat_id=message.from_user.id, text=script.FORCE_SUB_TEXT, reply_markup=InlineKeyboardMarkup(btn), parse_mode=enums.ParseMode.DEFAULT)
|
69 |
+
|
70 |
+
if len(message.command) == 2 and message.command[1] in ["subscribe", "error", "okay", "help"]:
|
71 |
+
buttons = [[
|
72 |
+
InlineKeyboardButton("➕️ Aᴅᴅ Mᴇ Tᴏ Yᴏᴜʀ Cʜᴀᴛ ➕", url=f"http://t.me/{temp.U_NAME}?startgroup=true")
|
73 |
+
],[
|
74 |
+
InlineKeyboardButton("Sᴇᴀʀᴄʜ 🔎", switch_inline_query_current_chat=''),
|
75 |
+
InlineKeyboardButton("Cʜᴀɴɴᴇʟ 🔈", url="https://t.me/mkn_bots_updates")
|
76 |
+
],[
|
77 |
+
InlineKeyboardButton("Hᴇʟᴩ 🕸️", callback_data="help"),
|
78 |
+
InlineKeyboardButton("Aʙᴏᴜᴛ ✨", callback_data="about")
|
79 |
+
]]
|
80 |
+
m = await message.reply_sticker("CAACAgUAAxkBAAEBvlVk7YKnYxIHVnKW2PUwoibIR2ygGAACBAADwSQxMYnlHW4Ls8gQHgQ")
|
81 |
+
await asyncio.sleep(2)
|
82 |
+
await message.reply_photo(photo=random.choice(PICS), caption=START_MESSAGE.format(user=message.from_user.mention, bot=client.mention), reply_markup=InlineKeyboardMarkup(buttons), parse_mode=enums.ParseMode.HTML)
|
83 |
+
return await m.delete()
|
84 |
+
|
85 |
+
data = message.command[1]
|
86 |
+
try:
|
87 |
+
pre, file_id = data.split('_', 1)
|
88 |
+
except:
|
89 |
+
file_id = data
|
90 |
+
pre = ""
|
91 |
+
|
92 |
+
if data.split("-", 1)[0] == "BATCH":
|
93 |
+
sts = await message.reply("PLEASE WAIT......")
|
94 |
+
file_id = data.split("-", 1)[1]
|
95 |
+
msgs = BATCH_FILES.get(file_id)
|
96 |
+
if not msgs:
|
97 |
+
file = await client.download_media(file_id)
|
98 |
+
try:
|
99 |
+
with open(file) as file_data:
|
100 |
+
msgs=json.loads(file_data.read())
|
101 |
+
except:
|
102 |
+
await sts.edit("FAILED")
|
103 |
+
return await client.send_message(LOG_CHANNEL, "UNABLE TO OPEN FILE.")
|
104 |
+
os.remove(file)
|
105 |
+
BATCH_FILES[file_id] = msgs
|
106 |
+
for msg in msgs:
|
107 |
+
title = msg.get("title")
|
108 |
+
size=get_size(int(msg.get("size", 0)))
|
109 |
+
f_caption=msg.get("caption", "")
|
110 |
+
if BATCH_FILE_CAPTION:
|
111 |
+
try:
|
112 |
+
f_caption=BATCH_FILE_CAPTION.format(mention=message.from_user.mention, file_name= '' if title is None else title, file_size='' if size is None else size, file_caption='' if f_caption is None else f_caption)
|
113 |
+
except Exception as e:
|
114 |
+
logger.exception(e)
|
115 |
+
f_caption=f_caption
|
116 |
+
if f_caption is None:
|
117 |
+
f_caption = f"{title}"
|
118 |
+
try:
|
119 |
+
await client.send_cached_media(chat_id=message.from_user.id, file_id=msg.get("file_id"), caption=f_caption, protect_content=msg.get('protect', False))
|
120 |
+
except FloodWait as e:
|
121 |
+
await asyncio.sleep(e.value)
|
122 |
+
await client.send_cached_media(chat_id=message.from_user.id, file_id=msg.get("file_id"), caption=f_caption, protect_content=msg.get('protect', False))
|
123 |
+
except Exception as e:
|
124 |
+
logger.warning(e, exc_info=True)
|
125 |
+
continue
|
126 |
+
await asyncio.sleep(1)
|
127 |
+
return await sts.delete()
|
128 |
+
|
129 |
+
elif data.split("-", 1)[0] == "DSTORE":
|
130 |
+
sts = await message.reply("PLEASE WAIT....")
|
131 |
+
b_string = data.split("-", 1)[1]
|
132 |
+
decoded = (base64.urlsafe_b64decode(b_string + "=" * (-len(b_string) % 4))).decode("ascii")
|
133 |
+
try:
|
134 |
+
f_msg_id, l_msg_id, f_chat_id, protect = decoded.split("_", 3)
|
135 |
+
except:
|
136 |
+
f_msg_id, l_msg_id, f_chat_id = decoded.split("_", 2)
|
137 |
+
protect = "/pbatch" if PROTECT_CONTENT else "batch"
|
138 |
+
diff = int(l_msg_id) - int(f_msg_id)
|
139 |
+
async for msg in client.iter_messages(int(f_chat_id), int(l_msg_id), int(f_msg_id)):
|
140 |
+
if msg.media:
|
141 |
+
media = getattr(msg, msg.media)
|
142 |
+
if BATCH_FILE_CAPTION:
|
143 |
+
try:
|
144 |
+
f_caption=BATCH_FILE_CAPTION.format(mention=message.from_user.mention, file_name=getattr(media, 'file_name', ''), file_size=getattr(media, 'file_size', ''), file_caption=getattr(msg, 'caption', ''))
|
145 |
+
except Exception as e:
|
146 |
+
logger.exception(e)
|
147 |
+
f_caption = getattr(msg, 'caption', '')
|
148 |
+
else:
|
149 |
+
media = getattr(msg, msg.media)
|
150 |
+
file_name = getattr(media, 'file_name', '')
|
151 |
+
f_caption = getattr(msg, 'caption', file_name)
|
152 |
+
try:
|
153 |
+
await msg.copy(message.chat.id, caption=f_caption, protect_content=True if protect == "/pbatch" else False)
|
154 |
+
except FloodWait as e:
|
155 |
+
await asyncio.sleep(e.value)
|
156 |
+
await msg.copy(message.chat.id, caption=f_caption, protect_content=True if protect == "/pbatch" else False)
|
157 |
+
except Exception as e:
|
158 |
+
logger.exception(e)
|
159 |
+
continue
|
160 |
+
elif msg.empty:
|
161 |
+
continue
|
162 |
+
else:
|
163 |
+
try:
|
164 |
+
await msg.copy(message.chat.id, protect_content=True if protect == "/pbatch" else False)
|
165 |
+
except FloodWait as e:
|
166 |
+
await asyncio.sleep(e.value)
|
167 |
+
await msg.copy(message.chat.id, protect_content=True if protect == "/pbatch" else False)
|
168 |
+
except Exception as e:
|
169 |
+
logger.exception(e)
|
170 |
+
continue
|
171 |
+
await asyncio.sleep(1)
|
172 |
+
return await sts.delete()
|
173 |
+
|
174 |
+
|
175 |
+
files_ = await get_file_details(file_id)
|
176 |
+
if not files_:
|
177 |
+
pre, file_id = ((base64.urlsafe_b64decode(data + "=" * (-len(data) % 4))).decode("ascii")).split("_", 1)
|
178 |
+
try:
|
179 |
+
msg = await client.send_cached_media(chat_id=message.from_user.id, file_id=file_id, protect_content=True if pre == 'filep' else False,)
|
180 |
+
filetype = msg.media
|
181 |
+
file = getattr(msg, filetype)
|
182 |
+
title = file.file_name
|
183 |
+
size=get_size(file.file_size)
|
184 |
+
f_caption = f"<code>{title}</code>"
|
185 |
+
if CUSTOM_FILE_CAPTION:
|
186 |
+
try: f_caption=CUSTOM_FILE_CAPTION.format(mention=message.from_user.mention, file_name= '' if title is None else title, file_size='' if size is None else size, file_caption='')
|
187 |
+
except: return
|
188 |
+
return await msg.edit_caption(f_caption)
|
189 |
+
except: pass
|
190 |
+
return await message.reply('NO SUCH FILE EXIST...')
|
191 |
+
|
192 |
+
files = files_[0]
|
193 |
+
title = files.file_name
|
194 |
+
size=get_size(files.file_size)
|
195 |
+
f_caption=files.caption
|
196 |
+
if CUSTOM_FILE_CAPTION:
|
197 |
+
try:
|
198 |
+
f_caption=CUSTOM_FILE_CAPTION.format(mention=message.from_user.mention, file_name= '' if title is None else title, file_size='' if size is None else size, file_caption='' if f_caption is None else f_caption)
|
199 |
+
except Exception as e:
|
200 |
+
logger.exception(e)
|
201 |
+
f_caption=f_caption
|
202 |
+
if f_caption is None:
|
203 |
+
f_caption = f"{files.file_name}"
|
204 |
+
await client.send_cached_media(chat_id=message.from_user.id, file_id=file_id, caption=f_caption, protect_content=True if pre == 'filep' else False,)
|
205 |
+
|
206 |
+
|
207 |
+
|
208 |
+
@Client.on_message(filters.command('channel') & filters.user(ADMINS))
|
209 |
+
async def channel_info(bot, message):
|
210 |
+
if isinstance(CHANNELS, (int, str)): channels = [CHANNELS]
|
211 |
+
elif isinstance(CHANNELS, list): channels = CHANNELS
|
212 |
+
else: raise ValueError("Unexpected Type Of CHANNELS")
|
213 |
+
text = '📑 **Indexed channels/groups**\n'
|
214 |
+
for channel in channels:
|
215 |
+
chat = await bot.get_chat(channel)
|
216 |
+
if chat.username: text += '\n@' + chat.username
|
217 |
+
else: text += '\n' + chat.title or chat.first_name
|
218 |
+
text += f'\n\n**Total:** {len(CHANNELS)}'
|
219 |
+
if len(text) < 4096: await message.reply(text)
|
220 |
+
else:
|
221 |
+
file = 'Indexed channels.txt'
|
222 |
+
with open(file, 'w') as f:
|
223 |
+
f.write(text)
|
224 |
+
await message.reply_document(file)
|
225 |
+
os.remove(file)
|
226 |
+
|
227 |
+
|
228 |
+
@Client.on_message(filters.command('delete') & filters.user(ADMINS))
|
229 |
+
async def delete(bot, message):
|
230 |
+
reply = message.reply_to_message
|
231 |
+
if reply and reply.media: msg = await message.reply("Processing...⏳", quote=True)
|
232 |
+
else: return await message.reply('Reply to file with /delete which you want to delete', quote=True)
|
233 |
+
for file_type in ("document", "video", "audio"):
|
234 |
+
media = getattr(reply, file_type, None)
|
235 |
+
if media is not None: break
|
236 |
+
else: return await msg.edit('This Is Not Supported File Format')
|
237 |
+
file_id, file_ref = unpack_new_file_id(media.file_id)
|
238 |
+
result = await Media.collection.delete_one({'_id': file_id})
|
239 |
+
if result.deleted_count: await msg.edit('File Is Successfully Deleted From Database')
|
240 |
+
else:
|
241 |
+
file_name = re.sub(r"(_|\-|\.|\+)", " ", str(media.file_name))
|
242 |
+
result = await Media.collection.delete_many({
|
243 |
+
'file_name': file_name,
|
244 |
+
'file_size': media.file_size,
|
245 |
+
'mime_type': media.mime_type
|
246 |
+
})
|
247 |
+
if result.deleted_count: await msg.edit('File Is Successfully Deleted From Database')
|
248 |
+
else:
|
249 |
+
result = await Media.collection.delete_many({
|
250 |
+
'file_name': media.file_name,
|
251 |
+
'file_size': media.file_size,
|
252 |
+
'mime_type': media.mime_type
|
253 |
+
})
|
254 |
+
if result.deleted_count: await msg.edit('File Is Successfully Deleted From Database')
|
255 |
+
else: await msg.edit('File Not Found In Database')
|
256 |
+
|
257 |
+
|
258 |
+
@Client.on_message(filters.command('deleteall') & filters.user(ADMINS))
|
259 |
+
async def delete_all_index(bot, message):
|
260 |
+
button = [[
|
261 |
+
InlineKeyboardButton("YES", callback_data="autofilter_delete")
|
262 |
+
],[
|
263 |
+
InlineKeyboardButton("CANCEL", callback_data="close_data")
|
264 |
+
]]
|
265 |
+
await message.reply_text('This Will Delete All Indexed Files.\ndo You Want To Continue??', quote=True, reply_markup=InlineKeyboardMarkup(button))
|
266 |
+
|
267 |
+
|
268 |
+
@Client.on_callback_query(filters.regex(r'^autofilter_delete'))
|
269 |
+
async def delete_all_index_confirm(bot, message):
|
270 |
+
await Media.collection.drop()
|
271 |
+
await message.message.edit('Succesfully Deleted All The Indexed Files.')
|
272 |
+
|
273 |
+
|
274 |
+
@Client.on_message(filters.command('settings'))
|
275 |
+
async def settings(client, message):
|
276 |
+
userid = message.from_user.id if message.from_user else None
|
277 |
+
if not userid: return await message.reply(f"Yᴏᴜ Aʀᴇ Aɴᴏɴʏᴍᴏᴜs Aᴅᴍɪɴ. Usᴇ /connect {message.chat.id} Iɴ PM")
|
278 |
+
chat_type = message.chat.type
|
279 |
+
if chat_type == enums.ChatType.PRIVATE:
|
280 |
+
grpid = await active_connection(str(userid))
|
281 |
+
if grpid is not None:
|
282 |
+
grp_id = grpid
|
283 |
+
try:
|
284 |
+
chat = await client.get_chat(grpid)
|
285 |
+
title = chat.title
|
286 |
+
except:
|
287 |
+
return await message.reply_text("Mᴀᴋᴇ Sᴜʀᴇ I'ᴍ Pʀᴇsᴇɴᴛ Iɴ Yᴏᴜʀ Gʀᴏᴜᴘ!!", quote=True)
|
288 |
+
else: return await message.reply_text("I'ᴍ Nᴏᴛ Cᴏɴɴᴇᴄᴛᴇᴅ Tᴏ Aɴʏ Gʀᴏᴜᴘs!", quote=True)
|
289 |
+
|
290 |
+
elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
|
291 |
+
grp_id = message.chat.id
|
292 |
+
title = message.chat.title
|
293 |
+
else: return
|
294 |
+
|
295 |
+
st = await client.get_chat_member(grp_id, userid)
|
296 |
+
if (
|
297 |
+
st.status != enums.ChatMemberStatus.ADMINISTRATOR
|
298 |
+
and st.status != enums.ChatMemberStatus.OWNER
|
299 |
+
and str(userid) not in ADMINS
|
300 |
+
): return
|
301 |
+
|
302 |
+
settings = await get_settings(grp_id)
|
303 |
+
if settings is not None:
|
304 |
+
buttons = [[
|
305 |
+
InlineKeyboardButton(f"ꜰɪʟᴛᴇʀ ʙᴜᴛᴛᴏɴ : {'sɪɴɢʟᴇ' if settings['button'] else 'ᴅᴏᴜʙʟᴇ'}", f'setgs#button#{settings["button"]}#{str(grp_id)}')
|
306 |
+
],[
|
307 |
+
InlineKeyboardButton(f"ꜰɪʟᴇ ɪɴ ᴩᴍ ꜱᴛᴀʀᴛ: {'ᴏɴ' if settings['botpm'] else 'ᴏꜰꜰ'}", f'setgs#botpm#{settings["botpm"]}#{str(grp_id)}')
|
308 |
+
],[
|
309 |
+
InlineKeyboardButton(f"ʀᴇꜱᴛʀɪᴄᴛ ᴄᴏɴᴛᴇɴᴛ : {'ᴏɴ' if settings['file_secure'] else 'ᴏꜰꜰ'}", f'setgs#file_secure#{settings["file_secure"]}#{str(grp_id)}')
|
310 |
+
],[
|
311 |
+
InlineKeyboardButton(f"ɪᴍᴅʙ ɪɴ ꜰɪʟᴛᴇʀ : {'ᴏɴ' if settings['imdb'] else 'ᴏꜰꜰ'}", f'setgs#imdb#{settings["imdb"]}#{str(grp_id)}')
|
312 |
+
],[
|
313 |
+
InlineKeyboardButton(f"ꜱᴩᴇʟʟɪɴɢ ᴄʜᴇᴄᴋ : {'ᴏɴ' if settings['spell_check'] else 'ᴏꜰꜰ'}", f'setgs#spell_check#{settings["spell_check"]}#{str(grp_id)}')
|
314 |
+
],[
|
315 |
+
InlineKeyboardButton(f"ᴡᴇʟᴄᴏᴍᴇ ᴍᴇꜱꜱᴀɢᴇ : {'ᴏɴ' if settings['welcome'] else 'ᴏꜰꜰ'}", f'setgs#welcome#{settings["welcome"]}#{str(grp_id)}')
|
316 |
+
]]
|
317 |
+
await message.reply_text(
|
318 |
+
text=f"<b>Cʜᴀɴɢᴇ Yᴏᴜʀ Sᴇᴛᴛɪɴɢꜱ Fᴏʀ {title} Aꜱ Yᴏᴜʀ Wɪꜱʜ ⚙</b>",
|
319 |
+
reply_markup=InlineKeyboardMarkup(buttons),
|
320 |
+
quote=True,
|
321 |
+
disable_web_page_preview=True,
|
322 |
+
parse_mode=enums.ParseMode.HTML,
|
323 |
+
)
|
324 |
+
|
325 |
+
|
326 |
+
|
327 |
+
@Client.on_message(filters.command('set_template'))
|
328 |
+
async def save_template(client, message):
|
329 |
+
sts = await message.reply("Cʜᴇᴄᴋɪɴɢ Tᴇᴍᴘʟᴀᴛᴇ")
|
330 |
+
userid = message.from_user.id if message.from_user else None
|
331 |
+
if not userid: return await message.reply(f"Yᴏᴜ Aʀᴇ Aɴᴏɴʏᴍᴏᴜs Aᴅᴍɪɴ. Usᴇ /connect {message.chat.id} Iɴ PM")
|
332 |
+
chat_type = message.chat.type
|
333 |
+
if chat_type == enums.ChatType.PRIVATE:
|
334 |
+
grpid = await active_connection(str(userid))
|
335 |
+
if grpid is not None:
|
336 |
+
grp_id = grpid
|
337 |
+
try:
|
338 |
+
chat = await client.get_chat(grpid)
|
339 |
+
title = chat.title
|
340 |
+
except:
|
341 |
+
return await message.reply_text("Mᴀᴋᴇ Sᴜʀᴇ I'ᴍ Pʀᴇsᴇɴᴛ Iɴ Yᴏᴜʀ Gʀᴏᴜᴘ !!", quote=True)
|
342 |
+
else:
|
343 |
+
return await message.reply_text("I'ᴍ Nᴏᴛ Cᴏɴɴᴇᴄᴛᴇᴅ Tᴏ Aɴʏ Gʀᴏᴜᴘs!", quote=True)
|
344 |
+
elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
|
345 |
+
grp_id = message.chat.id
|
346 |
+
title = message.chat.title
|
347 |
+
else: return
|
348 |
+
st = await client.get_chat_member(grp_id, userid)
|
349 |
+
if (
|
350 |
+
st.status != enums.ChatMemberStatus.ADMINISTRATOR
|
351 |
+
and st.status != enums.ChatMemberStatus.OWNER
|
352 |
+
and str(userid) not in ADMINS
|
353 |
+
): return
|
354 |
+
if len(message.command) < 2: return await sts.edit("No Iɴᴩᴜᴛ!!")
|
355 |
+
template = message.text.split(" ", 1)[1]
|
356 |
+
await save_group_settings(grp_id, 'template', template)
|
357 |
+
await sts.edit(f"Sᴜᴄᴄᴇssғᴜʟʟʏ Cʜᴀɴɢᴇᴅ Tᴇᴍᴘʟᴀᴛᴇ Fᴏʀ {title} Tᴏ\n\n{template}")
|
358 |
+
|
359 |
+
|
360 |
+
@Client.on_message(filters.command('get_template'))
|
361 |
+
async def geg_template(client, message):
|
362 |
+
sts = await message.reply("Cʜᴇᴄᴋɪɴɢ Tᴇᴍᴘʟᴀᴛᴇ")
|
363 |
+
userid = message.from_user.id if message.from_user else None
|
364 |
+
if not userid: return await message.reply(f"Yᴏᴜ Aʀᴇ Aɴᴏɴʏᴍᴏᴜs Aᴅᴍɪɴ. Usᴇ /connect {message.chat.id} Iɴ PM")
|
365 |
+
chat_type = message.chat.type
|
366 |
+
if chat_type == enums.ChatType.PRIVATE:
|
367 |
+
grpid = await active_connection(str(userid))
|
368 |
+
if grpid is not None:
|
369 |
+
grp_id = grpid
|
370 |
+
try:
|
371 |
+
chat = await client.get_chat(grpid)
|
372 |
+
title = chat.title
|
373 |
+
except:
|
374 |
+
return await message.reply_text("Mᴀᴋᴇ Sᴜʀᴇ I'ᴍ Pʀᴇsᴇɴᴛ Iɴ Yᴏᴜʀ Gʀᴏᴜᴘ !!", quote=True)
|
375 |
+
else:
|
376 |
+
return await message.reply_text("I'ᴍ Nᴏᴛ Cᴏɴɴᴇᴄᴛᴇᴅ Tᴏ Aɴʏ Gʀᴏᴜᴘs!", quote=True)
|
377 |
+
elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
|
378 |
+
grp_id = message.chat.id
|
379 |
+
title = message.chat.title
|
380 |
+
else: return
|
381 |
+
st = await client.get_chat_member(grp_id, userid)
|
382 |
+
if (
|
383 |
+
st.status != enums.ChatMemberStatus.ADMINISTRATOR
|
384 |
+
and st.status != enums.ChatMemberStatus.OWNER
|
385 |
+
and str(userid) not in ADMINS
|
386 |
+
): return
|
387 |
+
settings = await get_settings(grp_id)
|
388 |
+
template = settings['template']
|
389 |
+
await sts.edit(f"Cᴜʀʀᴇɴᴛ Tᴇᴍᴘʟᴀᴛᴇ Fᴏʀ {title} Iꜱ\n\n{template}")
|
390 |
+
|
391 |
+
|
392 |
+
|
plugins/connection.py
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram import filters, Client, enums
|
2 |
+
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
3 |
+
from database.connections_mdb import add_connection, all_connections, if_active, delete_connection
|
4 |
+
from info import ADMINS
|
5 |
+
import logging
|
6 |
+
|
7 |
+
logger = logging.getLogger(__name__)
|
8 |
+
logger.setLevel(logging.ERROR)
|
9 |
+
|
10 |
+
|
11 |
+
@Client.on_message((filters.private | filters.group) & filters.command('connect'))
|
12 |
+
async def addconnection(client, message):
|
13 |
+
userid = message.from_user.id if message.from_user else None
|
14 |
+
if not userid:
|
15 |
+
return await message.reply(f"You are anonymous admin. Use /connect {message.chat.id} in PM")
|
16 |
+
chat_type = message.chat.type
|
17 |
+
|
18 |
+
if chat_type == enums.ChatType.PRIVATE:
|
19 |
+
try:
|
20 |
+
cmd, group_id = message.text.split(" ", 1)
|
21 |
+
except:
|
22 |
+
await message.reply_text(
|
23 |
+
"<b>Enter in correct format!</b>\n\n"
|
24 |
+
"<code>/connect groupid</code>\n\n"
|
25 |
+
"<i>Get your Group id by adding this bot to your group and use <code>/id</code></i>",
|
26 |
+
quote=True
|
27 |
+
)
|
28 |
+
return
|
29 |
+
|
30 |
+
elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
|
31 |
+
group_id = message.chat.id
|
32 |
+
|
33 |
+
try:
|
34 |
+
st = await client.get_chat_member(group_id, userid)
|
35 |
+
if (
|
36 |
+
st.status != enums.ChatMemberStatus.ADMINISTRATOR
|
37 |
+
and st.status != enums.ChatMemberStatus.OWNER
|
38 |
+
and userid not in ADMINS
|
39 |
+
):
|
40 |
+
return await message.reply_text("You should be an admin in Given group!", quote=True)
|
41 |
+
except Exception as e:
|
42 |
+
logger.exception(e)
|
43 |
+
return await message.reply_text("Invalid Group ID!\n\nIf correct, Make sure I'm present in your group!!", quote=True,)
|
44 |
+
try:
|
45 |
+
st = await client.get_chat_member(group_id, "me")
|
46 |
+
if st.status == enums.ChatMemberStatus.ADMINISTRATOR:
|
47 |
+
ttl = await client.get_chat(group_id)
|
48 |
+
title = ttl.title
|
49 |
+
|
50 |
+
addcon = await add_connection(str(group_id), str(userid))
|
51 |
+
if addcon:
|
52 |
+
await message.reply_text(
|
53 |
+
f"Successfully connected to **{title}**\nNow manage your group from my pm !",
|
54 |
+
quote=True,
|
55 |
+
parse_mode=enums.ParseMode.MARKDOWN
|
56 |
+
)
|
57 |
+
if chat_type in ["group", "supergroup"]:
|
58 |
+
await client.send_message(
|
59 |
+
userid,
|
60 |
+
f"Connected to **{title}** !",
|
61 |
+
parse_mode=enums.ParseMode.MARKDOWN
|
62 |
+
)
|
63 |
+
else:
|
64 |
+
await message.reply_text("You're already connected to this chat!", quote=True)
|
65 |
+
else:
|
66 |
+
await message.reply_text("Add me as an admin in group", quote=True)
|
67 |
+
except Exception as e:
|
68 |
+
logger.exception(e)
|
69 |
+
return await message.reply_text('Some error occurred! Try again later.', quote=True)
|
70 |
+
|
71 |
+
|
72 |
+
@Client.on_message((filters.private | filters.group) & filters.command('disconnect'))
|
73 |
+
async def deleteconnection(client, message):
|
74 |
+
userid = message.from_user.id if message.from_user else None
|
75 |
+
if not userid:
|
76 |
+
return await message.reply(f"You are anonymous admin. Use /connect {message.chat.id} in PM")
|
77 |
+
chat_type = message.chat.type
|
78 |
+
if chat_type == enums.ChatType.PRIVATE:
|
79 |
+
await message.reply_text("Run /connections to view or disconnect from groups!", quote=True)
|
80 |
+
elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
|
81 |
+
group_id = message.chat.id
|
82 |
+
|
83 |
+
st = await client.get_chat_member(group_id, userid)
|
84 |
+
if (
|
85 |
+
st.status != enums.ChatMemberStatus.ADMINISTRATOR
|
86 |
+
and st.status != enums.ChatMemberStatus.OWNER
|
87 |
+
and str(userid) not in ADMINS
|
88 |
+
):
|
89 |
+
return
|
90 |
+
|
91 |
+
delcon = await delete_connection(str(userid), str(group_id))
|
92 |
+
if delcon:
|
93 |
+
await message.reply_text("Successfully disconnected from this chat", quote=True)
|
94 |
+
else:
|
95 |
+
await message.reply_text("This chat isn't connected to me!\nDo /connect to connect.", quote=True)
|
96 |
+
|
97 |
+
|
98 |
+
@Client.on_message(filters.private & filters.command(["connections"]))
|
99 |
+
async def connections(client, message):
|
100 |
+
userid = message.from_user.id
|
101 |
+
groupids = await all_connections(str(userid))
|
102 |
+
if groupids is None:
|
103 |
+
return await message.reply_text("There are no active connections!! Connect to some groups first.", quote=True)
|
104 |
+
buttons = []
|
105 |
+
for groupid in groupids:
|
106 |
+
try:
|
107 |
+
ttl = await client.get_chat(int(groupid))
|
108 |
+
title = ttl.title
|
109 |
+
active = await if_active(str(userid), str(groupid))
|
110 |
+
act = " - ACTIVE" if active else ""
|
111 |
+
buttons.append([InlineKeyboardButton(f"{title}{act}", callback_data=f"groupcb:{groupid}:{act}")])
|
112 |
+
except:
|
113 |
+
pass
|
114 |
+
if buttons:
|
115 |
+
await message.reply_text("Your connected group details ;\n\n", reply_markup=InlineKeyboardMarkup(buttons), quote=True)
|
116 |
+
else:
|
117 |
+
await message.reply_text("There are no active connections!! Connect to some groups first.", quote=True)
|
plugins/file_store.py
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import re, os, json, base64, logging
|
2 |
+
from pyrogram import filters, Client, enums
|
3 |
+
from pyrogram.errors.exceptions.bad_request_400 import ChannelInvalid, UsernameInvalid, UsernameNotModified
|
4 |
+
from info import ADMINS, LOG_CHANNEL, FILE_STORE_CHANNEL, PUBLIC_FILE_STORE
|
5 |
+
from database.ia_filterdb import unpack_new_file_id
|
6 |
+
from utils import temp
|
7 |
+
|
8 |
+
logger = logging.getLogger(__name__)
|
9 |
+
logger.setLevel(logging.INFO)
|
10 |
+
|
11 |
+
async def allowed(_, __, message):
|
12 |
+
if PUBLIC_FILE_STORE:
|
13 |
+
return True
|
14 |
+
if message.from_user and message.from_user.id in ADMINS:
|
15 |
+
return True
|
16 |
+
return False
|
17 |
+
|
18 |
+
@Client.on_message(filters.command(['link', 'plink']) & filters.create(allowed))
|
19 |
+
async def gen_link_s(bot, message):
|
20 |
+
replied = message.reply_to_message
|
21 |
+
if not replied:
|
22 |
+
return await message.reply('Reply to a message to get a shareable link.')
|
23 |
+
file_type = replied.media
|
24 |
+
if file_type not in [enums.MessageMediaType.VIDEO, enums.MessageMediaType.AUDIO, enums.MessageMediaType.DOCUMENT]:
|
25 |
+
return await message.reply("Reply to a supported media")
|
26 |
+
if message.has_protected_content and message.chat.id not in ADMINS:
|
27 |
+
return await message.reply("okDa")
|
28 |
+
file_id, ref = unpack_new_file_id((getattr(replied, file_type.value)).file_id)
|
29 |
+
string = 'filep_' if message.text.lower().strip() == "/plink" else 'file_'
|
30 |
+
string += file_id
|
31 |
+
outstr = base64.urlsafe_b64encode(string.encode("ascii")).decode().strip("=")
|
32 |
+
await message.reply(f"Here is your Link:\nhttps://t.me/{temp.U_NAME}?start={outstr}")
|
33 |
+
|
34 |
+
|
35 |
+
@Client.on_message(filters.command(['batch', 'pbatch']) & filters.create(allowed))
|
36 |
+
async def gen_link_batch(bot, message):
|
37 |
+
if " " not in message.text:
|
38 |
+
return await message.reply("Use correct format.\nExample <code>/batch https://t.me/TeamEvamaria/10 https://t.me/TeamEvamaria/20</code>.")
|
39 |
+
links = message.text.strip().split(" ")
|
40 |
+
if len(links) != 3:
|
41 |
+
return await message.reply("Use correct format.\nExample <code>/batch https://t.me/TeamEvamaria/10 https://t.me/TeamEvamaria/20</code>.")
|
42 |
+
cmd, first, last = links
|
43 |
+
regex = re.compile("(https://)?(t\.me/|telegram\.me/|telegram\.dog/)(c/)?(\d+|[a-zA-Z_0-9]+)/(\d+)$")
|
44 |
+
match = regex.match(first)
|
45 |
+
if not match:
|
46 |
+
return await message.reply('Invalid link')
|
47 |
+
f_chat_id = match.group(4)
|
48 |
+
f_msg_id = int(match.group(5))
|
49 |
+
if f_chat_id.isnumeric():
|
50 |
+
f_chat_id = int(("-100" + f_chat_id))
|
51 |
+
|
52 |
+
match = regex.match(last)
|
53 |
+
if not match:
|
54 |
+
return await message.reply('Invalid link')
|
55 |
+
l_chat_id = match.group(4)
|
56 |
+
l_msg_id = int(match.group(5))
|
57 |
+
if l_chat_id.isnumeric():
|
58 |
+
l_chat_id = int(("-100" + l_chat_id))
|
59 |
+
|
60 |
+
if f_chat_id != l_chat_id:
|
61 |
+
return await message.reply("Chat ids not matched.")
|
62 |
+
try:
|
63 |
+
chat_id = (await bot.get_chat(f_chat_id)).id
|
64 |
+
except ChannelInvalid:
|
65 |
+
return await message.reply('This may be a private channel / group. Make me an admin over there to index the files.')
|
66 |
+
except (UsernameInvalid, UsernameNotModified):
|
67 |
+
return await message.reply('Invalid Link specified.')
|
68 |
+
except Exception as e:
|
69 |
+
return await message.reply(f'Errors - {e}')
|
70 |
+
|
71 |
+
sts = await message.reply("Generating link for your message.\nThis may take time depending upon number of messages")
|
72 |
+
if chat_id in FILE_STORE_CHANNEL:
|
73 |
+
string = f"{f_msg_id}_{l_msg_id}_{chat_id}_{cmd.lower().strip()}"
|
74 |
+
b_64 = base64.urlsafe_b64encode(string.encode("ascii")).decode().strip("=")
|
75 |
+
return await sts.edit(f"Here is your link https://t.me/{temp.U_NAME}?start=DSTORE-{b_64}")
|
76 |
+
|
77 |
+
FRMT = "Generating Link...\nTotal Messages: `{total}`\nDone: `{current}`\nRemaining: `{rem}`\nStatus: `{sts}`"
|
78 |
+
|
79 |
+
outlist = []
|
80 |
+
|
81 |
+
# file store without db channel
|
82 |
+
og_msg = 0
|
83 |
+
tot = 0
|
84 |
+
async for msg in bot.iter_messages(f_chat_id, l_msg_id, f_msg_id):
|
85 |
+
tot += 1
|
86 |
+
if msg.empty or msg.service:
|
87 |
+
continue
|
88 |
+
if not msg.media:
|
89 |
+
# only media messages supported.
|
90 |
+
continue
|
91 |
+
try:
|
92 |
+
file_type = msg.media
|
93 |
+
file = getattr(msg, file_type.value)
|
94 |
+
caption = getattr(msg, 'caption', '')
|
95 |
+
if caption:
|
96 |
+
caption = caption.html
|
97 |
+
if file:
|
98 |
+
file = {
|
99 |
+
"file_id": file.file_id,
|
100 |
+
"caption": caption,
|
101 |
+
"title": getattr(file, "file_name", ""),
|
102 |
+
"size": file.file_size,
|
103 |
+
"protect": cmd.lower().strip() == "/pbatch",
|
104 |
+
}
|
105 |
+
|
106 |
+
og_msg +=1
|
107 |
+
outlist.append(file)
|
108 |
+
except:
|
109 |
+
pass
|
110 |
+
if not og_msg % 20:
|
111 |
+
try:
|
112 |
+
await sts.edit(FRMT.format(total=l_msg_id-f_msg_id, current=tot, rem=((l_msg_id-f_msg_id) - tot), sts="Saving Messages"))
|
113 |
+
except:
|
114 |
+
pass
|
115 |
+
with open(f"batchmode_{message.from_user.id}.json", "w+") as out:
|
116 |
+
json.dump(outlist, out)
|
117 |
+
post = await bot.send_document(LOG_CHANNEL, f"batchmode_{message.from_user.id}.json", file_name="Batch.json", caption="⚠️Generated for filestore.")
|
118 |
+
os.remove(f"batchmode_{message.from_user.id}.json")
|
119 |
+
file_id, ref = unpack_new_file_id(post.document.file_id)
|
120 |
+
await sts.edit(f"Here is your link\nContains `{og_msg}` files.\n https://t.me/{temp.U_NAME}?start=BATCH-{file_id}")
|
plugins/filters_global.py
ADDED
@@ -0,0 +1,409 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import io
|
2 |
+
from pyrogram import filters, Client, enums
|
3 |
+
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
4 |
+
|
5 |
+
from database.filters_mdb import add_filter, get_filters, delete_filter, count_filters
|
6 |
+
from database.gfilters_mdb import add_gfilter, get_gfilters, delete_gfilter, count_gfilters, del_allg
|
7 |
+
from database.connections_mdb import active_connection
|
8 |
+
from utils import get_file_id, parser, split_quotes
|
9 |
+
from info import ADMINS
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
@Client.on_message(filters.command(['filter', 'add']) & filters.incoming)
|
14 |
+
async def addfilter(client, message):
|
15 |
+
userid = message.from_user.id if message.from_user else None
|
16 |
+
if not userid:
|
17 |
+
return await message.reply(f"You are anonymous admin. Use /connect {message.chat.id} in PM")
|
18 |
+
chat_type = message.chat.type
|
19 |
+
args = message.text.html.split(None, 1)
|
20 |
+
|
21 |
+
if chat_type == enums.ChatType.PRIVATE:
|
22 |
+
grpid = await active_connection(str(userid))
|
23 |
+
if grpid is not None:
|
24 |
+
grp_id = grpid
|
25 |
+
try:
|
26 |
+
chat = await client.get_chat(grpid)
|
27 |
+
title = chat.title
|
28 |
+
except:
|
29 |
+
await message.reply_text("Make sure I'm present in your group!!", quote=True)
|
30 |
+
return
|
31 |
+
else:
|
32 |
+
await message.reply_text("I'm not connected to any groups!", quote=True)
|
33 |
+
return
|
34 |
+
|
35 |
+
elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
|
36 |
+
grp_id = message.chat.id
|
37 |
+
title = message.chat.title
|
38 |
+
|
39 |
+
else:
|
40 |
+
return
|
41 |
+
|
42 |
+
st = await client.get_chat_member(grp_id, userid)
|
43 |
+
if (
|
44 |
+
st.status != enums.ChatMemberStatus.ADMINISTRATOR
|
45 |
+
and st.status != enums.ChatMemberStatus.OWNER
|
46 |
+
and str(userid) not in ADMINS
|
47 |
+
):
|
48 |
+
return
|
49 |
+
|
50 |
+
|
51 |
+
if len(args) < 2:
|
52 |
+
await message.reply_text("Command Incomplete :(", quote=True)
|
53 |
+
return
|
54 |
+
|
55 |
+
extracted = split_quotes(args[1])
|
56 |
+
text = extracted[0].lower()
|
57 |
+
|
58 |
+
if not message.reply_to_message and len(extracted) < 2:
|
59 |
+
await message.reply_text("Add some content to save your filter!", quote=True)
|
60 |
+
return
|
61 |
+
|
62 |
+
if (len(extracted) >= 2) and not message.reply_to_message:
|
63 |
+
reply_text, btn, alert = parser(extracted[1], text, "alertmessage")
|
64 |
+
fileid = None
|
65 |
+
if not reply_text:
|
66 |
+
await message.reply_text("You cannot have buttons alone, give some text to go with it!", quote=True)
|
67 |
+
return
|
68 |
+
|
69 |
+
elif message.reply_to_message and message.reply_to_message.reply_markup:
|
70 |
+
try:
|
71 |
+
rm = message.reply_to_message.reply_markup
|
72 |
+
btn = rm.inline_keyboard
|
73 |
+
msg = get_file_id(message.reply_to_message)
|
74 |
+
if msg:
|
75 |
+
fileid = msg.file_id
|
76 |
+
reply_text = message.reply_to_message.caption.html
|
77 |
+
else:
|
78 |
+
reply_text = message.reply_to_message.text.html
|
79 |
+
fileid = None
|
80 |
+
alert = None
|
81 |
+
except:
|
82 |
+
reply_text = ""
|
83 |
+
btn = "[]"
|
84 |
+
fileid = None
|
85 |
+
alert = None
|
86 |
+
|
87 |
+
elif message.reply_to_message and message.reply_to_message.media:
|
88 |
+
try:
|
89 |
+
msg = get_file_id(message.reply_to_message)
|
90 |
+
fileid = msg.file_id if msg else None
|
91 |
+
reply_text, btn, alert = parser(extracted[1], text, "alertmessage") if message.reply_to_message.sticker else parser(message.reply_to_message.caption.html, text, "alertmessage")
|
92 |
+
except:
|
93 |
+
reply_text = ""
|
94 |
+
btn = "[]"
|
95 |
+
alert = None
|
96 |
+
elif message.reply_to_message and message.reply_to_message.text:
|
97 |
+
try:
|
98 |
+
fileid = None
|
99 |
+
reply_text, btn, alert = parser(message.reply_to_message.text.html, text, "alertmessage")
|
100 |
+
except:
|
101 |
+
reply_text = ""
|
102 |
+
btn = "[]"
|
103 |
+
alert = None
|
104 |
+
else:
|
105 |
+
return
|
106 |
+
|
107 |
+
await add_filter(grp_id, text, reply_text, btn, fileid, alert)
|
108 |
+
|
109 |
+
await message.reply_text(
|
110 |
+
f"Filter for `{text}` added in **{title}**",
|
111 |
+
quote=True,
|
112 |
+
parse_mode=enums.ParseMode.MARKDOWN
|
113 |
+
)
|
114 |
+
|
115 |
+
|
116 |
+
@Client.on_message(filters.command(['viewfilters', 'filters']) & filters.incoming)
|
117 |
+
async def get_all(client, message):
|
118 |
+
|
119 |
+
chat_type = message.chat.type
|
120 |
+
userid = message.from_user.id if message.from_user else None
|
121 |
+
if not userid:
|
122 |
+
return await message.reply(f"You are anonymous admin. Use /connect {message.chat.id} in PM")
|
123 |
+
if chat_type == enums.ChatType.PRIVATE:
|
124 |
+
grpid = await active_connection(str(userid))
|
125 |
+
if grpid is not None:
|
126 |
+
grp_id = grpid
|
127 |
+
try:
|
128 |
+
chat = await client.get_chat(grpid)
|
129 |
+
title = chat.title
|
130 |
+
except:
|
131 |
+
await message.reply_text("Make sure I'm present in your group!!", quote=True)
|
132 |
+
return
|
133 |
+
else:
|
134 |
+
await message.reply_text("I'm not connected to any groups!", quote=True)
|
135 |
+
return
|
136 |
+
|
137 |
+
elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
|
138 |
+
grp_id = message.chat.id
|
139 |
+
title = message.chat.title
|
140 |
+
|
141 |
+
else:
|
142 |
+
return
|
143 |
+
|
144 |
+
st = await client.get_chat_member(grp_id, userid)
|
145 |
+
if (
|
146 |
+
st.status != enums.ChatMemberStatus.ADMINISTRATOR
|
147 |
+
and st.status != enums.ChatMemberStatus.OWNER
|
148 |
+
and str(userid) not in ADMINS
|
149 |
+
):
|
150 |
+
return
|
151 |
+
|
152 |
+
texts = await get_filters(grp_id)
|
153 |
+
count = await count_filters(grp_id)
|
154 |
+
if count:
|
155 |
+
filterlist = f"Total number of filters in **{title}** : {count}\n\n"
|
156 |
+
|
157 |
+
for text in texts:
|
158 |
+
keywords = " × `{}`\n".format(text)
|
159 |
+
|
160 |
+
filterlist += keywords
|
161 |
+
|
162 |
+
if len(filterlist) > 4096:
|
163 |
+
with io.BytesIO(str.encode(filterlist.replace("`", ""))) as keyword_file:
|
164 |
+
keyword_file.name = "keywords.txt"
|
165 |
+
await message.reply_document(
|
166 |
+
document=keyword_file,
|
167 |
+
quote=True
|
168 |
+
)
|
169 |
+
return
|
170 |
+
else:
|
171 |
+
filterlist = f"There are no active filters in **{title}**"
|
172 |
+
|
173 |
+
await message.reply_text(
|
174 |
+
text=filterlist,
|
175 |
+
quote=True,
|
176 |
+
parse_mode=enums.ParseMode.MARKDOWN
|
177 |
+
)
|
178 |
+
|
179 |
+
@Client.on_message(filters.command('del') & filters.incoming)
|
180 |
+
async def deletefilter(client, message):
|
181 |
+
userid = message.from_user.id if message.from_user else None
|
182 |
+
if not userid:
|
183 |
+
return await message.reply(f"You are anonymous admin. Use /connect {message.chat.id} in PM")
|
184 |
+
chat_type = message.chat.type
|
185 |
+
|
186 |
+
if chat_type == enums.ChatType.PRIVATE:
|
187 |
+
grpid = await active_connection(str(userid))
|
188 |
+
if grpid is not None:
|
189 |
+
grp_id = grpid
|
190 |
+
try:
|
191 |
+
chat = await client.get_chat(grpid)
|
192 |
+
title = chat.title
|
193 |
+
except:
|
194 |
+
await message.reply_text("Make sure I'm present in your group!!", quote=True)
|
195 |
+
return
|
196 |
+
else:
|
197 |
+
await message.reply_text("I'm not connected to any groups!", quote=True)
|
198 |
+
return
|
199 |
+
|
200 |
+
elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
|
201 |
+
grp_id = message.chat.id
|
202 |
+
title = message.chat.title
|
203 |
+
|
204 |
+
else:
|
205 |
+
return
|
206 |
+
|
207 |
+
st = await client.get_chat_member(grp_id, userid)
|
208 |
+
if (
|
209 |
+
st.status != enums.ChatMemberStatus.ADMINISTRATOR
|
210 |
+
and st.status != enums.ChatMemberStatus.OWNER
|
211 |
+
and str(userid) not in ADMINS
|
212 |
+
):
|
213 |
+
return
|
214 |
+
|
215 |
+
try:
|
216 |
+
cmd, text = message.text.split(" ", 1)
|
217 |
+
except:
|
218 |
+
await message.reply_text(
|
219 |
+
"<i>Mention the filtername which you wanna delete!</i>\n\n"
|
220 |
+
"<code>/del filtername</code>\n\n"
|
221 |
+
"Use /viewfilters to view all available filters",
|
222 |
+
quote=True
|
223 |
+
)
|
224 |
+
return
|
225 |
+
|
226 |
+
query = text.lower()
|
227 |
+
|
228 |
+
await delete_filter(message, query, grp_id)
|
229 |
+
|
230 |
+
|
231 |
+
@Client.on_message(filters.command('delall') & filters.incoming)
|
232 |
+
async def delallconfirm(client, message):
|
233 |
+
userid = message.from_user.id if message.from_user else None
|
234 |
+
if not userid:
|
235 |
+
return await message.reply(f"You are anonymous admin. Use /connect {message.chat.id} in PM")
|
236 |
+
chat_type = message.chat.type
|
237 |
+
|
238 |
+
if chat_type == enums.ChatType.PRIVATE:
|
239 |
+
grpid = await active_connection(str(userid))
|
240 |
+
if grpid is not None:
|
241 |
+
grp_id = grpid
|
242 |
+
try:
|
243 |
+
chat = await client.get_chat(grpid)
|
244 |
+
title = chat.title
|
245 |
+
except:
|
246 |
+
await message.reply_text("Make sure I'm present in your group!!", quote=True)
|
247 |
+
return
|
248 |
+
else:
|
249 |
+
await message.reply_text("I'm not connected to any groups!", quote=True)
|
250 |
+
return
|
251 |
+
|
252 |
+
elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
|
253 |
+
grp_id = message.chat.id
|
254 |
+
title = message.chat.title
|
255 |
+
|
256 |
+
else:
|
257 |
+
return
|
258 |
+
|
259 |
+
|
260 |
+
st = await client.get_chat_member(grp_id, userid)
|
261 |
+
if (st.status == enums.ChatMemberStatus.OWNER) or (str(userid) in ADMINS):
|
262 |
+
await message.reply_text(
|
263 |
+
f"This will delete all filters from '{title}'.\nDo you want to continue??",
|
264 |
+
reply_markup=InlineKeyboardMarkup([
|
265 |
+
[InlineKeyboardButton(text="YES",callback_data="delallconfirm")],
|
266 |
+
[InlineKeyboardButton(text="CANCEL",callback_data="delallcancel")]
|
267 |
+
]),
|
268 |
+
quote=True
|
269 |
+
)
|
270 |
+
|
271 |
+
|
272 |
+
# Kanged from https://github.com/KDBotz
|
273 |
+
@Client.on_message(filters.command(['gfilter', 'addg']) & filters.incoming & filters.user(ADMINS))
|
274 |
+
async def addgfilter(client, message):
|
275 |
+
args = message.text.html.split(None, 1)
|
276 |
+
|
277 |
+
if len(args) < 2:
|
278 |
+
await message.reply_text("Command Incomplete :(", quote=True)
|
279 |
+
return
|
280 |
+
|
281 |
+
extracted = split_quotes(args[1])
|
282 |
+
text = extracted[0].lower()
|
283 |
+
|
284 |
+
if not message.reply_to_message and len(extracted) < 2:
|
285 |
+
await message.reply_text("Add some content to save your filter!", quote=True)
|
286 |
+
return
|
287 |
+
|
288 |
+
if (len(extracted) >= 2) and not message.reply_to_message:
|
289 |
+
reply_text, btn, alert = parser(extracted[1], text, "galert")
|
290 |
+
fileid = None
|
291 |
+
if not reply_text:
|
292 |
+
await message.reply_text("You cannot have buttons alone, give some text to go with it!", quote=True)
|
293 |
+
return
|
294 |
+
|
295 |
+
elif message.reply_to_message and message.reply_to_message.reply_markup:
|
296 |
+
try:
|
297 |
+
rm = message.reply_to_message.reply_markup
|
298 |
+
btn = rm.inline_keyboard
|
299 |
+
msg = get_file_id(message.reply_to_message)
|
300 |
+
if msg:
|
301 |
+
fileid = msg.file_id
|
302 |
+
reply_text = message.reply_to_message.caption.html
|
303 |
+
else:
|
304 |
+
reply_text = message.reply_to_message.text.html
|
305 |
+
fileid = None
|
306 |
+
alert = None
|
307 |
+
except:
|
308 |
+
reply_text = ""
|
309 |
+
btn = "[]"
|
310 |
+
fileid = None
|
311 |
+
alert = None
|
312 |
+
|
313 |
+
elif message.reply_to_message and message.reply_to_message.media:
|
314 |
+
try:
|
315 |
+
msg = get_file_id(message.reply_to_message)
|
316 |
+
fileid = msg.file_id if msg else None
|
317 |
+
reply_text, btn, alert = parser(extracted[1], text, "galert") if message.reply_to_message.sticker else parser(message.reply_to_message.caption.html, text, "galert")
|
318 |
+
except:
|
319 |
+
reply_text = ""
|
320 |
+
btn = "[]"
|
321 |
+
alert = None
|
322 |
+
elif message.reply_to_message and message.reply_to_message.text:
|
323 |
+
try:
|
324 |
+
fileid = None
|
325 |
+
reply_text, btn, alert = parser(message.reply_to_message.text.html, text, "galert")
|
326 |
+
except:
|
327 |
+
reply_text = ""
|
328 |
+
btn = "[]"
|
329 |
+
alert = None
|
330 |
+
else:
|
331 |
+
return
|
332 |
+
|
333 |
+
await add_gfilter('gfilters', text, reply_text, btn, fileid, alert)
|
334 |
+
|
335 |
+
await message.reply_text(
|
336 |
+
f"GFilter for `{text}` added",
|
337 |
+
quote=True,
|
338 |
+
parse_mode=enums.ParseMode.MARKDOWN
|
339 |
+
)
|
340 |
+
|
341 |
+
|
342 |
+
@Client.on_message(filters.command(['viewgfilters', 'gfilters']) & filters.incoming & filters.user(ADMINS))
|
343 |
+
async def get_all_gfilters(client, message):
|
344 |
+
texts = await get_gfilters('gfilters')
|
345 |
+
count = await count_gfilters('gfilters')
|
346 |
+
if count:
|
347 |
+
gfilterlist = f"Total number of gfilters : {count}\n\n"
|
348 |
+
|
349 |
+
for text in texts:
|
350 |
+
keywords = " × `{}`\n".format(text)
|
351 |
+
|
352 |
+
gfilterlist += keywords
|
353 |
+
|
354 |
+
if len(gfilterlist) > 4096:
|
355 |
+
with io.BytesIO(str.encode(gfilterlist.replace("`", ""))) as keyword_file:
|
356 |
+
keyword_file.name = "keywords.txt"
|
357 |
+
await message.reply_document(
|
358 |
+
document=keyword_file,
|
359 |
+
quote=True
|
360 |
+
)
|
361 |
+
return
|
362 |
+
else:
|
363 |
+
gfilterlist = f"There are no active gfilters."
|
364 |
+
|
365 |
+
await message.reply_text(
|
366 |
+
text=gfilterlist,
|
367 |
+
quote=True,
|
368 |
+
parse_mode=enums.ParseMode.MARKDOWN
|
369 |
+
)
|
370 |
+
|
371 |
+
@Client.on_message(filters.command('delg') & filters.incoming & filters.user(ADMINS))
|
372 |
+
async def deletegfilter(client, message):
|
373 |
+
try:
|
374 |
+
cmd, text = message.text.split(" ", 1)
|
375 |
+
except:
|
376 |
+
await message.reply_text(
|
377 |
+
"<i>Mention the gfiltername which you wanna delete!</i>\n\n"
|
378 |
+
"<code>/delg gfiltername</code>\n\n"
|
379 |
+
"Use /viewgfilters to view all available gfilters",
|
380 |
+
quote=True
|
381 |
+
)
|
382 |
+
return
|
383 |
+
|
384 |
+
query = text.lower()
|
385 |
+
|
386 |
+
await delete_gfilter(message, query, 'gfilters')
|
387 |
+
|
388 |
+
|
389 |
+
@Client.on_message(filters.command('delallg') & filters.user(ADMINS))
|
390 |
+
async def delallgfill(client, message):
|
391 |
+
await message.reply_text(
|
392 |
+
f"Do you want to continue??",
|
393 |
+
reply_markup=InlineKeyboardMarkup([
|
394 |
+
[InlineKeyboardButton(text="YES",callback_data="gconforme")],
|
395 |
+
[InlineKeyboardButton(text="CANCEL",callback_data="close_data")]
|
396 |
+
]),
|
397 |
+
quote=True
|
398 |
+
)
|
399 |
+
|
400 |
+
|
401 |
+
@Client.on_callback_query(filters.regex("gconforme"))
|
402 |
+
async def dellacbd(client, message):
|
403 |
+
await del_allg(message.message, 'gfilters')
|
404 |
+
return await message.reply("👍 Done")
|
405 |
+
|
406 |
+
|
407 |
+
|
408 |
+
|
409 |
+
|
plugins/group_filter.py
ADDED
@@ -0,0 +1,466 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio, re, ast, math, logging
|
2 |
+
from pyrogram.errors.exceptions.bad_request_400 import MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty
|
3 |
+
from Script import script
|
4 |
+
from utils import get_shortlink, admin_filter
|
5 |
+
import pyrogram
|
6 |
+
from database.connections_mdb import active_connection, all_connections, delete_connection, if_active, make_active, make_inactive
|
7 |
+
from info import ADMINS, AUTH_CHANNEL, AUTH_USERS, CUSTOM_FILE_CAPTION, AUTH_GROUPS, P_TTI_SHOW_OFF, IMDB, PM_IMDB, SINGLE_BUTTON, PROTECT_CONTENT, \
|
8 |
+
SPELL_CHECK_REPLY, IMDB_TEMPLATE, IMDB_DELET_TIME, START_MESSAGE, PMFILTER, G_FILTER, BUTTON_LOCK, BUTTON_LOCK_TEXT, SHORT_URL, SHORT_API
|
9 |
+
|
10 |
+
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery
|
11 |
+
from pyrogram import Client, filters, enums
|
12 |
+
from pyrogram.errors import FloodWait, UserIsBlocked, MessageNotModified, PeerIdInvalid
|
13 |
+
from utils import get_size, is_subscribed, get_poster, search_gagala, temp, get_settings, save_group_settings
|
14 |
+
from database.users_chats_db import db
|
15 |
+
from database.ia_filterdb import Media, get_file_details, get_search_results
|
16 |
+
from database.filters_mdb import del_all, find_filter, get_filters
|
17 |
+
from database.gfilters_mdb import find_gfilter, get_gfilters
|
18 |
+
|
19 |
+
logger = logging.getLogger(__name__)
|
20 |
+
logger.setLevel(logging.ERROR)
|
21 |
+
|
22 |
+
|
23 |
+
FILTER_MODE = {}
|
24 |
+
G_MODE = {}
|
25 |
+
SPELL_CHECK = {}
|
26 |
+
|
27 |
+
@Client.on_message(filters.command('autofilter') & filters.group & filters.create(admin_filter))
|
28 |
+
async def fil_mod(client, message):
|
29 |
+
mode_on = ["yes", "on", "true"]
|
30 |
+
mode_of = ["no", "off", "false"]
|
31 |
+
|
32 |
+
try:
|
33 |
+
args = message.text.split(None, 1)[1].lower()
|
34 |
+
except:
|
35 |
+
return await message.reply("**ɪɴᴄᴏᴍᴩʟᴇᴛᴇ ᴄᴏᴍᴍᴀɴᴅ...**")
|
36 |
+
|
37 |
+
m = await message.reply("**ꜱᴇᴛᴛɪɴɢ....**")
|
38 |
+
|
39 |
+
if args in mode_on:
|
40 |
+
FILTER_MODE[str(message.chat.id)] = "True"
|
41 |
+
await m.edit("**ᴀᴜᴛᴏꜰɪʟᴛᴇʀ ᴇɴᴀʙʟᴇᴅ**")
|
42 |
+
|
43 |
+
elif args in mode_of:
|
44 |
+
FILTER_MODE[str(message.chat.id)] = "False"
|
45 |
+
await m.edit("**ᴀᴜᴛᴏꜰɪʟᴛᴇʀ ᴅɪꜱᴀʙʟᴇᴅ**")
|
46 |
+
else:
|
47 |
+
await m.edit("ᴜꜱᴇ :- `/autofilter on` ᴏʀ `/autofilter off`")
|
48 |
+
|
49 |
+
|
50 |
+
@Client.on_message(filters.command('g_filter') & filters.group & filters.create(admin_filter))
|
51 |
+
async def g_fil_mod(client, message):
|
52 |
+
mode_on = ["yes", "on", "true"]
|
53 |
+
mode_of = ["no", "off", "false"]
|
54 |
+
|
55 |
+
try:
|
56 |
+
args = message.text.split(None, 1)[1].lower()
|
57 |
+
except:
|
58 |
+
return await message.reply("**ɪɴᴄᴏᴍᴩʟᴇᴛᴇ ᴄᴏᴍᴍᴀɴᴅ...**")
|
59 |
+
|
60 |
+
m = await message.reply("**ꜱᴇᴛᴛɪɴɢ...**")
|
61 |
+
|
62 |
+
if args in mode_on:
|
63 |
+
G_MODE[str(message.chat.id)] = "True"
|
64 |
+
await m.edit("**ɢʟᴏʙᴀʟ ꜰɪʟᴛᴇʀ ᴇɴᴀʙʟᴇᴅ**")
|
65 |
+
|
66 |
+
elif args in mode_of:
|
67 |
+
G_MODE[str(message.chat.id)] = "False"
|
68 |
+
await m.edit("**ɢʟᴏʙᴀʟ ꜰɪʟᴛᴇʀ ᴅɪꜱᴀʙʟᴇᴅ**")
|
69 |
+
else:
|
70 |
+
await m.edit("ᴜꜱᴇ :- `/g_filter on` ᴏʀ `/g_filter off`")
|
71 |
+
|
72 |
+
|
73 |
+
@Client.on_callback_query(filters.create(lambda _, __, query: query.data.startswith("next")))
|
74 |
+
async def next_page(bot, query):
|
75 |
+
ident, req, key, offset = query.data.split("_")
|
76 |
+
if int(req) not in [query.from_user.id, 0]:
|
77 |
+
return await query.answer(BUTTON_LOCK_TEXT.format(query.from_user.first_name), show_alert=True)
|
78 |
+
try: offset = int(offset)
|
79 |
+
except: offset = 0
|
80 |
+
search = temp.GP_BUTTONS.get(key)
|
81 |
+
if not search: return await query.answer("Yᴏᴜ Aʀᴇ Usɪɴɢ Oɴᴇ Oғ Mʏ Oʟᴅ Mᴇssᴀɢᴇs, Pʟᴇᴀsᴇ Sᴇɴᴅ Tʜᴇ Rᴇǫᴜᴇsᴛ Aɢᴀɪɴ", show_alert=True)
|
82 |
+
|
83 |
+
files, n_offset, total = await get_search_results(search, offset=offset, filter=True)
|
84 |
+
try: n_offset = int(n_offset)
|
85 |
+
except: n_offset = 0
|
86 |
+
|
87 |
+
if not files: return
|
88 |
+
settings = await get_settings(query.message.chat.id)
|
89 |
+
nxreq = query.from_user.id if query.from_user else 0
|
90 |
+
if SHORT_URL and SHORT_API:
|
91 |
+
if settings["button"]:
|
92 |
+
btn = [[InlineKeyboardButton(text=f"[{get_size(file.file_size)}] {file.file_name}", url=await get_shortlink(f"https://telegram.dog/{temp.U_NAME}?start=files_{file.file_id}"))] for file in files ]
|
93 |
+
else:
|
94 |
+
btn = [[InlineKeyboardButton(text=f"{file.file_name}", url=await get_shortlink(f"https://telegram.dog/{temp.U_NAME}?start=files_{file.file_id}")),
|
95 |
+
InlineKeyboardButton(text=f"{get_size(file.file_size)}", url=await get_shortlink(f"https://telegram.dog/{temp.U_NAME}?start=files_{file.file_id}"))] for file in files ]
|
96 |
+
else:
|
97 |
+
if settings["button"]:
|
98 |
+
btn = [[InlineKeyboardButton(text=f"[{get_size(file.file_size)}] {file.file_name}", callback_data=f'files#{nxreq}#{file.file_id}')] for file in files ]
|
99 |
+
else:
|
100 |
+
btn = [[InlineKeyboardButton(text=f"{file.file_name}", callback_data=f'files#{nxreq}#{file.file_id}'),
|
101 |
+
InlineKeyboardButton(text=f"{get_size(file.file_size)}", callback_data=f'files#{nxreq}#{file.file_id}')] for file in files ]
|
102 |
+
|
103 |
+
btn.insert(0, [InlineKeyboardButton("🔗 ʜᴏᴡ ᴛᴏ ᴅᴏᴡɴʟᴏᴀᴅ 🔗", "howdl")])
|
104 |
+
if 0 < offset <= 10:
|
105 |
+
off_set = 0
|
106 |
+
elif offset == 0:
|
107 |
+
off_set = None
|
108 |
+
else:
|
109 |
+
off_set = offset - 10
|
110 |
+
if n_offset == 0:
|
111 |
+
btn.append(
|
112 |
+
[InlineKeyboardButton("⬅️ ʙᴀᴄᴋ", callback_data=f"next_{req}_{key}_{off_set}"),
|
113 |
+
InlineKeyboardButton(f"❄️ ᴩᴀɢᴇꜱ {math.ceil(int(offset) / 10) + 1} / {math.ceil(total / 10)}", callback_data="pages")]
|
114 |
+
)
|
115 |
+
elif off_set is None:
|
116 |
+
btn.append(
|
117 |
+
[InlineKeyboardButton(f"❄️ {math.ceil(int(offset) / 10) + 1} / {math.ceil(total / 10)}", callback_data="pages"),
|
118 |
+
InlineKeyboardButton("ɴᴇxᴛ ➡️", callback_data=f"next_{req}_{key}_{n_offset}")])
|
119 |
+
else:
|
120 |
+
btn.append(
|
121 |
+
[
|
122 |
+
InlineKeyboardButton("⬅️ ʙᴀᴄᴋ", callback_data=f"next_{req}_{key}_{off_set}"),
|
123 |
+
InlineKeyboardButton(f"❄️ {math.ceil(int(offset) / 10) + 1} / {math.ceil(total / 10)}", callback_data="pages"),
|
124 |
+
InlineKeyboardButton("ɴᴇxᴛ ➡️", callback_data=f"next_{req}_{key}_{n_offset}")
|
125 |
+
],
|
126 |
+
)
|
127 |
+
|
128 |
+
try:
|
129 |
+
await query.edit_message_reply_markup( reply_markup=InlineKeyboardMarkup(btn))
|
130 |
+
except MessageNotModified:
|
131 |
+
pass
|
132 |
+
await query.answer()
|
133 |
+
|
134 |
+
|
135 |
+
@Client.on_callback_query(filters.create(lambda _, __, query: query.data.startswith("spolling")))
|
136 |
+
async def advantage_spoll_choker(bot, query):
|
137 |
+
_, user, movie_ = query.data.split('#')
|
138 |
+
if int(user) != 0 and query.from_user.id != int(user):
|
139 |
+
return await query.answer("okDa", show_alert=True)
|
140 |
+
if movie_ == "close_spellcheck":
|
141 |
+
return await query.message.delete()
|
142 |
+
movies = temp.GP_SPELL.get(query.message.reply_to_message.id)
|
143 |
+
if not movies:
|
144 |
+
return await query.answer("Yᴏᴜ Aʀᴇ Usɪɴɢ Oɴᴇ Oғ Mʏ Oʟᴅ Mᴇssᴀɢᴇs, Pʟᴇᴀsᴇ Sᴇɴᴅ Tʜᴇ Rᴇǫᴜᴇsᴛ Aɢᴀɪɴ", show_alert=True)
|
145 |
+
movie = movies[(int(movie_))]
|
146 |
+
await query.answer('Checking for Movie in database...')
|
147 |
+
k = await manual_filters(bot, query.message, text=movie)
|
148 |
+
if k == False:
|
149 |
+
files, offset, total_results = await get_search_results(movie, offset=0, filter=True)
|
150 |
+
if files:
|
151 |
+
k = (movie, files, offset, total_results)
|
152 |
+
await auto_filter(bot, query, k)
|
153 |
+
else:
|
154 |
+
k = await query.message.edit('This Movie Not Found In DataBase')
|
155 |
+
await asyncio.sleep(10)
|
156 |
+
await k.delete()
|
157 |
+
|
158 |
+
|
159 |
+
@Client.on_message(filters.group & filters.text & filters.incoming & filters.chat(AUTH_GROUPS) if AUTH_GROUPS else filters.text & filters.incoming & filters.group)
|
160 |
+
async def give_filter(client, message):
|
161 |
+
if G_FILTER:
|
162 |
+
if G_MODE.get(str(message.chat.id)) == "False":
|
163 |
+
return
|
164 |
+
else:
|
165 |
+
kd = await global_filters(client, message)
|
166 |
+
if kd == False:
|
167 |
+
k = await manual_filters(client, message)
|
168 |
+
if k == False:
|
169 |
+
if FILTER_MODE.get(str(message.chat.id)) == "False":
|
170 |
+
return
|
171 |
+
else:
|
172 |
+
await auto_filter(client, message)
|
173 |
+
else:
|
174 |
+
k = await manual_filters(client, message)
|
175 |
+
if k == False:
|
176 |
+
if FILTER_MODE.get(str(message.chat.id)) == "False":
|
177 |
+
return
|
178 |
+
else:
|
179 |
+
await auto_filter(client, message)
|
180 |
+
|
181 |
+
|
182 |
+
async def auto_filter(client, msg, spoll=False):
|
183 |
+
if not spoll:
|
184 |
+
message = msg
|
185 |
+
settings = await get_settings(message.chat.id)
|
186 |
+
if message.text.startswith("/"): return # ignore commands
|
187 |
+
if re.findall("((^\/|^,|^!|^\.|^[\U0001F600-\U000E007F]).*)", message.text):
|
188 |
+
return
|
189 |
+
if 2 < len(message.text) < 100:
|
190 |
+
search = message.text
|
191 |
+
files, offset, total_results = await get_search_results(search.lower(), offset=0, filter=True)
|
192 |
+
if not files:
|
193 |
+
if settings["spell_check"]:
|
194 |
+
return await advantage_spell_chok(msg)
|
195 |
+
else:
|
196 |
+
return
|
197 |
+
else:
|
198 |
+
return
|
199 |
+
else:
|
200 |
+
settings = await get_settings(msg.message.chat.id)
|
201 |
+
message = msg.message.reply_to_message # msg will be callback query
|
202 |
+
search, files, offset, total_results = spoll
|
203 |
+
pre = 'filep' if settings['file_secure'] else 'file'
|
204 |
+
req = message.from_user.id if message.from_user else 0
|
205 |
+
|
206 |
+
if SHORT_URL and SHORT_API:
|
207 |
+
if settings["button"]:
|
208 |
+
btn = [[InlineKeyboardButton(text=f"[{get_size(file.file_size)}] {file.file_name}", url=await get_shortlink(f"https://telegram.dog/{temp.U_NAME}?start=pre_{file.file_id}"))] for file in files ]
|
209 |
+
else:
|
210 |
+
btn = [[InlineKeyboardButton(text=f"{file.file_name}", url=await get_shortlink(f"https://telegram.dog/{temp.U_NAME}?start=pre_{file.file_id}")),
|
211 |
+
InlineKeyboardButton(text=f"{get_size(file.file_size)}", url=await get_shortlink(f"https://telegram.dog/{temp.U_NAME}?start=pre_{file.file_id}"))] for file in files ]
|
212 |
+
else:
|
213 |
+
if settings["button"]:
|
214 |
+
btn = [[InlineKeyboardButton(text=f"[{get_size(file.file_size)}] {file.file_name}", callback_data=f'{pre}#{req}#{file.file_id}')] for file in files ]
|
215 |
+
else:
|
216 |
+
btn = [[InlineKeyboardButton(text=f"{file.file_name}", callback_data=f'{pre}#{req}#{file.file_id}'),
|
217 |
+
InlineKeyboardButton(text=f"{get_size(file.file_size)}", callback_data=f'{pre}#{req}#{file.file_id}')] for file in files ]
|
218 |
+
|
219 |
+
btn.insert(0, [InlineKeyboardButton("🔗 ʜᴏᴡ ᴛᴏ ᴅᴏᴡɴʟᴏᴀᴅ 🔗", "howdl")])
|
220 |
+
if offset != "":
|
221 |
+
key = f"{message.chat.id}-{message.id}"
|
222 |
+
temp.GP_BUTTONS[key] = search
|
223 |
+
req = message.from_user.id if message.from_user else 0
|
224 |
+
btn.append(
|
225 |
+
[InlineKeyboardButton(text=f"❄️ ᴩᴀɢᴇꜱ 1/{math.ceil(int(total_results) / 6)}", callback_data="pages"),
|
226 |
+
InlineKeyboardButton(text="➡️ ɴᴇxᴛ", callback_data=f"next_{req}_{key}_{offset}")]
|
227 |
+
)
|
228 |
+
else:
|
229 |
+
btn.append(
|
230 |
+
[InlineKeyboardButton(text="❄️ ᴩᴀɢᴇꜱ 1/1", callback_data="pages")]
|
231 |
+
)
|
232 |
+
|
233 |
+
imdb = await get_poster(search, file=(files[0]).file_name) if settings["imdb"] else None
|
234 |
+
TEMPLATE = settings['template']
|
235 |
+
if imdb:
|
236 |
+
cap = TEMPLATE.format(
|
237 |
+
group = message.chat.title,
|
238 |
+
requested = message.from_user.mention,
|
239 |
+
query = search,
|
240 |
+
title = imdb['title'],
|
241 |
+
votes = imdb['votes'],
|
242 |
+
aka = imdb["aka"],
|
243 |
+
seasons = imdb["seasons"],
|
244 |
+
box_office = imdb['box_office'],
|
245 |
+
localized_title = imdb['localized_title'],
|
246 |
+
kind = imdb['kind'],
|
247 |
+
imdb_id = imdb["imdb_id"],
|
248 |
+
cast = imdb["cast"],
|
249 |
+
runtime = imdb["runtime"],
|
250 |
+
countries = imdb["countries"],
|
251 |
+
certificates = imdb["certificates"],
|
252 |
+
languages = imdb["languages"],
|
253 |
+
director = imdb["director"],
|
254 |
+
writer = imdb["writer"],
|
255 |
+
producer = imdb["producer"],
|
256 |
+
composer = imdb["composer"],
|
257 |
+
cinematographer = imdb["cinematographer"],
|
258 |
+
music_team = imdb["music_team"],
|
259 |
+
distributors = imdb["distributors"],
|
260 |
+
release_date = imdb['release_date'],
|
261 |
+
year = imdb['year'],
|
262 |
+
genres = imdb['genres'],
|
263 |
+
poster = imdb['poster'],
|
264 |
+
plot = imdb['plot'],
|
265 |
+
rating = imdb['rating'],
|
266 |
+
url = imdb['url'],
|
267 |
+
**locals()
|
268 |
+
)
|
269 |
+
else:
|
270 |
+
cap = f"Hᴇʀᴇ Is Wʜᴀᴛ I Fᴏᴜɴᴅ Fᴏʀ Yᴏᴜʀ Qᴜᴇʀʏ {search}"
|
271 |
+
if imdb and imdb.get('poster'):
|
272 |
+
try:
|
273 |
+
hehe = await message.reply_photo(photo=imdb.get('poster'), caption=cap, reply_markup=InlineKeyboardMarkup(btn))
|
274 |
+
await asyncio.sleep(IMDB_DELET_TIME)
|
275 |
+
await hehe.delete()
|
276 |
+
await message.delete()
|
277 |
+
except (MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty):
|
278 |
+
pic = imdb.get('poster')
|
279 |
+
poster = pic.replace('.jpg', "._V1_UX360.jpg")
|
280 |
+
hmm = await message.reply_photo(photo=poster, caption=cap, reply_markup=InlineKeyboardMarkup(btn))
|
281 |
+
await asyncio.sleep(IMDB_DELET_TIME)
|
282 |
+
await hmm.delete()
|
283 |
+
await message.delete()
|
284 |
+
except Exception as e:
|
285 |
+
logger.exception(e)
|
286 |
+
cdb = await message.reply_text(cap, reply_markup=InlineKeyboardMarkup(btn))
|
287 |
+
await asyncio.sleep(IMDB_DELET_TIME)
|
288 |
+
await cdb.delete()
|
289 |
+
await message.delete()
|
290 |
+
else:
|
291 |
+
crl = await message.reply_text(cap, reply_markup=InlineKeyboardMarkup(btn))
|
292 |
+
await asyncio.sleep(IMDB_DELET_TIME)
|
293 |
+
await crl.delete()
|
294 |
+
await message.delete()
|
295 |
+
if spoll:
|
296 |
+
await msg.message.delete()
|
297 |
+
|
298 |
+
|
299 |
+
|
300 |
+
async def advantage_spell_chok(msg):
|
301 |
+
query = re.sub(r"\b(pl(i|e)*?(s|z+|ease|se|ese|(e+)s(e)?)|((send|snd|giv(e)?|gib)(\sme)?)|movie(s)?|new|latest|br((o|u)h?)*|^h(e|a)?(l)*(o)*|mal(ayalam)?|t(h)?amil|file|that|find|und(o)*|kit(t(i|y)?)?o(w)?|thar(u)?(o)*w?|kittum(o)*|aya(k)*(um(o)*)?|full\smovie|any(one)|with\ssubtitle(s)?)","", msg.text, flags=re.IGNORECASE) # plis contribute some common words
|
302 |
+
query = query.strip() + " movie"
|
303 |
+
g_s = await search_gagala(query)
|
304 |
+
g_s += await search_gagala(msg.text)
|
305 |
+
gs_parsed = []
|
306 |
+
if not g_s:
|
307 |
+
k = await msg.reply("I Cᴏᴜʟᴅɴ'ᴛ Fɪɴᴅ Aɴʏ Mᴏᴠɪᴇ Iɴ Tʜᴀᴛ Nᴀᴍᴇ")
|
308 |
+
await asyncio.sleep(8)
|
309 |
+
return await k.delete()
|
310 |
+
regex = re.compile(r".*(imdb|wikipedia).*", re.IGNORECASE) # look for imdb / wiki results
|
311 |
+
gs = list(filter(regex.match, g_s))
|
312 |
+
gs_parsed = [re.sub(r'\b(\-([a-zA-Z-\s])\-\simdb|(\-\s)?imdb|(\-\s)?wikipedia|\(|\)|\-|reviews|full|all|episode(s)?|film|movie|series)', '', i, flags=re.IGNORECASE) for i in gs]
|
313 |
+
if not gs_parsed:
|
314 |
+
reg = re.compile(r"watch(\s[a-zA-Z0-9_\s\-\(\)]*)*\|.*", re.IGNORECASE) # match something like Watch Niram | Amazon Prime
|
315 |
+
for mv in g_s:
|
316 |
+
match = reg.match(mv)
|
317 |
+
if match:
|
318 |
+
gs_parsed.append(match.group(1))
|
319 |
+
user = msg.from_user.id if msg.from_user else 0
|
320 |
+
movielist = []
|
321 |
+
gs_parsed = list(dict.fromkeys(gs_parsed)) # removing duplicates https://stackoverflow.com/a/7961425
|
322 |
+
if len(gs_parsed) > 3:
|
323 |
+
gs_parsed = gs_parsed[:3]
|
324 |
+
if gs_parsed:
|
325 |
+
for mov in gs_parsed:
|
326 |
+
imdb_s = await get_poster(mov.strip(), bulk=True) # searching each keyword in imdb
|
327 |
+
if imdb_s:
|
328 |
+
movielist += [movie.get('title') for movie in imdb_s]
|
329 |
+
movielist += [(re.sub(r'(\-|\(|\)|_)', '', i, flags=re.IGNORECASE)).strip() for i in gs_parsed]
|
330 |
+
movielist = list(dict.fromkeys(movielist)) # removing duplicates
|
331 |
+
if not movielist:
|
332 |
+
k = await msg.reply("I Cᴏᴜʟᴅɴ'ᴛ Fɪɴᴅ Aɴʏᴛʜɪɴɢ Rᴇʟᴀᴛᴇᴅ Tᴏ Tʜᴀᴛ. Cʜᴇᴄᴋ Yᴏᴜʀ Sᴘᴇʟʟɪɴɢ")
|
333 |
+
await asyncio.sleep(8)
|
334 |
+
return await k.delete()
|
335 |
+
temp.GP_SPELL[msg.id] = movielist
|
336 |
+
btn = [[InlineKeyboardButton(text=movie.strip(), callback_data=f"spolling#{user}#{k}",)] for k, movie in enumerate(movielist)]
|
337 |
+
btn.append([InlineKeyboardButton(text="Close", callback_data=f'spolling#{user}#close_spellcheck')])
|
338 |
+
await msg.reply("I Cᴏᴜʟᴅɴ'ᴛ Fɪɴᴅ Aɴʏᴛʜɪɴɢ Rᴇʟᴀᴛᴇᴅ Tᴏ Tʜᴀᴛ. Dɪᴅ Yᴏᴜ Mᴇᴀɴ Aɴʏ Oɴᴇ Oғ Tʜᴇsᴇ?", reply_markup=InlineKeyboardMarkup(btn))
|
339 |
+
|
340 |
+
|
341 |
+
async def manual_filters(client, message, text=False):
|
342 |
+
group_id = message.chat.id
|
343 |
+
name = text or message.text
|
344 |
+
reply_id = message.reply_to_message.id if message.reply_to_message else message.id
|
345 |
+
keywords = await get_filters(group_id)
|
346 |
+
for keyword in reversed(sorted(keywords, key=len)):
|
347 |
+
pattern = r"( |^|[^\w])" + re.escape(keyword) + r"( |$|[^\w])"
|
348 |
+
if re.search(pattern, name, flags=re.IGNORECASE):
|
349 |
+
reply_text, btn, alert, fileid = await find_filter(group_id, keyword)
|
350 |
+
|
351 |
+
if reply_text:
|
352 |
+
reply_text = reply_text.replace("\\n", "\n").replace("\\t", "\t")
|
353 |
+
|
354 |
+
if btn is not None:
|
355 |
+
try:
|
356 |
+
if fileid == "None":
|
357 |
+
if btn == "[]":
|
358 |
+
await client.send_message(group_id, reply_text, disable_web_page_preview=True, reply_to_message_id=reply_id)
|
359 |
+
else:
|
360 |
+
button = eval(btn)
|
361 |
+
await client.send_message(
|
362 |
+
group_id,
|
363 |
+
reply_text,
|
364 |
+
disable_web_page_preview=True,
|
365 |
+
reply_markup=InlineKeyboardMarkup(button),
|
366 |
+
reply_to_message_id=reply_id
|
367 |
+
)
|
368 |
+
elif btn == "[]":
|
369 |
+
await client.send_cached_media(
|
370 |
+
group_id,
|
371 |
+
fileid,
|
372 |
+
caption=reply_text or "",
|
373 |
+
reply_to_message_id=reply_id
|
374 |
+
)
|
375 |
+
else:
|
376 |
+
button = eval(btn)
|
377 |
+
await message.reply_cached_media(
|
378 |
+
fileid,
|
379 |
+
caption=reply_text or "",
|
380 |
+
reply_markup=InlineKeyboardMarkup(button),
|
381 |
+
reply_to_message_id=reply_id
|
382 |
+
)
|
383 |
+
except Exception as e:
|
384 |
+
logger.exception(e)
|
385 |
+
break
|
386 |
+
else:
|
387 |
+
return False
|
388 |
+
|
389 |
+
|
390 |
+
|
391 |
+
async def global_filters(client, message, text=False):
|
392 |
+
group_id = message.chat.id
|
393 |
+
name = text or message.text
|
394 |
+
reply_id = message.reply_to_message.id if message.reply_to_message else message.id
|
395 |
+
keywords = await get_gfilters('gfilters')
|
396 |
+
for keyword in reversed(sorted(keywords, key=len)):
|
397 |
+
pattern = r"( |^|[^\w])" + re.escape(keyword) + r"( |$|[^\w])"
|
398 |
+
if re.search(pattern, name, flags=re.IGNORECASE):
|
399 |
+
reply_text, btn, alert, fileid = await find_gfilter('gfilters', keyword)
|
400 |
+
|
401 |
+
if reply_text:
|
402 |
+
reply_text = reply_text.replace("\\n", "\n").replace("\\t", "\t")
|
403 |
+
|
404 |
+
if btn is not None:
|
405 |
+
try:
|
406 |
+
if fileid == "None":
|
407 |
+
if btn == "[]":
|
408 |
+
knd3 = await client.send_message(
|
409 |
+
group_id,
|
410 |
+
reply_text,
|
411 |
+
disable_web_page_preview=True,
|
412 |
+
reply_to_message_id=reply_id
|
413 |
+
)
|
414 |
+
await asyncio.sleep(IMDB_DELET_TIME)
|
415 |
+
await knd3.delete()
|
416 |
+
await message.delete()
|
417 |
+
|
418 |
+
else:
|
419 |
+
button = eval(btn)
|
420 |
+
knd2 = await client.send_message(
|
421 |
+
group_id,
|
422 |
+
reply_text,
|
423 |
+
disable_web_page_preview=True,
|
424 |
+
reply_markup=InlineKeyboardMarkup(button),
|
425 |
+
reply_to_message_id=reply_id
|
426 |
+
)
|
427 |
+
await asyncio.sleep(IMDB_DELET_TIME)
|
428 |
+
await knd2.delete()
|
429 |
+
await message.delete()
|
430 |
+
|
431 |
+
elif btn == "[]":
|
432 |
+
knd1 = await client.send_cached_media(
|
433 |
+
group_id,
|
434 |
+
fileid,
|
435 |
+
caption=reply_text or "",
|
436 |
+
reply_to_message_id=reply_id
|
437 |
+
)
|
438 |
+
await asyncio.sleep(IMDB_DELET_TIME)
|
439 |
+
await knd1.delete()
|
440 |
+
await message.delete()
|
441 |
+
|
442 |
+
else:
|
443 |
+
button = eval(btn)
|
444 |
+
knd = await message.reply_cached_media(
|
445 |
+
fileid,
|
446 |
+
caption=reply_text or "",
|
447 |
+
reply_markup=InlineKeyboardMarkup(button),
|
448 |
+
reply_to_message_id=reply_id
|
449 |
+
)
|
450 |
+
await asyncio.sleep(IMDB_DELET_TIME)
|
451 |
+
await knd.delete()
|
452 |
+
await message.delete()
|
453 |
+
|
454 |
+
except Exception as e:
|
455 |
+
logger.exception(e)
|
456 |
+
break
|
457 |
+
else:
|
458 |
+
return False
|
459 |
+
|
460 |
+
|
461 |
+
|
462 |
+
|
463 |
+
|
464 |
+
|
465 |
+
|
466 |
+
|
plugins/index.py
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import logging, re, asyncio
|
2 |
+
from pyrogram import Client, filters, enums
|
3 |
+
from pyrogram.errors import FloodWait
|
4 |
+
from pyrogram.errors.exceptions.bad_request_400 import ChannelInvalid, ChatAdminRequired, UsernameInvalid, UsernameNotModified
|
5 |
+
from info import CHANNELS, LOG_CHANNEL, ADMINS
|
6 |
+
from database.ia_filterdb import save_file
|
7 |
+
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
8 |
+
from utils import temp
|
9 |
+
|
10 |
+
logger = logging.getLogger(__name__)
|
11 |
+
logger.setLevel(logging.INFO)
|
12 |
+
lock = asyncio.Lock()
|
13 |
+
|
14 |
+
|
15 |
+
@Client.on_message(filters.chat(CHANNELS) & (filters.document | filters.video | filters.audio))
|
16 |
+
async def media(bot, message):
|
17 |
+
for file_type in ("document", "video", "audio"):
|
18 |
+
media = getattr(message, file_type, None)
|
19 |
+
if media is not None: break
|
20 |
+
else: return
|
21 |
+
media.file_type = file_type
|
22 |
+
media.caption = message.caption
|
23 |
+
await save_file(media)
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
@Client.on_callback_query(filters.regex(r'^index'))
|
28 |
+
async def index_files(bot, query):
|
29 |
+
if query.data.startswith('index_cancel'):
|
30 |
+
temp.CANCEL = True
|
31 |
+
return await query.answer("Cᴀɴᴄᴇʟʟɪɴɢ Iɴᴅᴇxɪɴɢ", show_alert=True)
|
32 |
+
|
33 |
+
perfx, chat, lst_msg_id = query.data.split("#")
|
34 |
+
if lock.locked():
|
35 |
+
return await query.answer('Wᴀɪᴛ Uɴᴛɪʟ Pʀᴇᴠɪᴏᴜs Pʀᴏᴄᴇss Cᴏᴍᴘʟᴇᴛᴇ', show_alert=True)
|
36 |
+
msg = query.message
|
37 |
+
button = InlineKeyboardMarkup([[
|
38 |
+
InlineKeyboardButton('🚫 ᴄᴀɴᴄᴇʟʟ', "index_cancel")
|
39 |
+
]])
|
40 |
+
await msg.edit("ɪɴᴅᴇxɪɴɢ ɪs sᴛᴀʀᴛᴇᴅ ✨", reply_markup=button)
|
41 |
+
try: chat = int(chat)
|
42 |
+
except: chat = chat
|
43 |
+
await index_files_to_db(int(lst_msg_id), chat, msg, bot)
|
44 |
+
|
45 |
+
|
46 |
+
@Client.on_message((filters.forwarded | (filters.regex("(https://)?(t\.me/|telegram\.me/|telegram\.dog/)(c/)?(\d+|[a-zA-Z_0-9]+)/(\d+)$")) & filters.text ) & filters.private & filters.incoming & filters.user(ADMINS))
|
47 |
+
async def send_for_index(bot, message):
|
48 |
+
if message.text:
|
49 |
+
regex = re.compile("(https://)?(t\.me/|telegram\.me/|telegram\.dog/)(c/)?(\d+|[a-zA-Z_0-9]+)/(\d+)$")
|
50 |
+
match = regex.match(message.text)
|
51 |
+
if not match: return await message.reply('Invalid link')
|
52 |
+
chat_id = match.group(4)
|
53 |
+
last_msg_id = int(match.group(5))
|
54 |
+
if chat_id.isnumeric(): chat_id = int(("-100" + chat_id))
|
55 |
+
elif message.forward_from_chat.type == enums.ChatType.CHANNEL:
|
56 |
+
last_msg_id = message.forward_from_message_id
|
57 |
+
chat_id = message.forward_from_chat.username or message.forward_from_chat.id
|
58 |
+
else: return
|
59 |
+
try: await bot.get_chat(chat_id)
|
60 |
+
except ChannelInvalid: return await message.reply('This may be a private channel / group. Make me an admin over there to index the files.')
|
61 |
+
except (UsernameInvalid, UsernameNotModified): return await message.reply('Invalid Link specified.')
|
62 |
+
except Exception as e: return await message.reply(f'Errors - {e}')
|
63 |
+
try: k = await bot.get_messages(chat_id, last_msg_id)
|
64 |
+
except: return await message.reply('Make Sure That Iam An Admin In The Channel, if channel is private')
|
65 |
+
if k.empty: return await message.reply('This may be group and iam not a admin of the group.')
|
66 |
+
buttons = InlineKeyboardMarkup([[
|
67 |
+
InlineKeyboardButton('✨ ʏᴇꜱ', callback_data=f'index#{chat_id}#{last_msg_id}')
|
68 |
+
],[
|
69 |
+
InlineKeyboardButton('🚫 ᴄʟᴏꜱᴇ', callback_data='close_data')
|
70 |
+
]])
|
71 |
+
await message.reply(f'Do You Want To Index This Channel/ Group ?\n\nChat ID/ Username: <code>{chat_id}</code>\nLast Message ID: <code>{last_msg_id}</code>', reply_markup=buttons)
|
72 |
+
|
73 |
+
|
74 |
+
@Client.on_message(filters.command('setskip') & filters.user(ADMINS))
|
75 |
+
async def set_skip_number(bot, message):
|
76 |
+
if len(message.command) == 2:
|
77 |
+
try: skip = int(message.text.split(" ", 1)[1])
|
78 |
+
except: return await message.reply("Skip Number Should Be An Integer.")
|
79 |
+
await message.reply(f"Successfully Set Skip Number As {skip}")
|
80 |
+
temp.CURRENT = int(skip)
|
81 |
+
else:
|
82 |
+
await message.reply("Give Me A Skip Number")
|
83 |
+
|
84 |
+
|
85 |
+
async def index_files_to_db(lst_msg_id, chat, msg, bot):
|
86 |
+
total_files = 0
|
87 |
+
duplicate = 0
|
88 |
+
errors = 0
|
89 |
+
deleted = 0
|
90 |
+
no_media = 0
|
91 |
+
unsupported = 0
|
92 |
+
async with lock:
|
93 |
+
try:
|
94 |
+
current = temp.CURRENT
|
95 |
+
temp.CANCEL = False
|
96 |
+
async for message in bot.iter_messages(chat, lst_msg_id, temp.CURRENT):
|
97 |
+
if temp.CANCEL:
|
98 |
+
await msg.edit(f"Successfully Cancelled!!\n\nSaved <code>{total_files}</code> files to dataBase!\nDuplicate Files Skipped: <code>{duplicate}</code>\nDeleted Messages Skipped: <code>{deleted}</code>\nNon-Media messages skipped: <code>{no_media + unsupported}</code>(Unsupported Media - `{unsupported}` )\nErrors Occurred: <code>{errors}</code>")
|
99 |
+
break
|
100 |
+
current += 1
|
101 |
+
if current % 100 == 0:
|
102 |
+
can = [[InlineKeyboardButton('Cancel', callback_data='index_cancel')]]
|
103 |
+
reply = InlineKeyboardMarkup(can)
|
104 |
+
try:
|
105 |
+
await msg.edit_text(text=f"Total Messages Fetched: <code>{current}</code>\nTotal Messages Saved: <code>{total_files}</code>\nDuplicate Files Skipped: <code>{duplicate}</code>\nDeleted Messages Skipped: <code>{deleted}</code>\nNon-Media messages skipped: <code>{no_media + unsupported}</code>(Unsupported Media - `{unsupported}` )\nErrors Occurred: <code>{errors}</code>", reply_markup=reply)
|
106 |
+
except FloodWait as t:
|
107 |
+
await asyncio.sleep(t.value)
|
108 |
+
await msg.edit_text(text=f"Total Messages Fetched: <code>{current}</code>\nTotal Messages Saved: <code>{total_files}</code>\nDuplicate Files Skipped: <code>{duplicate}</code>\nDeleted Messages Skipped: <code>{deleted}</code>\nNon-Media messages skipped: <code>{no_media + unsupported}</code>(Unsupported Media - `{unsupported}` )\nErrors Occurred: <code>{errors}</code>", reply_markup=reply)
|
109 |
+
if message.empty:
|
110 |
+
deleted += 1
|
111 |
+
continue
|
112 |
+
elif not message.media:
|
113 |
+
no_media += 1
|
114 |
+
continue
|
115 |
+
elif message.media not in [enums.MessageMediaType.VIDEO, enums.MessageMediaType.AUDIO, enums.MessageMediaType.DOCUMENT]:
|
116 |
+
unsupported += 1
|
117 |
+
continue
|
118 |
+
media = getattr(message, message.media.value, None)
|
119 |
+
if not media:
|
120 |
+
unsupported += 1
|
121 |
+
continue
|
122 |
+
media.file_type = message.media.value
|
123 |
+
media.caption = message.caption
|
124 |
+
aynav, vnay = await save_file(media)
|
125 |
+
if aynav:
|
126 |
+
total_files += 1
|
127 |
+
elif vnay == 0:
|
128 |
+
duplicate += 1
|
129 |
+
elif vnay == 2:
|
130 |
+
errors += 1
|
131 |
+
except Exception as e:
|
132 |
+
logger.exception(e)
|
133 |
+
await msg.edit(f'Error: {e}')
|
134 |
+
else:
|
135 |
+
await msg.edit(f'Succesfully Saved <code>{total_files}</code> To Database!\nDuplicate Files Skipped: <code>{duplicate}</code>\nDeleted Messages Skipped: <code>{deleted}</code>\nNon-Media Messages Skipped: <code>{no_media + unsupported}</code>(Unsupported Media - `{unsupported}` )\nErrors Occurred: <code>{errors}</code>')
|
136 |
+
|
137 |
+
|
138 |
+
|
139 |
+
|
140 |
+
|
plugins/inline.py
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import logging
|
2 |
+
from pyrogram import Client, emoji, filters
|
3 |
+
from pyrogram.errors.exceptions.bad_request_400 import QueryIdInvalid
|
4 |
+
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, InlineQueryResultCachedDocument, InlineQuery
|
5 |
+
from database.ia_filterdb import get_search_results
|
6 |
+
from utils import is_subscribed, get_size, temp
|
7 |
+
from info import CACHE_TIME, AUTH_USERS, AUTH_CHANNEL, CUSTOM_FILE_CAPTION
|
8 |
+
|
9 |
+
logger = logging.getLogger(__name__)
|
10 |
+
cache_time = 0 if AUTH_USERS or AUTH_CHANNEL else CACHE_TIME
|
11 |
+
|
12 |
+
async def inline_users(query: InlineQuery):
|
13 |
+
if AUTH_USERS:
|
14 |
+
if query.from_user and query.from_user.id in AUTH_USERS:
|
15 |
+
return True
|
16 |
+
else:
|
17 |
+
return False
|
18 |
+
if query.from_user and query.from_user.id not in temp.BANNED_USERS:
|
19 |
+
return True
|
20 |
+
return False
|
21 |
+
|
22 |
+
@Client.on_inline_query()
|
23 |
+
async def answer(bot, query):
|
24 |
+
if not await inline_users(query):
|
25 |
+
await query.answer(results=[],
|
26 |
+
cache_time=0,
|
27 |
+
switch_pm_text='okDa',
|
28 |
+
switch_pm_parameter="hehe")
|
29 |
+
return
|
30 |
+
|
31 |
+
if AUTH_CHANNEL and not await is_subscribed(bot, query):
|
32 |
+
await query.answer(results=[],
|
33 |
+
cache_time=0,
|
34 |
+
switch_pm_text='You have to subscribe my channel to use the bot',
|
35 |
+
switch_pm_parameter="subscribe")
|
36 |
+
return
|
37 |
+
|
38 |
+
results = []
|
39 |
+
if '|' in query.query:
|
40 |
+
string, file_type = query.query.split('|', maxsplit=1)
|
41 |
+
string = string.strip()
|
42 |
+
file_type = file_type.strip().lower()
|
43 |
+
else:
|
44 |
+
string = query.query.strip()
|
45 |
+
file_type = None
|
46 |
+
|
47 |
+
offset = int(query.offset or 0)
|
48 |
+
reply_markup = get_reply_markup(query=string)
|
49 |
+
files, next_offset, total = await get_search_results(string, file_type=file_type, max_results=10, offset=offset)
|
50 |
+
|
51 |
+
for file in files:
|
52 |
+
title=file.file_name
|
53 |
+
size=get_size(file.file_size)
|
54 |
+
f_caption=file.caption
|
55 |
+
if CUSTOM_FILE_CAPTION:
|
56 |
+
try:
|
57 |
+
f_caption=CUSTOM_FILE_CAPTION.format(mention=query.from_user.mention, file_name= '' if title is None else title, file_size='' if size is None else size, file_caption='' if f_caption is None else f_caption)
|
58 |
+
except Exception as e:
|
59 |
+
logger.exception(e)
|
60 |
+
f_caption=f_caption
|
61 |
+
if f_caption is None:
|
62 |
+
f_caption = f"{file.file_name}"
|
63 |
+
results.append(
|
64 |
+
InlineQueryResultCachedDocument(
|
65 |
+
title=file.file_name,
|
66 |
+
document_file_id=file.file_id,
|
67 |
+
caption=f_caption,
|
68 |
+
description=f'Size: {get_size(file.file_size)}\nType: {file.file_type}',
|
69 |
+
reply_markup=reply_markup))
|
70 |
+
|
71 |
+
if results:
|
72 |
+
switch_pm_text = f"{emoji.FILE_FOLDER} Results - {total}"
|
73 |
+
if string:
|
74 |
+
switch_pm_text += f" for {string}"
|
75 |
+
try:
|
76 |
+
await query.answer(results=results,
|
77 |
+
is_personal = True,
|
78 |
+
cache_time=cache_time,
|
79 |
+
switch_pm_text=switch_pm_text,
|
80 |
+
switch_pm_parameter="start",
|
81 |
+
next_offset=str(next_offset))
|
82 |
+
except QueryIdInvalid:
|
83 |
+
pass
|
84 |
+
except Exception as e:
|
85 |
+
logging.exception(str(e))
|
86 |
+
else:
|
87 |
+
switch_pm_text = f'{emoji.CROSS_MARK} No Results'
|
88 |
+
if string:
|
89 |
+
switch_pm_text += f' for "{string}"'
|
90 |
+
|
91 |
+
await query.answer(results=[],
|
92 |
+
is_personal = True,
|
93 |
+
cache_time=cache_time,
|
94 |
+
switch_pm_text=switch_pm_text,
|
95 |
+
switch_pm_parameter="okay")
|
96 |
+
|
97 |
+
|
98 |
+
def get_reply_markup(query):
|
99 |
+
buttons = [[InlineKeyboardButton('⟳ ꜱᴇᴀʀᴄʜ ᴀɢᴀɪɴ', switch_inline_query_current_chat=query)]]
|
100 |
+
return InlineKeyboardMarkup(buttons)
|
101 |
+
|
102 |
+
|
103 |
+
|
plugins/pm_filter.py
ADDED
@@ -0,0 +1,243 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio, re, ast, math, logging, pyrogram
|
2 |
+
from pyrogram.errors.exceptions.bad_request_400 import MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty
|
3 |
+
from Script import script
|
4 |
+
from utils import get_shortlink
|
5 |
+
from info import AUTH_USERS, PM_IMDB, SINGLE_BUTTON, PROTECT_CONTENT, SPELL_CHECK_REPLY, IMDB_TEMPLATE, IMDB_DELET_TIME, PMFILTER, G_FILTER, SHORT_URL, SHORT_API
|
6 |
+
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery
|
7 |
+
from pyrogram import Client, filters, enums
|
8 |
+
from pyrogram.errors import FloodWait, UserIsBlocked, MessageNotModified, PeerIdInvalid
|
9 |
+
from utils import get_size, is_subscribed, get_poster, search_gagala, temp, get_settings, save_group_settings
|
10 |
+
from database.users_chats_db import db
|
11 |
+
from database.ia_filterdb import Media, get_file_details, get_search_results
|
12 |
+
from plugins.group_filter import global_filters
|
13 |
+
|
14 |
+
logger = logging.getLogger(__name__)
|
15 |
+
logger.setLevel(logging.ERROR)
|
16 |
+
|
17 |
+
|
18 |
+
@Client.on_message(filters.private & filters.text & filters.chat(AUTH_USERS) if AUTH_USERS else filters.text & filters.private)
|
19 |
+
async def auto_pm_fill(b, m):
|
20 |
+
if PMFILTER:
|
21 |
+
if G_FILTER:
|
22 |
+
kd = await global_filters(b, m)
|
23 |
+
if kd == False: await pm_AutoFilter(b, m)
|
24 |
+
else: await pm_AutoFilter(b, m)
|
25 |
+
else: return
|
26 |
+
|
27 |
+
@Client.on_callback_query(filters.create(lambda _, __, query: query.data.startswith("pmnext")))
|
28 |
+
async def pm_next_page(bot, query):
|
29 |
+
ident, req, key, offset = query.data.split("_")
|
30 |
+
try: offset = int(offset)
|
31 |
+
except: offset = 0
|
32 |
+
search = temp.PM_BUTTONS.get(str(key))
|
33 |
+
if not search: return await query.answer("Yᴏᴜ Aʀᴇ Usɪɴɢ Oɴᴇ Oғ Mʏ Oʟᴅ Mᴇssᴀɢᴇs, Pʟᴇᴀsᴇ Sᴇɴᴅ Tʜᴇ Rᴇǫᴜᴇsᴛ Aɢᴀɪɴ", show_alert=True)
|
34 |
+
|
35 |
+
files, n_offset, total = await get_search_results(search.lower(), offset=offset, filter=True)
|
36 |
+
try: n_offset = int(n_offset)
|
37 |
+
except: n_offset = 0
|
38 |
+
if not files: return
|
39 |
+
|
40 |
+
if SHORT_URL and SHORT_API:
|
41 |
+
if SINGLE_BUTTON:
|
42 |
+
btn = [[InlineKeyboardButton(text=f"[{get_size(file.file_size)}] {file.file_name}", url=await get_shortlink(f"https://telegram.dog/{temp.U_NAME}?start=files_{file.file_id}"))] for file in files ]
|
43 |
+
else:
|
44 |
+
btn = [[InlineKeyboardButton(text=f"{file.file_name}", url=await get_shortlink(f"https://telegram.dog/{temp.U_NAME}?start=files_{file.file_id}")),
|
45 |
+
InlineKeyboardButton(text=f"{get_size(file.file_size)}", url=await get_shortlink(f"https://telegram.dog/{temp.U_NAME}?start=files_{file.file_id}"))] for file in files ]
|
46 |
+
else:
|
47 |
+
if SINGLE_BUTTON:
|
48 |
+
btn = [[InlineKeyboardButton(text=f"[{get_size(file.file_size)}] {file.file_name}", callback_data=f'pmfile#{file.file_id}')] for file in files ]
|
49 |
+
else:
|
50 |
+
btn = [[InlineKeyboardButton(text=f"{file.file_name}", callback_data=f'pmfile#{file.file_id}'),
|
51 |
+
InlineKeyboardButton(text=f"{get_size(file.file_size)}", callback_data=f'pmfile#{file.file_id}')] for file in files ]
|
52 |
+
|
53 |
+
btn.insert(0, [InlineKeyboardButton("🔗 ʜᴏᴡ ᴛᴏ ᴅᴏᴡɴʟᴏᴀᴅ 🔗", "howdl")])
|
54 |
+
if 0 < offset <= 10: off_set = 0
|
55 |
+
elif offset == 0: off_set = None
|
56 |
+
else: off_set = offset - 10
|
57 |
+
if n_offset == 0:
|
58 |
+
btn.append(
|
59 |
+
[InlineKeyboardButton("⬅️ ʙᴀᴄᴋ", callback_data=f"pmnext_{req}_{key}_{off_set}"),
|
60 |
+
InlineKeyboardButton(f"❄️ ᴩᴀɢᴇꜱ {math.ceil(int(offset) / 10) + 1} / {math.ceil(total / 10)}", callback_data="pages")]
|
61 |
+
)
|
62 |
+
elif off_set is None:
|
63 |
+
btn.append(
|
64 |
+
[InlineKeyboardButton(f"❄️ {math.ceil(int(offset) / 10) + 1} / {math.ceil(total / 10)}", callback_data="pages"),
|
65 |
+
InlineKeyboardButton("ɴᴇxᴛ ➡️", callback_data=f"pmnext_{req}_{key}_{n_offset}")])
|
66 |
+
else:
|
67 |
+
btn.append([
|
68 |
+
InlineKeyboardButton("⬅️ ʙᴀᴄᴋ", callback_data=f"pmnext_{req}_{key}_{off_set}"),
|
69 |
+
InlineKeyboardButton(f"❄️ {math.ceil(int(offset) / 10) + 1} / {math.ceil(total / 10)}", callback_data="pages"),
|
70 |
+
InlineKeyboardButton("ɴᴇxᴛ ➡️", callback_data=f"pmnext_{req}_{key}_{n_offset}")
|
71 |
+
])
|
72 |
+
try:
|
73 |
+
await query.edit_message_reply_markup(reply_markup=InlineKeyboardMarkup(btn))
|
74 |
+
except MessageNotModified:
|
75 |
+
pass
|
76 |
+
await query.answer()
|
77 |
+
|
78 |
+
|
79 |
+
@Client.on_callback_query(filters.create(lambda _, __, query: query.data.startswith("pmspolling")))
|
80 |
+
async def pm_spoll_tester(bot, query):
|
81 |
+
_, user, movie_ = query.data.split('#')
|
82 |
+
if movie_ == "close_spellcheck":
|
83 |
+
return await query.message.delete()
|
84 |
+
movies = temp.PM_SPELL.get(str(query.message.reply_to_message.id))
|
85 |
+
if not movies:
|
86 |
+
return await query.answer("Yᴏᴜ Aʀᴇ Usɪɴɢ Oɴᴇ Oғ Mʏ Oʟᴅ Mᴇssᴀɢᴇs, Pʟᴇᴀsᴇ Sᴇɴᴅ Tʜᴇ Rᴇǫᴜᴇsᴛ Aɢᴀɪɴ", show_alert=True)
|
87 |
+
movie = movies[(int(movie_))]
|
88 |
+
await query.answer('Cʜᴇ���ᴋɪɴɢ Fᴏʀ Mᴏᴠɪᴇ Iɴ Dᴀᴛᴀʙᴀsᴇ...')
|
89 |
+
files, offset, total_results = await get_search_results(movie, offset=0, filter=True)
|
90 |
+
if files:
|
91 |
+
k = (movie, files, offset, total_results)
|
92 |
+
await pm_AutoFilter(bot, query, k)
|
93 |
+
else:
|
94 |
+
k = await query.message.edit('Tʜɪs Mᴏᴠɪᴇ Nᴏᴛ Fᴏᴜɴᴅ Iɴ Dᴀᴛᴀʙᴀsᴇ')
|
95 |
+
await asyncio.sleep(10)
|
96 |
+
await k.delete()
|
97 |
+
|
98 |
+
|
99 |
+
async def pm_AutoFilter(client, msg, pmspoll=False):
|
100 |
+
if not pmspoll:
|
101 |
+
message = msg
|
102 |
+
if message.text.startswith("/"): return # ignore commands
|
103 |
+
if re.findall("((^\/|^,|^!|^\.|^[\U0001F600-\U000E007F]).*)", message.text): return
|
104 |
+
if 2 < len(message.text) < 100:
|
105 |
+
search = message.text
|
106 |
+
files, offset, total_results = await get_search_results(search.lower(), offset=0, filter=True)
|
107 |
+
if not files: return await pm_spoll_choker(msg)
|
108 |
+
else: return
|
109 |
+
else:
|
110 |
+
message = msg.message.reply_to_message # msg will be callback query
|
111 |
+
search, files, offset, total_results = pmspoll
|
112 |
+
pre = 'pmfilep' if PROTECT_CONTENT else 'pmfile'
|
113 |
+
|
114 |
+
if SHORT_URL and SHORT_API:
|
115 |
+
if SINGLE_BUTTON:
|
116 |
+
btn = [[InlineKeyboardButton(text=f"[{get_size(file.file_size)}] {file.file_name}", url=await get_shortlink(f"https://telegram.dog/{temp.U_NAME}?start=pre_{file.file_id}"))] for file in files ]
|
117 |
+
else:
|
118 |
+
btn = [[InlineKeyboardButton(text=f"{file.file_name}", url=await get_shortlink(f"https://telegram.dog/{temp.U_NAME}?start=pre_{file.file_id}")),
|
119 |
+
InlineKeyboardButton(text=f"{get_size(file.file_size)}", url=await get_shortlink(f"https://telegram.dog/{temp.U_NAME}?start=pre_{file.file_id}"))] for file in files ]
|
120 |
+
else:
|
121 |
+
if SINGLE_BUTTON:
|
122 |
+
btn = [[InlineKeyboardButton(text=f"[{get_size(file.file_size)}] {file.file_name}", callback_data=f'{pre}#{file.file_id}')] for file in files ]
|
123 |
+
else:
|
124 |
+
btn = [[InlineKeyboardButton(text=f"{file.file_name}", callback_data=f'{pre}#{req}#{file.file_id}'),
|
125 |
+
InlineKeyboardButton(text=f"{get_size(file.file_size)}", callback_data=f'{pre}#{file.file_id}')] for file in files ]
|
126 |
+
|
127 |
+
btn.insert(0, [InlineKeyboardButton("🔗 ʜᴏᴡ ᴛᴏ ᴅᴏᴡɴʟᴏᴀᴅ 🔗", "howdl")])
|
128 |
+
if offset != "":
|
129 |
+
key = f"{message.id}"
|
130 |
+
temp.PM_BUTTONS[key] = search
|
131 |
+
req = message.from_user.id if message.from_user else 0
|
132 |
+
btn.append(
|
133 |
+
[InlineKeyboardButton(text=f"❄️ ᴩᴀɢᴇꜱ 1/{math.ceil(int(total_results) / 6)}", callback_data="pages"),
|
134 |
+
InlineKeyboardButton(text="ɴᴇxᴛ ➡️", callback_data=f"pmnext_{req}_{key}_{offset}")]
|
135 |
+
)
|
136 |
+
else:
|
137 |
+
btn.append(
|
138 |
+
[InlineKeyboardButton(text="❄️ ᴩᴀɢᴇꜱ 1/1", callback_data="pages")]
|
139 |
+
)
|
140 |
+
if PM_IMDB:
|
141 |
+
imdb = await get_poster(search)
|
142 |
+
else:
|
143 |
+
imdb = None
|
144 |
+
TEMPLATE = IMDB_TEMPLATE
|
145 |
+
if imdb:
|
146 |
+
cap = TEMPLATE.format(
|
147 |
+
group = message.chat.title,
|
148 |
+
requested = message.from_user.mention,
|
149 |
+
query = search,
|
150 |
+
title = imdb['title'],
|
151 |
+
votes = imdb['votes'],
|
152 |
+
aka = imdb["aka"],
|
153 |
+
seasons = imdb["seasons"],
|
154 |
+
box_office = imdb['box_office'],
|
155 |
+
localized_title = imdb['localized_title'],
|
156 |
+
kind = imdb['kind'],
|
157 |
+
imdb_id = imdb["imdb_id"],
|
158 |
+
cast = imdb["cast"],
|
159 |
+
runtime = imdb["runtime"],
|
160 |
+
countries = imdb["countries"],
|
161 |
+
certificates = imdb["certificates"],
|
162 |
+
languages = imdb["languages"],
|
163 |
+
director = imdb["director"],
|
164 |
+
writer = imdb["writer"],
|
165 |
+
producer = imdb["producer"],
|
166 |
+
composer = imdb["composer"],
|
167 |
+
cinematographer = imdb["cinematographer"],
|
168 |
+
music_team = imdb["music_team"],
|
169 |
+
distributors = imdb["distributors"],
|
170 |
+
release_date = imdb['release_date'],
|
171 |
+
year = imdb['year'],
|
172 |
+
genres = imdb['genres'],
|
173 |
+
poster = imdb['poster'],
|
174 |
+
plot = imdb['plot'],
|
175 |
+
rating = imdb['rating'],
|
176 |
+
url = imdb['url'],
|
177 |
+
**locals()
|
178 |
+
)
|
179 |
+
else:
|
180 |
+
cap = f"Hᴇʀᴇ Is Wʜᴀᴛ I Fᴏᴜɴᴅ Fᴏʀ Yᴏᴜʀ Qᴜᴇʀʏ {search}"
|
181 |
+
if imdb and imdb.get('poster'):
|
182 |
+
try:
|
183 |
+
hehe = await message.reply_photo(photo=imdb.get('poster'), caption=cap, quote=True, reply_markup=InlineKeyboardMarkup(btn))
|
184 |
+
await asyncio.sleep(IMDB_DELET_TIME)
|
185 |
+
await hehe.delete()
|
186 |
+
except (MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty):
|
187 |
+
pic = imdb.get('poster')
|
188 |
+
poster = pic.replace('.jpg', "._V1_UX360.jpg")
|
189 |
+
hmm = await message.reply_photo(photo=poster, caption=cap, quote=True, reply_markup=InlineKeyboardMarkup(btn))
|
190 |
+
await asyncio.sleep(IMDB_DELET_TIME)
|
191 |
+
await hmm.delete()
|
192 |
+
except Exception as e:
|
193 |
+
logger.exception(e)
|
194 |
+
cdp = await message.reply_text(cap, quote=True, reply_markup=InlineKeyboardMarkup(btn))
|
195 |
+
await asyncio.sleep(IMDB_DELET_TIME)
|
196 |
+
await cdp.delete()
|
197 |
+
else:
|
198 |
+
abc = await message.reply_text(cap, quote=True, reply_markup=InlineKeyboardMarkup(btn))
|
199 |
+
await asyncio.sleep(IMDB_DELET_TIME)
|
200 |
+
await abc.delete()
|
201 |
+
if pmspoll:
|
202 |
+
await msg.message.delete()
|
203 |
+
|
204 |
+
|
205 |
+
async def pm_spoll_choker(msg):
|
206 |
+
query = re.sub(r"\b(pl(i|e)*?(s|z+|ease|se|ese|(e+)s(e)?)|((send|snd|giv(e)?|gib)(\sme)?)|movie(s)?|new|latest|br((o|u)h?)*|^h(e|a)?(l)*(o)*|mal(ayalam)?|t(h)?amil|file|that|find|und(o)*|kit(t(i|y)?)?o(w)?|thar(u)?(o)*w?|kittum(o)*|aya(k)*(um(o)*)?|full\smovie|any(one)|with\ssubtitle(s)?)", "", msg.text, flags=re.IGNORECASE) # plis contribute some common words
|
207 |
+
query = query.strip() + " movie"
|
208 |
+
g_s = await search_gagala(query)
|
209 |
+
g_s += await search_gagala(msg.text)
|
210 |
+
gs_parsed = []
|
211 |
+
if not g_s:
|
212 |
+
k = await msg.reply("I Cᴏᴜʟᴅɴ'ᴛ Fɪɴᴅ Aɴʏ Mᴏᴠɪᴇ Iɴ Tʜᴀᴛ Nᴀᴍᴇ", quote=True)
|
213 |
+
await asyncio.sleep(10)
|
214 |
+
return await k.delete()
|
215 |
+
regex = re.compile(r".*(imdb|wikipedia).*", re.IGNORECASE) # look for imdb / wiki results
|
216 |
+
gs = list(filter(regex.match, g_s))
|
217 |
+
gs_parsed = [re.sub(r'\b(\-([a-zA-Z-\s])\-\simdb|(\-\s)?imdb|(\-\s)?wikipedia|\(|\)|\-|reviews|full|all|episode(s)?|film|movie|series)', '', i, flags=re.IGNORECASE) for i in gs]
|
218 |
+
if not gs_parsed:
|
219 |
+
reg = re.compile(r"watch(\s[a-zA-Z0-9_\s\-\(\)]*)*\|.*", re.IGNORECASE) # match something like Watch Niram | Amazon Prime
|
220 |
+
for mv in g_s:
|
221 |
+
match = reg.match(mv)
|
222 |
+
if match: gs_parsed.append(match.group(1))
|
223 |
+
user = msg.from_user.id if msg.from_user else 0
|
224 |
+
movielist = []
|
225 |
+
gs_parsed = list(dict.fromkeys(gs_parsed)) # removing duplicates https://stackoverflow.com/a/7961425
|
226 |
+
if len(gs_parsed) > 3: gs_parsed = gs_parsed[:3]
|
227 |
+
if gs_parsed:
|
228 |
+
for mov in gs_parsed:
|
229 |
+
imdb_s = await get_poster(mov.strip(), bulk=True) # searching each keyword in imdb
|
230 |
+
if imdb_s: movielist += [movie.get('title') for movie in imdb_s]
|
231 |
+
movielist += [(re.sub(r'(\-|\(|\)|_)', '', i, flags=re.IGNORECASE)).strip() for i in gs_parsed]
|
232 |
+
movielist = list(dict.fromkeys(movielist)) # removing duplicates
|
233 |
+
if not movielist:
|
234 |
+
k = await msg.reply("I Cᴏᴜʟᴅɴ'ᴛ Fɪɴᴅ Aɴʏᴛʜɪɴɢ Rᴇʟᴀᴛᴇᴅ Tᴏ Tʜᴀᴛ. Cʜᴇᴄᴋ Yᴏᴜʀ Sᴘᴇʟʟɪɴɢ", quote=True)
|
235 |
+
await asyncio.sleep(10)
|
236 |
+
return await k.delete()
|
237 |
+
temp.PM_SPELL[str(msg.id)] = movielist
|
238 |
+
btn = [[InlineKeyboardButton(text=movie.strip(), callback_data=f"pmspolling#{user}#{k}")] for k, movie in enumerate(movielist)]
|
239 |
+
btn.append([InlineKeyboardButton(text="Close", callback_data=f'pmspolling#{user}#close_spellcheck')])
|
240 |
+
await msg.reply("I Cᴏᴜʟᴅɴ'ᴛ Fɪɴᴅ Aɴʏᴛʜɪɴɢ Rᴇʟᴀᴛᴇᴅ Tᴏ Tʜᴀᴛ. Dɪᴅ Yᴏᴜ Mᴇᴀɴ Aɴʏ Oɴᴇ Oғ Tʜᴇsᴇ?", reply_markup=InlineKeyboardMarkup(btn), quote=True)
|
241 |
+
|
242 |
+
|
243 |
+
|
plugins/query.py
ADDED
@@ -0,0 +1,608 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio, re, ast, time, math, logging, random, pyrogram, shutil, psutil
|
2 |
+
|
3 |
+
# Pyrogram Functions
|
4 |
+
from pyrogram.errors.exceptions.bad_request_400 import MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty
|
5 |
+
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery, InputMediaPhoto
|
6 |
+
from pyrogram import Client, filters, enums
|
7 |
+
from pyrogram.errors import FloodWait, UserIsBlocked, MessageNotModified, PeerIdInvalid
|
8 |
+
|
9 |
+
# Helper Function
|
10 |
+
from Script import script
|
11 |
+
from utils import get_size, is_subscribed, get_poster, search_gagala, temp, get_settings, save_group_settings, get_shortlink, get_time, humanbytes
|
12 |
+
from .ExtraMods.carbon import make_carbon
|
13 |
+
|
14 |
+
# Database Function
|
15 |
+
from database.connections_mdb import active_connection, all_connections, delete_connection, if_active, make_active, make_inactive
|
16 |
+
from database.ia_filterdb import Media, get_file_details, get_search_results
|
17 |
+
from database.filters_mdb import del_all, find_filter, get_filters
|
18 |
+
from database.gfilters_mdb import find_gfilter, get_gfilters
|
19 |
+
from database.users_chats_db import db
|
20 |
+
|
21 |
+
# Image Editor Function
|
22 |
+
from image.edit_1 import bright, mix, black_white, g_blur, normal_blur, box_blur
|
23 |
+
from image.edit_2 import circle_with_bg, circle_without_bg, sticker, edge_curved, contrast, sepia_mode, pencil, cartoon
|
24 |
+
from image.edit_3 import green_border, blue_border, black_border, red_border
|
25 |
+
from image.edit_4 import rotate_90, rotate_180, rotate_270, inverted, round_sticker, removebg_white, removebg_plain, removebg_sticker
|
26 |
+
from image.edit_5 import normalglitch_1, normalglitch_2, normalglitch_3, normalglitch_4, normalglitch_5, scanlineglitch_1, scanlineglitch_2, scanlineglitch_3, scanlineglitch_4, scanlineglitch_5
|
27 |
+
|
28 |
+
# Configuration
|
29 |
+
from info import ADMINS, AUTH_CHANNEL, AUTH_USERS, CUSTOM_FILE_CAPTION, AUTH_GROUPS, P_TTI_SHOW_OFF, PICS, IMDB, PM_IMDB, SINGLE_BUTTON, PROTECT_CONTENT, \
|
30 |
+
SPELL_CHECK_REPLY, IMDB_TEMPLATE, IMDB_DELET_TIME, START_MESSAGE, PMFILTER, G_FILTER, BUTTON_LOCK, BUTTON_LOCK_TEXT, SHORT_URL, SHORT_API
|
31 |
+
|
32 |
+
|
33 |
+
logger = logging.getLogger(__name__)
|
34 |
+
logger.setLevel(logging.ERROR)
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
@Client.on_callback_query()
|
39 |
+
async def cb_handler(client: Client, query: CallbackQuery):
|
40 |
+
if query.data == "close_data":
|
41 |
+
await query.message.delete()
|
42 |
+
|
43 |
+
elif query.data == "delallconfirm":
|
44 |
+
userid = query.from_user.id
|
45 |
+
chat_type = query.message.chat.type
|
46 |
+
if chat_type == enums.ChatType.PRIVATE:
|
47 |
+
grpid = await active_connection(str(userid))
|
48 |
+
if grpid is not None:
|
49 |
+
grp_id = grpid
|
50 |
+
try:
|
51 |
+
chat = await client.get_chat(grpid)
|
52 |
+
title = chat.title
|
53 |
+
except:
|
54 |
+
return await query.message.edit_text("Make Sure I'm Present In Your Group!!", quote=True)
|
55 |
+
else:
|
56 |
+
return await query.message.edit_text("I'm Not Connected To Any Groups!\ncheck /Connections Or Connect To Any Groups", quote=True)
|
57 |
+
elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
|
58 |
+
grp_id = query.message.chat.id
|
59 |
+
title = query.message.chat.title
|
60 |
+
else: return
|
61 |
+
st = await client.get_chat_member(grp_id, userid)
|
62 |
+
if (st.status == enums.ChatMemberStatus.OWNER) or (str(userid) in ADMINS): await del_all(query.message, grp_id, title)
|
63 |
+
else: await query.answer("You Need To Be Group Owner Or An Auth User To Do That!", show_alert=True)
|
64 |
+
|
65 |
+
elif query.data == "delallcancel":
|
66 |
+
userid = query.from_user.id
|
67 |
+
chat_type = query.message.chat.type
|
68 |
+
if chat_type == enums.ChatType.PRIVATE:
|
69 |
+
await query.message.reply_to_message.delete()
|
70 |
+
await query.message.delete()
|
71 |
+
elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
|
72 |
+
grp_id = query.message.chat.id
|
73 |
+
st = await client.get_chat_member(grp_id, userid)
|
74 |
+
if (st.status == enums.ChatMemberStatus.OWNER) or (str(userid) in ADMINS):
|
75 |
+
await query.message.delete()
|
76 |
+
try: await query.message.reply_to_message.delete()
|
77 |
+
except: pass
|
78 |
+
else: await query.answer("Buddy Don't Touch Others Property 😁", show_alert=True)
|
79 |
+
|
80 |
+
elif "groupcb" in query.data:
|
81 |
+
group_id = query.data.split(":")[1]
|
82 |
+
act = query.data.split(":")[2]
|
83 |
+
hr = await client.get_chat(int(group_id))
|
84 |
+
title = hr.title
|
85 |
+
user_id = query.from_user.id
|
86 |
+
if act == "":
|
87 |
+
stat = "Connect"
|
88 |
+
cb = "connectcb"
|
89 |
+
else:
|
90 |
+
stat = "Disconnect"
|
91 |
+
cb = "disconnect"
|
92 |
+
keyboard = InlineKeyboardMarkup([[
|
93 |
+
InlineKeyboardButton(f"{stat}", callback_data=f"{cb}:{group_id}"),
|
94 |
+
InlineKeyboardButton("Delete", callback_data=f"deletecb:{group_id}")
|
95 |
+
],[
|
96 |
+
InlineKeyboardButton("Back", callback_data="backcb")]
|
97 |
+
])
|
98 |
+
await query.message.edit_text(f"Group Name:- **{title}**\nGroup Id:- `{group_id}`", reply_markup=keyboard, parse_mode=enums.ParseMode.MARKDOWN)
|
99 |
+
|
100 |
+
elif "connectcb" in query.data:
|
101 |
+
group_id = query.data.split(":")[1]
|
102 |
+
hr = await client.get_chat(int(group_id))
|
103 |
+
title = hr.title
|
104 |
+
user_id = query.from_user.id
|
105 |
+
mkact = await make_active(str(user_id), str(group_id))
|
106 |
+
if mkact: await query.message.edit_text(f"Connected To: **{title}**", parse_mode=enums.ParseMode.MARKDOWN,)
|
107 |
+
else: await query.message.edit_text('Some Error Occurred!!', parse_mode="md")
|
108 |
+
|
109 |
+
elif "disconnect" in query.data:
|
110 |
+
group_id = query.data.split(":")[1]
|
111 |
+
hr = await client.get_chat(int(group_id))
|
112 |
+
title = hr.title
|
113 |
+
user_id = query.from_user.id
|
114 |
+
mkinact = await make_inactive(str(user_id))
|
115 |
+
if mkinact: await query.message.edit_text(f"Disconnected From **{title}**", parse_mode=enums.ParseMode.MARKDOWN)
|
116 |
+
else: await query.message.edit_text(f"Some Error Occurred!!", parse_mode=enums.ParseMode.MARKDOWN)
|
117 |
+
|
118 |
+
elif "deletecb" in query.data:
|
119 |
+
user_id = query.from_user.id
|
120 |
+
group_id = query.data.split(":")[1]
|
121 |
+
delcon = await delete_connection(str(user_id), str(group_id))
|
122 |
+
if delcon: await query.message.edit_text("Successfully Deleted Connection")
|
123 |
+
else: await query.message.edit_text(f"Some Error Occurred!!", parse_mode=enums.ParseMode.MARKDOWN)
|
124 |
+
|
125 |
+
elif query.data == "backcb":
|
126 |
+
userid = query.from_user.id
|
127 |
+
groupids = await all_connections(str(userid))
|
128 |
+
if groupids is None:
|
129 |
+
return await query.message.edit_text("There Are No Active Connections!! Connect To Some Groups First.")
|
130 |
+
buttons = []
|
131 |
+
for groupid in groupids:
|
132 |
+
try:
|
133 |
+
ttl = await client.get_chat(int(groupid))
|
134 |
+
title = ttl.title
|
135 |
+
active = await if_active(str(userid), str(groupid))
|
136 |
+
act = " - ACTIVE" if active else ""
|
137 |
+
buttons.append([InlineKeyboardButton(f"{title}{act}", callback_data=f"groupcb:{groupid}:{act}")])
|
138 |
+
except: pass
|
139 |
+
if buttons: await query.message.edit_text("Your Connected Group Details ;\n\n", reply_markup=InlineKeyboardMarkup(buttons))
|
140 |
+
|
141 |
+
elif "alertmessage" in query.data:
|
142 |
+
grp_id = query.message.chat.id
|
143 |
+
i = query.data.split(":")[1]
|
144 |
+
keyword = query.data.split(":")[2]
|
145 |
+
reply_text, btn, alerts, fileid = await find_filter(grp_id, keyword)
|
146 |
+
if alerts is not None:
|
147 |
+
alerts = ast.literal_eval(alerts)
|
148 |
+
alert = alerts[int(i)]
|
149 |
+
alert = alert.replace("\\n", "\n").replace("\\t", "\t")
|
150 |
+
await query.answer(alert, show_alert=True)
|
151 |
+
|
152 |
+
elif "galert" in query.data:
|
153 |
+
i = query.data.split(":")[1]
|
154 |
+
keyword = query.data.split(":")[2]
|
155 |
+
reply_text, btn, alerts, fileid = await find_gfilter("gfilters", keyword)
|
156 |
+
if alerts is not None:
|
157 |
+
alerts = ast.literal_eval(alerts)
|
158 |
+
alert = alerts[int(i)]
|
159 |
+
alert = alert.replace("\\n", "\n").replace("\\t", "\t")
|
160 |
+
await query.answer(alert, show_alert=True)
|
161 |
+
|
162 |
+
if query.data.startswith("pmfile"):
|
163 |
+
ident, file_id = query.data.split("#")
|
164 |
+
files_ = await get_file_details(file_id)
|
165 |
+
if not files_: return await query.answer('No Such File Exist.')
|
166 |
+
files = files_[0]
|
167 |
+
title = files.file_name
|
168 |
+
size = get_size(files.file_size)
|
169 |
+
f_caption = f_caption = f"{title}"
|
170 |
+
if CUSTOM_FILE_CAPTION:
|
171 |
+
try: f_caption = CUSTOM_FILE_CAPTION.format(mention=query.from_user.mention, file_name='' if title is None else title, file_size='' if size is None else size, file_caption='' if f_caption is None else f_caption)
|
172 |
+
except Exception as e: logger.exception(e)
|
173 |
+
try:
|
174 |
+
if AUTH_CHANNEL and not await is_subscribed(client, query):
|
175 |
+
return await query.answer(url=f"https://t.me/{temp.U_NAME}?start={ident}_{file_id}")
|
176 |
+
else:
|
177 |
+
await client.send_cached_media(chat_id=query.from_user.id, file_id=file_id, caption=f_caption, protect_content=True if ident == "pmfilep" else False)
|
178 |
+
except Exception as e:
|
179 |
+
await query.answer(f"⚠️ Eʀʀᴏʀ {e}", show_alert=True)
|
180 |
+
|
181 |
+
if query.data.startswith("file"):
|
182 |
+
ident, req, file_id = query.data.split("#")
|
183 |
+
if BUTTON_LOCK:
|
184 |
+
if int(req) not in [query.from_user.id, 0]:
|
185 |
+
return await query.answer(BUTTON_LOCK_TEXT.format(query=query.from_user.first_name), show_alert=True)
|
186 |
+
files_ = await get_file_details(file_id)
|
187 |
+
if not files_: return await query.answer('No Such File Exist.')
|
188 |
+
files = files_[0]
|
189 |
+
title = files.file_name
|
190 |
+
size = get_size(files.file_size)
|
191 |
+
f_caption = f_caption = f"{title}"
|
192 |
+
settings = await get_settings(query.message.chat.id)
|
193 |
+
if CUSTOM_FILE_CAPTION:
|
194 |
+
try: f_caption = CUSTOM_FILE_CAPTION.format(mention=query.from_user.mention, file_name='' if title is None else title, file_size='' if size is None else size, file_caption='' if f_caption is None else f_caption)
|
195 |
+
except Exception as e: logger.exception(e)
|
196 |
+
try:
|
197 |
+
if AUTH_CHANNEL and not await is_subscribed(client, query):
|
198 |
+
return await query.answer(url=f"https://t.me/{temp.U_NAME}?start={ident}_{file_id}")
|
199 |
+
elif settings['botpm']:
|
200 |
+
return await query.answer(url=f"https://t.me/{temp.U_NAME}?start={ident}_{file_id}")
|
201 |
+
else:
|
202 |
+
await client.send_cached_media(chat_id=query.from_user.id, file_id=file_id, caption=f_caption, protect_content=True if ident == "filep" else False)
|
203 |
+
await query.answer('Cʜᴇᴄᴋ PM, I Hᴀᴠᴇ Sᴇɴᴛ Fɪʟᴇs Iɴ Pᴍ', show_alert=True)
|
204 |
+
except UserIsBlocked:
|
205 |
+
await query.answer('Uɴʙʟᴏᴄᴋ Tʜᴇ Bᴏᴛ Mᴀʜɴ !', show_alert=True)
|
206 |
+
except PeerIdInvalid:
|
207 |
+
await query.answer(url=f"https://t.me/{temp.U_NAME}?start={ident}_{file_id}")
|
208 |
+
except Exception as e:
|
209 |
+
await query.answer(url=f"https://t.me/{temp.U_NAME}?start={ident}_{file_id}")
|
210 |
+
|
211 |
+
elif query.data.startswith("checksub"):
|
212 |
+
if AUTH_CHANNEL and not await is_subscribed(client, query):
|
213 |
+
return await query.answer("I Lɪᴋᴇ Yᴏᴜʀ Sᴍᴀʀᴛɴᴇss, Bᴜᴛ Dᴏɴ'ᴛ Bᴇ Oᴠᴇʀsᴍᴀʀᴛ Oᴋᴀʏ 😏", show_alert=True)
|
214 |
+
ident, file_id = query.data.split("#")
|
215 |
+
files_ = await get_file_details(file_id)
|
216 |
+
if not files_: return await query.answer('NO SUCH FILE EXIST....')
|
217 |
+
files = files_[0]
|
218 |
+
title = files.file_name
|
219 |
+
size = get_size(files.file_size)
|
220 |
+
f_caption = f_caption = f"{title}"
|
221 |
+
if CUSTOM_FILE_CAPTION:
|
222 |
+
try: f_caption = CUSTOM_FILE_CAPTION.format(mention=query.from_user.mention, file_name='' if title is None else title, file_size='' if size is None else size, file_caption='' if f_caption is None else f_caption)
|
223 |
+
except Exception as e: logger.exception(e)
|
224 |
+
await client.send_cached_media(chat_id=query.from_user.id, file_id=file_id, caption=f_caption, protect_content=True if ident == 'checksubp' else False)
|
225 |
+
|
226 |
+
elif query.data == "removebg":
|
227 |
+
buttons = [[
|
228 |
+
InlineKeyboardButton(text="𝖶𝗂𝗍𝗁 𝖶𝗁𝗂𝗍𝖾 𝖡𝖦", callback_data="rmbgwhite"),
|
229 |
+
InlineKeyboardButton(text="𝖶𝗂𝗍𝗁𝗈𝗎𝗍 𝖡𝖦", callback_data="rmbgplain"),
|
230 |
+
],[
|
231 |
+
InlineKeyboardButton(text="𝖲𝗍𝗂𝖼𝗄𝖾𝗋", callback_data="rmbgsticker"),
|
232 |
+
],[
|
233 |
+
InlineKeyboardButton('𝙱𝙰𝙲𝙺', callback_data='photo')
|
234 |
+
]]
|
235 |
+
await query.message.edit_text("**Select Required Mode**", reply_markup=InlineKeyboardMarkup(buttons))
|
236 |
+
|
237 |
+
elif query.data == "stick":
|
238 |
+
buttons = [[
|
239 |
+
InlineKeyboardButton(text="𝖭𝗈𝗋𝗆𝖺𝗅", callback_data="stkr"),
|
240 |
+
InlineKeyboardButton(text="𝖤𝖽𝗀𝖾 𝖢𝗎𝗋𝗏𝖾𝖽", callback_data="cur_ved"),
|
241 |
+
],[
|
242 |
+
InlineKeyboardButton(text="𝖢𝗂𝗋𝖼𝗅𝖾", callback_data="circle_sticker")
|
243 |
+
],[
|
244 |
+
InlineKeyboardButton('𝙱𝙰𝙲𝙺', callback_data='photo')
|
245 |
+
]]
|
246 |
+
await query.message.edit("**Select A Type**", reply_markup=InlineKeyboardMarkup(buttons))
|
247 |
+
|
248 |
+
elif query.data == "rotate":
|
249 |
+
buttons = [[
|
250 |
+
InlineKeyboardButton(text="180", callback_data="180"),
|
251 |
+
InlineKeyboardButton(text="90", callback_data="90")
|
252 |
+
],[
|
253 |
+
InlineKeyboardButton(text="270", callback_data="270")
|
254 |
+
],[
|
255 |
+
InlineKeyboardButton('𝙱𝙰𝙲𝙺', callback_data='photo')
|
256 |
+
]]
|
257 |
+
await query.message.edit_text("**Select The Degree**", reply_markup=InlineKeyboardMarkup(buttons))
|
258 |
+
|
259 |
+
elif query.data == "glitch":
|
260 |
+
buttons = [[
|
261 |
+
InlineKeyboardButton(text="𝖭𝗈𝗋𝗆𝖺𝗅", callback_data="normalglitch"),
|
262 |
+
InlineKeyboardButton(text="𝖲𝖼𝖺𝗇 𝖫𝖺𝗂𝗇𝗌", callback_data="scanlineglitch")
|
263 |
+
],[
|
264 |
+
InlineKeyboardButton('𝙱𝙰𝙲𝙺', callback_data='photo')
|
265 |
+
]]
|
266 |
+
await query.message.edit_text("**Select Required Mode**", reply_markup=InlineKeyboardMarkup(buttons))
|
267 |
+
|
268 |
+
elif query.data == "normalglitch":
|
269 |
+
buttons = [[
|
270 |
+
InlineKeyboardButton(text="1", callback_data="normalglitch1"),
|
271 |
+
InlineKeyboardButton(text="2", callback_data="normalglitch2"),
|
272 |
+
InlineKeyboardButton(text="3", callback_data="normalglitch3"),
|
273 |
+
],[
|
274 |
+
InlineKeyboardButton(text="4", callback_data="normalglitch4"),
|
275 |
+
InlineKeyboardButton(text="5", callback_data="normalglitch5"),
|
276 |
+
],[
|
277 |
+
InlineKeyboardButton('𝙱𝙰𝙲𝙺', callback_data='glitch')
|
278 |
+
]]
|
279 |
+
await query.message.edit_text(text="**Select Glitch Power Level**", reply_markup=InlineKeyboardMarkup(buttons))
|
280 |
+
|
281 |
+
elif query.data == "scanlineglitch":
|
282 |
+
buttons = [[
|
283 |
+
InlineKeyboardButton(text="1", callback_data="scanlineglitch1"),
|
284 |
+
InlineKeyboardButton(text="2", callback_data="scanlineglitch2"),
|
285 |
+
InlineKeyboardButton(text="3", callback_data="scanlineglitch3"),
|
286 |
+
],[
|
287 |
+
InlineKeyboardButton(text="4", callback_data="scanlineglitch4"),
|
288 |
+
InlineKeyboardButton(text="5", callback_data="scanlineglitch5"),
|
289 |
+
],[
|
290 |
+
InlineKeyboardButton('𝙱𝙰𝙲𝙺', callback_data='glitch')
|
291 |
+
]]
|
292 |
+
await query.message.edit_text("**Select Glitch Power Level**", reply_markup=InlineKeyboardMarkup(buttons))
|
293 |
+
|
294 |
+
elif query.data == "blur":
|
295 |
+
buttons = [[
|
296 |
+
InlineKeyboardButton(text="𝖡𝗈𝗑", callback_data="box"),
|
297 |
+
InlineKeyboardButton(text="𝖭𝗈𝗋𝗆𝖺𝗅", callback_data="normal"),
|
298 |
+
],[
|
299 |
+
InlineKeyboardButton(text="𝖦𝖺𝗎𝗌𝗌𝗂𝖺𝗇", callback_data="gas")
|
300 |
+
],[
|
301 |
+
InlineKeyboardButton('𝙱𝙰𝙲𝙺', callback_data='photo')
|
302 |
+
]]
|
303 |
+
await query.message.edit("**Select A Type**", reply_markup=InlineKeyboardMarkup(buttons))
|
304 |
+
|
305 |
+
elif query.data == "circle":
|
306 |
+
buttons = [[
|
307 |
+
InlineKeyboardButton(text="𝖶𝗂𝗍𝗁 𝖡𝖦", callback_data="circlewithbg"),
|
308 |
+
InlineKeyboardButton(text="𝖶𝗂𝗍𝗁𝗈𝗎𝗍 𝖡𝖦", callback_data="circlewithoutbg"),
|
309 |
+
],[
|
310 |
+
InlineKeyboardButton('𝙱𝙰𝙲𝙺', callback_data='photo')
|
311 |
+
]]
|
312 |
+
await query.message.edit_text("**Select Required Mode**", reply_markup=InlineKeyboardMarkup(buttons))
|
313 |
+
|
314 |
+
elif query.data == "border":
|
315 |
+
buttons = [[
|
316 |
+
InlineKeyboardButton(text="𝖱𝖾𝖽", callback_data="red"),
|
317 |
+
InlineKeyboardButton(text="𝖦𝗋𝖾𝖾𝗇", callback_data="green"),
|
318 |
+
],[
|
319 |
+
InlineKeyboardButton(text="𝖡𝗅𝖺𝖼𝗄", callback_data="black"),
|
320 |
+
InlineKeyboardButton(text="𝖡𝗅𝗎𝖾", callback_data="blue"),
|
321 |
+
],[
|
322 |
+
InlineKeyboardButton('𝙱𝙰𝙲𝙺', callback_data='photo')
|
323 |
+
]]
|
324 |
+
await query.message.edit("**Select Border**", reply_markup=InlineKeyboardMarkup(buttons))
|
325 |
+
|
326 |
+
elif query.data == "photo":
|
327 |
+
buttons = [[
|
328 |
+
InlineKeyboardButton(text="𝖡𝗋𝗂𝗀𝗍𝗁", callback_data="bright"),
|
329 |
+
InlineKeyboardButton(text="𝖬𝗂𝗑𝖾𝖽", callback_data="mix"),
|
330 |
+
InlineKeyboardButton(text="𝖡 & 𝖶", callback_data="b|w"),
|
331 |
+
],[
|
332 |
+
InlineKeyboardButton(text="𝖢𝗂𝗋𝖼𝗅𝖾", callback_data="circle"),
|
333 |
+
InlineKeyboardButton(text="𝖡𝗅𝗎𝗋", callback_data="blur"),
|
334 |
+
InlineKeyboardButton(text="𝖡𝗈𝗋𝖽𝖾𝗋", callback_data="border"),
|
335 |
+
],[
|
336 |
+
InlineKeyboardButton(text="𝖲𝗍𝗂𝖼𝗄𝖾𝗋", callback_data="stick"),
|
337 |
+
InlineKeyboardButton(text="𝖱𝗈𝗍𝖺𝗍𝖾", callback_data="rotate"),
|
338 |
+
InlineKeyboardButton(text="𝖢𝗈𝗇𝗍𝗋𝖺𝗌𝗍", callback_data="contrast"),
|
339 |
+
],[
|
340 |
+
InlineKeyboardButton(text="𝖲𝖾𝗉𝗂𝖺", callback_data="sepia"),
|
341 |
+
InlineKeyboardButton(text="𝖯𝖾𝗇𝖼𝗂𝗅", callback_data="pencil"),
|
342 |
+
InlineKeyboardButton(text="𝖢𝖺𝗋𝗍𝗈𝗈𝗇", callback_data="cartoon"),
|
343 |
+
],[
|
344 |
+
InlineKeyboardButton(text="𝖨𝗇𝗏𝖾𝗋𝗍", callback_data="inverted"),
|
345 |
+
InlineKeyboardButton(text="𝖦𝗅𝗂𝗍𝖼𝗁", callback_data="glitch"),
|
346 |
+
InlineKeyboardButton(text="𝖱𝖾𝗆𝗈𝗏𝖾 𝖡𝖦", callback_data="removebg")
|
347 |
+
],[
|
348 |
+
InlineKeyboardButton(text="𝖢𝗅𝗈𝗌𝖾", callback_data="close_data")
|
349 |
+
]]
|
350 |
+
await query.message.edit_text("Sᴇʟᴇᴄᴛ Yᴏᴜʀ Rᴇǫᴜɪʀᴇᴅ Mᴏᴅᴇ Fʀᴏᴍ Bᴇʟᴏᴡ!", reply_markup=InlineKeyboardMarkup(buttons))
|
351 |
+
|
352 |
+
elif query.data == "bright":
|
353 |
+
await bright(client, query.message)
|
354 |
+
elif query.data == "mix":
|
355 |
+
await mix(client, query.message)
|
356 |
+
elif query.data == "b|w":
|
357 |
+
await black_white(client, query.message)
|
358 |
+
elif query.data == "circlewithbg":
|
359 |
+
await circle_with_bg(client, query.message)
|
360 |
+
elif query.data == "circlewithoutbg":
|
361 |
+
await circle_without_bg(client, query.message)
|
362 |
+
elif query.data == "green":
|
363 |
+
await green_border(client, query.message)
|
364 |
+
elif query.data == "blue":
|
365 |
+
await blue_border(client, query.message)
|
366 |
+
elif query.data == "red":
|
367 |
+
await red_border(client, query.message)
|
368 |
+
elif query.data == "black":
|
369 |
+
await black_border(client, query.message)
|
370 |
+
elif query.data == "circle_sticker":
|
371 |
+
await round_sticker(client, query.message)
|
372 |
+
elif query.data == "inverted":
|
373 |
+
await inverted(client, query.message)
|
374 |
+
elif query.data == "stkr":
|
375 |
+
await sticker(client, query.message)
|
376 |
+
elif query.data == "cur_ved":
|
377 |
+
await edge_curved(client, query.message)
|
378 |
+
elif query.data == "90":
|
379 |
+
await rotate_90(client, query.message)
|
380 |
+
elif query.data == "180":
|
381 |
+
await rotate_180(client, query.message)
|
382 |
+
elif query.data == "270":
|
383 |
+
await rotate_270(client, query.message)
|
384 |
+
elif query.data == "contrast":
|
385 |
+
await contrast(client, query.message)
|
386 |
+
elif query.data == "box":
|
387 |
+
await box_blur(client, query.message)
|
388 |
+
elif query.data == "gas":
|
389 |
+
await g_blur(client, query.message)
|
390 |
+
elif query.data == "normal":
|
391 |
+
await normal_blur(client, query.message)
|
392 |
+
elif query.data == "sepia":
|
393 |
+
await sepia_mode(client, query.message)
|
394 |
+
elif query.data == "pencil":
|
395 |
+
await pencil(client, query.message)
|
396 |
+
elif query.data == "cartoon":
|
397 |
+
await cartoon(client, query.message)
|
398 |
+
elif query.data == "normalglitch1":
|
399 |
+
await normalglitch_1(client, query.message)
|
400 |
+
elif query.data == "normalglitch2":
|
401 |
+
await normalglitch_2(client, query.message)
|
402 |
+
elif query.data == "normalglitch3":
|
403 |
+
await normalglitch_3(client, query.message)
|
404 |
+
elif query.data == "normalglitch4":
|
405 |
+
await normalglitch_4(client, query.message)
|
406 |
+
elif query.data == "normalglitch5":
|
407 |
+
await normalglitch_5(client, query.message)
|
408 |
+
elif query.data == "scanlineglitch1":
|
409 |
+
await scanlineglitch_1(client, query.message)
|
410 |
+
elif query.data == "scanlineglitch2":
|
411 |
+
await scanlineglitch_2(client, query.message)
|
412 |
+
elif query.data == "scanlineglitch3":
|
413 |
+
await scanlineglitch_3(client, query.message)
|
414 |
+
elif query.data == "scanlineglitch4":
|
415 |
+
await scanlineglitch_4(client, query.message)
|
416 |
+
elif query.data == "scanlineglitch5":
|
417 |
+
await scanlineglitch_5(client, query.message)
|
418 |
+
elif query.data == "rmbgwhite":
|
419 |
+
await removebg_white(client, query.message)
|
420 |
+
elif query.data == "rmbgplain":
|
421 |
+
await removebg_plain(client, query.message)
|
422 |
+
elif query.data == "rmbgsticker":
|
423 |
+
await removebg_sticker(client, query.message)
|
424 |
+
elif query.data == "pages":
|
425 |
+
await query.answer("🤨 Cᴜʀɪᴏsɪᴛʏ Is A Lɪᴛᴛʟᴇ Mᴏʀᴇ, Isɴ'ᴛ Iᴛ? 😁", show_alert=True)
|
426 |
+
elif query.data == "howdl":
|
427 |
+
try: await query.answer(script.HOW_TO_DOWNLOAD.format(query.from_user.first_name), show_alert=True)
|
428 |
+
except: await query.message.edit(script.HOW_TO_DOWNLOAD.format(query.from_user.first_name))
|
429 |
+
|
430 |
+
elif query.data == "start":
|
431 |
+
buttons = [[
|
432 |
+
InlineKeyboardButton("➕️ Aᴅᴅ Mᴇ Tᴏ Yᴏᴜʀ Cʜᴀᴛ ➕", url=f"http://t.me/{temp.U_NAME}?startgroup=true")
|
433 |
+
],[
|
434 |
+
InlineKeyboardButton("Sᴇᴀʀᴄʜ 🔎", switch_inline_query_current_chat=''),
|
435 |
+
InlineKeyboardButton("Cʜᴀɴɴᴇʟ 🔈", url="https://t.me/mkn_bots_updates")
|
436 |
+
],[
|
437 |
+
InlineKeyboardButton("Hᴇʟᴩ 🕸️", callback_data="help"),
|
438 |
+
InlineKeyboardButton("Aʙᴏᴜᴛ ✨", callback_data="about")
|
439 |
+
]]
|
440 |
+
await query.edit_message_media(InputMediaPhoto(random.choice(PICS), START_MESSAGE.format(user=query.from_user.mention, bot=client.mention), enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
441 |
+
|
442 |
+
elif query.data == "help":
|
443 |
+
buttons = [[
|
444 |
+
InlineKeyboardButton('⚙️ Aᴅᴍɪɴ Pᴀɴᴇʟ ⚙️', 'admin')
|
445 |
+
],[
|
446 |
+
InlineKeyboardButton('Fɪʟᴛᴇʀꜱ', 'openfilter'),
|
447 |
+
InlineKeyboardButton('Cᴏɴɴᴇᴄᴛ', 'coct')
|
448 |
+
],[
|
449 |
+
InlineKeyboardButton('Fɪʟᴇ Sᴛᴏʀᴇ', 'newdata'),
|
450 |
+
InlineKeyboardButton('Exᴛʀᴀ Mᴏᴅᴇ', 'extmod')
|
451 |
+
],[
|
452 |
+
InlineKeyboardButton('Gʀᴏᴜᴩ Mᴀɴᴀɢᴇʀ', 'gpmanager'),
|
453 |
+
InlineKeyboardButton('Bᴏᴛ Sᴛᴀᴛᴜꜱ ❄️', 'stats')
|
454 |
+
],[
|
455 |
+
InlineKeyboardButton('✘ Cʟᴏꜱᴇ', 'close_data'),
|
456 |
+
InlineKeyboardButton('« Bᴀᴄᴋ', 'start')
|
457 |
+
]]
|
458 |
+
await query.edit_message_media(InputMediaPhoto(random.choice(PICS), script.HELP_TXT.format(query.from_user.mention), enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
459 |
+
|
460 |
+
elif query.data == "about":
|
461 |
+
buttons= [[
|
462 |
+
InlineKeyboardButton('Sᴏᴜʀᴄᴇ Cᴏᴅᴇ 📜', 'source')
|
463 |
+
],[
|
464 |
+
InlineKeyboardButton('✘ Cʟᴏꜱᴇ', 'close_data'),
|
465 |
+
InlineKeyboardButton('« Bᴀᴄᴋ', 'start')
|
466 |
+
]]
|
467 |
+
await query.edit_message_media(InputMediaPhoto(random.choice(PICS), script.ABOUT_TXT.format(temp.B_NAME), enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
468 |
+
|
469 |
+
elif query.data == "source":
|
470 |
+
buttons = [[
|
471 |
+
InlineKeyboardButton('ꜱᴏᴜʀᴄᴇ ᴄᴏᴅᴇ', url='https://github.com/MrMKN/PROFESSOR-BOT')
|
472 |
+
],[
|
473 |
+
InlineKeyboardButton('‹ Bᴀᴄᴋ', 'about')
|
474 |
+
]]
|
475 |
+
await query.edit_message_media(InputMediaPhoto(random.choice(PICS), script.SOURCE_TXT, enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
476 |
+
|
477 |
+
elif query.data == "admin":
|
478 |
+
buttons = [[
|
479 |
+
InlineKeyboardButton('✘ Cʟᴏꜱᴇ', 'close_data'),
|
480 |
+
InlineKeyboardButton('« Bᴀᴄᴋ', 'help')
|
481 |
+
]]
|
482 |
+
if query.from_user.id not in ADMINS:
|
483 |
+
return await query.answer("Sᴏʀʀʏ Tʜɪs Mᴇɴᴜ Oɴʟʏ Fᴏʀ Mʏ Aᴅᴍɪɴs ⚒️", show_alert=True)
|
484 |
+
await query.message.edit("Pʀᴏᴄᴇꜱꜱɪɴɢ Wᴀɪᴛ Fᴏʀ 15 ꜱᴇᴄ...")
|
485 |
+
total, used, free = shutil.disk_usage(".")
|
486 |
+
stats = script.SERVER_STATS.format(get_time(time.time() - client.uptime), psutil.cpu_percent(), psutil.virtual_memory().percent, humanbytes(total), humanbytes(used), psutil.disk_usage('/').percent, humanbytes(free))
|
487 |
+
stats_pic = await make_carbon(stats, True)
|
488 |
+
await query.edit_message_media(InputMediaPhoto(stats_pic, script.ADMIN_TXT, enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
489 |
+
|
490 |
+
elif query.data == "openfilter":
|
491 |
+
buttons = [[
|
492 |
+
InlineKeyboardButton('AᴜᴛᴏFɪʟᴛᴇʀ', 'autofilter'),
|
493 |
+
InlineKeyboardButton('MᴀɴᴜᴀʟFɪʟᴛᴇʀ', 'manuelfilter')
|
494 |
+
],[
|
495 |
+
InlineKeyboardButton('GʟᴏʙᴀʟFɪʟᴛᴇʀ', 'globalfilter')
|
496 |
+
],[
|
497 |
+
InlineKeyboardButton('✘ Cʟᴏꜱᴇ', 'close_data'),
|
498 |
+
InlineKeyboardButton('« Bᴀᴄᴋ', 'help')
|
499 |
+
]]
|
500 |
+
await query.edit_message_media(InputMediaPhoto(random.choice(PICS), script.FILTER_TXT, enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
501 |
+
|
502 |
+
elif query.data == "autofilter":
|
503 |
+
buttons = [[
|
504 |
+
InlineKeyboardButton('✘ Cʟᴏꜱᴇ', 'close_data'),
|
505 |
+
InlineKeyboardButton('« Bᴀᴄᴋ', 'openfilter')
|
506 |
+
]]
|
507 |
+
await query.edit_message_media(InputMediaPhoto(random.choice(PICS), script.AUTOFILTER_TXT, enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
508 |
+
|
509 |
+
elif query.data == "manuelfilter":
|
510 |
+
buttons = [[
|
511 |
+
InlineKeyboardButton('Bᴜᴛᴛᴏɴ Fᴏʀᴍᴀᴛ', 'button')
|
512 |
+
],[
|
513 |
+
InlineKeyboardButton('✘ Cʟᴏꜱᴇ', 'close_data'),
|
514 |
+
InlineKeyboardButton('« Bᴀᴄᴋ', 'openfilter')
|
515 |
+
]]
|
516 |
+
await query.edit_message_media(InputMediaPhoto(random.choice(PICS), script.MANUELFILTER_TXT, enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
517 |
+
|
518 |
+
elif query.data == "globalfilter":
|
519 |
+
buttons = [[
|
520 |
+
InlineKeyboardButton('Bᴜᴛᴛᴏɴ Fᴏʀᴍᴀᴛ', 'buttong')
|
521 |
+
],[
|
522 |
+
InlineKeyboardButton('✘ Cʟᴏꜱᴇ', 'close_data'),
|
523 |
+
InlineKeyboardButton('« Bᴀᴄᴋ', 'openfilter')
|
524 |
+
]]
|
525 |
+
if query.from_user.id not in ADMINS:
|
526 |
+
return await query.answer("Sᴏʀʀʏ Tʜɪs Mᴇɴᴜ Oɴʟʏ Fᴏʀ Mʏ Aᴅᴍɪɴs ⚒️", show_alert=True)
|
527 |
+
await query.edit_message_media(InputMediaPhoto(random.choice(PICS), script.GLOBALFILTER_TXT, enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
528 |
+
|
529 |
+
elif query.data.startswith("button"):
|
530 |
+
buttons = [[
|
531 |
+
InlineKeyboardButton('✘ Cʟᴏꜱᴇ', 'close_data'),
|
532 |
+
InlineKeyboardButton('« Bᴀᴄᴋ', f"{'manuelfilter' if query.data == 'button' else 'globalfilter'}")
|
533 |
+
]]
|
534 |
+
await query.edit_message_media(InputMediaPhoto(random.choice(PICS), script.BUTTON_TXT, enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
535 |
+
|
536 |
+
elif query.data == "coct":
|
537 |
+
buttons = [[
|
538 |
+
InlineKeyboardButton('✘ Cʟᴏꜱᴇ', 'close_data'),
|
539 |
+
InlineKeyboardButton('« Bᴀᴄᴋ', 'help')
|
540 |
+
]]
|
541 |
+
await query.edit_message_media(InputMediaPhoto(random.choice(PICS), script.CONNECTION_TXT, enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
542 |
+
|
543 |
+
elif query.data == "newdata":
|
544 |
+
buttons = [[
|
545 |
+
InlineKeyboardButton('✘ Cʟᴏꜱᴇ', 'close_data'),
|
546 |
+
InlineKeyboardButton('« Bᴀᴄᴋ', 'help')
|
547 |
+
]]
|
548 |
+
await query.edit_message_media(InputMediaPhoto(random.choice(PICS), script.FILE_TXT, enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
549 |
+
|
550 |
+
elif query.data == "extmod":
|
551 |
+
buttons = [[
|
552 |
+
InlineKeyboardButton('✘ Cʟᴏꜱᴇ', 'close_data'),
|
553 |
+
InlineKeyboardButton('« Bᴀᴄᴋ', 'help')
|
554 |
+
]]
|
555 |
+
await query.edit_message_media(InputMediaPhoto(random.choice(PICS), script.EXTRAMOD_TXT, enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
556 |
+
|
557 |
+
elif query.data == "gpmanager":
|
558 |
+
buttons = [[
|
559 |
+
InlineKeyboardButton('✘ Cʟᴏꜱᴇ', 'close_data'),
|
560 |
+
InlineKeyboardButton('« Bᴀᴄᴋ', 'help')
|
561 |
+
]]
|
562 |
+
await query.edit_message_media(InputMediaPhoto(random.choice(PICS), script.GROUPMANAGER_TXT, enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
563 |
+
|
564 |
+
elif query.data == "stats":
|
565 |
+
buttons = [[
|
566 |
+
InlineKeyboardButton('⟳ Rᴇꜰʀᴇꜱʜ', 'stats'),
|
567 |
+
InlineKeyboardButton('« Bᴀᴄᴋ', 'help')
|
568 |
+
]]
|
569 |
+
total = await Media.count_documents()
|
570 |
+
users = await db.total_users_count()
|
571 |
+
chats = await db.total_chat_count()
|
572 |
+
monsize = await db.get_db_size()
|
573 |
+
free = 536870912 - monsize
|
574 |
+
monsize = get_size(monsize)
|
575 |
+
free = get_size(free)
|
576 |
+
await query.message.edit('ʟᴏᴀᴅɪɴɢ....')
|
577 |
+
await query.edit_message_media(InputMediaPhoto(random.choice(PICS), script.STATUS_TXT.format(total, users, chats, monsize, free), enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
578 |
+
|
579 |
+
elif query.data.startswith("setgs"):
|
580 |
+
ident, set_type, status, grp_id = query.data.split("#")
|
581 |
+
grpid = await active_connection(str(query.from_user.id))
|
582 |
+
if str(grp_id) != str(grpid):
|
583 |
+
return await query.message.edit("Yᴏᴜʀ Aᴄᴛɪᴠᴇ Cᴏɴɴᴇᴄᴛɪᴏɴ Hᴀs Bᴇᴇɴ Cʜᴀɴɢᴇᴅ. Gᴏ Tᴏ /settings")
|
584 |
+
if status == "True": await save_group_settings(grpid, set_type, False)
|
585 |
+
else: await save_group_settings(grpid, set_type, True)
|
586 |
+
settings = await get_settings(grpid)
|
587 |
+
if settings is not None:
|
588 |
+
buttons = [[
|
589 |
+
InlineKeyboardButton(f"ꜰɪʟᴛᴇʀ ʙᴜᴛᴛᴏɴ : {'sɪɴɢʟᴇ' if settings['button'] else 'ᴅᴏᴜʙʟᴇ'}", f'setgs#button#{settings["button"]}#{str(grp_id)}')
|
590 |
+
],[
|
591 |
+
InlineKeyboardButton(f"ꜰɪʟᴇ ɪɴ ᴩᴍ ꜱᴛᴀʀᴛ: {'ᴏɴ' if settings['botpm'] else 'ᴏꜰꜰ'}", f'setgs#botpm#{settings["botpm"]}#{str(grp_id)}')
|
592 |
+
],[
|
593 |
+
InlineKeyboardButton(f"ʀᴇꜱᴛʀɪᴄᴛ ᴄᴏɴᴛᴇɴᴛ : {'ᴏɴ' if settings['file_secure'] else 'ᴏꜰꜰ'}", f'setgs#file_secure#{settings["file_secure"]}#{str(grp_id)}')
|
594 |
+
],[
|
595 |
+
InlineKeyboardButton(f"ɪᴍᴅʙ ɪɴ ꜰɪʟᴛᴇʀ : {'ᴏɴ' if settings['imdb'] else 'ᴏꜰꜰ'}", f'setgs#imdb#{settings["imdb"]}#{str(grp_id)}')
|
596 |
+
],[
|
597 |
+
InlineKeyboardButton(f"ꜱᴩᴇʟʟɪɴɢ ᴄʜᴇᴄᴋ : {'ᴏɴ' if settings['spell_check'] else 'ᴏꜰꜰ'}", f'setgs#spell_check#{settings["spell_check"]}#{str(grp_id)}')
|
598 |
+
],[
|
599 |
+
InlineKeyboardButton(f"ᴡᴇʟᴄᴏᴍᴇ ᴍᴇꜱꜱᴀɢᴇ : {'ᴏɴ' if settings['welcome'] else 'ᴏꜰꜰ'}", f'setgs#welcome#{settings["welcome"]}#{str(grp_id)}')
|
600 |
+
]]
|
601 |
+
await query.message.edit_reply_markup(InlineKeyboardMarkup(buttons))
|
602 |
+
|
603 |
+
|
604 |
+
|
605 |
+
|
606 |
+
|
607 |
+
|
608 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#--Main----#
|
2 |
+
pyrofork==2.3.45
|
3 |
+
tgcrypto==1.2.5
|
4 |
+
aiofiles==22.1.0
|
5 |
+
aiohttp==3.10.11
|
6 |
+
requests==2.30.0
|
7 |
+
bs4==0.0.1
|
8 |
+
|
9 |
+
#---database---#
|
10 |
+
pymongo
|
11 |
+
dnspython
|
12 |
+
marshmallow
|
13 |
+
umongo
|
14 |
+
motor
|
15 |
+
|
16 |
+
#---ytdl----#
|
17 |
+
youtube-search-python
|
18 |
+
youtube-search
|
19 |
+
yt-dlp==2023.2.17
|
20 |
+
|
21 |
+
#---imdb---#
|
22 |
+
cinemagoer==2023.5.1
|
23 |
+
|
24 |
+
#---others----#
|
25 |
+
opencv-python-headless==4.7.0.68
|
26 |
+
googletrans==3.1.0a0
|
27 |
+
telegraph==2.2.0
|
28 |
+
python-dotenv==0.21.1
|
29 |
+
gTTS==2.3.1
|
30 |
+
Pillow==10.2.0
|
31 |
+
psutil==5.9.4
|
32 |
+
NumPy==1.26.2
|
33 |
+
wheel
|
34 |
+
ujson
|
35 |
+
wget
|
36 |
+
pytz
|
runtime.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
python-3.10.8
|
utils.py
ADDED
@@ -0,0 +1,366 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import logging, os, re, asyncio, requests, aiohttp
|
2 |
+
from pyrogram.errors import InputUserDeactivated, UserNotParticipant, FloodWait, UserIsBlocked, PeerIdInvalid
|
3 |
+
from pyrogram.types import Message, InlineKeyboardButton
|
4 |
+
from pyrogram import filters, enums
|
5 |
+
from info import AUTH_CHANNEL, LONG_IMDB_DESCRIPTION, MAX_LIST_ELM, SHORT_URL, SHORT_API
|
6 |
+
from imdb import Cinemagoer
|
7 |
+
from typing import Union, List
|
8 |
+
from datetime import datetime, timedelta
|
9 |
+
from database.users_chats_db import db
|
10 |
+
from bs4 import BeautifulSoup
|
11 |
+
|
12 |
+
logger = logging.getLogger(__name__)
|
13 |
+
logger.setLevel(logging.INFO)
|
14 |
+
|
15 |
+
BTN_URL_REGEX = re.compile(r"(\[([^\[]+?)\]\((buttonurl|buttonalert):(?:/{0,2})(.+?)(:same)?\))")
|
16 |
+
BANNED = {}
|
17 |
+
SMART_OPEN = '“'
|
18 |
+
SMART_CLOSE = '”'
|
19 |
+
START_CHAR = ('\'', '"', SMART_OPEN)
|
20 |
+
|
21 |
+
# temp db for banned
|
22 |
+
class temp(object):
|
23 |
+
BANNED_USERS = []
|
24 |
+
BANNED_CHATS = []
|
25 |
+
CURRENT = 0
|
26 |
+
CANCEL = False
|
27 |
+
MELCOW = {}
|
28 |
+
U_NAME = None
|
29 |
+
B_NAME = None
|
30 |
+
SETTINGS = {}
|
31 |
+
GP_BUTTONS = {}
|
32 |
+
PM_BUTTONS = {}
|
33 |
+
PM_SPELL = {}
|
34 |
+
GP_SPELL = {}
|
35 |
+
|
36 |
+
async def is_subscribed(bot, query):
|
37 |
+
try:
|
38 |
+
user = await bot.get_chat_member(AUTH_CHANNEL, query.from_user.id)
|
39 |
+
except UserNotParticipant:
|
40 |
+
pass
|
41 |
+
except Exception as e:
|
42 |
+
print(e)
|
43 |
+
else:
|
44 |
+
if user.status != enums.ChatMemberStatus.BANNED:
|
45 |
+
return True
|
46 |
+
return False
|
47 |
+
|
48 |
+
|
49 |
+
async def get_poster(query, bulk=False, id=False, file=None):
|
50 |
+
imdb = Cinemagoer()
|
51 |
+
if not id:
|
52 |
+
query = (query.strip()).lower()
|
53 |
+
title = query
|
54 |
+
year = re.findall(r'[1-2]\d{3}$', query, re.IGNORECASE)
|
55 |
+
if year:
|
56 |
+
year = list_to_str(year[:1])
|
57 |
+
title = (query.replace(year, "")).strip()
|
58 |
+
elif file is not None:
|
59 |
+
year = re.findall(r'[1-2]\d{3}', file, re.IGNORECASE)
|
60 |
+
if year:
|
61 |
+
year = list_to_str(year[:1])
|
62 |
+
else:
|
63 |
+
year = None
|
64 |
+
try:
|
65 |
+
movieid = imdb.search_movie(title.lower(), results=10)
|
66 |
+
except:
|
67 |
+
return None
|
68 |
+
if not movieid:
|
69 |
+
return None
|
70 |
+
if year:
|
71 |
+
filtered=list(filter(lambda k: str(k.get('year')) == str(year), movieid))
|
72 |
+
if not filtered:
|
73 |
+
filtered = movieid
|
74 |
+
else:
|
75 |
+
filtered = movieid
|
76 |
+
movieid=list(filter(lambda k: k.get('kind') in ['movie', 'tv series'], filtered))
|
77 |
+
if not movieid:
|
78 |
+
movieid = filtered
|
79 |
+
if bulk:
|
80 |
+
return movieid
|
81 |
+
movieid = movieid[0].movieID
|
82 |
+
else:
|
83 |
+
movieid = query
|
84 |
+
movie = imdb.get_movie(movieid)
|
85 |
+
if movie.get("original air date"):
|
86 |
+
date = movie["original air date"]
|
87 |
+
elif movie.get("year"):
|
88 |
+
date = movie.get("year")
|
89 |
+
else:
|
90 |
+
date = "N/A"
|
91 |
+
plot = ""
|
92 |
+
if not LONG_IMDB_DESCRIPTION:
|
93 |
+
plot = movie.get('plot')
|
94 |
+
if plot and len(plot) > 0:
|
95 |
+
plot = plot[0]
|
96 |
+
else:
|
97 |
+
plot = movie.get('plot outline')
|
98 |
+
if plot and len(plot) > 800:
|
99 |
+
plot = plot[0:800] + "..."
|
100 |
+
|
101 |
+
return {
|
102 |
+
'title': movie.get('title'),
|
103 |
+
'votes': movie.get('votes'),
|
104 |
+
"aka": list_to_str(movie.get("akas")),
|
105 |
+
"seasons": movie.get("number of seasons"),
|
106 |
+
"box_office": movie.get('box office'),
|
107 |
+
'localized_title': movie.get('localized title'),
|
108 |
+
'kind': movie.get("kind"),
|
109 |
+
"imdb_id": f"tt{movie.get('imdbID')}",
|
110 |
+
"cast": list_to_str(movie.get("cast")),
|
111 |
+
"runtime": list_to_str(movie.get("runtimes")),
|
112 |
+
"countries": list_to_str(movie.get("countries")),
|
113 |
+
"certificates": list_to_str(movie.get("certificates")),
|
114 |
+
"languages": list_to_str(movie.get("languages")),
|
115 |
+
"director": list_to_str(movie.get("director")),
|
116 |
+
"writer":list_to_str(movie.get("writer")),
|
117 |
+
"producer":list_to_str(movie.get("producer")),
|
118 |
+
"composer":list_to_str(movie.get("composer")) ,
|
119 |
+
"cinematographer":list_to_str(movie.get("cinematographer")),
|
120 |
+
"music_team": list_to_str(movie.get("music department")),
|
121 |
+
"distributors": list_to_str(movie.get("distributors")),
|
122 |
+
'release_date': date,
|
123 |
+
'year': movie.get('year'),
|
124 |
+
'genres': list_to_str(movie.get("genres")),
|
125 |
+
'poster': movie.get('full-size cover url'),
|
126 |
+
'plot': plot,
|
127 |
+
'rating': str(movie.get("rating")),
|
128 |
+
'url':f'https://www.imdb.com/title/tt{movieid}'
|
129 |
+
}
|
130 |
+
|
131 |
+
def list_to_str(k):
|
132 |
+
if not k: return "N/A"
|
133 |
+
elif len(k) == 1: return str(k[0])
|
134 |
+
elif MAX_LIST_ELM:
|
135 |
+
k = k[:int(MAX_LIST_ELM)]
|
136 |
+
return ' '.join(f'{elem}, ' for elem in k)
|
137 |
+
else:
|
138 |
+
return ' '.join(f'{elem}, ' for elem in k)
|
139 |
+
|
140 |
+
__repo__ = "https://github.com/MrMKN/PROFESSOR-BOT"
|
141 |
+
__version__ = "PROFESSOR-BOT ᴠ4.5.0"
|
142 |
+
__license__ = "GNU GENERAL PUBLIC LICENSE V2"
|
143 |
+
__copyright__ = "Copyright (C) 2023-present MrMKN <https://github.com/MrMKN>"
|
144 |
+
|
145 |
+
async def search_gagala(text):
|
146 |
+
usr_agent = {
|
147 |
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
|
148 |
+
'Chrome/61.0.3163.100 Safari/537.36'
|
149 |
+
}
|
150 |
+
text = text.replace(" ", '+')
|
151 |
+
url = f'https://www.google.com/search?q={text}'
|
152 |
+
response = requests.get(url, headers=usr_agent)
|
153 |
+
response.raise_for_status()
|
154 |
+
soup = BeautifulSoup(response.text, 'html.parser')
|
155 |
+
titles = soup.find_all( 'h3' )
|
156 |
+
return [title.getText() for title in titles]
|
157 |
+
|
158 |
+
|
159 |
+
async def get_settings(group_id):
|
160 |
+
settings = temp.SETTINGS.get(group_id)
|
161 |
+
if not settings:
|
162 |
+
settings = await db.get_settings(group_id)
|
163 |
+
temp.SETTINGS[group_id] = settings
|
164 |
+
return settings
|
165 |
+
|
166 |
+
async def save_group_settings(group_id, key, value):
|
167 |
+
current = await get_settings(group_id)
|
168 |
+
current[key] = value
|
169 |
+
temp.SETTINGS[group_id] = current
|
170 |
+
await db.update_settings(group_id, current)
|
171 |
+
|
172 |
+
def get_size(size):
|
173 |
+
units = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB"]
|
174 |
+
size = float(size)
|
175 |
+
i = 0
|
176 |
+
while size >= 1024.0 and i < len(units):
|
177 |
+
i += 1
|
178 |
+
size /= 1024.0
|
179 |
+
return "%.2f %s" % (size, units[i])
|
180 |
+
|
181 |
+
|
182 |
+
def get_file_id(msg: Message):
|
183 |
+
if not msg.media: return None
|
184 |
+
for message_type in ("photo", "animation", "audio", "document", "video", "video_note", "voice", "sticker"):
|
185 |
+
obj = getattr(msg, message_type)
|
186 |
+
if obj:
|
187 |
+
setattr(obj, "message_type", message_type)
|
188 |
+
return obj
|
189 |
+
|
190 |
+
|
191 |
+
def extract_user(message: Message) -> Union[int, str]:
|
192 |
+
user_id = None
|
193 |
+
user_first_name = None
|
194 |
+
if message.reply_to_message:
|
195 |
+
user_id = message.reply_to_message.from_user.id
|
196 |
+
user_first_name = message.reply_to_message.from_user.first_name
|
197 |
+
elif len(message.command) > 1:
|
198 |
+
if (len(message.entities) > 1 and message.entities[1].type == enums.MessageEntityType.TEXT_MENTION):
|
199 |
+
required_entity = message.entities[1]
|
200 |
+
user_id = required_entity.user.id
|
201 |
+
user_first_name = required_entity.user.first_name
|
202 |
+
else:
|
203 |
+
user_id = message.command[1]
|
204 |
+
user_first_name = user_id
|
205 |
+
try:
|
206 |
+
user_id = int(user_id)
|
207 |
+
except ValueError: pass
|
208 |
+
else:
|
209 |
+
user_id = message.from_user.id
|
210 |
+
user_first_name = message.from_user.first_name
|
211 |
+
return (user_id, user_first_name)
|
212 |
+
|
213 |
+
|
214 |
+
def split_quotes(text: str) -> List:
|
215 |
+
if not any(text.startswith(char) for char in START_CHAR):
|
216 |
+
return text.split(None, 1)
|
217 |
+
counter = 1 # ignore first char -> is some kind of quote
|
218 |
+
while counter < len(text):
|
219 |
+
if text[counter] == "\\":
|
220 |
+
counter += 1
|
221 |
+
elif text[counter] == text[0] or (text[0] == SMART_OPEN and text[counter] == SMART_CLOSE):
|
222 |
+
break
|
223 |
+
counter += 1
|
224 |
+
else:
|
225 |
+
return text.split(None, 1)
|
226 |
+
|
227 |
+
# 1 to avoid starting quote, and counter is exclusive so avoids ending
|
228 |
+
key = remove_escapes(text[1:counter].strip())
|
229 |
+
# index will be in range, or `else` would have been executed and returned
|
230 |
+
rest = text[counter + 1:].strip()
|
231 |
+
if not key:
|
232 |
+
key = text[0] + text[0]
|
233 |
+
return list(filter(None, [key, rest]))
|
234 |
+
|
235 |
+
def parser(text, keyword, cb_data):
|
236 |
+
if "buttonalert" in text: text = (text.replace("\n", "\\n").replace("\t", "\\t"))
|
237 |
+
buttons = []
|
238 |
+
note_data = ""
|
239 |
+
prev = 0
|
240 |
+
i = 0
|
241 |
+
alerts = []
|
242 |
+
for match in BTN_URL_REGEX.finditer(text):
|
243 |
+
n_escapes = 0
|
244 |
+
to_check = match.start(1) - 1
|
245 |
+
while to_check > 0 and text[to_check] == "\\":
|
246 |
+
n_escapes += 1
|
247 |
+
to_check -= 1
|
248 |
+
# if even, not escaped -> create button
|
249 |
+
if n_escapes % 2 == 0:
|
250 |
+
note_data += text[prev:match.start(1)]
|
251 |
+
prev = match.end(1)
|
252 |
+
if match.group(3) == "buttonalert":
|
253 |
+
# create a thruple with button label, url, and newline status
|
254 |
+
if bool(match.group(5)) and buttons:
|
255 |
+
buttons[-1].append(InlineKeyboardButton(match.group(2), callback_data=f"{cb_data}:{i}:{keyword}"))
|
256 |
+
else:
|
257 |
+
buttons.append([InlineKeyboardButton(match.group(2), callback_data=f"{cb_data}:{i}:{keyword}")])
|
258 |
+
i += 1
|
259 |
+
alerts.append(match.group(4))
|
260 |
+
elif bool(match.group(5)) and buttons:
|
261 |
+
buttons[-1].append(InlineKeyboardButton(match.group(2), url=match.group(4).replace(" ", "")))
|
262 |
+
else:
|
263 |
+
buttons.append([InlineKeyboardButton(match.group(2), url=match.group(4).replace(" ", ""))])
|
264 |
+
else:
|
265 |
+
note_data += text[prev:to_check]
|
266 |
+
prev = match.start(1) - 1
|
267 |
+
else: note_data += text[prev:]
|
268 |
+
try: return note_data, buttons, alerts
|
269 |
+
except: return note_data, buttons, None
|
270 |
+
|
271 |
+
|
272 |
+
def remove_escapes(text: str) -> str:
|
273 |
+
res = ""
|
274 |
+
is_escaped = False
|
275 |
+
for counter in range(len(text)):
|
276 |
+
if is_escaped:
|
277 |
+
res += text[counter]
|
278 |
+
is_escaped = False
|
279 |
+
elif text[counter] == "\\":
|
280 |
+
is_escaped = True
|
281 |
+
else:
|
282 |
+
res += text[counter]
|
283 |
+
return res
|
284 |
+
|
285 |
+
|
286 |
+
def humanbytes(size):
|
287 |
+
if not size:
|
288 |
+
return ""
|
289 |
+
power = 2**10
|
290 |
+
n = 0
|
291 |
+
Dic_powerN = {0: ' ', 1: 'Ki', 2: 'Mi', 3: 'Gi', 4: 'Ti'}
|
292 |
+
while size > power:
|
293 |
+
size /= power
|
294 |
+
n += 1
|
295 |
+
return str(round(size, 2)) + " " + Dic_powerN[n] + 'B'
|
296 |
+
|
297 |
+
def get_time(seconds):
|
298 |
+
periods = [('ᴅ', 86400), ('ʜ', 3600), ('ᴍ', 60), ('ꜱ', 1)]
|
299 |
+
result = ''
|
300 |
+
for period_name, period_seconds in periods:
|
301 |
+
if seconds >= period_seconds:
|
302 |
+
period_value, seconds = divmod(seconds, period_seconds)
|
303 |
+
result += f'{int(period_value)}{period_name}'
|
304 |
+
return result
|
305 |
+
|
306 |
+
async def get_shortlink(link):
|
307 |
+
url = f'{SHORT_URL}/api'
|
308 |
+
params = {'api': SHORT_API, 'url': link}
|
309 |
+
try:
|
310 |
+
async with aiohttp.ClientSession() as session:
|
311 |
+
async with session.get(url, params=params, raise_for_status=True, ssl=False) as response:
|
312 |
+
data = await response.json()
|
313 |
+
if data["status"] == "success":
|
314 |
+
return data['shortenedUrl']
|
315 |
+
else:
|
316 |
+
logger.error(f"Error: {data['message']}")
|
317 |
+
return link
|
318 |
+
except Exception as e:
|
319 |
+
logger.error(e)
|
320 |
+
return link
|
321 |
+
|
322 |
+
|
323 |
+
# from Midukki-RoBoT
|
324 |
+
def extract_time(time_val):
|
325 |
+
if any(time_val.endswith(unit) for unit in ("s", "m", "h", "d")):
|
326 |
+
unit = time_val[-1]
|
327 |
+
time_num = time_val[:-1] # type: str
|
328 |
+
if not time_num.isdigit():
|
329 |
+
return None
|
330 |
+
|
331 |
+
if unit == "s":
|
332 |
+
bantime = datetime.now() + timedelta(seconds=int(time_num))
|
333 |
+
elif unit == "m":
|
334 |
+
bantime = datetime.now() + timedelta(minutes=int(time_num))
|
335 |
+
elif unit == "h":
|
336 |
+
bantime = datetime.now() + timedelta(hours=int(time_num))
|
337 |
+
elif unit == "d":
|
338 |
+
bantime = datetime.now() + timedelta(days=int(time_num))
|
339 |
+
else:
|
340 |
+
# how even...?
|
341 |
+
return None
|
342 |
+
return bantime
|
343 |
+
else:
|
344 |
+
return None
|
345 |
+
|
346 |
+
|
347 |
+
async def admin_check(message: Message) -> bool:
|
348 |
+
if not message.from_user: return False
|
349 |
+
if message.chat.type not in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]: return False
|
350 |
+
if message.from_user.id in [777000, 1087968824]: return True
|
351 |
+
client = message._client
|
352 |
+
chat_id = message.chat.id
|
353 |
+
user_id = message.from_user.id
|
354 |
+
check_status = await client.get_chat_member(chat_id=chat_id,user_id=user_id)
|
355 |
+
admin_strings = [enums.ChatMemberStatus.OWNER, enums.ChatMemberStatus.ADMINISTRATOR]
|
356 |
+
if check_status.status not in admin_strings: return False
|
357 |
+
else: return True
|
358 |
+
|
359 |
+
async def admin_filter(filt, client, message):
|
360 |
+
return await admin_check(message)
|
361 |
+
|
362 |
+
|
363 |
+
|
364 |
+
|
365 |
+
|
366 |
+
|