├── .gitignore ├── CYNITE ├── __init__.py ├── banned.py ├── broadcast.py ├── channel.py ├── commands.py ├── connection.py ├── filters.py ├── genlink.py ├── gfilters.py ├── index.py ├── inline.py ├── misc.py ├── p_ttishow.py └── pm_filter.py ├── Dockerfile ├── LICENSE ├── Procfile ├── README.md ├── Script.py ├── app.json ├── bot.py ├── database ├── Pro ├── connections_mdb.py ├── filters_mdb.py ├── gfilters_mdb.py ├── ia_filterdb.py └── users_chats_db.py ├── docker-compose.yml ├── heroku.yml ├── info.py ├── logging.conf ├── requirements.txt ├── runtime.txt ├── start.sh └── utils.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Personal files 2 | *.session 3 | *.session-journal 4 | .vscode 5 | *test*.py 6 | setup.cfg 7 | 8 | # Byte-compiled / optimized / DLL files 9 | __pycache__/ 10 | *.py[cod] 11 | *$py.class 12 | 13 | # C extensions 14 | *.so 15 | 16 | # Distribution / packaging 17 | .Python 18 | build/ 19 | develop-eggs/ 20 | dist/ 21 | downloads/ 22 | eggs/ 23 | .eggs/ 24 | lib/ 25 | lib64/ 26 | parts/ 27 | sdist/ 28 | var/ 29 | wheels/ 30 | share/python-wheels/ 31 | *.egg-info/ 32 | .installed.cfg 33 | *.egg 34 | MANIFEST 35 | 36 | # PyInstaller 37 | # Usually these files are written by a python script from a template 38 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 39 | *.manifest 40 | *.spec 41 | 42 | # Installer logs 43 | pip-log.txt 44 | pip-delete-this-directory.txt 45 | 46 | # Unit test / coverage reports 47 | htmlcov/ 48 | .tox/ 49 | .nox/ 50 | .coverage 51 | .coverage.* 52 | .cache 53 | nosetests.xml 54 | coverage.xml 55 | *.cover 56 | *.py,cover 57 | .hypothesis/ 58 | .pytest_cache/ 59 | cover/ 60 | 61 | # Translations 62 | *.mo 63 | *.pot 64 | 65 | # Django stuff: 66 | *.log 67 | local_settings.py 68 | db.sqlite3 69 | db.sqlite3-journal 70 | 71 | # Flask stuff: 72 | instance/ 73 | .webassets-cache 74 | 75 | # Scrapy stuff: 76 | .scrapy 77 | 78 | # Sphinx documentation 79 | docs/_build/ 80 | 81 | # PyBuilder 82 | .pybuilder/ 83 | target/ 84 | 85 | # Jupyter Notebook 86 | .ipynb_checkpoints 87 | 88 | # IPython 89 | profile_default/ 90 | ipython_config.py 91 | 92 | # pyenv 93 | # For a library or package, you might want to ignore these files since the code is 94 | # intended to run in multiple environments; otherwise, check them in: 95 | # .python-version 96 | 97 | # pipenv 98 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 99 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 100 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 101 | # install all needed dependencies. 102 | #Pipfile.lock 103 | 104 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 105 | __pypackages__/ 106 | 107 | # Celery stuff 108 | celerybeat-schedule 109 | celerybeat.pid 110 | 111 | # SageMath parsed files 112 | *.sage.py 113 | 114 | # Environments 115 | .env 116 | .venv 117 | env/ 118 | venv/ 119 | ENV/ 120 | env.bak/ 121 | venv.bak/ 122 | 123 | # Spyder project settings 124 | .spyderproject 125 | .spyproject 126 | 127 | # Rope project settings 128 | .ropeproject 129 | 130 | # mkdocs documentation 131 | /site 132 | 133 | # mypy 134 | .mypy_cache/ 135 | .dmypy.json 136 | dmypy.json 137 | 138 | # Pyre type checker 139 | .pyre/ 140 | 141 | # pytype static type analyzer 142 | .pytype/ 143 | 144 | # Cython debug symbols 145 | cython_debug/ 146 | config.py 147 | .goutputstream-VAFWB1 148 | result.json 149 | -------------------------------------------------------------------------------- /CYNITE/__init__.py: -------------------------------------------------------------------------------- 1 | from aiohttp import web 2 | 3 | routes = web.RouteTableDef() 4 | 5 | @routes.get("/", allow_head=True) 6 | async def root_route_handler(request): 7 | return web.json_response("Mᴋɴ Bᴏᴛᴢ") 8 | 9 | async def web_server(): 10 | web_app = web.Application(client_max_size=30000000) 11 | web_app.add_routes(routes) 12 | return web_app 13 | -------------------------------------------------------------------------------- /CYNITE/banned.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, filters 2 | from utils import temp 3 | from pyrogram.types import Message 4 | from database.users_chats_db import db 5 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup 6 | from info import SUPPORT_CHAT 7 | 8 | async def banned_users(_, client, message: Message): 9 | return ( 10 | message.from_user is not None or not message.sender_chat 11 | ) and message.from_user.id in temp.BANNED_USERS 12 | 13 | banned_user = filters.create(banned_users) 14 | 15 | async def disabled_chat(_, client, message: Message): 16 | return message.chat.id in temp.BANNED_CHATS 17 | 18 | disabled_group=filters.create(disabled_chat) 19 | 20 | 21 | @Client.on_message(filters.private & banned_user & filters.incoming) 22 | async def ban_reply(bot, message): 23 | ban = await db.get_ban_status(message.from_user.id) 24 | await message.reply(f'Sᴏʀʀʏ Dᴜᴅᴇ, Yᴏᴜ ᴀʀᴇ Bᴀɴɴᴇᴅ ᴛᴏ ᴜsᴇ Mᴇ\n\nBᴀɴ Rᴇᴀsᴏɴ : {ban["ban_reason"]}') 25 | 26 | @Client.on_message(filters.group & disabled_group & filters.incoming) 27 | async def grp_bd(bot, message): 28 | buttons = [[ 29 | InlineKeyboardButton('Sᴜᴘᴘᴏʀᴛ', url=f'https://t.me/{SUPPORT_CHAT}') 30 | ]] 31 | reply_markup=InlineKeyboardMarkup(buttons) 32 | vazha = await db.get_chat(message.chat.id) 33 | k = await message.reply( 34 | 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ᴜᴘᴘᴏʀᴛ..\n\nRᴇᴀsᴏɴ : {vazha['reason']}.", 35 | reply_markup=reply_markup) 36 | try: 37 | await k.pin() 38 | except: 39 | pass 40 | await bot.leave_chat(message.chat.id) 41 | -------------------------------------------------------------------------------- /CYNITE/broadcast.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, filters 2 | import datetime 3 | import time 4 | from database.users_chats_db import db 5 | from info import ADMINS 6 | from utils import broadcast_messages, broadcast_messages_group 7 | import asyncio 8 | 9 | @Client.on_message(filters.command("broadcast") & filters.user(ADMINS) & filters.reply) 10 | # https://t.me/GetTGLink/4178 11 | async def verupikkals(bot, message): 12 | users = await db.get_all_users() 13 | b_msg = message.reply_to_message 14 | sts = await message.reply_text( 15 | text='Broadcasting your messages...' 16 | ) 17 | start_time = time.time() 18 | total_users = await db.total_users_count() 19 | done = 0 20 | blocked = 0 21 | deleted = 0 22 | failed =0 23 | 24 | success = 0 25 | async for user in users: 26 | pti, sh = await broadcast_messages(int(user['id']), b_msg) 27 | if pti: 28 | success += 1 29 | elif pti == False: 30 | if sh == "Blocked": 31 | blocked+=1 32 | elif sh == "Deleted": 33 | deleted += 1 34 | elif sh == "Error": 35 | failed += 1 36 | done += 1 37 | if not done % 20: 38 | await sts.edit(f"Broadcast in progress:\n\nTotal Users {total_users}\nCompleted: {done} / {total_users}\nSuccess: {success}\nBlocked: {blocked}\nDeleted: {deleted}") 39 | time_taken = datetime.timedelta(seconds=int(time.time()-start_time)) 40 | await sts.edit(f"Broadcast Completed:\nCompleted in {time_taken} seconds.\n\nTotal Users {total_users}\nCompleted: {done} / {total_users}\nSuccess: {success}\nBlocked: {blocked}\nDeleted: {deleted}") 41 | 42 | @Client.on_message(filters.command("group_broadcast") & filters.user(ADMINS) & filters.reply) 43 | async def broadcast_group(bot, message): 44 | groups = await db.get_all_chats() 45 | b_msg = message.reply_to_message 46 | sts = await message.reply_text( 47 | text='Broadcasting your messages To Groups...' 48 | ) 49 | start_time = time.time() 50 | total_groups = await db.total_chat_count() 51 | done = 0 52 | failed =0 53 | 54 | success = 0 55 | async for group in groups: 56 | pti, sh = await broadcast_messages_group(int(group['id']), b_msg) 57 | if pti: 58 | success += 1 59 | elif sh == "Error": 60 | failed += 1 61 | done += 1 62 | if not done % 20: 63 | await sts.edit(f"Broadcast in progress:\n\nTotal Groups {total_groups}\nCompleted: {done} / {total_groups}\nSuccess: {success}") 64 | time_taken = datetime.timedelta(seconds=int(time.time()-start_time)) 65 | await sts.edit(f"Broadcast Completed:\nCompleted in {time_taken} seconds.\n\nTotal Groups {total_groups}\nCompleted: {done} / {total_groups}\nSuccess: {success}") 66 | -------------------------------------------------------------------------------- /CYNITE/channel.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, filters 2 | from info import CHANNELS 3 | from database.ia_filterdb import save_file 4 | 5 | media_filter = filters.document | filters.video | filters.audio 6 | 7 | 8 | @Client.on_message(filters.chat(CHANNELS) & media_filter) 9 | async def media(bot, message): 10 | """Media Handler""" 11 | for file_type in ("document", "video", "audio"): 12 | media = getattr(message, file_type, None) 13 | if media is not None: 14 | break 15 | else: 16 | return 17 | 18 | media.file_type = file_type 19 | media.caption = message.caption 20 | await save_file(media) -------------------------------------------------------------------------------- /CYNITE/commands.py: -------------------------------------------------------------------------------- 1 | import os 2 | import logging 3 | import random 4 | import asyncio 5 | from Script import script 6 | from pyrogram import Client, filters, enums 7 | from pyrogram.errors import ChatAdminRequired, FloodWait 8 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery 9 | from database.ia_filterdb import Media, get_file_details, unpack_new_file_id 10 | from database.users_chats_db import db 11 | from info import CHANNELS, ADMINS, AUTH_CHANNEL, LOG_CHANNEL, RQST_LOG_CHANNEL, PICS, BATCH_FILE_CAPTION, CUSTOM_FILE_CAPTION, PROTECT_CONTENT, CHNL_LNK, GRP_LNK, SUPPORT_GROUP 12 | from utils import get_settings, get_size, is_subscribed, save_group_settings, temp 13 | from database.connections_mdb import active_connection 14 | import re 15 | import json 16 | import base64 17 | logger = logging.getLogger(__name__) 18 | 19 | BATCH_FILES = {} 20 | 21 | @Client.on_message(filters.command("start") & filters.incoming) 22 | async def start(client, message): 23 | if message.chat.type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]: 24 | buttons = [[ 25 | InlineKeyboardButton('ᴀᴅᴅ ᴍᴇ ᴛᴏ ʏᴏᴜʀ ɢʀᴏᴜᴘ', url=f'http://t.me/{temp.U_NAME}?startgroup=true') 26 | ],[ 27 | InlineKeyboardButton('ᴜᴘᴅᴀᴛᴇs', url='https://t.me/CyniteBackup'), 28 | InlineKeyboardButton('sᴜᴘᴘᴏʀᴛ', url='https://t.me/CyniteSupport') 29 | ]] 30 | reply_markup = InlineKeyboardMarkup(buttons) 31 | kd = await message.reply_photo( 32 | photo=random.choice(PICS), 33 | caption=script.START_TXT.format(message.from_user.mention if message.from_user else message.chat.title, temp.U_NAME, temp.B_NAME), reply_markup=reply_markup) 34 | await asyncio.sleep(20) 35 | await kd.delete() 36 | await message.delete() 37 | 38 | if not await db.get_chat(message.chat.id): 39 | total=await client.get_chat_members_count(message.chat.id) 40 | await client.send_message(LOG_CHANNEL, script.LOG_TEXT_G.format(message.chat.title, message.chat.id, total, "Unknown")) 41 | await db.add_chat(message.chat.id, message.chat.title) 42 | return 43 | if not await db.is_user_exist(message.from_user.id): 44 | await db.add_user(message.from_user.id, message.from_user.first_name) 45 | await client.send_message(LOG_CHANNEL, script.LOG_TEXT_P.format(message.from_user.id, message.from_user.mention)) 46 | if len(message.command) != 2: 47 | buttons = [[ 48 | InlineKeyboardButton('ᴀᴅᴅ ᴍᴇ ᴛᴏ ʏᴏᴜʀ ɢʀᴏᴜᴘ', url=f'http://t.me/{temp.U_NAME}?startgroup=true') 49 | ],[ 50 | InlineKeyboardButton('ʜᴇʟᴘ', callback_data='help'), 51 | InlineKeyboardButton('ᴀʙᴏᴜᴛ', callback_data='about'), 52 | ],[ 53 | InlineKeyboardButton('sᴜʙsᴄʀɪʙᴇ ᴏᴜʀ ʏᴛ ᴄʜᴀɴɴᴇʟ', url="https://youtube.com/@TechnicalCynite") 54 | ]] 55 | reply_markup = InlineKeyboardMarkup(buttons) 56 | await message.reply_photo( 57 | photo=random.choice(PICS), 58 | caption=script.START_TXT.format(message.from_user.mention, temp.U_NAME, temp.B_NAME), 59 | reply_markup=reply_markup, 60 | quote=True, 61 | parse_mode=enums.ParseMode.HTML 62 | ) 63 | return 64 | if AUTH_CHANNEL and not await is_subscribed(client, message): 65 | try: 66 | invite_link = await client.create_chat_invite_link(int(AUTH_CHANNEL)) 67 | except ChatAdminRequired: 68 | logger.error("Make sure Bot is admin in Forcesub channel") 69 | return 70 | btn = [ 71 | [ 72 | InlineKeyboardButton( 73 | "❆ Jᴏɪɴ Oᴜʀ Cʜᴀɴɴᴇʟ ❆", url=invite_link.invite_link 74 | ) 75 | ] 76 | ] 77 | 78 | if message.command[1] != "subscribe": 79 | try: 80 | kk, file_id = message.command[1].split("_", 1) 81 | pre = 'checksubp' if kk == 'filep' else 'checksub' 82 | btn.append([InlineKeyboardButton("↻ Tʀʏ Aɢᴀɪɴ", callback_data=f"{pre}#{file_id}")]) 83 | except (IndexError, ValueError): 84 | btn.append([InlineKeyboardButton("↻ Tʀʏ Aɢᴀɪɴ", url=f"https://t.me/{temp.U_NAME}?start={message.command[1]}")]) 85 | await client.send_photo( 86 | photo="https://telegra.ph/file/a4c2c5d8a999b47970227.jpg", 87 | chat_id=message.from_user.id, 88 | caption=(script.FORCE_SUB), 89 | reply_markup=InlineKeyboardMarkup(btn), 90 | parse_mode=enums.ParseMode.MARKDOWN 91 | ) 92 | return 93 | if len(message.command) == 2 and message.command[1] in ["subscribe", "error", "okay", "help"]: 94 | buttons = [[ 95 | InlineKeyboardButton('ᴀᴅᴅ ᴍᴇ ᴛᴏ ʏᴏᴜʀ ɢʀᴏᴜᴘ', url=f'http://t.me/{temp.U_NAME}?startgroup=true') 96 | ],[ 97 | InlineKeyboardButton('ʜᴇʟᴘ', callback_data='help'), 98 | InlineKeyboardButton('ᴀʙᴏᴜᴛ', callback_data='about'), 99 | ],[ 100 | InlineKeyboardButton('sᴜʙsᴄʀɪʙᴇ ᴏᴜʀ ʏᴛ ᴄʜᴀɴɴᴇʟ', url="https://youtube.com/@TechnicalCynite") 101 | ]] 102 | reply_markup = InlineKeyboardMarkup(buttons) 103 | await message.reply_photo( 104 | photo=random.choice(PICS), 105 | caption=script.START_TXT.format(message.from_user.mention, temp.U_NAME, temp.B_NAME), 106 | reply_markup=reply_markup, 107 | quote=True, 108 | parse_mode=enums.ParseMode.HTML 109 | ) 110 | return 111 | data = message.command[1] 112 | try: 113 | pre, file_id = data.split('_', 1) 114 | except: 115 | file_id = data 116 | pre = "" 117 | if data.split("-", 1)[0] == "BATCH": 118 | sts = await message.reply("Please wait...") 119 | file_id = data.split("-", 1)[1] 120 | msgs = BATCH_FILES.get(file_id) 121 | if not msgs: 122 | file = await client.download_media(file_id) 123 | try: 124 | with open(file) as file_data: 125 | msgs=json.loads(file_data.read()) 126 | except: 127 | await sts.edit("FAILED") 128 | return await client.send_message(LOG_CHANNEL, "UNABLE TO OPEN FILE.") 129 | os.remove(file) 130 | BATCH_FILES[file_id] = msgs 131 | for msg in msgs: 132 | title = msg.get("title") 133 | size=get_size(int(msg.get("size", 0))) 134 | f_caption=msg.get("caption", "") 135 | if BATCH_FILE_CAPTION: 136 | try: 137 | f_caption=BATCH_FILE_CAPTION.format(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) 138 | except Exception as e: 139 | logger.exception(e) 140 | f_caption=f_caption 141 | if f_caption is None: 142 | f_caption = f"{title}" 143 | try: 144 | await client.send_cached_media( 145 | chat_id=message.from_user.id, 146 | file_id=msg.get("file_id"), 147 | caption=f_caption, 148 | protect_content=msg.get('protect', False), 149 | reply_markup=InlineKeyboardMarkup( 150 | [ 151 | [ 152 | InlineKeyboardButton('Sᴜᴘᴘᴏʀᴛ Gʀᴏᴜᴘ', url=GRP_LNK), 153 | InlineKeyboardButton('Uᴘᴅᴀᴛᴇs Cʜᴀɴɴᴇʟ', url=CHNL_LNK) 154 | ] 155 | ] 156 | ) 157 | ) 158 | except FloodWait as e: 159 | await asyncio.sleep(e.x) 160 | logger.warning(f"Floodwait of {e.x} sec.") 161 | await client.send_cached_media( 162 | chat_id=message.from_user.id, 163 | file_id=msg.get("file_id"), 164 | caption=f_caption, 165 | protect_content=msg.get('protect', False), 166 | reply_markup=InlineKeyboardMarkup( 167 | [ 168 | [ 169 | InlineKeyboardButton('Sᴜᴘᴘᴏʀᴛ Gʀᴏᴜᴘ', url=GRP_LNK), 170 | InlineKeyboardButton('Uᴘᴅᴀᴛᴇs Cʜᴀɴɴᴇʟ', url=CHNL_LNK) 171 | ] 172 | ] 173 | ) 174 | ) 175 | except Exception as e: 176 | logger.warning(e, exc_info=True) 177 | continue 178 | await asyncio.sleep(1) 179 | await sts.delete() 180 | return 181 | elif data.split("-", 1)[0] == "DSTORE": 182 | sts = await message.reply("Please wait...") 183 | b_string = data.split("-", 1)[1] 184 | decoded = (base64.urlsafe_b64decode(b_string + "=" * (-len(b_string) % 4))).decode("ascii") 185 | try: 186 | f_msg_id, l_msg_id, f_chat_id, protect = decoded.split("_", 3) 187 | except: 188 | f_msg_id, l_msg_id, f_chat_id = decoded.split("_", 2) 189 | protect = "/pbatch" if PROTECT_CONTENT else "batch" 190 | diff = int(l_msg_id) - int(f_msg_id) 191 | async for msg in client.iter_messages(int(f_chat_id), int(l_msg_id), int(f_msg_id)): 192 | if msg.media: 193 | media = getattr(msg, msg.media.value) 194 | if BATCH_FILE_CAPTION: 195 | try: 196 | f_caption=BATCH_FILE_CAPTION.format(file_name=getattr(media, 'file_name', ''), file_size=getattr(media, 'file_size', ''), file_caption=getattr(msg, 'caption', '')) 197 | except Exception as e: 198 | logger.exception(e) 199 | f_caption = getattr(msg, 'caption', '') 200 | else: 201 | media = getattr(msg, msg.media.value) 202 | file_name = getattr(media, 'file_name', '') 203 | f_caption = getattr(msg, 'caption', file_name) 204 | try: 205 | await msg.copy(message.chat.id, caption=f_caption, protect_content=True if protect == "/pbatch" else False) 206 | except FloodWait as e: 207 | await asyncio.sleep(e.x) 208 | await msg.copy(message.chat.id, caption=f_caption, protect_content=True if protect == "/pbatch" else False) 209 | except Exception as e: 210 | logger.exception(e) 211 | continue 212 | elif msg.empty: 213 | continue 214 | else: 215 | try: 216 | await msg.copy(message.chat.id, protect_content=True if protect == "/pbatch" else False) 217 | except FloodWait as e: 218 | await asyncio.sleep(e.x) 219 | await msg.copy(message.chat.id, protect_content=True if protect == "/pbatch" else False) 220 | except Exception as e: 221 | logger.exception(e) 222 | continue 223 | await asyncio.sleep(1) 224 | return await sts.delete() 225 | 226 | 227 | files_ = await get_file_details(file_id) 228 | if not files_: 229 | pre, file_id = ((base64.urlsafe_b64decode(data + "=" * (-len(data) % 4))).decode("ascii")).split("_", 1) 230 | try: 231 | msg = await client.send_cached_media( 232 | chat_id=message.from_user.id, 233 | file_id=file_id, 234 | protect_content=True if pre == 'filep' else False, 235 | reply_markup=InlineKeyboardMarkup( 236 | [ 237 | [ 238 | InlineKeyboardButton('Sᴜᴘᴘᴏʀᴛ Gʀᴏᴜᴘ', url=GRP_LNK), 239 | InlineKeyboardButton('Uᴘᴅᴀᴛᴇs Cʜᴀɴɴᴇʟ', url=CHNL_LNK) 240 | ] 241 | ] 242 | ) 243 | ) 244 | filetype = msg.media 245 | file = getattr(msg, filetype.value) 246 | title = file.file_name 247 | size=get_size(file.file_size) 248 | f_caption = f"{title}" 249 | if CUSTOM_FILE_CAPTION: 250 | try: 251 | f_caption=CUSTOM_FILE_CAPTION.format(file_name= '' if title is None else title, file_size='' if size is None else size, file_caption='') 252 | except: 253 | return 254 | await msg.edit_caption(f_caption) 255 | return 256 | except: 257 | pass 258 | return await message.reply('No such file exist.') 259 | files = files_[0] 260 | title = files.file_name 261 | size=get_size(files.file_size) 262 | f_caption=files.caption 263 | if CUSTOM_FILE_CAPTION: 264 | try: 265 | f_caption=CUSTOM_FILE_CAPTION.format(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) 266 | except Exception as e: 267 | logger.exception(e) 268 | f_caption=f_caption 269 | if f_caption is None: 270 | f_caption = f"{files.file_name}" 271 | await client.send_cached_media( 272 | chat_id=message.from_user.id, 273 | file_id=file_id, 274 | caption=f_caption, 275 | protect_content=True if pre == 'filep' else False, 276 | reply_markup=InlineKeyboardMarkup( 277 | [ 278 | [ 279 | InlineKeyboardButton('Sᴜᴘᴘᴏʀᴛ Gʀᴏᴜᴘ', url=GRP_LNK), 280 | InlineKeyboardButton('Uᴘᴅᴀᴛᴇs Cʜᴀɴɴᴇʟ', url=CHNL_LNK) 281 | ] 282 | ] 283 | ) 284 | ) 285 | 286 | @Client.on_message(filters.command('channel') & filters.user(ADMINS)) 287 | async def channel_info(bot, message): 288 | 289 | """Send basic information of channel""" 290 | if isinstance(CHANNELS, (int, str)): 291 | channels = [CHANNELS] 292 | elif isinstance(CHANNELS, list): 293 | channels = CHANNELS 294 | else: 295 | raise ValueError("Unexpected type of CHANNELS") 296 | 297 | text = '📑 𝗜𝗡𝗗𝗘𝗫𝗘𝗗 𝗖𝗛𝗔𝗡𝗡𝗘𝗟𝗦 𝗟𝗜𝗦𝗧\n' 298 | for channel in channels: 299 | chat = await bot.get_chat(channel) 300 | if chat.username: 301 | text += '\n@' + chat.username 302 | else: 303 | text += '\n' + chat.title or chat.first_name 304 | 305 | text += f'\n\n𝗧𝗢𝗧𝗔𝗟 {len(CHANNELS)}' 306 | 307 | if len(text) < 4096: 308 | await message.reply(text) 309 | else: 310 | file = 'Indexed channels.txt' 311 | with open(file, 'w') as f: 312 | f.write(text) 313 | await message.reply_document(file) 314 | os.remove(file) 315 | 316 | 317 | @Client.on_message(filters.command('logs') & filters.user(ADMINS)) 318 | async def log_file(bot, message): 319 | """Send log file""" 320 | try: 321 | await message.reply_document('LuciferBotLog.txt') 322 | except Exception as e: 323 | await message.reply(str(e)) 324 | 325 | @Client.on_message(filters.command('delete') & filters.user(ADMINS)) 326 | async def delete(bot, message): 327 | """Delete file from database""" 328 | reply = message.reply_to_message 329 | if reply and reply.media: 330 | msg = await message.reply("Processing...⏳", quote=True) 331 | else: 332 | await message.reply('Reply to file with /delete which you want to delete', quote=True) 333 | return 334 | 335 | for file_type in ("document", "video", "audio"): 336 | media = getattr(reply, file_type, None) 337 | if media is not None: 338 | break 339 | else: 340 | await msg.edit('This is not supported file format') 341 | return 342 | 343 | file_id, file_ref = unpack_new_file_id(media.file_id) 344 | 345 | result = await Media.collection.delete_one({ 346 | '_id': file_id, 347 | }) 348 | if result.deleted_count: 349 | await msg.edit('File is successfully deleted from database') 350 | else: 351 | file_name = re.sub(r"(_|\-|\.|\+)", " ", str(media.file_name)) 352 | result = await Media.collection.delete_many({ 353 | 'file_name': file_name, 354 | 'file_size': media.file_size, 355 | 'mime_type': media.mime_type 356 | }) 357 | if result.deleted_count: 358 | await msg.edit('File is successfully deleted from database') 359 | else: 360 | # files indexed before https://github.com/EvamariaTG/EvaMaria/commit/f3d2a1bcb155faf44178e5d7a685a1b533e714bf#diff-86b613edf1748372103e94cacff3b578b36b698ef9c16817bb98fe9ef22fb669R39 361 | # have original file name. 362 | result = await Media.collection.delete_many({ 363 | 'file_name': media.file_name, 364 | 'file_size': media.file_size, 365 | 'mime_type': media.mime_type 366 | }) 367 | if result.deleted_count: 368 | await msg.edit('File is successfully deleted from database') 369 | else: 370 | await msg.edit('File not found in database') 371 | 372 | 373 | @Client.on_message(filters.command('deleteall') & filters.user(ADMINS)) 374 | async def delete_all_index(bot, message): 375 | await message.reply_text( 376 | 'This will delete all indexed files.\nDo you want to continue??', 377 | reply_markup=InlineKeyboardMarkup( 378 | [ 379 | [ 380 | InlineKeyboardButton( 381 | text="YES", callback_data="autofilter_delete" 382 | ) 383 | ], 384 | [ 385 | InlineKeyboardButton( 386 | text="CANCEL", callback_data="close_data" 387 | ) 388 | ], 389 | ] 390 | ), 391 | quote=True, 392 | ) 393 | 394 | 395 | @Client.on_callback_query(filters.regex(r'^autofilter_delete')) 396 | async def delete_all_index_confirm(bot, message): 397 | await Media.collection.drop() 398 | await message.answer('Piracy Is Crime') 399 | await message.message.edit('Succesfully Deleted All The Indexed Files.') 400 | 401 | 402 | @Client.on_message(filters.command('settings')) 403 | async def settings(client, message): 404 | userid = message.from_user.id if message.from_user else None 405 | if not userid: 406 | return await message.reply(f"**Yᴏᴜʀ Aʀᴇ Aɴᴏɴʏᴍᴏᴜs Aᴅᴍɪɴ. Usᴇ /settings Iɴ PM**") 407 | chat_type = message.chat.type 408 | 409 | if chat_type == enums.ChatType.PRIVATE: 410 | grpid = await active_connection(str(userid)) 411 | if grpid is not None: 412 | grp_id = grpid 413 | try: 414 | chat = await client.get_chat(grpid) 415 | title = chat.title 416 | except: 417 | await message.reply_text("**Mᴀᴋᴇ Sᴜʀᴇ I'ᴍ Pʀᴇsᴇɴᴛ Iɴ Yᴏᴜʀ Gʀᴏᴜᴘ !!**", quote=True) 418 | return 419 | else: 420 | await message.reply_text("**I'ᴍ Nᴏᴛ Cᴏɴɴᴇᴄᴛᴇᴅ Tᴏ Aɴʏ Gʀᴏᴜᴘs !**", quote=True) 421 | return 422 | 423 | elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]: 424 | grp_id = message.chat.id 425 | title = message.chat.title 426 | 427 | else: 428 | return 429 | 430 | st = await client.get_chat_member(grp_id, userid) 431 | if ( 432 | st.status != enums.ChatMemberStatus.ADMINISTRATOR 433 | and st.status != enums.ChatMemberStatus.OWNER 434 | and str(userid) not in ADMINS 435 | ): 436 | return 437 | 438 | settings = await get_settings(grp_id) 439 | try: 440 | if settings['auto_ffilter']: 441 | settings = await get_settings(grp_id) 442 | except KeyError: 443 | await save_group_settings(grp_id, 'auto_ffilter', True) 444 | try: 445 | if settings['auto_delete']: 446 | settings = await get_settings(grp_id) 447 | except KeyError: 448 | await save_group_settings(grp_id, 'auto_delete', True) 449 | try: 450 | if settings['mauto_delete']: 451 | settings = await get_settings(grp_id) 452 | except KeyError: 453 | await save_group_settings(grp_id, 'mauto_delete', True) 454 | 455 | if settings is not None: 456 | buttons = [ 457 | [ 458 | InlineKeyboardButton( 459 | 'Fɪʟᴛᴇʀ Bᴜᴛᴛᴏɴ', 460 | callback_data=f'setgs#button#{settings["button"]}#{grp_id}', 461 | ), 462 | InlineKeyboardButton( 463 | 'Sɪɴɢʟᴇ' if settings["button"] else 'Dᴏᴜʙʟᴇ', 464 | callback_data=f'setgs#button#{settings["button"]}#{grp_id}', 465 | ), 466 | ], 467 | [ 468 | InlineKeyboardButton( 469 | 'Fɪʟᴇ Mᴏᴅᴇ', 470 | callback_data=f'setgs#botpm#{settings["botpm"]}#{grp_id}', 471 | ), 472 | InlineKeyboardButton( 473 | 'Sᴛᴀʀᴛ' if settings["botpm"] else 'Cʜᴀɴɴᴇʟ', 474 | callback_data=f'setgs#botpm#{settings["botpm"]}#{grp_id}', 475 | ), 476 | ], 477 | [ 478 | InlineKeyboardButton( 479 | 'Fɪʟᴇ Sᴇᴄᴜʀᴇ', 480 | callback_data=f'setgs#file_secure#{settings["file_secure"]}#{grp_id}', 481 | ), 482 | InlineKeyboardButton( 483 | 'Eɴᴀʙʟᴇ' if settings["file_secure"] else 'Dɪsᴀʙʟᴇ', 484 | callback_data=f'setgs#file_secure#{settings["file_secure"]}#{grp_id}', 485 | ), 486 | ], 487 | [ 488 | InlineKeyboardButton( 489 | 'Iᴍᴅʙ Pᴏsᴛᴇʀ', 490 | callback_data=f'setgs#imdb#{settings["imdb"]}#{grp_id}', 491 | ), 492 | InlineKeyboardButton( 493 | 'Eɴᴀʙʟᴇ' if settings["imdb"] else 'Dɪsᴀʙʟᴇ', 494 | callback_data=f'setgs#imdb#{settings["imdb"]}#{grp_id}', 495 | ), 496 | ], 497 | [ 498 | InlineKeyboardButton( 499 | 'Sᴘᴇʟʟ Cʜᴇᴄᴋ', 500 | callback_data=f'setgs#spell_check#{settings["spell_check"]}#{grp_id}', 501 | ), 502 | InlineKeyboardButton( 503 | 'Eɴᴀʙʟᴇ' if settings["spell_check"] else 'Dɪsᴀʙʟᴇ', 504 | callback_data=f'setgs#spell_check#{settings["spell_check"]}#{grp_id}', 505 | ), 506 | ], 507 | [ 508 | InlineKeyboardButton( 509 | 'Wᴇʟᴄᴏᴍᴇ Msɢ', 510 | callback_data=f'setgs#welcome#{settings["welcome"]}#{grp_id}', 511 | ), 512 | InlineKeyboardButton( 513 | 'Eɴᴀʙʟᴇ' if settings["welcome"] else 'Dɪsᴀʙʟᴇ', 514 | callback_data=f'setgs#welcome#{settings["welcome"]}#{grp_id}', 515 | ), 516 | ], 517 | [ 518 | InlineKeyboardButton( 519 | 'Aᴜᴛᴏ Fɪʟᴛᴇʀ', 520 | callback_data=f'setgs#auto_ffilter#{settings["auto_ffilter"]}#{grp_id}', 521 | ), 522 | InlineKeyboardButton( 523 | 'Eɴᴀʙʟᴇ' if settings["auto_ffilter"] else 'Dɪsᴀʙʟᴇ', 524 | callback_data=f'setgs#auto_ffilter#{settings["auto_ffilter"]}#{grp_id}', 525 | ), 526 | ], 527 | [ 528 | InlineKeyboardButton( 529 | 'Aᴜᴛᴏ Fɪʟᴛᴇʀ Dᴇʟ', 530 | callback_data=f'setgs#auto_delete#{settings["auto_delete"]}#{grp_id}', 531 | ), 532 | InlineKeyboardButton( 533 | 'Eɴᴀʙʟᴇ' if settings["auto_delete"] else 'Dɪsᴀʙʟᴇ', 534 | callback_data=f'setgs#auto_delete#{settings["auto_delete"]}#{grp_id}', 535 | ), 536 | ], 537 | [ 538 | InlineKeyboardButton( 539 | 'Fɪʟᴛᴇʀs Aᴜᴛᴏ Dᴇʟ', 540 | callback_data=f'setgs#mauto_delete#{settings["mauto_delete"]}#{grp_id}', 541 | ), 542 | InlineKeyboardButton( 543 | 'Eɴᴀʙʟᴇ' if settings["mauto_delete"] else 'Dɪsᴀʙʟᴇ', 544 | callback_data=f'setgs#mauto_delete#{settings["mauto_delete"]}#{grp_id}', 545 | ), 546 | ], 547 | [ 548 | InlineKeyboardButton('Cʟᴏsᴇ Sᴇᴛᴛɪɴɢs', callback_data='close_data') 549 | ] 550 | ] 551 | 552 | reply_markup = InlineKeyboardMarkup(buttons) 553 | stng = await message.reply_text( 554 | text=f"Cᴜʀʀᴇɴᴛ Sᴇᴛᴛɪɴɢs Fᴏʀ {title}\n\nHᴇʏ Bᴜᴅᴅʏ Hᴇʀᴇ Yᴏᴜ Cᴀɴ Cʜᴀɴɢᴇ Sᴇᴛᴛɪɴɢs As Yᴏᴜʀ Wɪsʜ Bʏ Usɪɴɢ Bᴇʟᴏᴡ Bᴜᴛᴛᴏɴs", 555 | reply_markup=reply_markup, 556 | disable_web_page_preview=True, 557 | parse_mode=enums.ParseMode.HTML, 558 | reply_to_message_id=message.id 559 | ) 560 | await asyncio.sleep(100) 561 | await stng.delete() 562 | await message.delete() 563 | 564 | @Client.on_message(filters.command('set_template')) 565 | async def save_template(client, message): 566 | sts = await message.reply("**Cʜᴇᴄᴋɪɴɢ Tᴇᴍᴘʟᴀᴛᴇ....**") 567 | userid = message.from_user.id if message.from_user else None 568 | if not userid: 569 | return await message.reply(f"**Yᴏᴜʀ Aʀᴇ Aɴᴏɴʏᴍᴏᴜs Aᴅᴍɪɴ. Usᴇ /set_template Iɴ PM**") 570 | chat_type = message.chat.type 571 | 572 | if chat_type == enums.ChatType.PRIVATE: 573 | grpid = await active_connection(str(userid)) 574 | if grpid is not None: 575 | grp_id = grpid 576 | try: 577 | chat = await client.get_chat(grpid) 578 | title = chat.title 579 | except: 580 | await message.reply_text("**Mᴀᴋᴇ Sᴜʀᴇ I'ᴍ Pʀᴇsᴇɴᴛ Iɴ Yᴏᴜʀ Gʀᴏᴜᴘ !!**", quote=True) 581 | return 582 | else: 583 | await message.reply_text("**I'ᴍ Nᴏᴛ Cᴏɴɴᴇᴄᴛᴇᴅ Tᴏ Aɴʏ Gʀᴏᴜᴘs !**", quote=True) 584 | return 585 | 586 | elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]: 587 | grp_id = message.chat.id 588 | title = message.chat.title 589 | 590 | else: 591 | return 592 | 593 | st = await client.get_chat_member(grp_id, userid) 594 | if ( 595 | st.status != enums.ChatMemberStatus.ADMINISTRATOR 596 | and st.status != enums.ChatMemberStatus.OWNER 597 | and str(userid) not in ADMINS 598 | ): 599 | return 600 | 601 | if len(message.command) < 2: 602 | return await sts.edit("**Gɪᴠᴇ Mᴇ Tᴇᴍᴘʟᴀᴛᴇ !!**") 603 | template = message.text.split(" ", 1)[1] 604 | await save_group_settings(grp_id, 'template', template) 605 | await sts.edit(f"**Sᴜᴄᴄᴇssғᴜʟʟʏ Cʜᴀɴɢᴇᴅ Tᴇᴍᴘʟᴀᴛᴇ Fᴏʀ `{title}` Tᴏ**\n\n`{template}`") 606 | 607 | @Client.on_message((filters.regex("#request")) & filters.chat(chats=SUPPORT_GROUP)) 608 | async def request(bot, message): 609 | if message.text in ['#request']: 610 | await message.reply_text(text = '𝚄𝚂𝙴 𝙲𝙾𝚁𝚁𝙴𝙲𝚃 𝙵𝙾𝚁𝙼𝙰𝚃...', quote = True) 611 | return 612 | grqmsg = await message.reply_text( 613 | text=script.REQUEST2_TXT, 614 | disable_web_page_preview=True, 615 | reply_to_message_id=message.id 616 | ) 617 | rqmsg = await bot.send_message(RQST_LOG_CHANNEL, script.REQUEST_TXT.format(message.text.replace("#request", ""), message.from_user.mention, message.from_user.id), 618 | reply_markup=InlineKeyboardMarkup( 619 | [[ 620 | InlineKeyboardButton(text="🔍 Gᴏ Tᴏ Tʜᴇ Mᴇssᴀɢᴇ 🔎", url=f"{message.link}") 621 | ], 622 | [ 623 | InlineKeyboardButton(text="🉐 Sʜᴏᴡ Oᴘᴛɪᴏɴs 🉐", callback_data=f"morbtn {message.id} {grqmsg.id}") 624 | ]] 625 | ) 626 | ) 627 | asyncio.sleep(1.5) 628 | await grqmsg.edit_reply_markup( 629 | reply_markup=InlineKeyboardMarkup( 630 | [[ 631 | InlineKeyboardButton(text="‼️ Vɪᴇᴡ Yᴏᴜʀ Rᴇǫᴜᴇsᴛ ‼️", url=f"{rqmsg.link}") 632 | ]] 633 | ) 634 | ) 635 | 636 | @Client.on_message((filters.private | filters.chat(chats=SUPPORT_GROUP)) & filters.command('ping')) 637 | async def ping(_, message): 638 | kd = await message.reply_sticker('CAACAgUAAxkBAAEGOytjW6NWTA-5W3mgd-EM097fO5d9NwACqAgAAjUZ2FaMuFVVR8ipsCoE') 639 | await asyncio.sleep(30) 640 | await kd.delete() 641 | await message.delete() 642 | 643 | @Client.on_message(filters.command("usend") & filters.user(ADMINS)) 644 | async def send_msg(bot, message): 645 | if message.reply_to_message: 646 | target_id = message.text 647 | command = ["/usend"] 648 | for cmd in command: 649 | if cmd in target_id: 650 | target_id = target_id.replace(cmd, "") 651 | success = False 652 | try: 653 | user = await bot.get_users(int(target_id)) 654 | await message.reply_to_message.copy(int(user.id)) 655 | success = True 656 | except Exception as e: 657 | await message.reply_text(f"Eʀʀᴏʀ :- {e}") 658 | if success: 659 | await message.reply_text(f"Yᴏᴜʀ Mᴇssᴀɢᴇ Hᴀs Bᴇᴇɴ Sᴜᴄᴇssғᴜʟʟʏ Sᴇɴᴅ To {user.mention}.") 660 | else: 661 | await message.reply_text("Aɴ Eʀʀᴏʀ Oᴄᴄᴜʀʀᴇᴅ !") 662 | else: 663 | await message.reply_text("Cᴏᴍᴍᴀɴᴅ Iɴᴄᴏᴍᴘʟᴇᴛᴇ...") 664 | 665 | @Client.on_message(filters.command("gsend") & filters.user(ADMINS)) 666 | async def send_chatmsg(bot, message): 667 | if message.reply_to_message: 668 | target_id = message.text 669 | command = ["/gsend"] 670 | for cmd in command: 671 | if cmd in target_id: 672 | target_id = target_id.replace(cmd, "") 673 | success = False 674 | try: 675 | chat = await bot.get_chat(int(target_id)) 676 | await message.reply_to_message.copy(int(chat.id)) 677 | success = True 678 | except Exception as e: 679 | await message.reply_text(f"Eʀʀᴏʀ :- {e}") 680 | if success: 681 | await message.reply_text(f"Yᴏᴜʀ Mᴇssᴀɢᴇ Hᴀs Bᴇᴇɴ Sᴜᴄᴇssғᴜʟʟʏ Sᴇɴᴅ To {chat.id}.") 682 | else: 683 | await message.reply_text("Aɴ Eʀʀᴏʀ Oᴄᴄᴜʀʀᴇᴅ !") 684 | else: 685 | await message.reply_text("Cᴏᴍᴍᴀɴᴅ Iɴᴄᴏᴍᴘʟᴇᴛᴇ...") 686 | -------------------------------------------------------------------------------- /CYNITE/connection.py: -------------------------------------------------------------------------------- 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"**Yᴏᴜʀ Aʀᴇ Aɴᴏɴʏᴍᴏᴜs Aᴅᴍɪɴ. Usᴇ `/connect {message.chat.id}` Iɴ 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 | "Enter in correct format!\n\n" 24 | "/connect groupid\n\n" 25 | "Get your Group id by adding this bot to your group and use /id", 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 | await message.reply_text("You should be an admin in Given group!", quote=True) 41 | return 42 | except Exception as e: 43 | logger.exception(e) 44 | await message.reply_text( 45 | "Invalid Group ID!\n\nIf correct, Make sure I'm present in your group!!", 46 | quote=True, 47 | ) 48 | 49 | return 50 | try: 51 | st = await client.get_chat_member(group_id, "me") 52 | if st.status == enums.ChatMemberStatus.ADMINISTRATOR: 53 | ttl = await client.get_chat(group_id) 54 | title = ttl.title 55 | 56 | addcon = await add_connection(str(group_id), str(userid)) 57 | if addcon: 58 | await message.reply_text( 59 | f"Successfully connected to **{title}**\nNow manage your group from my pm !", 60 | quote=True, 61 | parse_mode=enums.ParseMode.MARKDOWN 62 | ) 63 | if chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]: 64 | await client.send_message( 65 | userid, 66 | f"Connected to **{title}** !", 67 | parse_mode=enums.ParseMode.MARKDOWN 68 | ) 69 | else: 70 | await message.reply_text( 71 | "You're already connected to this chat!", 72 | quote=True 73 | ) 74 | else: 75 | await message.reply_text("Add me as an admin in group", quote=True) 76 | except Exception as e: 77 | logger.exception(e) 78 | await message.reply_text('Some error occurred! Try again later.', quote=True) 79 | return 80 | 81 | 82 | @Client.on_message((filters.private | filters.group) & filters.command('disconnect')) 83 | async def deleteconnection(client, message): 84 | userid = message.from_user.id if message.from_user else None 85 | if not userid: 86 | return await message.reply(f"**Yᴏᴜʀ Aʀᴇ Aɴᴏɴʏᴍᴏᴜs Aᴅᴍɪɴ. Usᴇ `/connect {message.chat.id}` Iɴ PM**") 87 | chat_type = message.chat.type 88 | 89 | if chat_type == enums.ChatType.PRIVATE: 90 | await message.reply_text("Run /connections to view or disconnect from groups!", quote=True) 91 | 92 | elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]: 93 | group_id = message.chat.id 94 | 95 | st = await client.get_chat_member(group_id, userid) 96 | if ( 97 | st.status != enums.ChatMemberStatus.ADMINISTRATOR 98 | and st.status != enums.ChatMemberStatus.OWNER 99 | and str(userid) not in ADMINS 100 | ): 101 | return 102 | 103 | delcon = await delete_connection(str(userid), str(group_id)) 104 | if delcon: 105 | await message.reply_text("Successfully disconnected from this chat", quote=True) 106 | else: 107 | await message.reply_text("This chat isn't connected to me!\nDo /connect to connect.", quote=True) 108 | 109 | 110 | @Client.on_message(filters.private & filters.command(["connections"])) 111 | async def connections(client, message): 112 | userid = message.from_user.id 113 | 114 | groupids = await all_connections(str(userid)) 115 | if groupids is None: 116 | await message.reply_text( 117 | "There are no active connections!! Connect to some groups first.", 118 | quote=True 119 | ) 120 | return 121 | buttons = [] 122 | for groupid in groupids: 123 | try: 124 | ttl = await client.get_chat(int(groupid)) 125 | title = ttl.title 126 | active = await if_active(str(userid), str(groupid)) 127 | act = " - ACTIVE" if active else "" 128 | buttons.append( 129 | [ 130 | InlineKeyboardButton( 131 | text=f"{title}{act}", callback_data=f"groupcb:{groupid}:{act}" 132 | ) 133 | ] 134 | ) 135 | except: 136 | pass 137 | if buttons: 138 | await message.reply_text( 139 | "Your connected group details ;\n\n", 140 | reply_markup=InlineKeyboardMarkup(buttons), 141 | quote=True 142 | ) 143 | else: 144 | await message.reply_text( 145 | "There are no active connections!! Connect to some groups first.", 146 | quote=True 147 | ) 148 | -------------------------------------------------------------------------------- /CYNITE/filters.py: -------------------------------------------------------------------------------- 1 | import io 2 | from pyrogram import filters, Client, enums 3 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup 4 | from database.filters_mdb import( 5 | add_filter, 6 | get_filters, 7 | delete_filter, 8 | count_filters 9 | ) 10 | 11 | from database.connections_mdb import active_connection 12 | from utils import get_file_id, parser, split_quotes 13 | from info import ADMINS 14 | 15 | 16 | @Client.on_message(filters.command(['filter', 'add']) & filters.incoming) 17 | async def addfilter(client, message): 18 | userid = message.from_user.id if message.from_user else None 19 | if not userid: 20 | return await message.reply(f"You are anonymous admin. Use /connect {message.chat.id} in PM") 21 | chat_type = message.chat.type 22 | args = message.text.html.split(None, 1) 23 | 24 | if chat_type == enums.ChatType.PRIVATE: 25 | grpid = await active_connection(str(userid)) 26 | if grpid is not None: 27 | grp_id = grpid 28 | try: 29 | chat = await client.get_chat(grpid) 30 | title = chat.title 31 | except: 32 | await message.reply_text("Make sure I'm present in your group!!", quote=True) 33 | return 34 | else: 35 | await message.reply_text("I'm not connected to any groups!", quote=True) 36 | return 37 | 38 | elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]: 39 | grp_id = message.chat.id 40 | title = message.chat.title 41 | 42 | else: 43 | return 44 | 45 | st = await client.get_chat_member(grp_id, userid) 46 | if ( 47 | st.status != enums.ChatMemberStatus.ADMINISTRATOR 48 | and st.status != enums.ChatMemberStatus.OWNER 49 | and str(userid) not in ADMINS 50 | ): 51 | return 52 | 53 | 54 | if len(args) < 2: 55 | await message.reply_text("Command Incomplete :(", quote=True) 56 | return 57 | 58 | extracted = split_quotes(args[1]) 59 | text = extracted[0].lower() 60 | 61 | if not message.reply_to_message and len(extracted) < 2: 62 | await message.reply_text("Add some content to save your filter!", quote=True) 63 | return 64 | 65 | if (len(extracted) >= 2) and not message.reply_to_message: 66 | reply_text, btn, alert = parser(extracted[1], text) 67 | fileid = None 68 | if not reply_text: 69 | await message.reply_text("You cannot have buttons alone, give some text to go with it!", quote=True) 70 | return 71 | 72 | elif message.reply_to_message and message.reply_to_message.reply_markup: 73 | try: 74 | rm = message.reply_to_message.reply_markup 75 | btn = rm.inline_keyboard 76 | msg = get_file_id(message.reply_to_message) 77 | if msg: 78 | fileid = msg.file_id 79 | reply_text = message.reply_to_message.caption.html 80 | else: 81 | reply_text = message.reply_to_message.text.html 82 | fileid = None 83 | alert = None 84 | except: 85 | reply_text = "" 86 | btn = "[]" 87 | fileid = None 88 | alert = None 89 | 90 | elif message.reply_to_message and message.reply_to_message.media: 91 | try: 92 | msg = get_file_id(message.reply_to_message) 93 | fileid = msg.file_id if msg else None 94 | reply_text, btn, alert = parser(extracted[1], text) if message.reply_to_message.sticker else parser(message.reply_to_message.caption.html, text) 95 | except: 96 | reply_text = "" 97 | btn = "[]" 98 | alert = None 99 | elif message.reply_to_message and message.reply_to_message.text: 100 | try: 101 | fileid = None 102 | reply_text, btn, alert = parser(message.reply_to_message.text.html, text) 103 | except: 104 | reply_text = "" 105 | btn = "[]" 106 | alert = None 107 | else: 108 | return 109 | 110 | await add_filter(grp_id, text, reply_text, btn, fileid, alert) 111 | 112 | await message.reply_text( 113 | f"Filter for `{text}` added in **{title}**", 114 | quote=True, 115 | parse_mode=enums.ParseMode.MARKDOWN 116 | ) 117 | 118 | 119 | @Client.on_message(filters.command(['viewfilters', 'filters']) & filters.incoming) 120 | async def get_all(client, message): 121 | 122 | chat_type = message.chat.type 123 | userid = message.from_user.id if message.from_user else None 124 | if not userid: 125 | return await message.reply(f"You are anonymous admin. Use /connect {message.chat.id} in PM") 126 | if chat_type == enums.ChatType.PRIVATE: 127 | userid = message.from_user.id 128 | grpid = await active_connection(str(userid)) 129 | if grpid is not None: 130 | grp_id = grpid 131 | try: 132 | chat = await client.get_chat(grpid) 133 | title = chat.title 134 | except: 135 | await message.reply_text("Make sure I'm present in your group!!", quote=True) 136 | return 137 | else: 138 | await message.reply_text("I'm not connected to any groups!", quote=True) 139 | return 140 | 141 | elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]: 142 | grp_id = message.chat.id 143 | title = message.chat.title 144 | 145 | else: 146 | return 147 | 148 | st = await client.get_chat_member(grp_id, userid) 149 | if ( 150 | st.status != enums.ChatMemberStatus.ADMINISTRATOR 151 | and st.status != enums.ChatMemberStatus.OWNER 152 | and str(userid) not in ADMINS 153 | ): 154 | return 155 | 156 | texts = await get_filters(grp_id) 157 | count = await count_filters(grp_id) 158 | if count: 159 | filterlist = f"Total number of filters in **{title}** : {count}\n\n" 160 | 161 | for text in texts: 162 | keywords = " × `{}`\n".format(text) 163 | 164 | filterlist += keywords 165 | 166 | if len(filterlist) > 4096: 167 | with io.BytesIO(str.encode(filterlist.replace("`", ""))) as keyword_file: 168 | keyword_file.name = "keywords.txt" 169 | await message.reply_document( 170 | document=keyword_file, 171 | quote=True 172 | ) 173 | return 174 | else: 175 | filterlist = f"There are no active filters in **{title}**" 176 | 177 | await message.reply_text( 178 | text=filterlist, 179 | quote=True, 180 | parse_mode=enums.ParseMode.MARKDOWN 181 | ) 182 | 183 | @Client.on_message(filters.command('del') & filters.incoming) 184 | async def deletefilter(client, message): 185 | userid = message.from_user.id if message.from_user else None 186 | if not userid: 187 | return await message.reply(f"You are anonymous admin. Use /connect {message.chat.id} in PM") 188 | chat_type = message.chat.type 189 | 190 | if chat_type == enums.ChatType.PRIVATE: 191 | grpid = await active_connection(str(userid)) 192 | if grpid is not None: 193 | grp_id = grpid 194 | try: 195 | chat = await client.get_chat(grpid) 196 | title = chat.title 197 | except: 198 | await message.reply_text("Make sure I'm present in your group!!", quote=True) 199 | return 200 | else: 201 | await message.reply_text("I'm not connected to any groups!", quote=True) 202 | 203 | elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]: 204 | grp_id = message.chat.id 205 | title = message.chat.title 206 | 207 | else: 208 | return 209 | 210 | st = await client.get_chat_member(grp_id, userid) 211 | if ( 212 | st.status != enums.ChatMemberStatus.ADMINISTRATOR 213 | and st.status != enums.ChatMemberStatus.OWNER 214 | and str(userid) not in ADMINS 215 | ): 216 | return 217 | 218 | try: 219 | cmd, text = message.text.split(" ", 1) 220 | except: 221 | await message.reply_text( 222 | "Mention the filtername which you wanna delete!\n\n" 223 | "/del filtername\n\n" 224 | "Use /viewfilters to view all available filters", 225 | quote=True 226 | ) 227 | return 228 | 229 | query = text.lower() 230 | 231 | await delete_filter(message, query, grp_id) 232 | 233 | 234 | @Client.on_message(filters.command('delall') & filters.incoming) 235 | async def delallconfirm(client, message): 236 | userid = message.from_user.id if message.from_user else None 237 | if not userid: 238 | return await message.reply(f"You are anonymous admin. Use /connect {message.chat.id} in PM") 239 | chat_type = message.chat.type 240 | 241 | if chat_type == enums.ChatType.PRIVATE: 242 | grpid = await active_connection(str(userid)) 243 | if grpid is not None: 244 | grp_id = grpid 245 | try: 246 | chat = await client.get_chat(grpid) 247 | title = chat.title 248 | except: 249 | await message.reply_text("Make sure I'm present in your group!!", quote=True) 250 | return 251 | else: 252 | await message.reply_text("I'm not connected to any groups!", quote=True) 253 | return 254 | 255 | elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]: 256 | grp_id = message.chat.id 257 | title = message.chat.title 258 | 259 | else: 260 | return 261 | 262 | st = await client.get_chat_member(grp_id, userid) 263 | if (st.status == enums.ChatMemberStatus.OWNER) or (str(userid) in ADMINS): 264 | await message.reply_text( 265 | f"This will delete all filters from '{title}'.\nDo you want to continue??", 266 | reply_markup=InlineKeyboardMarkup([ 267 | [InlineKeyboardButton(text="YES",callback_data="delallconfirm")], 268 | [InlineKeyboardButton(text="CANCEL",callback_data="delallcancel")] 269 | ]), 270 | quote=True 271 | ) 272 | 273 | -------------------------------------------------------------------------------- /CYNITE/genlink.py: -------------------------------------------------------------------------------- 1 | import re 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 | import re 8 | import os 9 | import json 10 | import base64 11 | import logging 12 | 13 | logger = logging.getLogger(__name__) 14 | logger.setLevel(logging.INFO) 15 | 16 | async def allowed(_, __, message): 17 | if PUBLIC_FILE_STORE: 18 | return True 19 | if message.from_user and message.from_user.id in ADMINS: 20 | return True 21 | return False 22 | 23 | @Client.on_message(filters.command(['link', 'plink']) & filters.create(allowed)) 24 | async def gen_link_s(bot, message): 25 | replied = message.reply_to_message 26 | if not replied: 27 | return await message.reply('Reply to a message to get a shareable link.') 28 | file_type = replied.media 29 | if file_type not in [enums.MessageMediaType.VIDEO, enums.MessageMediaType.AUDIO, enums.MessageMediaType.DOCUMENT]: 30 | return await message.reply("Reply to a supported media") 31 | if message.has_protected_content and message.chat.id not in ADMINS: 32 | return await message.reply("okDa") 33 | file_id, ref = unpack_new_file_id((getattr(replied, file_type.value)).file_id) 34 | string = 'filep_' if message.text.lower().strip() == "/plink" else 'file_' 35 | string += file_id 36 | outstr = base64.urlsafe_b64encode(string.encode("ascii")).decode().strip("=") 37 | await message.reply(f"Here is your Link:\nhttps://t.me/{temp.U_NAME}?start={outstr}") 38 | 39 | 40 | @Client.on_message(filters.command(['batch', 'pbatch']) & filters.create(allowed)) 41 | async def gen_link_batch(bot, message): 42 | if " " not in message.text: 43 | return await message.reply("Use correct format.\nExample /batch https://t.me/cyniteBackup/3 https://t.me/CyniteBackup/9.") 44 | links = message.text.strip().split(" ") 45 | if len(links) != 3: 46 | return await message.reply("Use correct format.\nExample /batch https://t.me/CyniteBackup/3 https://t.me/CyniteBackup/9.") 47 | cmd, first, last = links 48 | regex = re.compile("(https://)?(t\.me/|telegram\.me/|telegram\.dog/)(c/)?(\d+|[a-zA-Z_0-9]+)/(\d+)$") 49 | match = regex.match(first) 50 | if not match: 51 | return await message.reply('Invalid link') 52 | f_chat_id = match.group(4) 53 | f_msg_id = int(match.group(5)) 54 | if f_chat_id.isnumeric(): 55 | f_chat_id = int(("-100" + f_chat_id)) 56 | 57 | match = regex.match(last) 58 | if not match: 59 | return await message.reply('Invalid link') 60 | l_chat_id = match.group(4) 61 | l_msg_id = int(match.group(5)) 62 | if l_chat_id.isnumeric(): 63 | l_chat_id = int(("-100" + l_chat_id)) 64 | 65 | if f_chat_id != l_chat_id: 66 | return await message.reply("Chat ids not matched.") 67 | try: 68 | chat_id = (await bot.get_chat(f_chat_id)).id 69 | except ChannelInvalid: 70 | return await message.reply('This may be a private channel / group. Make me an admin over there to index the files.') 71 | except (UsernameInvalid, UsernameNotModified): 72 | return await message.reply('Invalid Link specified.') 73 | except Exception as e: 74 | return await message.reply(f'Errors - {e}') 75 | 76 | sts = await message.reply("Generating link for your message.\nThis may take time depending upon number of messages") 77 | if chat_id in FILE_STORE_CHANNEL: 78 | string = f"{f_msg_id}_{l_msg_id}_{chat_id}_{cmd.lower().strip()}" 79 | b_64 = base64.urlsafe_b64encode(string.encode("ascii")).decode().strip("=") 80 | return await sts.edit(f"Here is your link https://t.me/{temp.U_NAME}?start=DSTORE-{b_64}") 81 | 82 | FRMT = "Generating Link...\nTotal Messages: `{total}`\nDone: `{current}`\nRemaining: `{rem}`\nStatus: `{sts}`" 83 | 84 | outlist = [] 85 | 86 | # file store without db channel 87 | og_msg = 0 88 | tot = 0 89 | async for msg in bot.iter_messages(f_chat_id, l_msg_id, f_msg_id): 90 | tot += 1 91 | if msg.empty or msg.service: 92 | continue 93 | if not msg.media: 94 | # only media messages supported. 95 | continue 96 | try: 97 | file_type = msg.media 98 | file = getattr(msg, file_type.value) 99 | caption = getattr(msg, 'caption', '') 100 | if caption: 101 | caption = caption.html 102 | if file: 103 | file = { 104 | "file_id": file.file_id, 105 | "caption": caption, 106 | "title": getattr(file, "file_name", ""), 107 | "size": file.file_size, 108 | "protect": cmd.lower().strip() == "/pbatch", 109 | } 110 | 111 | og_msg +=1 112 | outlist.append(file) 113 | except: 114 | pass 115 | if not og_msg % 20: 116 | try: 117 | 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")) 118 | except: 119 | pass 120 | with open(f"batchmode_{message.from_user.id}.json", "w+") as out: 121 | json.dump(outlist, out) 122 | post = await bot.send_document(LOG_CHANNEL, f"batchmode_{message.from_user.id}.json", file_name="Batch.json", caption="⚠️Generated for filestore.") 123 | os.remove(f"batchmode_{message.from_user.id}.json") 124 | file_id, ref = unpack_new_file_id(post.document.file_id) 125 | await sts.edit(f"Here is your link\nContains `{og_msg}` files.\n https://t.me/{temp.U_NAME}?start=BATCH-{file_id}") 126 | -------------------------------------------------------------------------------- /CYNITE/gfilters.py: -------------------------------------------------------------------------------- 1 | import io 2 | from pyrogram import filters, Client, enums 3 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup 4 | from database.gfilters_mdb import( 5 | add_gfilter, 6 | get_gfilters, 7 | delete_gfilter, 8 | count_gfilters 9 | ) 10 | 11 | from database.connections_mdb import active_connection 12 | from utils import get_file_id, parser, split_quotes 13 | from info import ADMINS 14 | 15 | 16 | @Client.on_message(filters.command(['gfilter', 'addg']) & filters.incoming & filters.user(ADMINS)) 17 | async def addgfilter(client, message): 18 | args = message.text.html.split(None, 1) 19 | 20 | if len(args) < 2: 21 | await message.reply_text("Command Incomplete :(", quote=True) 22 | return 23 | 24 | extracted = split_quotes(args[1]) 25 | text = extracted[0].lower() 26 | 27 | if not message.reply_to_message and len(extracted) < 2: 28 | await message.reply_text("Add some content to save your filter!", quote=True) 29 | return 30 | 31 | if (len(extracted) >= 2) and not message.reply_to_message: 32 | reply_text, btn, alert = parser(extracted[1], text) 33 | fileid = None 34 | if not reply_text: 35 | await message.reply_text("You cannot have buttons alone, give some text to go with it!", quote=True) 36 | return 37 | 38 | elif message.reply_to_message and message.reply_to_message.reply_markup: 39 | try: 40 | rm = message.reply_to_message.reply_markup 41 | btn = rm.inline_keyboard 42 | msg = get_file_id(message.reply_to_message) 43 | if msg: 44 | fileid = msg.file_id 45 | reply_text = message.reply_to_message.caption.html 46 | else: 47 | reply_text = message.reply_to_message.text.html 48 | fileid = None 49 | alert = None 50 | except: 51 | reply_text = "" 52 | btn = "[]" 53 | fileid = None 54 | alert = None 55 | 56 | elif message.reply_to_message and message.reply_to_message.media: 57 | try: 58 | msg = get_file_id(message.reply_to_message) 59 | fileid = msg.file_id if msg else None 60 | reply_text, btn, alert = parser(extracted[1], text) if message.reply_to_message.sticker else parser(message.reply_to_message.caption.html, text) 61 | except: 62 | reply_text = "" 63 | btn = "[]" 64 | alert = None 65 | elif message.reply_to_message and message.reply_to_message.text: 66 | try: 67 | fileid = None 68 | reply_text, btn, alert = parser(message.reply_to_message.text.html, text) 69 | except: 70 | reply_text = "" 71 | btn = "[]" 72 | alert = None 73 | else: 74 | return 75 | 76 | await add_gfilter('gfilters', text, reply_text, btn, fileid, alert) 77 | 78 | await message.reply_text( 79 | f"GFilter for `{text}` added", 80 | quote=True, 81 | parse_mode=enums.ParseMode.MARKDOWN 82 | ) 83 | 84 | 85 | @Client.on_message(filters.command(['viewgfilters', 'gfilters']) & filters.incoming & filters.user(ADMINS)) 86 | async def get_all_gfilters(client, message): 87 | texts = await get_gfilters('gfilters') 88 | count = await count_gfilters('gfilters') 89 | if count: 90 | gfilterlist = f"Total number of gfilters : {count}\n\n" 91 | 92 | for text in texts: 93 | keywords = " × `{}`\n".format(text) 94 | 95 | gfilterlist += keywords 96 | 97 | if len(gfilterlist) > 4096: 98 | with io.BytesIO(str.encode(gfilterlist.replace("`", ""))) as keyword_file: 99 | keyword_file.name = "keywords.txt" 100 | await message.reply_document( 101 | document=keyword_file, 102 | quote=True 103 | ) 104 | return 105 | else: 106 | gfilterlist = f"There are no active gfilters." 107 | 108 | await message.reply_text( 109 | text=gfilterlist, 110 | quote=True, 111 | parse_mode=enums.ParseMode.MARKDOWN 112 | ) 113 | 114 | @Client.on_message(filters.command('delg') & filters.incoming & filters.user(ADMINS)) 115 | async def deletegfilter(client, message): 116 | try: 117 | cmd, text = message.text.split(" ", 1) 118 | except: 119 | await message.reply_text( 120 | "Mention the gfiltername which you wanna delete!\n\n" 121 | "/delg gfiltername\n\n" 122 | "Use /viewgfilters to view all available gfilters", 123 | quote=True 124 | ) 125 | return 126 | 127 | query = text.lower() 128 | 129 | await delete_gfilter(message, query, 'gfilters') 130 | -------------------------------------------------------------------------------- /CYNITE/index.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import asyncio 3 | from pyrogram import Client, filters, enums 4 | from pyrogram.errors import FloodWait 5 | from pyrogram.errors.exceptions.bad_request_400 import ChannelInvalid, ChatAdminRequired, UsernameInvalid, UsernameNotModified 6 | from info import ADMINS 7 | from info import INDEX_REQ_CHANNEL as LOG_CHANNEL 8 | from database.ia_filterdb import save_file 9 | from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton 10 | from utils import temp 11 | import re 12 | logger = logging.getLogger(__name__) 13 | logger.setLevel(logging.INFO) 14 | lock = asyncio.Lock() 15 | 16 | 17 | @Client.on_callback_query(filters.regex(r'^index')) 18 | async def index_files(bot, query): 19 | if query.data.startswith('index_cancel'): 20 | temp.CANCEL = True 21 | return await query.answer("Cancelling Indexing") 22 | _, raju, chat, lst_msg_id, from_user = query.data.split("#") 23 | if raju == 'reject': 24 | await query.message.delete() 25 | await bot.send_message(int(from_user), 26 | f'Your Submission for indexing {chat} has been decliened by our moderators.', 27 | reply_to_message_id=int(lst_msg_id)) 28 | return 29 | 30 | if lock.locked(): 31 | return await query.answer('Wait until previous process complete.', show_alert=True) 32 | msg = query.message 33 | 34 | await query.answer('Processing...⏳', show_alert=True) 35 | if int(from_user) not in ADMINS: 36 | await bot.send_message(int(from_user), 37 | f'Your Submission for indexing {chat} has been accepted by our moderators and will be added soon.', 38 | reply_to_message_id=int(lst_msg_id)) 39 | await msg.edit( 40 | "Starting Indexing", 41 | reply_markup=InlineKeyboardMarkup( 42 | [[InlineKeyboardButton('Cancel', callback_data='index_cancel')]] 43 | ) 44 | ) 45 | try: 46 | chat = int(chat) 47 | except: 48 | chat = chat 49 | await index_files_to_db(int(lst_msg_id), chat, msg, bot) 50 | 51 | 52 | @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) 53 | async def send_for_index(bot, message): 54 | if message.text: 55 | regex = re.compile("(https://)?(t\.me/|telegram\.me/|telegram\.dog/)(c/)?(\d+|[a-zA-Z_0-9]+)/(\d+)$") 56 | match = regex.match(message.text) 57 | if not match: 58 | return await message.reply('Invalid link') 59 | chat_id = match.group(4) 60 | last_msg_id = int(match.group(5)) 61 | if chat_id.isnumeric(): 62 | chat_id = int(("-100" + chat_id)) 63 | elif message.forward_from_chat.type == enums.ChatType.CHANNEL: 64 | last_msg_id = message.forward_from_message_id 65 | chat_id = message.forward_from_chat.username or message.forward_from_chat.id 66 | else: 67 | return 68 | try: 69 | await bot.get_chat(chat_id) 70 | except ChannelInvalid: 71 | return await message.reply('This may be a private channel / group. Make me an admin over there to index the files.') 72 | except (UsernameInvalid, UsernameNotModified): 73 | return await message.reply('Invalid Link specified.') 74 | except Exception as e: 75 | logger.exception(e) 76 | return await message.reply(f'Errors - {e}') 77 | try: 78 | k = await bot.get_messages(chat_id, last_msg_id) 79 | except: 80 | return await message.reply('Make Sure That Iam An Admin In The Channel, if channel is private') 81 | if k.empty: 82 | return await message.reply('This may be group and iam not a admin of the group.') 83 | 84 | if message.from_user.id in ADMINS: 85 | buttons = [ 86 | [ 87 | InlineKeyboardButton('Yes', 88 | callback_data=f'index#accept#{chat_id}#{last_msg_id}#{message.from_user.id}') 89 | ], 90 | [ 91 | InlineKeyboardButton('close', callback_data='close_data'), 92 | ] 93 | ] 94 | reply_markup = InlineKeyboardMarkup(buttons) 95 | return await message.reply( 96 | f'Do you Want To Index This Channel/ Group ?\n\nChat ID/ Username: {chat_id}\nLast Message ID: {last_msg_id}', 97 | reply_markup=reply_markup) 98 | 99 | if type(chat_id) is int: 100 | try: 101 | link = (await bot.create_chat_invite_link(chat_id)).invite_link 102 | except ChatAdminRequired: 103 | return await message.reply('Make sure iam an admin in the chat and have permission to invite users.') 104 | else: 105 | link = f"@{message.forward_from_chat.username}" 106 | buttons = [ 107 | [ 108 | InlineKeyboardButton('Accept Index', 109 | callback_data=f'index#accept#{chat_id}#{last_msg_id}#{message.from_user.id}') 110 | ], 111 | [ 112 | InlineKeyboardButton('Reject Index', 113 | callback_data=f'index#reject#{chat_id}#{message.id}#{message.from_user.id}'), 114 | ] 115 | ] 116 | reply_markup = InlineKeyboardMarkup(buttons) 117 | await bot.send_message(LOG_CHANNEL, 118 | f'#IndexRequest\n\nBy : {message.from_user.mention} ({message.from_user.id})\nChat ID/ Username - {chat_id}\nLast Message ID - {last_msg_id}\nInviteLink - {link}', 119 | reply_markup=reply_markup) 120 | await message.reply('ThankYou For the Contribution, Wait For My Moderators to verify the files.') 121 | 122 | 123 | @Client.on_message(filters.command('setskip') & filters.user(ADMINS)) 124 | async def set_skip_number(bot, message): 125 | if ' ' in message.text: 126 | _, skip = message.text.split(" ") 127 | try: 128 | skip = int(skip) 129 | except: 130 | return await message.reply("Skip number should be an integer.") 131 | await message.reply(f"Successfully set SKIP number as {skip}") 132 | temp.CURRENT = int(skip) 133 | else: 134 | await message.reply("Give me a skip number") 135 | 136 | 137 | async def index_files_to_db(lst_msg_id, chat, msg, bot): 138 | total_files = 0 139 | duplicate = 0 140 | errors = 0 141 | deleted = 0 142 | no_media = 0 143 | unsupported = 0 144 | async with lock: 145 | try: 146 | current = temp.CURRENT 147 | temp.CANCEL = False 148 | async for message in bot.iter_messages(chat, lst_msg_id, temp.CURRENT): 149 | if temp.CANCEL: 150 | await msg.edit(f"Successfully Cancelled!!\n\nSaved {total_files} files to dataBase!\nDuplicate Files Skipped: {duplicate}\nDeleted Messages Skipped: {deleted}\nNon-Media messages skipped: {no_media + unsupported}(Unsupported Media - `{unsupported}` )\nErrors Occurred: {errors}") 151 | break 152 | current += 1 153 | if current % 20 == 0: 154 | can = [[InlineKeyboardButton('Cancel', callback_data='index_cancel')]] 155 | reply = InlineKeyboardMarkup(can) 156 | await msg.edit_text( 157 | text=f"Total messages fetched: {current}\nTotal messages saved: {total_files}\nDuplicate Files Skipped: {duplicate}\nDeleted Messages Skipped: {deleted}\nNon-Media messages skipped: {no_media + unsupported}(Unsupported Media - `{unsupported}` )\nErrors Occurred: {errors}", 158 | reply_markup=reply) 159 | if message.empty: 160 | deleted += 1 161 | continue 162 | elif not message.media: 163 | no_media += 1 164 | continue 165 | elif message.media not in [enums.MessageMediaType.VIDEO, enums.MessageMediaType.AUDIO, enums.MessageMediaType.DOCUMENT]: 166 | unsupported += 1 167 | continue 168 | media = getattr(message, message.media.value, None) 169 | if not media: 170 | unsupported += 1 171 | continue 172 | media.file_type = message.media.value 173 | media.caption = message.caption 174 | aynav, vnay = await save_file(media) 175 | if aynav: 176 | total_files += 1 177 | elif vnay == 0: 178 | duplicate += 1 179 | elif vnay == 2: 180 | errors += 1 181 | except Exception as e: 182 | logger.exception(e) 183 | await msg.edit(f'Error: {e}') 184 | else: 185 | await msg.edit(f'Succesfully saved {total_files} to dataBase!\nDuplicate Files Skipped: {duplicate}\nDeleted Messages Skipped: {deleted}\nNon-Media messages skipped: {no_media + unsupported}(Unsupported Media - `{unsupported}` )\nErrors Occurred: {errors}') 186 | -------------------------------------------------------------------------------- /CYNITE/inline.py: -------------------------------------------------------------------------------- 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 | """Show search results for given inline query""" 25 | 26 | if not await inline_users(query): 27 | await query.answer(results=[], 28 | cache_time=0, 29 | switch_pm_text='okDa', 30 | switch_pm_parameter="hehe") 31 | return 32 | 33 | if AUTH_CHANNEL and not await is_subscribed(bot, query): 34 | await query.answer(results=[], 35 | cache_time=0, 36 | switch_pm_text='You have to subscribe my channel to use the bot', 37 | switch_pm_parameter="subscribe") 38 | return 39 | 40 | results = [] 41 | if '|' in query.query: 42 | string, file_type = query.query.split('|', maxsplit=1) 43 | string = string.strip() 44 | file_type = file_type.strip().lower() 45 | else: 46 | string = query.query.strip() 47 | file_type = None 48 | 49 | offset = int(query.offset or 0) 50 | reply_markup = get_reply_markup(query=string) 51 | files, next_offset, total = await get_search_results(string, 52 | file_type=file_type, 53 | max_results=10, 54 | offset=offset) 55 | 56 | for file in files: 57 | title=file.file_name 58 | size=get_size(file.file_size) 59 | f_caption=file.caption 60 | if CUSTOM_FILE_CAPTION: 61 | try: 62 | f_caption=CUSTOM_FILE_CAPTION.format(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) 63 | except Exception as e: 64 | logger.exception(e) 65 | f_caption=f_caption 66 | if f_caption is None: 67 | f_caption = f"{file.file_name}" 68 | results.append( 69 | InlineQueryResultCachedDocument( 70 | title=file.file_name, 71 | document_file_id=file.file_id, 72 | caption=f_caption, 73 | description=f'Size: {get_size(file.file_size)}\nType: {file.file_type}', 74 | reply_markup=reply_markup)) 75 | 76 | if results: 77 | switch_pm_text = f"{emoji.FILE_FOLDER} Results - {total}" 78 | if string: 79 | switch_pm_text += f" for {string}" 80 | try: 81 | await query.answer(results=results, 82 | is_personal = True, 83 | cache_time=cache_time, 84 | switch_pm_text=switch_pm_text, 85 | switch_pm_parameter="start", 86 | next_offset=str(next_offset)) 87 | except QueryIdInvalid: 88 | pass 89 | except Exception as e: 90 | logging.exception(str(e)) 91 | else: 92 | switch_pm_text = f'{emoji.CROSS_MARK} No results' 93 | if string: 94 | switch_pm_text += f' for "{string}"' 95 | 96 | await query.answer(results=[], 97 | is_personal = True, 98 | cache_time=cache_time, 99 | switch_pm_text=switch_pm_text, 100 | switch_pm_parameter="okay") 101 | 102 | 103 | def get_reply_markup(query): 104 | buttons = [ 105 | [ 106 | InlineKeyboardButton('Search again', switch_inline_query_current_chat=query) 107 | ] 108 | ] 109 | return InlineKeyboardMarkup(buttons) 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /CYNITE/misc.py: -------------------------------------------------------------------------------- 1 | import os 2 | from pyrogram import Client, filters, enums 3 | from pyrogram.errors.exceptions.bad_request_400 import UserNotParticipant, MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty 4 | from info import CYNITE_IMDB_TEMPLATE 5 | from utils import extract_user, get_file_id, get_poster, last_online 6 | import time 7 | from datetime import datetime 8 | from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery 9 | import logging 10 | logger = logging.getLogger(__name__) 11 | logger.setLevel(logging.ERROR) 12 | 13 | @Client.on_message(filters.command('id')) 14 | async def showid(client, message): 15 | chat_type = message.chat.type 16 | if chat_type == enums.ChatType.PRIVATE: 17 | user_id = message.chat.id 18 | first = message.from_user.first_name 19 | last = message.from_user.last_name or "" 20 | username = message.from_user.username 21 | dc_id = message.from_user.dc_id or "" 22 | await message.reply_text( 23 | f"➲ First Name: {first}\n➲ Last Name: {last}\n➲ Username: {username}\n➲ Telegram ID: {user_id}\n➲ Data Centre: {dc_id}", 24 | quote=True 25 | ) 26 | 27 | elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]: 28 | _id = "" 29 | _id += ( 30 | "➲ Chat ID: " 31 | f"{message.chat.id}\n" 32 | ) 33 | if message.reply_to_message: 34 | _id += ( 35 | "➲ User ID: " 36 | f"{message.from_user.id if message.from_user else 'Anonymous'}\n" 37 | "➲ Replied User ID: " 38 | f"{message.reply_to_message.from_user.id if message.reply_to_message.from_user else 'Anonymous'}\n" 39 | ) 40 | file_info = get_file_id(message.reply_to_message) 41 | else: 42 | _id += ( 43 | "➲ User ID: " 44 | f"{message.from_user.id if message.from_user else 'Anonymous'}\n" 45 | ) 46 | file_info = get_file_id(message) 47 | if file_info: 48 | _id += ( 49 | f"{file_info.message_type}: " 50 | f"{file_info.file_id}\n" 51 | ) 52 | await message.reply_text( 53 | _id, 54 | quote=True 55 | ) 56 | 57 | @Client.on_message(filters.command(["info"])) 58 | async def who_is(client, message): 59 | # https://github.com/SpEcHiDe/PyroGramBot/blob/master/pyrobot/plugins/admemes/whois.py#L19 60 | status_message = await message.reply_text( 61 | "`𝙿𝙻𝙴𝙰𝚂𝙴 𝚆𝙰𝙸𝚃 𝙱𝚁𝙾...`" 62 | ) 63 | await status_message.edit( 64 | "`𝙿𝙻𝙴𝙰𝚂𝙴 𝚆𝙰𝙸𝚃 𝙱𝚁𝙾....`" 65 | ) 66 | from_user = None 67 | from_user_id, _ = extract_user(message) 68 | try: 69 | from_user = await client.get_users(from_user_id) 70 | except Exception as error: 71 | await status_message.edit(str(error)) 72 | return 73 | if from_user is None: 74 | return await status_message.edit("no valid user_id / message specified") 75 | message_out_str = "" 76 | message_out_str += f"➲ First Name: {from_user.first_name}\n" 77 | last_name = from_user.last_name or "None" 78 | message_out_str += f"➲ Last Name: {last_name}\n" 79 | message_out_str += f"➲ Telegram ID: {from_user.id}\n" 80 | username = from_user.username or "None" 81 | dc_id = from_user.dc_id or "[User Doesn't Have A Valid DP]" 82 | message_out_str += f"➲ Data Centre: {dc_id}\n" 83 | message_out_str += f"➲ User Name: @{username}\n" 84 | message_out_str += f"➲ User 𝖫𝗂𝗇𝗄: Click Here\n" 85 | if message.chat.type in ((enums.ChatType.SUPERGROUP, enums.ChatType.CHANNEL)): 86 | try: 87 | chat_member_p = await message.chat.get_member(from_user.id) 88 | joined_date = ( 89 | chat_member_p.joined_date or datetime.now() 90 | ).strftime("%Y.%m.%d %H:%M:%S") 91 | message_out_str += ( 92 | "➲ Joined this Chat on: " 93 | f"{joined_date}" 94 | "\n" 95 | ) 96 | except UserNotParticipant: 97 | pass 98 | chat_photo = from_user.photo 99 | if chat_photo: 100 | local_user_photo = await client.download_media( 101 | message=chat_photo.big_file_id 102 | ) 103 | buttons = [[ 104 | InlineKeyboardButton('🔐 𝗖𝗟𝗢𝗦𝗘', callback_data='close_data') 105 | ]] 106 | reply_markup = InlineKeyboardMarkup(buttons) 107 | await message.reply_photo( 108 | photo=local_user_photo, 109 | quote=True, 110 | reply_markup=reply_markup, 111 | caption=message_out_str, 112 | parse_mode=enums.ParseMode.HTML, 113 | disable_notification=True 114 | ) 115 | os.remove(local_user_photo) 116 | else: 117 | buttons = [[ 118 | InlineKeyboardButton('🔐 𝗖𝗟𝗢𝗦𝗘', callback_data='close_data') 119 | ]] 120 | reply_markup = InlineKeyboardMarkup(buttons) 121 | await message.reply_text( 122 | text=message_out_str, 123 | reply_markup=reply_markup, 124 | quote=True, 125 | parse_mode=enums.ParseMode.HTML, 126 | disable_notification=True 127 | ) 128 | await status_message.delete() 129 | 130 | @Client.on_message(filters.command(["imdb", 'search'])) 131 | async def imdb_search(client, message): 132 | if ' ' in message.text: 133 | k = await message.reply('𝚂𝙴𝙰𝚁𝙲𝙷𝙸𝙽𝙶 𝙸𝙼𝙳𝙱') 134 | r, title = message.text.split(None, 1) 135 | movies = await get_poster(title, bulk=True) 136 | if not movies: 137 | return await message.reply("𝗡𝗢 𝗥𝗘𝗦𝗨𝗟𝗧𝗦 𝗙𝗢𝗨𝗡𝗗") 138 | btn = [ 139 | [ 140 | InlineKeyboardButton( 141 | text=f"{movie.get('title')} - {movie.get('year')}", 142 | callback_data=f"imdb#{movie.movieID}", 143 | ) 144 | ] 145 | for movie in movies 146 | ] 147 | await k.edit('𝗪𝗛𝗔𝗧 𝗜 𝗙𝗢𝗨𝗡𝗗 𝗢𝗡 𝗜𝗠𝗗𝗕 𝗔𝗥𝗘 シ︎', reply_markup=InlineKeyboardMarkup(btn)) 148 | else: 149 | await message.reply('𝗚𝗜𝗩𝗘 𝗠𝗘 𝗠𝗢𝗩𝗜𝗘 / 𝗦𝗘𝗥𝗜𝗘𝗦 𝗡𝗔𝗠𝗘 ☻︎') 150 | 151 | @Client.on_callback_query(filters.regex('^imdb')) 152 | async def imdb_callback(bot: Client, quer_y: CallbackQuery): 153 | i, movie = quer_y.data.split('#') 154 | imdb = await get_poster(query=movie, id=True) 155 | btn = [ 156 | [ 157 | InlineKeyboardButton( 158 | text=f"{imdb.get('title')}", 159 | url=imdb['url'], 160 | ) 161 | ] 162 | ] 163 | message = quer_y.message.reply_to_message or quer_y.message 164 | if imdb: 165 | caption = CYNITE_IMDB_TEMPLATE.format( 166 | query = imdb['title'], 167 | title = imdb['title'], 168 | votes = imdb['votes'], 169 | aka = imdb["aka"], 170 | seasons = imdb["seasons"], 171 | box_office = imdb['box_office'], 172 | localized_title = imdb['localized_title'], 173 | kind = imdb['kind'], 174 | imdb_id = imdb["imdb_id"], 175 | cast = imdb["cast"], 176 | runtime = imdb["runtime"], 177 | countries = imdb["countries"], 178 | certificates = imdb["certificates"], 179 | languages = imdb["languages"], 180 | director = imdb["director"], 181 | writer = imdb["writer"], 182 | producer = imdb["producer"], 183 | composer = imdb["composer"], 184 | cinematographer = imdb["cinematographer"], 185 | music_team = imdb["music_team"], 186 | distributors = imdb["distributors"], 187 | release_date = imdb['release_date'], 188 | year = imdb['year'], 189 | genres = imdb['genres'], 190 | poster = imdb['poster'], 191 | plot = imdb['plot'], 192 | rating = imdb['rating'], 193 | url = imdb['url'], 194 | **locals() 195 | ) 196 | else: 197 | caption = "No Results" 198 | if imdb.get('poster'): 199 | try: 200 | await quer_y.message.reply_photo(photo=imdb['poster'], caption=caption, reply_markup=InlineKeyboardMarkup(btn)) 201 | except (MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty): 202 | pic = imdb.get('poster') 203 | poster = pic.replace('.jpg', "._V1_UX360.jpg") 204 | await quer_y.message.reply_photo(photo=poster, caption=caption, reply_markup=InlineKeyboardMarkup(btn)) 205 | except Exception as e: 206 | logger.exception(e) 207 | await quer_y.message.reply(caption, reply_markup=InlineKeyboardMarkup(btn), disable_web_page_preview=False) 208 | await quer_y.message.delete() 209 | else: 210 | await quer_y.message.edit(caption, reply_markup=InlineKeyboardMarkup(btn), disable_web_page_preview=False) 211 | await quer_y.answer() 212 | 213 | 214 | 215 | -------------------------------------------------------------------------------- /CYNITE/p_ttishow.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import time 3 | import math 4 | import os 5 | import psutil 6 | from pyrogram import Client, filters, enums 7 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery 8 | from pyrogram.errors.exceptions.bad_request_400 import MessageTooLong, PeerIdInvalid 9 | from info import ADMINS, LOG_CHANNEL, SUPPORT_CHAT, MELCOW_NEW_USERS, CHNL_LNK, GRP_LNK, NEWGRP 10 | from database.users_chats_db import db 11 | from database.ia_filterdb import Media 12 | from utils import get_size, temp, get_settings 13 | from Script import script 14 | from pyrogram.errors import ChatAdminRequired 15 | 16 | """-----------------------------------------https://t.me/GetTGLink/4179 --------------------------------------""" 17 | BOT_START_TIME = time.time() 18 | 19 | @Client.on_message(filters.new_chat_members & filters.group) 20 | async def save_group(bot, message): 21 | r_j_check = [u.id for u in message.new_chat_members] 22 | if temp.ME in r_j_check: 23 | if not await db.get_chat(message.chat.id): 24 | total=await bot.get_chat_members_count(message.chat.id) 25 | r_j = message.from_user.mention if message.from_user else "Anonymous" 26 | await bot.send_message(LOG_CHANNEL, script.LOG_TEXT_G.format(message.chat.title, message.chat.id, total, r_j)) 27 | await db.add_chat(message.chat.id, message.chat.title) 28 | if message.chat.id in temp.BANNED_CHATS: 29 | # Inspired from a boat of a banana tree 30 | buttons = [[ 31 | InlineKeyboardButton('Sᴜᴘᴘᴏʀᴛ', url=f'https://t.me/{SUPPORT_CHAT}') 32 | ]] 33 | reply_markup=InlineKeyboardMarkup(buttons) 34 | k = await message.reply( 35 | text='🚫 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ᴜᴘᴘᴏʀᴛ..', 36 | reply_markup=reply_markup, 37 | ) 38 | 39 | try: 40 | await k.pin() 41 | except: 42 | pass 43 | await bot.leave_chat(message.chat.id) 44 | return 45 | buttons = [[ 46 | InlineKeyboardButton('ᴜᴘᴅᴀᴛᴇs', url=CHNL_LNK), 47 | InlineKeyboardButton('ʀᴇᴘᴏʀᴛ ʜᴇʀᴇ', url=f"https://t.me/CyniteSupport") 48 | ]] 49 | reply_markup=InlineKeyboardMarkup(buttons) 50 | await message.reply_photo( 51 | photo=NEWGRP, 52 | caption=f"ᴛʜᴀɴᴋs ᴛᴏ ᴀᴅᴅ ᴍᴇ ɪɴ ʏᴏᴜʀ ɢʀᴏᴜᴘ. {message.chat.title} ❣️\n\nɪs ᴀɴʏ ᴅᴏᴜʙᴛs ᴀʙᴏᴜᴛ ᴜsɪɴɢ ᴍᴇ ᴄʟɪᴄᴋ ʙᴇʟᴏᴡ ʙᴜᴛᴛᴏɴ 👇", 53 | reply_markup=reply_markup) 54 | else: 55 | settings = await get_settings(message.chat.id) 56 | if settings["welcome"]: 57 | for u in message.new_chat_members: 58 | buttons = [[ 59 | InlineKeyboardButton("ɢʀᴏᴜᴘ📌", url="https://t.me/cynitesupport") 60 | ]] 61 | if (temp.MELCOW).get('welcome') is not None: 62 | try: 63 | await (temp.MELCOW['welcome']).delete() 64 | except: 65 | pass 66 | temp.MELCOW['welcome'] = await message.reply_photo( 67 | photo="https://telegra.ph/file/5c586e00f34665267ab5b.jpg", 68 | caption=f"🔖 ʜᴇʟʟᴏ ᴍʏ ғʀɪᴇɴᴅ {u.mention},\nᴡᴇʟᴄᴏᴍᴇ ᴛᴏ {message.chat.title} !\n\nʀᴇᴀᴅ ɢʀᴏᴜᴘ ʀᴜʟᴇs ᴛᴏ ᴋɴᴏᴡ ᴍᴏʀᴇ...", 69 | reply_markup=InlineKeyboardMarkup(buttons)) 70 | await asyncio.sleep(60) 71 | await temp.MELCOW['welcome'].delete() 72 | 73 | @Client.on_message(filters.command('leave') & filters.user(ADMINS)) 74 | async def leave_a_chat(bot, message): 75 | if len(message.command) == 1: 76 | return await message.reply('Give me a chat id') 77 | chat = message.command[1] 78 | try: 79 | chat = int(chat) 80 | except: 81 | chat = chat 82 | try: 83 | buttons = [[ 84 | InlineKeyboardButton('Sᴜᴘᴘᴏʀᴛ', url=f'https://t.me/{SUPPORT_CHAT}') 85 | ]] 86 | reply_markup=InlineKeyboardMarkup(buttons) 87 | await bot.send_message( 88 | chat_id=chat, 89 | text='Hᴇʟʟᴏ Fʀɪᴇɴᴅs,\n\nMʏ Aᴅᴍɪɴs Hᴀs Tᴏʟᴅ Mᴇ Tᴏ Lᴇᴀᴠᴇ Fʀᴏᴍ Gʀᴏᴜᴘ Sᴏ I Gᴏ! Iғ Yᴏᴜ Wᴀɴɴᴀ Aᴅᴅ Mᴇ Aɢᴀɪɴ Cᴏɴᴛᴀᴄᴛ Mʏ Sᴜᴘᴘᴏʀᴛ Gʀᴏᴜᴘ.', 90 | reply_markup=reply_markup, 91 | ) 92 | 93 | await bot.leave_chat(chat) 94 | await message.reply(f"left the chat `{chat}`") 95 | except Exception as e: 96 | await message.reply(f'Error - {e}') 97 | 98 | @Client.on_message(filters.command('disable') & filters.user(ADMINS)) 99 | async def disable_chat(bot, message): 100 | if len(message.command) == 1: 101 | return await message.reply('Give me a chat id') 102 | r = message.text.split(None) 103 | if len(r) > 2: 104 | reason = message.text.split(None, 2)[2] 105 | chat = message.text.split(None, 2)[1] 106 | else: 107 | chat = message.command[1] 108 | reason = "No reason Provided" 109 | try: 110 | chat_ = int(chat) 111 | except: 112 | return await message.reply('Give Me A Valid Chat ID') 113 | cha_t = await db.get_chat(int(chat_)) 114 | if not cha_t: 115 | return await message.reply("Chat Not Found In DB") 116 | if cha_t['is_disabled']: 117 | return await message.reply(f"This chat is already disabled:\n\nReason- {cha_t['reason']} ") 118 | await db.disable_chat(int(chat_), reason) 119 | temp.BANNED_CHATS.append(int(chat_)) 120 | await message.reply('Chat Successfully Disabled') 121 | try: 122 | buttons = [[ 123 | InlineKeyboardButton('Sᴜᴘᴘᴏʀᴛ', url=f'https://t.me/{SUPPORT_CHAT}') 124 | ]] 125 | reply_markup=InlineKeyboardMarkup(buttons) 126 | await bot.send_message( 127 | chat_id=chat_, 128 | text=f'Hᴇʟʟᴏ Fʀɪᴇɴᴅs,\n\nMʏ Aᴅᴍɪɴs Hᴀs Tᴏʟᴅ Mᴇ Tᴏ Lᴇᴀᴠᴇ Fʀᴏᴍ Gʀᴏᴜᴘ Sᴏ I Gᴏ! Iғ Yᴏᴜ Wᴀɴɴᴀ Aᴅᴅ Mᴇ Aɢᴀɪɴ Cᴏɴᴛᴀᴄᴛ Mʏ Sᴜᴘᴘᴏʀᴛ Gʀᴏᴜᴘ.\n\nRᴇᴀsᴏɴ : {reason}', 129 | reply_markup=reply_markup) 130 | await bot.leave_chat(chat_) 131 | await bot.send_message(LOG_CHANNEL, script.BANG_LOG_TXT.format(chat_, reason, message.from_user.mention)) 132 | except Exception as e: 133 | await message.reply(f"Error - {e}") 134 | 135 | 136 | @Client.on_message(filters.command('enable') & filters.user(ADMINS)) 137 | async def re_enable_chat(bot, message): 138 | if len(message.command) == 1: 139 | return await message.reply('Give me a chat id') 140 | chat = message.command[1] 141 | try: 142 | chat_ = int(chat) 143 | except: 144 | return await message.reply('Give Me A Valid Chat ID') 145 | sts = await db.get_chat(int(chat)) 146 | if not sts: 147 | return await message.reply("Chat Not Found In DB !") 148 | if not sts.get('is_disabled'): 149 | return await message.reply('This chat is not yet disabled.') 150 | await db.re_enable_chat(int(chat_)) 151 | temp.BANNED_CHATS.remove(int(chat_)) 152 | await message.reply("Chat Successfully re-enabled") 153 | await bot.send_message(LOG_CHANNEL, script.UNBANG_LOG_TXT.format(chat_, message.from_user.mention)) 154 | 155 | 156 | @Client.on_message(filters.command('stats') & filters.user(ADMINS) & filters.incoming) 157 | async def get_ststs(bot, message): 158 | buttons = [[ 159 | InlineKeyboardButton('ᴜᴘᴅᴀᴛᴇꜱ', url=CHNL_LNK) 160 | ]] 161 | reply_markup = InlineKeyboardMarkup(buttons) 162 | kdbotz = await message.reply('Fetching stats..') 163 | uptime = time.strftime("%Hh %Mm %Ss", time.gmtime(time.time() - BOT_START_TIME)) 164 | ram = psutil.virtual_memory().percent 165 | cpu = psutil.cpu_percent() 166 | total_users = await db.total_users_count() 167 | totl_chats = await db.total_chat_count() 168 | files = await Media.count_documents() 169 | size = await db.get_db_size() 170 | free = 536870912 - size 171 | size = get_size(size) 172 | free = get_size(free) 173 | await kdbotz.edit_text( 174 | text=script.ADMIN_STATUS_TXT.format(uptime, ram, cpu, files, total_users, totl_chats, size, free), 175 | disable_web_page_preview=True, 176 | reply_markup=reply_markup, 177 | parse_mode=enums.ParseMode.HTML 178 | ) 179 | 180 | @Client.on_message(filters.command('invite') & filters.user(ADMINS)) 181 | async def gen_invite(bot, message): 182 | if len(message.command) == 1: 183 | return await message.reply('Give me a chat id') 184 | chat = message.command[1] 185 | try: 186 | chat = int(chat) 187 | except: 188 | return await message.reply('Give Me A Valid Chat ID') 189 | try: 190 | link = await bot.create_chat_invite_link(chat) 191 | except ChatAdminRequired: 192 | return await message.reply("Invite Link Generation Failed, Iam Not Having Sufficient Rights") 193 | except Exception as e: 194 | return await message.reply(f'Error {e}') 195 | await message.reply(f'Here is your Invite Link {link.invite_link}') 196 | 197 | @Client.on_message(filters.command('ban_user') & filters.user(ADMINS)) 198 | async def ban_a_user(bot, message): 199 | # https://t.me/GetTGLink/4185 200 | if len(message.command) == 1: 201 | return await message.reply('Give me a user id / username') 202 | r = message.text.split(None) 203 | if len(r) > 2: 204 | reason = message.text.split(None, 2)[2] 205 | chat = message.text.split(None, 2)[1] 206 | else: 207 | chat = message.command[1] 208 | reason = "No reason Provided" 209 | try: 210 | chat = int(chat) 211 | except: 212 | pass 213 | try: 214 | k = await bot.get_users(chat) 215 | except PeerIdInvalid: 216 | return await message.reply("This is an invalid user, make sure ia have met him before.") 217 | except IndexError: 218 | return await message.reply("This might be a channel, make sure its a user.") 219 | except Exception as e: 220 | return await message.reply(f'Error - {e}') 221 | else: 222 | jar = await db.get_ban_status(k.id) 223 | if jar['is_banned']: 224 | return await message.reply(f"{k.mention} is already banned\nReason: {jar['ban_reason']}") 225 | await db.ban_user(k.id, reason) 226 | temp.BANNED_USERS.append(k.id) 227 | await message.reply(f"Successfully banned {k.mention}") 228 | await bot.send_message(LOG_CHANNEL, script.BANP_LOG_TXT.format(message.from_user.mention, k.mention, reason)) 229 | 230 | 231 | 232 | @Client.on_message(filters.command('unban_user') & filters.user(ADMINS)) 233 | async def unban_a_user(bot, message): 234 | if len(message.command) == 1: 235 | return await message.reply('Give me a user id / username') 236 | r = message.text.split(None) 237 | if len(r) > 2: 238 | reason = message.text.split(None, 2)[2] 239 | chat = message.text.split(None, 2)[1] 240 | else: 241 | chat = message.command[1] 242 | reason = "No reason Provided" 243 | try: 244 | chat = int(chat) 245 | except: 246 | pass 247 | try: 248 | k = await bot.get_users(chat) 249 | except PeerIdInvalid: 250 | return await message.reply("This is an invalid user, make sure ia have met him before.") 251 | except IndexError: 252 | return await message.reply("This might be a channel, make sure its a user.") 253 | except Exception as e: 254 | return await message.reply(f'Error - {e}') 255 | else: 256 | jar = await db.get_ban_status(k.id) 257 | if not jar['is_banned']: 258 | return await message.reply(f"{k.mention} is not yet banned.") 259 | await db.remove_ban(k.id) 260 | temp.BANNED_USERS.remove(k.id) 261 | await message.reply(f"Successfully unbanned {k.mention}") 262 | await bot.send_message(LOG_CHANNEL, script.UNBANP_LOG_TXT.format(message.from_user.mention, k.mention)) 263 | 264 | 265 | 266 | @Client.on_message(filters.command('users') & filters.user(ADMINS)) 267 | async def list_users(bot, message): 268 | # https://t.me/GetTGLink/4184 269 | raju = await message.reply('Getting List Of Users') 270 | users = await db.get_all_users() 271 | out = "Users Saved In DB Are:\n\n" 272 | async for user in users: 273 | out += f"{user['name']}" 274 | if user['ban_status']['is_banned']: 275 | out += '( Banned User )' 276 | out += '\n' 277 | try: 278 | await raju.edit_text(out) 279 | except MessageTooLong: 280 | with open('users.txt', 'w+') as outfile: 281 | outfile.write(out) 282 | await message.reply_document('users.txt', caption="List Of Users") 283 | 284 | @Client.on_message(filters.command('chats') & filters.user(ADMINS)) 285 | async def list_chats(bot, message): 286 | raju = await message.reply('Getting List Of chats') 287 | chats = await db.get_all_chats() 288 | out = "Chats Saved In DB Are:\n\n" 289 | async for chat in chats: 290 | out += f"**Title:** `{chat['title']}`\n**- ID:** `{chat['id']}`" 291 | if chat['chat_status']['is_disabled']: 292 | out += '( Disabled Chat )' 293 | out += '\n' 294 | try: 295 | await raju.edit_text(out) 296 | except MessageTooLong: 297 | with open('chats.txt', 'w+') as outfile: 298 | outfile.write(out) 299 | await message.reply_document('chats.txt', caption="List Of Chats") 300 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.8-slim-buster 2 | 3 | RUN apt update && apt upgrade -y 4 | RUN apt install git -y 5 | COPY requirements.txt /requirements.txt 6 | 7 | RUN cd / 8 | RUN pip3 install -U pip && pip3 install -U -r requirements.txt 9 | RUN mkdir /Auto-Filter-V5 10 | WORKDIR /Auto-Filter-V5 11 | COPY start.sh /start.sh 12 | CMD ["/bin/bash", "/start.sh"] 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: python3 bot.py 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Typing SVG](https://readme-typing-svg.herokuapp.com/?lines=MOVIE+SEARCH+BOT+!;CREATED+BY+TECHNICAL+CYNITE!;A+ADVANCE+BOT+WITH+COOL+FEATURES!) 2 |

3 | 4 |

5 |

6 | Auto-Filter-V5 7 |

8 | 9 | # Admin Commands 10 | - [x] /logs - ᴛᴏ ɢᴇᴛ ᴛʜᴇ ʀᴇᴄᴇɴᴛ ᴇʀʀᴏʀꜱ. 11 | 12 | - [x] /stats - ᴛᴏ ɢᴇᴛ ꜱᴛᴀᴛᴜꜱ ᴏꜰ ꜰɪʟᴇꜱ ɪɴ ᴅʙ. 13 | 14 | - [x] /delete - ᴛᴏ ᴅᴇʟᴇᴛᴇ ᴀ ꜱᴘᴇᴄɪꜰɪᴄ ꜰɪʟᴇ ꜰʀᴏᴍ ᴅʙ. 15 | 16 | - [x] /deleteall - ᴛᴏ ᴅᴇʟᴇᴛᴇ ᴀʟʟ ꜰɪʟᴇs ꜰʀᴏᴍ ᴅʙ. 17 | 18 | - [x] /users - ᴛᴏ ɢᴇᴛ ʟɪꜱᴛ ᴏꜰ ᴍʏ ᴜꜱᴇʀꜱ ᴀɴᴅ ɪᴅꜱ. 19 | 20 | - [x] /chats - ᴛᴏ ɢᴇᴛ ʟɪꜱᴛ ᴏꜰ ᴍʏ ᴄʜᴀᴛꜱ ᴀɴᴅ ɪᴅꜱ 21 | 22 | - [x] /channel - ᴛᴏ ɢᴇᴛ ʟɪꜱᴛ ᴏꜰ ᴛᴏᴛᴀʟ ᴄᴏɴɴᴇᴄᴛᴇᴅ ᴄʜᴀɴɴᴇʟꜱ. 23 | 24 | - [x] /leave - ᴛᴏ ʟᴇᴀᴠᴇ ꜰʀᴏᴍ ᴀ ᴄʜᴀᴛ. 25 | 26 | - [x] /disable - ᴛᴏ ᴅɪꜱᴀʙʟᴇ ᴀ ᴄʜᴀᴛ. 27 | 28 | - [x] /invite - Tᴏ ɢᴇᴛ ᴛʜᴇ ɪɴᴠɪᴛᴇ ʟɪɴᴋ ᴏғ ᴀɴʏ ᴄʜᴀᴛ ᴡʜᴇʀᴇ ᴛʜᴇ ʙᴏᴛ ɪs ᴀᴅᴍɪɴ. 29 | 30 | - [x] /ban_user - ᴛᴏ ʙᴀɴ ᴀ ᴜꜱᴇʀ. 31 | 32 | - [x] /unban_user - ᴛᴏ ᴜɴʙᴀɴ ᴀ ᴜꜱᴇʀ. 33 | 34 | - [x] /restart - Tᴏ Rᴇsᴛᴀʀᴛ ᴀ Bᴏᴛ 35 | 36 | - [x] /usend - Tᴏ Sᴇɴᴅ ᴀ Mᴇssɢᴀᴇ ᴛᴏ Pᴇʀᴛɪᴄᴜʟᴀʀ Usᴇʀ 37 | 38 | - [x] /gsend - Tᴏ Sᴇɴᴅ ᴀ Mᴇssᴀɢᴇ ᴛᴏ Pᴇʀᴛɪᴄᴜʟᴀʀ Cʜᴀᴛ 39 | 40 | - [x] /broadcast - ᴛᴏ ʙʀᴏᴀᴅᴄᴀꜱᴛ ᴀ ᴍᴇꜱꜱᴀɢᴇ ᴛᴏ ᴀʟʟ ᴜꜱᴇʀꜱ 41 | 42 | - [x] /group_broadcast - ᴛᴏ ʙʀᴏᴀᴅᴄᴀsᴛ ᴀ ᴍᴇssᴀɢᴇ ᴛᴏ ᴀʟʟ ᴄᴏɴɴᴇᴄᴛᴇᴅ ɢʀᴏᴜᴘs 43 | 44 | - [x] /status - ᴛᴏ ɢᴇᴛ sᴛᴀᴛᴜs ᴏғ sᴇʀᴠᴇʀ 45 | 46 | - [x] /gfilter - ᴛᴏ ᴀᴅᴅ ɢʟᴏʙᴀʟ ғɪʟᴛᴇʀs 47 | 48 | - [x] /gfilters - ᴛᴏ ᴠɪᴇᴡ ʟɪsᴛ ᴏғ ᴀʟʟ ɢʟᴏʙᴀʟ ғɪʟᴛᴇʀs 49 | 50 | - [x] /delg - ᴛᴏ ᴅᴇʟᴇᴛᴇ ᴀ sᴘᴇᴄɪғɪᴄ ɢʟᴏʙᴀʟ ғɪʟᴛᴇʀ 51 | 52 | ## TG Bot [@CyniteBackup](t.me/CyniteBackup) 53 | 54 | ## Credits 55 | 56 | * [![Kd Bots](https://img.shields.io/static/v1?label=KDBotz&message=Telegram&color=critical)](https://t.me/KD_Botz) 57 | * [![Contact](https://img.shields.io/static/v1?label=Contact&message=On+Telegram&color=critical)](https://t.me/Cynitesupport) 58 | 59 | ## Deploy 60 | 61 | [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/cyniteofficial/Auto-Filter-V5) 62 | -------------------------------------------------------------------------------- /Script.py: -------------------------------------------------------------------------------- 1 | class script(object): 2 | START_TXT = """ʜᴇʟʟᴏ {} 3 | 4 | ɪ ᴄᴀɴ ᴘʀᴏᴠɪᴅᴇ ᴍᴏᴠɪᴇs ᴀɴᴅ sᴇʀɪᴇs, 5 | ᴊᴜsᴛ ᴀᴅᴅ ᴍᴇ ᴛᴏ ʏᴏᴜʀ ɢʀᴏᴜᴘ ᴀɴᴅ ᴇɴᴊᴏʏ. 6 | ɪ ᴡᴏʀᴋ ᴏɴ ʙᴏᴛʜ ɢʀᴏᴜᴘ ᴀɴᴅ ᴘᴍ.""" 7 | 8 | HELP_TXT = """Hᴇʏ {} 9 | 10 | Hᴇʀᴇ Is Tʜᴇ Hᴇʟᴘ Fᴏʀ Mʏ Cᴏᴍᴍᴀɴᴅs.""" 11 | 12 | ABOUT_TXT = """✯ Mʏ Nᴀᴍᴇ : {} 13 | 14 | ✯ Cʀᴇᴀᴛᴏʀ : ☢ Cynite ☢ 15 | 16 | ✯ Uᴘᴅᴀᴛᴇs : Cynite Updates 👾 17 | 18 | ✯ Bᴜɪʟᴅ Sᴛᴀᴛᴜs : ᴠ2.0.62 [Sᴛᴀʙʟᴇ]""" 19 | 20 | SOURCE_TXT =""" 21 | Tʜɪꜱ Bᴏᴛ Iꜱ Aɴ Oᴘᴇɴ Sᴏᴜʀᴄᴇ Pʀᴏᴊᴇᴄᴛ. 22 | 23 | - Sᴏᴜʀᴄᴇ - Watch Tutorial 24 | """ 25 | 26 | MANUELFILTER_TXT = """ʜᴇʟᴘ: ꜰɪʟᴛᴇʀꜱ 27 | - ꜰɪʟᴛᴇʀ ɪꜱ ᴀ ꜰᴇᴀᴛᴜʀᴇ ᴡᴇʀᴇ ᴜꜱᴇʀꜱ ᴄᴀɴ ꜱᴇᴛ ᴀᴜᴛᴏᴍᴀᴛᴇᴅ ʀᴇᴘʟɪᴇꜱ ꜰᴏʀ ᴀ ᴘᴀʀᴛɪᴄᴜʟᴀʀ ᴋᴇʏᴡᴏʀᴅ ᴀɴᴅ ɪ ᴡɪʟʟ ʀᴇꜱᴘᴏɴᴅ ᴡʜᴇɴᴇᴠᴇʀ ᴀ ᴋᴇʏᴡᴏʀᴅ ɪꜱ ꜰᴏᴜɴᴅ ɪɴ ᴛʜᴇ ᴍᴇꜱꜱᴀɢᴇ 28 | Nᴏᴛᴇ: 29 | 1. ᴛʜɪꜱ ʙᴏᴛ ꜱʜᴏᴜʟᴅ ʜᴀᴠᴇ ᴀᴅᴍɪɴ ᴘʀɪᴠɪʟᴇɢᴇ. 30 | 2. ᴏɴʟʏ ᴀᴅᴍɪɴꜱ ᴄᴀɴ ᴀᴅᴅ ꜰɪʟᴛᴇʀꜱ ɪɴ ᴀ ᴄʜᴀᴛ. 31 | 3. ᴀʟᴇʀᴛ ʙᴜᴛᴛᴏɴꜱ ʜᴀᴠᴇ ᴀ ʟɪᴍɪᴛ ᴏꜰ 64 ᴄʜᴀʀᴀᴄᴛᴇʀꜱ. 32 | 33 | Cᴏᴍᴍᴀɴᴅs Aɴᴅ Usᴀɢᴇ: 34 | • /filter - ᴀᴅᴅ ᴀ ꜰɪʟᴛᴇʀ ɪɴ ᴀ ᴄʜᴀᴛ 35 | • /filters - ʟɪꜱᴛ ᴀʟʟ ᴛʜᴇ ꜰɪʟᴛᴇʀꜱ ᴏꜰ ᴀ ᴄʜᴀᴛ 36 | • /del - ᴅᴇʟᴇᴛᴇ ᴀ ꜱᴘᴇᴄɪꜰɪᴄ ꜰɪʟᴛᴇʀ ɪɴ ᴀ ᴄʜᴀᴛ 37 | • /delall - ᴅᴇʟᴇᴛᴇ ᴛʜᴇ ᴡʜᴏʟᴇ ꜰɪʟᴛᴇʀꜱ ɪɴ ᴀ ᴄʜᴀᴛ (ᴄʜᴀᴛ ᴏᴡɴᴇʀ ᴏɴʟʏ) 38 | 39 | ~ Aᴅᴅ ᴛʜᴇ ʙᴏᴛ ᴀs ᴀᴅᴍɪɴ ᴏɴ ʏᴏᴜʀ ɢʀᴏᴜᴘ. 40 | ~ Usᴇ /connect ᴀɴᴅ ᴄᴏɴɴᴇᴄᴛ ʏᴏᴜʀ ɢʀᴏᴜᴘ ᴛᴏ ᴛʜᴇ ʙᴏᴛ. 41 | ~ Usᴇ /settings ᴏɴ ʙᴏᴛ's PM ᴀɴᴅ ᴛᴜʀɴ ᴏɴ/ᴏғғ Aᴜᴛᴏ Dᴇʟᴇᴛᴇ & Mᴀɴᴜᴀʟ Fɪʟᴛᴇʀs ᴏɴ ᴛʜᴇ sᴇᴛᴛɪɴɢs ᴍᴇɴᴜ.""" 42 | 43 | BUTTON_TXT = """ʜᴇʟᴘ: ʙᴜᴛᴛᴏɴꜱ 44 | 45 | - ᴛʜɪꜱ ʙᴏᴛ ꜱᴜᴘᴘᴏʀᴛꜱ ʙᴏᴛʜ ᴜʀʟ ᴀɴᴅ ᴀʟᴇʀᴛ ɪɴʟɪɴᴇ ʙᴜᴛᴛᴏɴꜱ. 46 | 47 | ɴᴏᴛᴇ: 48 | 1. ᴛᴇʟᴇɢʀᴀᴍ ᴡɪʟʟ ɴᴏᴛ ᴀʟʟᴏᴡꜱ ʏᴏᴜ ᴛᴏ ꜱᴇɴᴅ ʙᴜᴛᴛᴏɴꜱ ᴡɪᴛʜᴏᴜᴛ ᴀɴʏ ᴄᴏɴᴛᴇɴᴛ, ꜱᴏ ᴄᴏɴᴛᴇɴᴛ ɪꜱ ᴍᴀɴᴅᴀᴛᴏʀʏ. 49 | 2. ᴛʜɪꜱ ʙᴏᴛ ꜱᴜᴘᴘᴏʀᴛꜱ ʙᴜᴛᴛᴏɴꜱ ᴡɪᴛʜ ᴀɴʏ ᴛᴇʟᴇɢʀᴀᴍ ᴍᴇᴅɪᴀ ᴛʏᴘᴇ. 50 | 3. ʙᴜᴛᴛᴏɴꜱ ꜱʜᴏᴜʟᴅ ʙᴇ ᴘʀᴏᴘᴇʀʟʏ ᴘᴀʀꜱᴇᴅ ᴀꜱ ᴍᴀʀᴋᴅᴏᴡɴ ꜰᴏʀᴍᴀᴛ 51 | 52 | ᴜʀʟ ʙᴜᴛᴛᴏɴꜱ: 53 | [Button Text](buttonurl:https://t.me/CyniteBackup) 54 | 55 | ᴀʟᴇʀᴛ ʙᴜᴛᴛᴏɴꜱ: 56 | [Button Text](buttonalert:ᴛʜɪꜱ ɪꜱ ᴀɴ ᴀʟᴇʀᴛ ᴍᴇꜱꜱᴀɢᴇ)""" 57 | 58 | AUTOFILTER_TXT = """ʜᴇʟᴘ: ᴀᴜᴛᴏ ꜰɪʟᴛᴇʀ 59 | 60 | Nᴏᴛᴇ: Fɪʟᴇ Iɴᴅᴇx 61 | 1. ᴍᴀᴋᴇ ᴍᴇ ᴛʜᴇ ᴀᴅᴍɪɴ ᴏꜰ ʏᴏᴜʀ ᴄʜᴀɴɴᴇʟ ɪꜰ ɪᴛ'ꜱ ᴘʀɪᴠᴀᴛᴇ. 62 | 2. ᴍᴀᴋᴇ ꜱᴜʀᴇ ᴛʜᴀᴛ ʏᴏᴜʀ ᴄʜᴀɴɴᴇʟ ᴅᴏᴇꜱ ɴᴏᴛ ᴄᴏɴᴛᴀɪɴꜱ ᴄᴀᴍʀɪᴘꜱ, ᴘᴏʀɴ ᴀɴᴅ ꜰᴀᴋᴇ ꜰɪʟᴇꜱ. 63 | 3. ꜰᴏʀᴡᴀʀᴅ ᴛʜᴇ ʟᴀꜱᴛ ᴍᴇꜱꜱᴀɢᴇ ᴛᴏ ᴍᴇ ᴡɪᴛʜ Qᴜᴏᴛᴇꜱ. ɪ'ʟʟ ᴀᴅᴅ ᴀʟʟ ᴛʜᴇ ꜰɪʟᴇꜱ ɪɴ ᴛʜᴀᴛ ᴄʜᴀɴɴᴇʟ ᴛᴏ ᴍʏ ᴅʙ. 64 | 65 | Nᴏᴛᴇ: AᴜᴛᴏFɪʟᴛᴇʀ 66 | 1. Aᴅᴅ ᴛʜᴇ ʙᴏᴛ ᴀs ᴀᴅᴍɪɴ ᴏɴ ʏᴏᴜʀ ɢʀᴏᴜᴘ. 67 | 2. Usᴇ /connect ᴀɴᴅ ᴄᴏɴɴᴇᴄᴛ ʏᴏᴜʀ ɢʀᴏᴜᴘ ᴛᴏ ᴛʜᴇ ʙᴏᴛ. 68 | 3. Usᴇ /settings ᴏɴ ʙᴏᴛ's PM ᴀɴᴅ ᴛᴜʀɴ ᴏɴ/ᴏғғ AᴜᴛᴏFɪʟᴛᴇʀ & Aᴜᴛᴏ Dᴇʟᴇᴛᴇ ᴏɴ ᴛʜᴇ sᴇᴛᴛɪɴɢs ᴍᴇɴᴜ. 69 | 4. Usᴇ /set_template ᴛᴏ sᴇᴛ ʏᴘᴜʀ ᴄᴜsᴛᴏɴ ɪᴍᴅʙ ᴛᴇᴍᴘʟᴀᴛᴇ""" 70 | 71 | CONNECTION_TXT = """ʜᴇʟᴘ: ᴄᴏɴɴᴇᴄᴛɪᴏɴꜱ 72 | 73 | - ᴜꜱᴇᴅ ᴛᴏ ᴄᴏɴɴᴇᴄᴛ ʙᴏᴛ ᴛᴏ ᴘᴍ ꜰᴏʀ ᴍᴀɴᴀɢɪɴɢ ꜰɪʟᴛᴇʀꜱ 74 | - ɪᴛ ʜᴇʟᴘꜱ ᴛᴏ ᴀᴠᴏɪᴅ ꜱᴘᴀᴍᴍɪɴɢ ɪɴ ɢʀᴏᴜᴘꜱ. 75 | 76 | ɴᴏᴛᴇ: 77 | 1. ᴏɴʟʏ ᴀᴅᴍɪɴꜱ ᴄᴀɴ ᴀᴅᴅ ᴀ ᴄᴏɴɴᴇᴄᴛɪᴏɴ. 78 | 2. ꜱᴇɴᴅ /connect ꜰᴏʀ ᴄᴏɴɴᴇᴄᴛɪɴɢ ᴍᴇ ᴛᴏ ʏᴏᴜʀ ᴘᴍ 79 | 80 | Cᴏᴍᴍᴀɴᴅs Aɴᴅ Usᴀɢᴇ: 81 | • /connect - ᴄᴏɴɴᴇᴄᴛ ᴀ ᴘᴀʀᴛɪᴄᴜʟᴀʀ ᴄʜᴀᴛ ᴛᴏ ʏᴏᴜʀ ᴘᴍ 82 | • /disconnect - ᴅɪꜱᴄᴏɴɴᴇᴄᴛ ꜰʀᴏᴍ ᴀ ᴄʜᴀᴛ 83 | • /connections - ʟɪꜱᴛ ᴀʟʟ ʏᴏᴜʀ ᴄᴏɴɴᴇᴄᴛɪᴏɴꜱ""" 84 | 85 | ADMIN_TXT = """ 86 | Tʜɪs Mᴏᴅᴜʟᴇ Oɴʟʏ Wᴏʀᴋs Fᴏʀ Mʏ Aᴅᴍɪɴs 87 | 88 | • /logs - ᴛᴏ ɢᴇᴛ ᴛʜᴇ ʀᴇᴄᴇɴᴛ ᴇʀʀᴏʀꜱ 89 | • /stats - ᴛᴏ ɢᴇᴛ ꜱᴛᴀᴛᴜꜱ ᴏꜰ ꜰɪʟᴇꜱ ɪɴ ᴅʙ. 90 | • /delete - ᴛᴏ ᴅᴇʟᴇᴛᴇ ᴀ ꜱᴘᴇᴄɪꜰɪᴄ ꜰɪʟᴇ ꜰʀᴏᴍ ᴅʙ. 91 | • /deleteall - ᴛᴏ ᴅᴇʟᴇᴛᴇ ᴀʟʟ ꜰɪʟᴇs ꜰʀᴏᴍ ᴅʙ. 92 | • /users - ᴛᴏ ɢᴇᴛ ʟɪꜱᴛ ᴏꜰ ᴍʏ ᴜꜱᴇʀꜱ ᴀɴᴅ ɪᴅꜱ. 93 | • /chats - ᴛᴏ ɢᴇᴛ ʟɪꜱᴛ ᴏꜰ ᴍʏ ᴄʜᴀᴛꜱ ᴀɴᴅ ɪᴅꜱ 94 | • /channel - ᴛᴏ ɢᴇᴛ ʟɪꜱᴛ ᴏꜰ ᴛᴏᴛᴀʟ ᴄᴏɴɴᴇᴄᴛᴇᴅ ᴄʜᴀɴɴᴇʟꜱ 95 | • /setskip - Tᴏ sᴋɪᴘ ɴᴜᴍʙᴇʀ ᴏғ ᴍᴇssᴀɢᴇs ᴡʜᴇɴ ɪɴᴅᴇxɪɴɢ ғɪʟᴇs. 96 | • /leave - ᴛᴏ ʟᴇᴀᴠᴇ ꜰʀᴏᴍ ᴀ ᴄʜᴀᴛ. 97 | • /disable - ᴛᴏ ᴅɪꜱᴀʙʟᴇ ᴀ ᴄʜᴀᴛ. 98 | • /invite - Tᴏ ɢᴇᴛ ᴛʜᴇ ɪɴᴠɪᴛᴇ ʟɪɴᴋ ᴏғ ᴀɴʏ ᴄʜᴀᴛ ᴡʜᴇʀᴇ ᴛʜᴇ ʙᴏᴛ ɪs ᴀᴅᴍɪɴ. 99 | • /ban_user - ᴛᴏ ʙᴀɴ ᴀ ᴜꜱᴇʀ. 100 | • /unban_user - ᴛᴏ ᴜɴʙᴀɴ ᴀ ᴜꜱᴇʀ. 101 | • /restart - Tᴏ Rᴇsᴛᴀʀᴛ ᴀ Bᴏᴛ 102 | • /usend - Tᴏ Sᴇɴᴅ ᴀ Mᴇssɢᴀᴇ ᴛᴏ Pᴇʀᴛɪᴄᴜʟᴀʀ Usᴇʀ 103 | • /gsend - Tᴏ Sᴇɴᴅ ᴀ Mᴇssᴀɢᴇ ᴛᴏ Pᴇʀᴛɪᴄᴜʟᴀʀ Cʜᴀᴛ 104 | • /broadcast - ᴛᴏ ʙʀᴏᴀᴅᴄᴀꜱᴛ ᴀ ᴍᴇꜱꜱᴀɢᴇ ᴛᴏ ᴀʟʟ ᴜꜱᴇʀꜱ 105 | • /group_broadcast - ᴛᴏ ʙʀᴏᴀᴅᴄᴀsᴛ ᴀ ᴍᴇssᴀɢᴇ ᴛᴏ ᴀʟʟ ᴄᴏɴɴᴇᴄᴛᴇᴅ ɢʀᴏᴜᴘs 106 | • /status - ᴛᴏ ɢᴇᴛ sᴛᴀᴛᴜs ᴏғ sᴇʀᴠᴇʀ 107 | • /gfilter - ᴛᴏ ᴀᴅᴅ ɢʟᴏʙᴀʟ ғɪʟᴛᴇʀs 108 | • /gfilters - ᴛᴏ ᴠɪᴇᴡ ʟɪsᴛ ᴏғ ᴀʟʟ ɢʟᴏʙᴀʟ ғɪʟᴛᴇʀs 109 | • /delg - ᴛᴏ ᴅᴇʟᴇᴛᴇ ᴀ sᴘᴇᴄɪғɪᴄ ɢʟᴏʙᴀʟ ғɪʟᴛᴇʀ""" 110 | 111 | STATUS_TXT = """📂 ғɪʟᴇs sᴀᴠᴇᴅ: {} 112 | 👤 ᴜsᴇʀs: {} 113 | 👥 ɢʀᴏᴜᴘs: {} 114 | 📉 ᴏᴄᴄᴜᴘɪᴇᴅ: {} 115 | 116 | ~ Maintained by Cynite""" 117 | 118 | ADMIN_STATUS_TXT = """⍟────[ ʙᴏᴛ sᴛᴀᴛᴜ𝗌 ]────⍟ 119 | 120 | ⏳ ʙᴏᴛ ᴜᴘᴛɪᴍᴇ: {} 121 | 122 | ☣️ ᴄᴘᴜ: {}% 123 | 124 | ☢️ ʀᴀᴍ: {}% 125 | 126 | 📊 ғɪʟᴇs sᴀᴠᴇᴅ: {} 127 | 128 | 👤 ᴜsᴇʀs: {} 129 | 130 | 👥 ɢʀᴏᴜᴘs: {} 131 | 132 | ♻️ ᴛᴏᴛᴀʟ: 512 MB 133 | 134 | 🉐 ᴏᴄᴄᴜᴘɪᴇᴅ: {} 135 | 136 | 🆓 ғʀᴇᴇ: {} 137 | 138 | ⍟────[ @CyniteBackup ]─────⍟""" 139 | 140 | LOG_TEXT_G = """#NewGroup 141 | 142 | Gʀᴏᴜᴘ = {} ({}) 143 | 144 | Tᴏᴛᴀʟ Mᴇᴍʙᴇʀs = {} 145 | 146 | Aᴅᴅᴇᴅ Bʏ - {} 147 | """ 148 | LOG_TEXT_P = """#NewUser 149 | 150 | ID - {} 151 | 152 | Nᴀᴍᴇ - {} 153 | """ 154 | ALRT_TXT = """⚠️ 𝖧ᴇʏ ! 155 | 156 | 𝖲ᴇᴀʀᴄʜ 𝖸ᴏᴜʀ 𝖮ᴡɴ 𝖥ɪʟᴇ, 157 | 158 | 𝖣ᴏɴ'ᴛ 𝖢ʟɪᴄᴋ 𝖮ᴛʜᴇʀ𝗌 𝖱ᴇ𝗌ᴜʟᴛ𝗌 😬 159 | """ 160 | 161 | OLD_ALRT_TXT = """⚠️ 𝖧ᴇʏ ! 162 | 163 | 𝖸ᴏᴜ Aʀᴇ U𝗌ɪɴɢ Oɴᴇ Oғ Mʏ Oʟᴅ Mᴇ𝗌𝗌ᴀɢᴇ𝗌, 164 | 165 | Sᴇɴᴅ Tʜᴇ Rᴇǫᴜᴇ𝗌ᴛ Aɢᴀɪɴ 166 | """ 167 | 168 | CUDNT_FND = """sᴏʀʀʏ ɴᴏ ꜰɪʟᴇs ᴡᴇʀᴇ ꜰᴏᴜɴᴅ 169 | 170 | ᴄʜᴇᴄᴋ ʏᴏᴜʀ sᴘᴇʟʟɪɴɢ ɪɴ ɢᴏᴏɢʟᴇ ᴀɴᴅ ᴛʀʏ ᴀɢᴀɪɴ 171 | 172 | ʀᴇᴀᴅ ɪɴsᴛʀᴜᴄᴛɪᴏɴs ꜰᴏʀ ʙᴇᴛᴛᴇʀ ʀᴇsᴜʟᴛs ☟ 173 | """ 174 | 175 | I_CUDNT = """ 176 | Sᴏʀʀʏ 177 | 178 | I Cᴏᴜʟᴅ Nᴏᴛ Fɪɴᴅ Aɴʏᴛʜɪɴɢ Rᴇʟᴀᴛᴇᴅ Tᴏ Tʜᴀᴛ 179 | Pʟᴇᴀsᴇ Cʜᴇᴄᴋ Yᴏᴜʀ Sᴘᴇʟʟɪɴɢ 🤧 180 | """ 181 | 182 | I_CUD_NT = """ɪ ᴄᴏᴜʟᴅɴ'ᴛ ꜰɪɴᴅ ᴀɴʏ ᴍᴏᴠɪᴇ ʀᴇʟᴀᴛᴇᴅ ᴛᴏ {}. 183 | ᴘʟᴇᴀꜱᴇ ᴄʜᴇᴄᴋ ᴛʜᴇ ꜱᴘᴇʟʟɪɴɢ ᴏɴ ɢᴏᴏɢʟᴇ ᴏʀ ɪᴍᴅʙ... 184 | """ 185 | 186 | MVE_NT_FND = """ᴍᴏᴠɪᴇ ɴᴏᴛ ꜰᴏᴜɴᴅ ɪɴ ᴅᴀᴛᴀʙᴀꜱᴇ... 187 | """ 188 | 189 | TOP_ALRT_MSG = """Cʜᴇᴄᴋɪɴɢ Fᴏʀ Mᴏᴠɪᴇ Iɴ Dᴀᴛᴀʙᴀsᴇ... 190 | """ 191 | 192 | OWNER_INFO = """ 193 | ⍟───[ ᴏᴡɴᴇʀ ᴅᴇᴛᴀɪʟꜱ ]───⍟ 194 | 195 | • ꜰᴜʟʟ ɴᴀᴍᴇ:- Cynite 196 | ᴜsᴇʀɴᴀᴍᴇ:- @cynitesupport 197 | ᴘᴇʀᴍᴀɴᴇɴᴛ ᴅᴍ ʟɪɴᴋ:- Cynite 198 | """ 199 | 200 | CYNITE_IMDB = """ 201 | Cᴏᴍᴍᴀɴᴅs Aɴᴅ Usᴀɢᴇ: 202 | 203 | • /imdb - ɢᴇᴛ ᴛʜᴇ ꜰɪʟᴍ ɪɴꜰᴏʀᴍᴀᴛɪᴏɴ ꜰʀᴏᴍ ɪᴍᴅʙ ꜱᴏᴜʀᴄᴇ. 204 | • /search - ɢᴇᴛ ᴛʜᴇ ꜰɪʟᴍ ɪɴꜰᴏʀᴍᴀᴛɪᴏɴ ꜰʀᴏᴍ ᴠᴀʀɪᴏᴜꜱ ꜱᴏᴜʀᴄᴇꜱ. 205 | """ 206 | 207 | CYNITE_MISC = """ 208 | Cᴏᴍᴍᴀɴᴅs Aɴᴅ Usᴀɢᴇ: 209 | 210 | • /id - ɢᴇᴛ ɪᴅ ᴏꜰ ᴀ ꜱᴘᴇᴄɪꜰɪᴇᴅ ᴜꜱᴇʀ. 211 | • /info - ɢᴇᴛ ɪɴꜰᴏʀᴍᴀᴛɪᴏɴ ᴀʙᴏᴜᴛ ᴀ ᴜꜱᴇʀ. 212 | """ 213 | 214 | CYNITE_FILSTR = """ 215 | ⍟ Wᴇʟᴄᴏᴍᴇ Tᴏ Fɪʟᴇ Sᴛᴏʀᴇ Mᴏᴅᴜʟᴇ ⍟ 216 | 217 | » ᴀ ᴍᴏᴅᴜʟᴇ ᴛᴏ ɢᴇᴛ sʜᴀʀᴀʙʟᴇ ʟɪɴᴋ ғᴏʀ ᴀɴʏ ᴛᴇʟᴇɢʀᴀᴍ ᴍᴇᴅɪᴀ. 218 | 219 | Cᴏᴍᴍᴀɴᴅs Aɴᴅ Usᴀɢᴇ: 220 | 221 | • /link - ʀᴇᴘʟʏ ᴛᴏ ᴀɴʏ ᴛᴇʟᴇɢʀᴀᴍ ᴍᴇᴅɪᴀ. 222 | • /batch - ᴛᴏ ᴄʀᴇᴀᴛᴇ ʟɪɴᴋ ғᴏʀ ᴍᴜʟᴛɪᴘʟᴇ ᴍᴇᴅɪᴀ. 223 | 224 | Exᴀᴍᴘʟᴇ: 225 | /batch https://t.me/Cynitebackup 226 | https://t.me/CyniteBackup 227 | """ 228 | 229 | CYNITE_CNL = """ 230 | ♡ ᴄʜᴀɴɴᴇʟs & ɢʀᴏᴜᴘs ᴍᴏᴅᴜʟᴇ ♡ 231 | 232 | 📹 ᴄᴏᴍᴘʟᴇᴛᴇ ᴍᴏᴠɪᴇ ʀᴇǫᴜᴇsᴛɪɴɢ ɢʀᴏᴜᴘ. 233 | 🎙 ᴀʟʟ ʟᴀɴɢᴜᴀɢᴇs ᴍᴏᴠɪᴇ & sᴇʀɪᴇs. 234 | 🤖 ʙᴏᴛ sᴜᴘᴘᴏʀᴛ ɢʀᴏᴜᴘ. 235 | 👾 ʙᴏᴛ ᴜᴘᴅᴀᴛᴇs ᴄʜᴀɴɴᴇʟ. 236 | """ 237 | 238 | FORCE_SUB = """ 239 | **⚠️ ᴘʟᴇᴀsᴇ ғᴏʟʟᴏᴡ ᴛʜɪs ʀᴜʟᴇs ⚠️ 240 | 241 | ɪɴ ᴏʀᴅᴇʀ ᴛᴏ ɢᴇᴛ ᴛʜᴇ ᴍᴏᴠɪᴇ ʀᴇǫᴜᴇsᴛᴇᴅ ʙʏ ʏᴏᴜ. 242 | 243 | ʏᴏᴜ ᴡɪʟʟ ʜᴀᴠᴇ ᴛᴏ ᴊᴏɪɴ ᴏᴜʀ ᴏғғɪᴄɪᴀʟ ᴄʜᴀɴɴᴇʟ ғɪʀsᴛ. 244 | 245 | ᴀғᴛᴇʀ ᴛʜᴀᴛ ᴛʀʏ ᴀᴄᴄᴇssɪɴɢ ᴛʜᴀᴛ ᴍᴏᴠɪᴇ ᴛʜᴇɴ ᴄʟɪᴄᴋ ᴏɴ ᴛʜᴇ ᴛʀʏ ᴀɢᴀɪɴ. 246 | 247 | ɪ'ʟʟ sᴇɴᴅ ʏᴏᴜ ᴛʜᴀᴛ ᴍᴏᴠɪᴇ ᴘʀɪᴠᴀᴛᴇʟʏ.** 248 | """ 249 | 250 | BANP_LOG_TXT = """⍟ Bᴀɴɴᴇᴅ Usᴇʀ Lᴏɢs ⍟ 251 | 252 | Aᴅᴍɪɴ : {} 253 | 254 | Nᴀᴍᴇ : {} 255 | 256 | Rᴇᴀsᴏɴ : {} 257 | 258 | ⍟ #BannedUser ⍟ 259 | """ 260 | UNBANP_LOG_TXT = """⍟ UɴBᴀɴɴᴇᴅ Usᴇʀ Lᴏɢs ⍟ 261 | 262 | Aᴅᴍɪɴ : {} 263 | 264 | Nᴀᴍᴇ : {} 265 | 266 | ⍟ #UnBannedUser ⍟ 267 | """ 268 | BANG_LOG_TXT = """⍟ Bᴀɴɴᴇᴅ Gʀᴏᴜᴘ Lᴏɢs ⍟ 269 | 270 | Cʜᴀᴛ ID : {} 271 | 272 | Rᴇᴀsᴏɴ : {} 273 | 274 | Aᴅᴍɪɴ : {} 275 | 276 | ⍟ #BannedGroup ⍟ 277 | """ 278 | UNBANG_LOG_TXT = """⍟ UɴBᴀɴɴᴇᴅ Gʀᴏᴜᴘ Lᴏɢs ⍟ 279 | 280 | Cʜᴀᴛ ID : {} 281 | 282 | Aᴅᴍɪɴ : {} 283 | 284 | ⍟ #UnBannedGroup ⍟ 285 | """ 286 | 287 | REQINFO2 = """ 288 | ⚠ ɪɴꜰᴏʀᴍᴀᴛɪᴏɴ ⚠ 289 | 290 | ɪꜰ ʏᴏᴜ ᴅᴏ ɴᴏᴛ ꜱᴇᴇ ᴛʜᴇ ʀᴇǫᴜᴇsᴛᴇᴅ ᴍᴏᴠɪᴇ / sᴇʀɪᴇs ꜰɪʟᴇ, ʟᴏᴏᴋ ᴀᴛ ᴛʜᴇ ɴᴇxᴛ ᴘᴀɢᴇ 291 | """ 292 | 293 | REQINFO = """ 294 | ⚠ ɪɴꜰᴏʀᴍᴀᴛɪᴏɴ ⚠ 295 | 296 | ᴀꜰᴛᴇʀ 5 ᴍɪɴᴜᴛᴇꜱ ᴛʜɪꜱ ᴍᴇꜱꜱᴀɢᴇ ᴡɪʟʟ ʙᴇ ᴀᴜᴛᴏᴍᴀᴛɪᴄᴀʟʟʏ ᴅᴇʟᴇᴛᴇᴅ 297 | 298 | ɪꜰ ʏᴏᴜ ᴅᴏ ɴᴏᴛ ꜱᴇᴇ ᴛʜᴇ ʀᴇǫᴜᴇsᴛᴇᴅ ᴍᴏᴠɪᴇ / sᴇʀɪᴇs ꜰɪʟᴇ, ʟᴏᴏᴋ ᴀᴛ ᴛʜᴇ ɴᴇxᴛ ᴘᴀɢᴇ 299 | """ 300 | 301 | MINFO = """ 302 | ⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯ 303 | ᴍᴏᴠɪᴇ ʀᴇǫᴜᴇꜱᴛ ꜰᴏʀᴍᴀᴛ 304 | ⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯ 305 | 306 | ɢᴏ ᴛᴏ ɢᴏᴏɢʟᴇ ➠ ᴛʏᴘᴇ ᴍᴏᴠɪᴇ ɴᴀᴍᴇ ➠ ᴄᴏᴘʏ ᴄᴏʀʀᴇᴄᴛ ɴᴀᴍᴇ ➠ ᴘᴀꜱᴛᴇ ᴛʜɪꜱ ɢʀᴏᴜᴘ 307 | 308 | ᴇxᴀᴍᴘʟᴇ : Kgf 2022 309 | 310 | 🚯 ᴅᴏɴᴛ ᴜꜱᴇ ➠ ':(!,./) 311 | """ 312 | 313 | SINFO = """ 314 | ⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯ 315 | ꜱᴇʀɪᴇꜱ ʀᴇǫᴜᴇꜱᴛ ꜰᴏʀᴍᴀᴛ 316 | ⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯ 317 | 318 | ɢᴏ ᴛᴏ ɢᴏᴏɢʟᴇ ➠ ᴛʏᴘᴇ ꜱᴇʀɪᴇꜱ ɴᴀᴍᴇ ➠ ᴄᴏᴘʏ ᴄᴏʀʀᴇᴄᴛ ɴᴀᴍᴇ ➠ ᴘᴀꜱᴛᴇ ᴛʜɪꜱ ɢʀᴏᴜᴘ 319 | 320 | ᴇxᴀᴍᴘʟᴇ : Money Heist S01E01 or Money Heist S01 E01 321 | 322 | 🚯 ᴅᴏɴᴛ ᴜꜱᴇ ➠ ':(!,./) 323 | """ 324 | 325 | PAGEINFO = """ 326 | ᴘᴀɢᴇs ᴍᴇᴀɴs 10 ғɪʟᴇs ɪɴ ᴏɴᴇ ᴘᴀɢᴇ 327 | 328 | ɪғ ʏᴏᴜ ɴᴏᴛ sᴇᴇ ʏᴏᴜʀ ғɪʟᴇs ᴏɴ ᴛʜɪs ᴘᴀɢᴇ ᴛʜᴇɴ ᴄʟɪᴄᴋ ᴏɴ ɴᴇxᴛ ᴘᴀɢᴇ. 329 | 330 | Powered by :- @CyniteBackup 331 | """ 332 | 333 | SPLMD = """ 334 | ᴍᴏᴠɪᴇ ʀᴇǫᴜᴇsᴛ ғᴏʀᴍᴀᴛ 335 | 336 | ᴇxᴀᴍᴘʟᴇ : Kgf or Kgf 2022 337 | 338 | sᴇʀɪᴇs ʀᴇǫᴜᴇsᴛ ғᴏʀᴍᴀᴛ 339 | 340 | ᴇxᴀᴍᴘʟᴇ : Money Heist S01E01 or Money Heist S01 E01 341 | 342 | 🚯ᴅᴏɴ'ᴛ ᴜsᴇ ➠ ':(!,./) 343 | 344 | Powered by :- @CyniteBackup 345 | """ 346 | 347 | REQUEST_TXT = """ 348 | 📫 Rᴇǫᴜᴇsᴛ Dᴇᴛᴀɪʟs : 349 | 350 | 🔖 Mᴇssᴀɢᴇ :{} 351 | 352 | 🕵️ Rᴇǫᴜᴇsᴛᴇᴅ Bʏ : {} [ {} ] 353 | """ 354 | 355 | REQUEST2_TXT = """ 356 | Yᴏᴜʀ Rᴇǫᴜᴇsᴛ Hᴀs Bᴇᴇɴ Aᴅᴅᴇᴅ! 357 | Pʟᴇᴀsᴇ Wᴀɪᴛ Fᴏʀ Sᴏᴍᴇ Tɪᴍᴇ. 358 | """ 359 | 360 | SGROUP_TXT = """ 361 | Dᴇᴀʀ, {} 362 | 363 | {} Rᴇsᴜʟᴛs Aʀᴇ Aʟʀᴇᴀᴅʏ Aᴠᴀɪʟᴀʙʟᴇ Fᴏʀ Yᴏᴜʀ Rᴇǫᴜᴇsᴛ {}Oᴜʀ Cʜᴀɴɴᴇʟ. 364 | """ 365 | 366 | DONE_UPLOAD = """ 367 | Tʜᴇ Rᴇǫᴜᴇsᴛ Is Cᴏᴍᴘʟᴇᴛᴇᴅ !! Cʜᴇᴄᴋ Bᴏᴛ & Cʜᴀɴɴᴇʟ !! 368 | """ 369 | 370 | REQ_REJECT = """ 371 | Tʜᴇ Rᴇǫᴜᴇsᴛ Is Rᴇᴊᴇᴄᴛᴇᴅ Mᴀʏʙᴇ Dᴜᴇ Tᴏ Sᴀᴍᴇ Rᴇǫᴜᴇsᴛ, Nᴏᴛ Iɴ Fᴏʀᴍᴀᴛ !! 372 | """ 373 | 374 | REQ_NO = """ 375 | Tʜᴇ Rᴇǫᴜᴇsᴛ Is Nᴏᴛ Aᴠᴀɪʟᴀʙʟᴇ Mᴀʏʙᴇ Dᴜᴇ Tᴏ Nᴏᴛ Rᴇʟᴇᴀsᴇᴅ Oʀ Nᴏᴛ Aᴠᴀɪʟᴀʙʟᴇ !! 376 | """ 377 | 378 | DONE_ALREADY = """ 379 | Tʜᴇ Rᴇǫᴜᴇsᴛ Is Aʟʀᴇᴀᴅʏ Uᴘʟᴏᴀᴅᴇᴅ !! Cʜᴇᴄᴋ Bᴏᴛ & Cʜᴀɴɴᴇʟ !! 380 | """ 381 | 382 | DONE_UPLOAD2 = """ 383 | Yᴏᴜʀ Rᴇǫᴜᴇsᴛ Sᴜᴄᴇssғᴜʟʟʏ Uᴘʟᴏᴀᴅᴇᴅ Sᴇᴀʀᴄʜ Aɢᴀɪɴ..🙃 384 | """ 385 | 386 | REQ_REJECT2 = """ 387 | Rᴇǫᴜᴇsᴛ Rᴇᴊᴇᴄᴛᴇᴅ 🚫 !! 388 | 389 | Yᴏᴜʀ Rᴇǫᴜᴇsᴛ Aʟʀᴇᴀᴅʏ Mᴀʏʙᴇ Iɴ Tʜᴇ Rᴇǫᴜᴇsᴛ Lɪsᴛ Oʀ Yᴏᴜʀ Rᴇǫᴜᴇsᴛ Is Mᴀʟғᴏʀᴍᴀᴛᴛᴇᴅ. Kɪɴᴅʟʏ Rᴇǫᴜᴇsᴛ Aɢᴀɪɴ Oʀ Cᴏɴᴛᴀᴄᴛ Aᴅᴍɪɴ Fᴏʀ Hᴇʟᴘ. 390 | """ 391 | 392 | REQ_NO2 = """ 393 | Sᴏʀʀʏ Yᴏᴜʀ Rᴇǫᴜᴇsᴛ Nᴏᴛ Aᴠᴀɪʟᴀʙʟᴇ 😔, 394 | Kɪɴᴅʟʏ Cᴏɴᴛᴀᴄᴛ Aᴅᴍɪɴ Fᴏʀ Hᴇʟᴘ. 395 | """ 396 | 397 | DONE_ALREADY2 = """ 398 | Rᴇǫᴜᴇsᴛ Aʟʀᴇᴀᴅʏ Uᴘʟᴏᴀᴅᴇᴅ ❗, 399 | Kɪɴᴅʟʏ Cʜᴇᴄᴋ Tʜᴇ Bᴏᴛ Bᴇғᴏʀᴇ Rᴇǫᴜᴇsᴛɪɴɢ. 400 | """ 401 | 402 | CAP_DLT_TXT = """ 403 | ᴛʜᴇ ʀᴇsᴜʟᴛ ꜰᴏʀ:- {} 404 | 405 | ʀᴇǫᴜᴇsᴛᴇᴅ ʙʏ:- {} 406 | 407 | ᴛʜɪs ᴍᴇssᴀɢᴇ ᴡɪʟʟ ʙᴇ ᴀᴜᴛᴏ ᴅᴇʟᴇᴛᴇᴅ ᴀꜰᴛᴇʀ 5 ᴍɪɴᴜᴛᴇs… 408 | """ 409 | 410 | CAP_TXT = """ 411 | ᴛʜᴇ ʀᴇsᴜʟᴛ ꜰᴏʀ:- {} 412 | 413 | ʀᴇǫᴜᴇsᴛᴇᴅ ʙʏ:- {} 414 | 415 | ʜᴇʏ ᴄʟɪᴄᴋ ᴏɴ ᴛʜᴇ ʙᴜᴛᴛᴏɴ ʙᴇʟᴏᴡ ᴛʜᴇ ꜰɪʟᴇs ʏᴏᴜ ᴡᴀɴᴛ ᴀɴᴅ sᴛᴀʀᴛ ᴛʜᴇ ʙᴏᴛ.. 416 | """ 417 | 418 | FILE_CHANNEL_TXT = """ 419 | 🏷️ Tɪᴛʟᴇ :- {} 420 | 421 | ⚙️ Sɪᴢᴇ :- {} 422 | 423 | 🕵️‍♂️ Rᴇǫᴜᴇsᴛᴇᴅ Bʏ :- {} 424 | 425 | 🔅 Pᴏᴡᴇʀᴇᴅ Bʏ :- {} 426 | 427 | ‣ Tʜɪs Mᴇssᴀɢᴇ Wɪʟʟ ʙᴇ Aᴜᴛᴏ-Dᴇʟᴇᴛᴇᴅ Aғᴛᴇʀ 5 Mɪɴᴜᴛᴇs. Kɪɴᴅʟʏ Fᴏʀᴡᴀʀᴅ Yᴏᴜʀ Fɪʟᴇs Tᴏ Sᴀᴠᴇᴅ.""" 428 | 429 | FILE_READY_TXT = """ 430 | Hᴇʏ {} 431 | 432 | 📫 Yᴏᴜʀ Fɪʟᴇ Is Sᴇɴᴛ Tᴏ Cʜᴀɴɴᴇʟ, 433 | Cʜᴇᴄᴋ Dᴏᴡɴ Tᴏ Vɪᴇᴡ. 434 | 435 | 📂 Fɪʟᴇ Nᴀᴍᴇ :- {} 436 | 437 | ⚙️ Fɪʟᴇ Sɪᴢᴇ :- {} 438 | """ 439 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CYNITE", 3 | "description": "When you going to send file on telegram channel this bot will save that in database, So you can search that easily in inline mode", 4 | "stack": "container", 5 | "keywords": [ 6 | "telegram", 7 | "auto-filter", 8 | "filter", 9 | "best", 10 | "indian", 11 | "pyrogram", 12 | "media", 13 | "search", 14 | "channel", 15 | "index", 16 | "inline" 17 | ], 18 | "website": "https://github.com/Cyniteofficial/Auto-Filter-V5", 19 | "repository": "https://github.com/Cyniteofficial/Auto-Filter-V5", 20 | "env": { 21 | "BOT_TOKEN": { 22 | "description": "Your bot token.", 23 | "required": true 24 | }, 25 | "API_ID": { 26 | "description": "Get this value from https://my.telegram.org", 27 | "required": true 28 | }, 29 | "API_HASH": { 30 | "description": "Get this value from https://my.telegram.org", 31 | "required": true 32 | }, 33 | "CHANNELS": { 34 | "description": "Username or ID of channel or group. Separate multiple IDs by space.", 35 | "required": false 36 | }, 37 | "SUPPORT_GROUP": { 38 | "description": "Support Group Chat ID", 39 | "required": true 40 | }, 41 | "RQST_LOG_CHANNEL": { 42 | "description": "request log channel ID", 43 | "required": true 44 | }, 45 | "FILE_CHANNEL": { 46 | "description": "File Channel Id", 47 | "required": true 48 | }, 49 | "FILE_CHANNEL_LINK": { 50 | "description": "File Channel Link", 51 | "required": true 52 | }, 53 | "ADMINS": { 54 | "description": "Username or ID of Admin. Separate multiple Admins by space.", 55 | "required": true 56 | }, 57 | "PICS": { 58 | "description": "Add some telegraph link of pictures .", 59 | "required": false 60 | }, 61 | "LOG_CHANNEL": { 62 | "description": "Bot Logs,Give a channel id with -100xxxxxxx", 63 | "required": true 64 | }, 65 | "AUTH_USERS": { 66 | "description": "Username or ID of users to give access of inline search. Separate multiple users by space.\nLeave it empty if you don't want to restrict bot usage.", 67 | "required": false 68 | }, 69 | "AUTH_CHANNEL": { 70 | "description": "ID of channel.Make sure bot is admin in this channel. Without subscribing this channel users cannot use bot.", 71 | "required": false 72 | }, 73 | "DATABASE_URI": { 74 | "description": "mongoDB URI. Get this value from https://www.mongodb.com.", 75 | "required": true 76 | }, 77 | "DATABASE_NAME": { 78 | "description": "Name of the database in mongoDB.", 79 | "required": false 80 | }, 81 | "COLLECTION_NAME": { 82 | "description": "Name of the collections. Defaults to Telegram_files. If you are using the same database, then use different collection name for each bot", 83 | "value": "Telegram_files", 84 | "required": false 85 | }, 86 | "HEROKU_API_KEY": { 87 | "description": "Your Heroku API Key to check dyno, bot uptime and bot working day prediction", 88 | "required": true 89 | } 90 | }, 91 | "addons": [], 92 | "buildpacks": [{ 93 | "url": "heroku/python" 94 | }], 95 | "formation": { 96 | "worker": { 97 | "quantity": 1, 98 | "size": "free" 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /bot.py: -------------------------------------------------------------------------------- 1 | import os 2 | import math 3 | import logging 4 | import logging.config 5 | from aiohttp import web 6 | from CYNITE import web_server 7 | 8 | # Get logging configurations 9 | logging.config.fileConfig('logging.conf') 10 | logging.getLogger().setLevel(logging.INFO) 11 | logging.getLogger("pyrogram").setLevel(logging.ERROR) 12 | logging.getLogger("imdbpy").setLevel(logging.ERROR) 13 | 14 | from pyrogram.errors import BadRequest, Unauthorized 15 | from datetime import datetime 16 | from pytz import timezone 17 | from pyrogram import Client, __version__ 18 | from pyrogram.raw.all import layer 19 | from database.ia_filterdb import Media 20 | from database.users_chats_db import db 21 | from info import SESSION, API_ID, API_HASH, BOT_TOKEN, LOG_STR, LOG_CHANNEL, PORT 22 | from utils import temp 23 | from typing import Union, Optional, AsyncGenerator 24 | from pyrogram import types 25 | LOGGER = logging.getLogger(__name__) 26 | TIMEZONE = (os.environ.get("TIMEZONE", "Asia/Kolkata")) 27 | 28 | class Bot(Client): 29 | 30 | def __init__(self): 31 | super().__init__( 32 | name=SESSION, 33 | api_id=API_ID, 34 | api_hash=API_HASH, 35 | bot_token=BOT_TOKEN, 36 | workers=50, 37 | plugins={"root": "CYNITE"}, 38 | sleep_threshold=5, 39 | ) 40 | 41 | async def start(self): 42 | b_users, b_chats = await db.get_banned() 43 | temp.BANNED_USERS = b_users 44 | temp.BANNED_CHATS = b_chats 45 | await super().start() 46 | await Media.ensure_indexes() 47 | me = await self.get_me() 48 | temp.ME = me.id 49 | temp.U_NAME = me.username 50 | temp.B_NAME = me.first_name 51 | temp.B_LINK = me.mention 52 | self.username = '@' + me.username 53 | curr = datetime.now(timezone(TIMEZONE)) 54 | date = curr.strftime('%d %B, %Y') 55 | time = curr.strftime('%I:%M:%S %p') 56 | app = web.AppRunner(await web_server()) 57 | await app.setup() 58 | bind_address = "0.0.0.0" 59 | await web.TCPSite(app, bind_address, PORT).start() 60 | logging.info(f"{me.first_name} with for Pyrogram v{__version__} (Layer {layer}) started on {me.username}.") 61 | logging.info(LOG_STR) 62 | if LOG_CHANNEL: 63 | try: 64 | await self.send_message(LOG_CHANNEL, text=f"{me.mention} Rᴇsᴛᴀʀᴛᴇᴅ !!\n\n📅 Dᴀᴛᴇ : {date}\n⏰ Tɪᴍᴇ : {time}\n🌐 Tɪᴍᴇᴢᴏɴᴇ : {TIMEZONE}\n\n🉐 Vᴇʀsɪᴏɴ : v{__version__}") 65 | except Unauthorized: 66 | LOGGER.warning("Bot isn't able to send message to LOG_CHANNEL") 67 | except BadRequest as e: 68 | LOGGER.error(e) 69 | 70 | async def stop(self, *args): 71 | await super().stop() 72 | logging.info("Bot stopped. Bye.") 73 | 74 | async def iter_messages( 75 | self, 76 | chat_id: Union[int, str], 77 | limit: int, 78 | offset: int = 0, 79 | ) -> Optional[AsyncGenerator["types.Message", None]]: 80 | """Iterate through a chat sequentially. 81 | This convenience method does the same as repeatedly calling :meth:`~pyrogram.Client.get_messages` in a loop, thus saving 82 | you from the hassle of setting up boilerplate code. It is useful for getting the whole chat messages with a 83 | single call. 84 | Parameters: 85 | chat_id (``int`` | ``str``): 86 | Unique identifier (int) or username (str) of the target chat. 87 | For your personal cloud (Saved Messages) you can simply use "me" or "self". 88 | For a contact that exists in your Telegram address book you can use his phone number (str). 89 | 90 | limit (``int``): 91 | Identifier of the last message to be returned. 92 | 93 | offset (``int``, *optional*): 94 | Identifier of the first message to be returned. 95 | Defaults to 0. 96 | Returns: 97 | ``Generator``: A generator yielding :obj:`~pyrogram.types.Message` objects. 98 | Example: 99 | .. code-block:: python 100 | for message in app.iter_messages("pyrogram", 1, 15000): 101 | print(message.text) 102 | """ 103 | current = offset 104 | while True: 105 | new_diff = min(200, limit - current) 106 | if new_diff <= 0: 107 | return 108 | messages = await self.get_messages(chat_id, list(range(current, current+new_diff+1))) 109 | for message in messages: 110 | yield message 111 | current += 1 112 | 113 | 114 | app = Bot() 115 | app.run() 116 | -------------------------------------------------------------------------------- /database/Pro: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /database/connections_mdb.py: -------------------------------------------------------------------------------- 1 | import pymongo 2 | 3 | from info import DATABASE_URI, DATABASE_NAME 4 | 5 | import logging 6 | logger = logging.getLogger(__name__) 7 | logger.setLevel(logging.ERROR) 8 | 9 | myclient = pymongo.MongoClient(DATABASE_URI) 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 occurred!', 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 occurred!', 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 | return int(group_id) if group_id != None else None 66 | 67 | 68 | async def all_connections(user_id): 69 | query = mycol.find_one( 70 | { "_id": user_id }, 71 | { "_id": 0, "active_group": 0 } 72 | ) 73 | if query is not None: 74 | return [x["group_id"] for x in query["group_details"]] 75 | else: 76 | return None 77 | 78 | 79 | async def if_active(user_id, group_id): 80 | query = mycol.find_one( 81 | { "_id": user_id }, 82 | { "_id": 0, "group_details": 0 } 83 | ) 84 | return query is not None and query['active_group'] == group_id 85 | 86 | 87 | async def make_active(user_id, group_id): 88 | update = mycol.update_one( 89 | {'_id': user_id}, 90 | {"$set": {"active_group" : group_id}} 91 | ) 92 | return update.modified_count != 0 93 | 94 | 95 | async def make_inactive(user_id): 96 | update = mycol.update_one( 97 | {'_id': user_id}, 98 | {"$set": {"active_group" : None}} 99 | ) 100 | return update.modified_count != 0 101 | 102 | 103 | async def delete_connection(user_id, group_id): 104 | 105 | try: 106 | update = mycol.update_one( 107 | {"_id": user_id}, 108 | {"$pull" : { "group_details" : {"group_id":group_id} } } 109 | ) 110 | if update.modified_count == 0: 111 | return False 112 | query = mycol.find_one( 113 | { "_id": user_id }, 114 | { "_id": 0 } 115 | ) 116 | if len(query["group_details"]) >= 1: 117 | if query['active_group'] == group_id: 118 | prvs_group_id = query["group_details"][len(query["group_details"]) - 1]["group_id"] 119 | 120 | mycol.update_one( 121 | {'_id': user_id}, 122 | {"$set": {"active_group" : prvs_group_id}} 123 | ) 124 | else: 125 | mycol.update_one( 126 | {'_id': user_id}, 127 | {"$set": {"active_group" : None}} 128 | ) 129 | return True 130 | except Exception as e: 131 | logger.exception(f'Some error occurred! {e}', exc_info=True) 132 | return False 133 | 134 | -------------------------------------------------------------------------------- /database/filters_mdb.py: -------------------------------------------------------------------------------- 1 | import pymongo 2 | from info import DATABASE_URI, 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_URI) 9 | mydb = myclient[DATABASE_NAME] 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 | return False if count == 0 else count 99 | 100 | 101 | async def filter_stats(): 102 | collections = mydb.list_collection_names() 103 | 104 | if "CONNECTION" in collections: 105 | collections.remove("CONNECTION") 106 | 107 | totalcount = 0 108 | for collection in collections: 109 | mycol = mydb[collection] 110 | count = mycol.count() 111 | totalcount += count 112 | 113 | totalcollections = len(collections) 114 | 115 | return totalcollections, totalcount 116 | -------------------------------------------------------------------------------- /database/gfilters_mdb.py: -------------------------------------------------------------------------------- 1 | import pymongo 2 | from info import DATABASE_URI, 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_URI) 9 | mydb = myclient[DATABASE_NAME] 10 | 11 | 12 | 13 | async def add_gfilter(gfilters, text, reply_text, btn, file, alert): 14 | mycol = mydb[str(gfilters)] 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_gfilter(gfilters, name): 32 | mycol = mydb[str(gfilters)] 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_gfilters(gfilters): 51 | mycol = mydb[str(gfilters)] 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_gfilter(message, text, gfilters): 65 | mycol = mydb[str(gfilters)] 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 gfilter anymore.", 73 | quote=True, 74 | parse_mode=enums.ParseMode.MARKDOWN 75 | ) 76 | else: 77 | await message.reply_text("Couldn't find that gfilter!", quote=True) 78 | 79 | async def count_gfilters(gfilters): 80 | mycol = mydb[str(gfilters)] 81 | 82 | count = mycol.count() 83 | return False if count == 0 else count 84 | 85 | 86 | async def gfilter_stats(): 87 | collections = mydb.list_collection_names() 88 | 89 | if "CONNECTION" in collections: 90 | collections.remove("CONNECTION") 91 | 92 | totalcount = 0 93 | for collection in collections: 94 | mycol = mydb[collection] 95 | count = mycol.count() 96 | totalcount += count 97 | 98 | totalcollections = len(collections) 99 | 100 | return totalcollections, totalcount 101 | -------------------------------------------------------------------------------- /database/ia_filterdb.py: -------------------------------------------------------------------------------- 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 DATABASE_URI, DATABASE_NAME, COLLECTION_NAME, USE_CAPTION_FILTER 11 | 12 | logger = logging.getLogger(__name__) 13 | logger.setLevel(logging.INFO) 14 | 15 | 16 | client = AsyncIOMotorClient(DATABASE_URI) 17 | db = client[DATABASE_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 | indexes = ('$file_name', ) 32 | collection_name = COLLECTION_NAME 33 | 34 | 35 | async def save_file(media): 36 | """Save file in database""" 37 | 38 | # TODO: Find better way to get same file_id for same media to avoid duplicates 39 | file_id, file_ref = unpack_new_file_id(media.file_id) 40 | file_name = re.sub(r"(_|\-|\.|\+)", " ", str(media.file_name)) 41 | try: 42 | file = Media( 43 | file_id=file_id, 44 | file_ref=file_ref, 45 | file_name=file_name, 46 | file_size=media.file_size, 47 | file_type=media.file_type, 48 | mime_type=media.mime_type, 49 | caption=media.caption.html if media.caption else None, 50 | ) 51 | except ValidationError: 52 | logger.exception('Error occurred while saving file in database') 53 | return False, 2 54 | else: 55 | try: 56 | await file.commit() 57 | except DuplicateKeyError: 58 | logger.warning( 59 | f'{getattr(media, "file_name", "NO_FILE")} is already saved in database' 60 | ) 61 | 62 | return False, 0 63 | else: 64 | logger.info(f'{getattr(media, "file_name", "NO_FILE")} is saved to database') 65 | return True, 1 66 | 67 | 68 | 69 | async def get_search_results(query, file_type=None, max_results=10, offset=0, filter=False): 70 | """For given query return (results, next_offset)""" 71 | 72 | query = query.strip() 73 | #if filter: 74 | #better ? 75 | #query = query.replace(' ', r'(\s|\.|\+|\-|_)') 76 | #raw_pattern = r'(\s|_|\-|\.|\+)' + query + r'(\s|_|\-|\.|\+)' 77 | if not query: 78 | raw_pattern = '.' 79 | elif ' ' not in query: 80 | raw_pattern = r'(\b|[\.\+\-_])' + query + r'(\b|[\.\+\-_])' 81 | else: 82 | raw_pattern = query.replace(' ', r'.*[\s\.\+\-_]') 83 | 84 | try: 85 | regex = re.compile(raw_pattern, flags=re.IGNORECASE) 86 | except: 87 | return [] 88 | 89 | if USE_CAPTION_FILTER: 90 | filter = {'$or': [{'file_name': regex}, {'caption': regex}]} 91 | else: 92 | filter = {'file_name': regex} 93 | 94 | if file_type: 95 | filter['file_type'] = file_type 96 | 97 | total_results = await Media.count_documents(filter) 98 | next_offset = offset + max_results 99 | 100 | if next_offset > total_results: 101 | next_offset = '' 102 | 103 | cursor = Media.find(filter) 104 | # Sort by recent 105 | cursor.sort('$natural', -1) 106 | # Slice files according to offset and max results 107 | cursor.skip(offset).limit(max_results) 108 | # Get list of files 109 | files = await cursor.to_list(length=max_results) 110 | 111 | return files, next_offset, total_results 112 | 113 | 114 | 115 | async def get_file_details(query): 116 | filter = {'file_id': query} 117 | cursor = Media.find(filter) 118 | filedetails = await cursor.to_list(length=1) 119 | return filedetails 120 | 121 | 122 | def encode_file_id(s: bytes) -> str: 123 | r = b"" 124 | n = 0 125 | 126 | for i in s + bytes([22]) + bytes([4]): 127 | if i == 0: 128 | n += 1 129 | else: 130 | if n: 131 | r += b"\x00" + bytes([n]) 132 | n = 0 133 | 134 | r += bytes([i]) 135 | 136 | return base64.urlsafe_b64encode(r).decode().rstrip("=") 137 | 138 | 139 | def encode_file_ref(file_ref: bytes) -> str: 140 | return base64.urlsafe_b64encode(file_ref).decode().rstrip("=") 141 | 142 | 143 | def unpack_new_file_id(new_file_id): 144 | """Return file_id, file_ref""" 145 | decoded = FileId.decode(new_file_id) 146 | file_id = encode_file_id( 147 | pack( 148 | "{mention}'s Qᴜᴇʀʏ ☞ {query}\n\n🏷 Tɪᴛʟᴇ : {title}\n\n🌟 Rᴀᴛɪɴɢ : {rating} / 10\n💀 Rᴇʟᴇᴀsᴇ : {release_date} {countries}\n\n🎭 Gᴇɴʀᴇs : #{genres}\n\n🔅 Pᴏᴡᴇʀᴇᴅ Bʏ : {message.chat.title}") 67 | CYNITE_IMDB_TEMPLATE = environ.get("CYNITE_IMDB_TEMPLATE", "🏷 Tɪᴛʟᴇ : {title}\n\n🌟 Rᴀᴛɪɴɢ : {rating} / 10\n💀 Rᴇʟᴇᴀsᴇ : {release_date} {countries}\n\n🎭 Gᴇɴʀᴇs : {genres}\n\n📖 Sᴛᴏʀʏ Lɪɴᴇ : {plot}") 68 | LONG_IMDB_DESCRIPTION = is_enabled(environ.get("LONG_IMDB_DESCRIPTION", "False"), False) 69 | SPELL_CHECK_REPLY = is_enabled(environ.get("SPELL_CHECK_REPLY", "True"), True) 70 | MAX_LIST_ELM = environ.get("MAX_LIST_ELM", None) 71 | INDEX_REQ_CHANNEL = int(environ.get('INDEX_REQ_CHANNEL', LOG_CHANNEL)) 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 | 77 | # Auto Delete , Filter & Auto Filter 78 | AUTO_FFILTER = is_enabled((environ.get('AUTO_FFILTER', "True")), True) 79 | AUTO_DELETE = is_enabled((environ.get('AUTO_DELETE', "True")), True) 80 | MAUTO_DELETE = is_enabled((environ.get('MAUTO_DELETE', "True")), True) 81 | 82 | # Delete Time 83 | DELETE_TIME = int(environ.get('DELETE_TIME', 300)) 84 | SPL_DELETE_TIME = int(environ.get('SPL_DELETE_TIME', 15)) 85 | 86 | # URL SHORTNER 87 | 88 | URL_SHORTENR_WEBSITE = environ.get('URL_SHORTENR_WEBSITE', 'mdisklink.link') 89 | URL_SHORTNER_WEBSITE_API = environ.get('URL_SHORTNER_WEBSITE_API', 'b0e8c7cfe1b1f58accbb8884b72cc67a58feeeca') 90 | 91 | LOG_STR = "Current Cusomized Configurations are:-\n" 92 | LOG_STR += ("IMDB Results are enabled, Bot will be showing imdb details for you queries.\n" if IMDB else "IMBD Results are disabled.\n") 93 | LOG_STR += ("P_TTI_SHOW_OFF found , Users will be redirected to send /start to Bot PM instead of sending file file directly\n" if P_TTI_SHOW_OFF else "P_TTI_SHOW_OFF is disabled files will be send in PM, instead of sending start.\n") 94 | LOG_STR += ("SINGLE_BUTTON is Found, filename and files size will be shown in a single button instead of two separate buttons\n" if SINGLE_BUTTON else "SINGLE_BUTTON is disabled , filename and file_sixe will be shown as different buttons\n") 95 | LOG_STR += (f"CUSTOM_FILE_CAPTION enabled with value {CUSTOM_FILE_CAPTION}, your files will be send along with this customized caption.\n" if CUSTOM_FILE_CAPTION else "No CUSTOM_FILE_CAPTION Found, Default captions of file will be used.\n") 96 | LOG_STR += ("Long IMDB storyline enabled." if LONG_IMDB_DESCRIPTION else "LONG_IMDB_DESCRIPTION is disabled , Plot will be shorter.\n") 97 | LOG_STR += ("Spell Check Mode Is Enabled, bot will be suggesting related movies if movie not found\n" if SPELL_CHECK_REPLY else "SPELL_CHECK_REPLY Mode disabled\n") 98 | LOG_STR += (f"MAX_LIST_ELM Found, long list will be shortened to first {MAX_LIST_ELM} elements\n" if MAX_LIST_ELM else "Full List of casts and crew will be shown in imdb template, restrict them by adding a value to MAX_LIST_ELM\n") 99 | LOG_STR += f"Your current IMDB template is {IMDB_TEMPLATE}" 100 | -------------------------------------------------------------------------------- /logging.conf: -------------------------------------------------------------------------------- 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=ERROR 23 | formatter=fileFormatter 24 | args=('LuciferBotLog.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 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pyrogram>=2.0.30 2 | tgcrypto 3 | pymongo[srv]==3.12.3 4 | motor==2.5.1 5 | marshmallow==3.14.1 6 | umongo==3.0.1 7 | requests 8 | bs4 9 | IMDbPY==2022.7.9 10 | psutil 11 | aiohttp 12 | pytz 13 | -------------------------------------------------------------------------------- /runtime.txt: -------------------------------------------------------------------------------- 1 | python-3.8.7 2 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | if [ -z $UPSTREAM_REPO ] 2 | then 3 | echo "Cloning main Repository" 4 | git clone https://github.com/Cyniteofficial/Auto-Filter-V5.git /Auto-Filter-V5 5 | else 6 | echo "Cloning Custom Repo from $UPSTREAM_REPO " 7 | git clone $UPSTREAM_REPO /Auto-Filter-V5 8 | fi 9 | cd /Auto-Filter-V5 10 | pip3 install -U -r requirements.txt 11 | echo "Starting Bot...." 12 | python3 bot.py 13 | -------------------------------------------------------------------------------- /utils.py: -------------------------------------------------------------------------------- 1 | import logging 2 | from pyrogram.errors import InputUserDeactivated, UserNotParticipant, FloodWait, UserIsBlocked, PeerIdInvalid 3 | from info import AUTH_CHANNEL, LONG_IMDB_DESCRIPTION, MAX_LIST_ELM, URL_SHORTENR_WEBSITE, URL_SHORTNER_WEBSITE_API 4 | from imdb import IMDb 5 | import asyncio 6 | from pyrogram.types import Message, InlineKeyboardButton 7 | from pyrogram import enums 8 | from typing import Union 9 | import re 10 | import os 11 | from datetime import datetime 12 | from typing import List 13 | from database.users_chats_db import db 14 | from bs4 import BeautifulSoup 15 | import requests 16 | import aiohttp 17 | 18 | logger = logging.getLogger(__name__) 19 | logger.setLevel(logging.INFO) 20 | 21 | BTN_URL_REGEX = re.compile( 22 | r"(\[([^\[]+?)\]\((buttonurl|buttonalert):(?:/{0,2})(.+?)(:same)?\))" 23 | ) 24 | 25 | imdb = IMDb() 26 | 27 | BANNED = {} 28 | SMART_OPEN = '“' 29 | SMART_CLOSE = '”' 30 | START_CHAR = ('\'', '"', SMART_OPEN) 31 | 32 | # temp db for banned 33 | class temp(object): 34 | BANNED_USERS = [] 35 | BANNED_CHATS = [] 36 | ME = None 37 | CURRENT=int(os.environ.get("SKIP", 2)) 38 | CANCEL = False 39 | MELCOW = {} 40 | U_NAME = None 41 | B_NAME = None 42 | SETTINGS = {} 43 | 44 | async def is_subscribed(bot, query): 45 | try: 46 | user = await bot.get_chat_member(AUTH_CHANNEL, query.from_user.id) 47 | except UserNotParticipant: 48 | pass 49 | except Exception as e: 50 | logger.exception(e) 51 | else: 52 | if user.status != 'kicked': 53 | return True 54 | 55 | return False 56 | 57 | async def get_poster(query, bulk=False, id=False, file=None): 58 | if not id: 59 | # https://t.me/GetTGLink/4183 60 | query = (query.strip()).lower() 61 | title = query 62 | year = re.findall(r'[1-2]\d{3}$', query, re.IGNORECASE) 63 | if year: 64 | year = list_to_str(year[:1]) 65 | title = (query.replace(year, "")).strip() 66 | elif file is not None: 67 | year = re.findall(r'[1-2]\d{3}', file, re.IGNORECASE) 68 | if year: 69 | year = list_to_str(year[:1]) 70 | else: 71 | year = None 72 | movieid = imdb.search_movie(title.lower(), results=10) 73 | if not movieid: 74 | return None 75 | if year: 76 | filtered=list(filter(lambda k: str(k.get('year')) == str(year), movieid)) 77 | if not filtered: 78 | filtered = movieid 79 | else: 80 | filtered = movieid 81 | movieid=list(filter(lambda k: k.get('kind') in ['movie', 'tv series'], filtered)) 82 | if not movieid: 83 | movieid = filtered 84 | if bulk: 85 | return movieid 86 | movieid = movieid[0].movieID 87 | else: 88 | movieid = query 89 | movie = imdb.get_movie(movieid) 90 | if movie.get("original air date"): 91 | date = movie["original air date"] 92 | elif movie.get("year"): 93 | date = movie.get("year") 94 | else: 95 | date = "N/A" 96 | plot = "" 97 | if not LONG_IMDB_DESCRIPTION: 98 | plot = movie.get('plot') 99 | if plot and len(plot) > 0: 100 | plot = plot[0] 101 | else: 102 | plot = movie.get('plot outline') 103 | if plot and len(plot) > 800: 104 | plot = plot[0:800] + "..." 105 | 106 | return { 107 | 'title': movie.get('title'), 108 | 'votes': movie.get('votes'), 109 | "aka": list_to_str(movie.get("akas")), 110 | "seasons": movie.get("number of seasons"), 111 | "box_office": movie.get('box office'), 112 | 'localized_title': movie.get('localized title'), 113 | 'kind': movie.get("kind"), 114 | "imdb_id": f"tt{movie.get('imdbID')}", 115 | "cast": list_to_str(movie.get("cast")), 116 | "runtime": list_to_str(movie.get("runtimes")), 117 | "countries": list_to_str(movie.get("countries")), 118 | "certificates": list_to_str(movie.get("certificates")), 119 | "languages": list_to_str(movie.get("languages")), 120 | "director": list_to_str(movie.get("director")), 121 | "writer":list_to_str(movie.get("writer")), 122 | "producer":list_to_str(movie.get("producer")), 123 | "composer":list_to_str(movie.get("composer")) , 124 | "cinematographer":list_to_str(movie.get("cinematographer")), 125 | "music_team": list_to_str(movie.get("music department")), 126 | "distributors": list_to_str(movie.get("distributors")), 127 | 'release_date': date, 128 | 'year': movie.get('year'), 129 | 'genres': list_to_str(movie.get("genres")), 130 | 'poster': movie.get('full-size cover url'), 131 | 'plot': plot, 132 | 'rating': str(movie.get("rating")), 133 | 'url':f'https://www.imdb.com/title/tt{movieid}' 134 | } 135 | # https://github.com/odysseusmax/animated-lamp/blob/2ef4730eb2b5f0596ed6d03e7b05243d93e3415b/bot/utils/broadcast.py#L37 136 | 137 | async def broadcast_messages(user_id, message): 138 | try: 139 | await message.copy(chat_id=user_id) 140 | return True, "Success" 141 | except FloodWait as e: 142 | await asyncio.sleep(e.x) 143 | return await broadcast_messages(user_id, message) 144 | except InputUserDeactivated: 145 | await db.delete_user(int(user_id)) 146 | logging.info(f"{user_id}-Removed from Database, since deleted account.") 147 | return False, "Deleted" 148 | except UserIsBlocked: 149 | logging.info(f"{user_id} -Blocked the bot.") 150 | return False, "Blocked" 151 | except PeerIdInvalid: 152 | await db.delete_user(int(user_id)) 153 | logging.info(f"{user_id} - PeerIdInvalid") 154 | return False, "Error" 155 | except Exception as e: 156 | return False, "Error" 157 | 158 | async def broadcast_messages_group(chat_id, message): 159 | try: 160 | kd = await message.copy(chat_id=chat_id) 161 | try: 162 | await kd.pin() 163 | except: 164 | pass 165 | return True, "Succes" 166 | except FloodWait as e: 167 | await asyncio.sleep(e.x) 168 | return await broadcast_messages_group(chat_id, message) 169 | except Exception as e: 170 | return False, "Error" 171 | 172 | async def search_gagala(text): 173 | usr_agent = { 174 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) ' 175 | 'Chrome/61.0.3163.100 Safari/537.36' 176 | } 177 | text = text.replace(" ", '+') 178 | url = f'https://www.google.com/search?q={text}' 179 | response = requests.get(url, headers=usr_agent) 180 | response.raise_for_status() 181 | soup = BeautifulSoup(response.text, 'html.parser') 182 | titles = soup.find_all( 'h3' ) 183 | return [title.getText() for title in titles] 184 | 185 | 186 | async def get_settings(group_id): 187 | settings = temp.SETTINGS.get(group_id) 188 | if not settings: 189 | settings = await db.get_settings(group_id) 190 | temp.SETTINGS[group_id] = settings 191 | return settings 192 | 193 | async def save_group_settings(group_id, key, value): 194 | current = await get_settings(group_id) 195 | current[key] = value 196 | temp.SETTINGS[group_id] = current 197 | await db.update_settings(group_id, current) 198 | 199 | def get_size(size): 200 | """Get size in readable format""" 201 | 202 | units = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB"] 203 | size = float(size) 204 | i = 0 205 | while size >= 1024.0 and i < len(units): 206 | i += 1 207 | size /= 1024.0 208 | return "%.2f %s" % (size, units[i]) 209 | 210 | def split_list(l, n): 211 | for i in range(0, len(l), n): 212 | yield l[i:i + n] 213 | 214 | def get_file_id(msg: Message): 215 | if msg.media: 216 | for message_type in ( 217 | "photo", 218 | "animation", 219 | "audio", 220 | "document", 221 | "video", 222 | "video_note", 223 | "voice", 224 | "sticker" 225 | ): 226 | obj = getattr(msg, message_type) 227 | if obj: 228 | setattr(obj, "message_type", message_type) 229 | return obj 230 | 231 | def extract_user(message: Message) -> Union[int, str]: 232 | """extracts the user from a message""" 233 | # https://github.com/SpEcHiDe/PyroGramBot/blob/f30e2cca12002121bad1982f68cd0ff9814ce027/pyrobot/helper_functions/extract_user.py#L7 234 | user_id = None 235 | user_first_name = None 236 | if message.reply_to_message: 237 | user_id = message.reply_to_message.from_user.id 238 | user_first_name = message.reply_to_message.from_user.first_name 239 | 240 | elif len(message.command) > 1: 241 | if ( 242 | len(message.entities) > 1 and 243 | message.entities[1].type == enums.MessageEntityType.TEXT_MENTION 244 | ): 245 | 246 | required_entity = message.entities[1] 247 | user_id = required_entity.user.id 248 | user_first_name = required_entity.user.first_name 249 | else: 250 | user_id = message.command[1] 251 | # don't want to make a request -_- 252 | user_first_name = user_id 253 | try: 254 | user_id = int(user_id) 255 | except ValueError: 256 | pass 257 | else: 258 | user_id = message.from_user.id 259 | user_first_name = message.from_user.first_name 260 | return (user_id, user_first_name) 261 | 262 | def list_to_str(k): 263 | if not k: 264 | return "N/A" 265 | elif len(k) == 1: 266 | return str(k[0]) 267 | elif MAX_LIST_ELM: 268 | k = k[:int(MAX_LIST_ELM)] 269 | return ' '.join(f'{elem}, ' for elem in k) 270 | else: 271 | return ' '.join(f'{elem}, ' for elem in k) 272 | 273 | def last_online(from_user): 274 | time = "" 275 | if from_user.is_bot: 276 | time += "🤖 Bot :(" 277 | elif from_user.status == enums.UserStatus.RECENTLY: 278 | time += "Recently" 279 | elif from_user.status == enums.UserStatus.LAST_WEEK: 280 | time += "Within the last week" 281 | elif from_user.status == enums.UserStatus.LAST_MONTH: 282 | time += "Within the last month" 283 | elif from_user.status == enums.UserStatus.LONG_AGO: 284 | time += "A long time ago :(" 285 | elif from_user.status == enums.UserStatus.ONLINE: 286 | time += "Currently Online" 287 | elif from_user.status == enums.UserStatus.OFFLINE: 288 | time += from_user.last_online_date.strftime("%a, %d %b %Y, %H:%M:%S") 289 | return time 290 | 291 | 292 | def split_quotes(text: str) -> List: 293 | if not any(text.startswith(char) for char in START_CHAR): 294 | return text.split(None, 1) 295 | counter = 1 # ignore first char -> is some kind of quote 296 | while counter < len(text): 297 | if text[counter] == "\\": 298 | counter += 1 299 | elif text[counter] == text[0] or (text[0] == SMART_OPEN and text[counter] == SMART_CLOSE): 300 | break 301 | counter += 1 302 | else: 303 | return text.split(None, 1) 304 | 305 | # 1 to avoid starting quote, and counter is exclusive so avoids ending 306 | key = remove_escapes(text[1:counter].strip()) 307 | # index will be in range, or `else` would have been executed and returned 308 | rest = text[counter + 1:].strip() 309 | if not key: 310 | key = text[0] + text[0] 311 | return list(filter(None, [key, rest])) 312 | 313 | def parser(text, keyword): 314 | if "buttonalert" in text: 315 | text = (text.replace("\n", "\\n").replace("\t", "\\t")) 316 | buttons = [] 317 | note_data = "" 318 | prev = 0 319 | i = 0 320 | alerts = [] 321 | for match in BTN_URL_REGEX.finditer(text): 322 | # Check if btnurl is escaped 323 | n_escapes = 0 324 | to_check = match.start(1) - 1 325 | while to_check > 0 and text[to_check] == "\\": 326 | n_escapes += 1 327 | to_check -= 1 328 | 329 | # if even, not escaped -> create button 330 | if n_escapes % 2 == 0: 331 | note_data += text[prev:match.start(1)] 332 | prev = match.end(1) 333 | if match.group(3) == "buttonalert": 334 | # create a thruple with button label, url, and newline status 335 | if bool(match.group(5)) and buttons: 336 | buttons[-1].append(InlineKeyboardButton( 337 | text=match.group(2), 338 | callback_data=f"alertmessage:{i}:{keyword}" 339 | )) 340 | else: 341 | buttons.append([InlineKeyboardButton( 342 | text=match.group(2), 343 | callback_data=f"alertmessage:{i}:{keyword}" 344 | )]) 345 | i += 1 346 | alerts.append(match.group(4)) 347 | elif bool(match.group(5)) and buttons: 348 | buttons[-1].append(InlineKeyboardButton( 349 | text=match.group(2), 350 | url=match.group(4).replace(" ", "") 351 | )) 352 | else: 353 | buttons.append([InlineKeyboardButton( 354 | text=match.group(2), 355 | url=match.group(4).replace(" ", "") 356 | )]) 357 | 358 | else: 359 | note_data += text[prev:to_check] 360 | prev = match.start(1) - 1 361 | else: 362 | note_data += text[prev:] 363 | 364 | try: 365 | return note_data, buttons, alerts 366 | except: 367 | return note_data, buttons, None 368 | 369 | def remove_escapes(text: str) -> str: 370 | res = "" 371 | is_escaped = False 372 | for counter in range(len(text)): 373 | if is_escaped: 374 | res += text[counter] 375 | is_escaped = False 376 | elif text[counter] == "\\": 377 | is_escaped = True 378 | else: 379 | res += text[counter] 380 | return res 381 | 382 | 383 | def humanbytes(size): 384 | if not size: 385 | return "" 386 | power = 2**10 387 | n = 0 388 | Dic_powerN = {0: ' ', 1: 'Ki', 2: 'Mi', 3: 'Gi', 4: 'Ti'} 389 | while size > power: 390 | size /= power 391 | n += 1 392 | return str(round(size, 2)) + " " + Dic_powerN[n] + 'B' 393 | 394 | async def get_shortlink(link): 395 | https = link.split(":")[0] 396 | if "http" == https: 397 | https = "https" 398 | link = link.replace("http", https) 399 | url = f'https://{URL_SHORTENR_WEBSITE}/api' 400 | params = {'api': URL_SHORTNER_WEBSITE_API, 401 | 'url': link, 402 | } 403 | 404 | try: 405 | async with aiohttp.ClientSession() as session: 406 | async with session.get(url, params=params, raise_for_status=True, ssl=False) as response: 407 | data = await response.json() 408 | if data["status"] == "success": 409 | return data['shortenedUrl'] 410 | else: 411 | logger.error(f"Error: {data['message']}") 412 | return f'https://{URL_SHORTENR_WEBSITE}/api?api={URL_SHORTNER_WEBSITE_API}&link={link}' 413 | 414 | except Exception as e: 415 | logger.error(e) 416 | return f'{URL_SHORTENR_WEBSITE}/api?api={URL_SHORTNER_WEBSITE_API}&link={link}' 417 | --------------------------------------------------------------------------------