diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..27bc52c --- /dev/null +++ b/.gitignore @@ -0,0 +1,148 @@ +# Personal files +*.session +*.session-journal +.vscode +*test*.py +setup.cfg + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ +config.py +.goutputstream-VAFWB1 +result.json diff --git a/Script.py b/Script.py index d678d4d..4226782 100644 --- a/Script.py +++ b/Script.py @@ -1,10 +1,10 @@ class script(object): START_TXT = """๐™ท๐™ด๐™ป๐™พ {}, -๐™ผ๐šˆ ๐™ฝ๐™ฐ๐™ผ๐™ด ๐™ธ๐š‚ {},\n\n ๏ฟฝ ๐™ฒ๐™ฐ๐™ฝ ๐™ฟ๐š๐™พ๐š…๐™ธ๐™ณ๐™ด ๐™ผ๐™พ๐š…๐™ธ๐™ด๐š‚, ๐™น๐š„๐š‚๐šƒ ๐™ฐ๐™ณ๐™ณ ๐™ผ๐™ด ๐šƒ๐™พ ๐šˆ๐™พ๐š„๐š ๐™ถ๐š๐™พ๐š„๐™ฟ ๐™ฐ๐™ฝ๐™ณ ๐™ด๐™ฝ๐™น๐™พ๐šˆ ๐Ÿ˜ \n\n...""" +๐™ผ๐šˆ ๐™ฝ๐™ฐ๐™ผ๐™ด ๐™ธ๐š‚ {},\n\n ๏ฟฝ ๐™ฒ๐™ฐ๐™ฝ ๐™ฟ๐š๐™พ๐š…๐™ธ๐™ณ๐™ด ๐™ผ๐™พ๐š…๐™ธ๐™ด๐š‚, ๐™น๐š„๐š‚๐šƒ ๐™ฐ๐™ณ๐™ณ ๐™ผ๐™ด ๐šƒ๐™พ ๐šˆ๐™พ๐š„๐š ๐™ถ๐š๐™พ๐š„๐™ฟ ๐™ฐ๐™ฝ๐™ณ ๐™ด๐™ฝ๐™น๐™พ๐šˆ ๐Ÿ˜ \n @LISA_ROBOT""" HELP_TXT = """๐™ท๐™ด๐šˆ {} Here is the help for my COMMANDS.""" ABOUT_TXT = """โœฏ ๐™ผ๐šˆ ๐™ฝ๐™ฐ๐™ผ๐™ด: {} -โœฏ ๐™ฒ๐š๐™ด๐™ฐ๐šƒ๐™พ๐š: Adwin +โœฏ ๐™ฒ๐š๐™ด๐™ฐ๐šƒ๐™พ๐š: Adwin โœฏ ๐™ป๐™ธ๐™ฑ๐š๐™ฐ๐š๐šˆ: ๐™ฟ๐šˆ๐š๐™พ๐™ถ๐š๐™ฐ๐™ผ โœฏ ๐™ป๐™ฐ๐™ฝ๐™ถ๐š„๐™ฐ๐™ถ๐™ด: ๐™ฟ๐šˆ๐šƒ๐™ท๐™พ๐™ฝ ๐Ÿน โœฏ ๐™ณ๐™ฐ๐šƒ๐™ฐ ๐™ฑ๐™ฐ๐š‚๐™ด: ๐™ผ๐™พ๐™ฝ๐™ถ๐™พ ๐™ณ๐™ฑ @@ -12,13 +12,13 @@ class script(object): โœฏ ๐™ฑ๐š„๐™ธ๐™ป๐™ณ ๐š‚๐šƒ๐™ฐ๐šƒ๐š„๐š‚: v1.0.1 [ ๐™ฑ๐™ด๐šƒ๐™ฐ ]""" SOURCE_TXT = """NOTE: - This Bot is an open source project. -- Source - https://github.com/Private-Botz/Elsa-Bot +- Source - https://github.com/CodeHouse-TG/Elsa-Bot DEVS: - Archive_codes""" MANUELFILTER_TXT = """Help: Filters -- Filter is the feature were users can set automated replies for a particular keyword and LazyPriness will respond whenever that keyword hits the message +- Filter is the feature were users can set automated replies for a particular keyword and Bot will respond whenever that keyword hits the message NOTE: 1. BOT should have admin privillage. @@ -40,7 +40,7 @@ class script(object): 3. Buttons should be properly parsed as markdown format URL buttons: -[Button Text](buttonurl:https://t.me/Private_Botz) +[Button Text](buttonurl:https://t.me/CodeHouse_TG) Alert buttons: [Button Text](buttonalert:This is an alert message)""" diff --git a/plugins/commands.py b/plugins/commands.py index 0305a85..16014d4 100644 --- a/plugins/commands.py +++ b/plugins/commands.py @@ -42,10 +42,10 @@ async def start(client, message): await client.send_message(LOG_CHANNEL, script.LOG_TEXT_P.format(message.from_user.id, message.from_user.mention)) if len(message.command) != 2: buttons = [[ - InlineKeyboardButton('โž•โ†–๏ธ Add Me To Your Groups โ†—๏ธโž•', url=f'http://t.me/{temp.U_NAME}?startgroup=true') + InlineKeyboardButton('โž• Add Me To Your Groups โž•', url=f'http://t.me/{temp.U_NAME}?startgroup=true') ],[ InlineKeyboardButton('๐Ÿงžโ€โ™€๏ธ Search ๐Ÿง', switch_inline_query_current_chat=''), - InlineKeyboardButton('๐Ÿ”” Updates ๐Ÿค–', url='https://t.me/Private_Botz') + InlineKeyboardButton('๐Ÿ”” Updates ๐Ÿค–', url='https://t.me/CodeHouse_TG') ],[ InlineKeyboardButton('๐Ÿ™†๐Ÿป Help ๐Ÿฆพ', callback_data='help'), InlineKeyboardButton('โ™ฅ๏ธ About โ™ฅ๏ธ', callback_data='about') @@ -88,10 +88,10 @@ async def start(client, message): return if len(message.command) == 2 and message.command[1] in ["subscribe", "error", "okay", "help"]: buttons = [[ - InlineKeyboardButton('โž•โ†–๏ธ Add Me To Your Groups โ†—๏ธโž•', url=f'http://t.me/{temp.U_NAME}?startgroup=true') + InlineKeyboardButton('โž• Add Me To Your Groups โž•', url=f'http://t.me/{temp.U_NAME}?startgroup=true') ],[ InlineKeyboardButton('๐Ÿงžโ€โ™€๏ธ Search ๐Ÿง', switch_inline_query_current_chat=''), - InlineKeyboardButton('๐Ÿ”” Updates ๐Ÿค–', url='https://t.me/Private_Botz') + InlineKeyboardButton('๐Ÿ”” Updates ๐Ÿค–', url='https://t.me/CodeHouse_TG') ],[ InlineKeyboardButton('๐Ÿ™†๐Ÿป Help ๐Ÿฆพ', callback_data='help'), InlineKeyboardButton('โ™ฅ๏ธ About โ™ฅ๏ธ', callback_data='about') @@ -360,7 +360,6 @@ async def delete_all_index(bot, message): @Client.on_callback_query(filters.regex(r'^autofilter_delete')) async def delete_all_index_confirm(bot, message): await Media.collection.drop() - await message.answer('โ™ฅ๏ธ Thank You LazyDeveloper โ™ฅ๏ธ') await message.message.edit('Succesfully Deleted All The Indexed Files.') diff --git a/plugins/inline.py b/plugins/inline.py index 4ba9af3..faa2a3f 100644 --- a/plugins/inline.py +++ b/plugins/inline.py @@ -10,11 +10,8 @@ cache_time = 0 if AUTH_USERS or AUTH_CHANNEL else CACHE_TIME async def inline_users(query: InlineQuery): - if AUTH_USERS: - if query.from_user and query.from_user.id in AUTH_USERS: - return True - else: - return False + if AUTH_USERS and query.from_user and query.from_user.id in AUTH_USERS: + return True if query.from_user and query.from_user.id not in temp.BANNED_USERS: return True return False @@ -26,14 +23,14 @@ async def answer(bot, query): if not await inline_users(query): await query.answer(results=[], cache_time=0, - switch_pm_text='Results', + switch_pm_text='okDa', switch_pm_parameter="hehe") return if AUTH_CHANNEL and not await is_subscribed(bot, query): await query.answer(results=[], cache_time=0, - switch_pm_text='You have to subscribe main channel to use the bot', + switch_pm_text='You have to subscribe my channel to use the bot', switch_pm_parameter="subscribe") return @@ -88,6 +85,10 @@ async def answer(bot, query): pass except Exception as e: logging.exception(str(e)) + await query.answer(results=[], is_personal=True, + cache_time=cache_time, + switch_pm_text=str(e)[:63], + switch_pm_parameter="error") else: switch_pm_text = f'{emoji.CROSS_MARK} No results' if string: @@ -108,6 +109,3 @@ def get_reply_markup(query): ] return InlineKeyboardMarkup(buttons) - - - diff --git a/plugins/p_ttishow.py b/plugins/p_ttishow.py index 1b2140e..48549ad 100644 --- a/plugins/p_ttishow.py +++ b/plugins/p_ttishow.py @@ -38,7 +38,7 @@ async def save_group(bot, message): return buttons = [[ InlineKeyboardButton('๐Ÿคฅ Help', url=f"https://t.me/{temp.U_NAME}?start=help"), - InlineKeyboardButton('๐Ÿ”” Updates', url='https://t.me/Private_Botz') + InlineKeyboardButton('๐Ÿ”” Updates', url='https://t.me/COdeHouse_TG') ]] reply_markup=InlineKeyboardMarkup(buttons) await message.reply_text( diff --git a/plugins/pm_filter.py b/plugins/pm_filter.py index 9ebf790..40c5001 100644 --- a/plugins/pm_filter.py +++ b/plugins/pm_filter.py @@ -127,7 +127,7 @@ async def advantage_spoll_choker(bot, query): if not movies: return await query.answer("You are clicking on an old button which is expired.", show_alert=True) movie = movies[(int(movie_))] - await query.answer('Checking for Movie in database...') + await query.answer('wait, Checking for Movie in database...') k = await manual_filters(bot, query.message, text=movie) if k == False: files, offset, total_results = await get_search_results(movie, offset=0, filter=True) @@ -157,20 +157,20 @@ async def cb_handler(client: Client, query: CallbackQuery): title = chat.title except: await query.message.edit_text("Make sure I'm present in your group!!", quote=True) - return await query.answer('๐Ÿ”„ Elsa Bot ๐Ÿ”„') + return else: await query.message.edit_text( "I'm not connected to any groups!\nCheck /connections or connect to any groups", quote=True ) - return await query.answer('๐Ÿ”„ Elsa Bot ๐Ÿ”„') + return elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]: grp_id = query.message.chat.id title = query.message.chat.title else: - return await query.answer('๐Ÿ”„ Elsa Bot ๐Ÿ”„') + return st = await client.get_chat_member(grp_id, userid) if (st.status == enums.ChatMemberStatus.OWNER) or (str(userid) in ADMINS): @@ -224,7 +224,7 @@ async def cb_handler(client: Client, query: CallbackQuery): reply_markup=keyboard, parse_mode=enums.ParseMode.MARKDOWN ) - return await query.answer('๐Ÿ”„ Elsa Bot ๐Ÿ”„') + return elif "connectcb" in query.data: await query.answer() @@ -245,7 +245,7 @@ async def cb_handler(client: Client, query: CallbackQuery): ) else: await query.message.edit_text('Some error occurred!!', parse_mode=enums.ParseMode.MARKDOWN) - return await query.answer('๐Ÿ”„ Elsa Bot ๐Ÿ”„') + return elif "disconnect" in query.data: await query.answer() @@ -268,7 +268,7 @@ async def cb_handler(client: Client, query: CallbackQuery): f"Some error occurred!!", parse_mode=enums.ParseMode.MARKDOWN ) - return await query.answer('๐Ÿ”„ Elsa Bot ๐Ÿ”„') + return elif "deletecb" in query.data: await query.answer() @@ -286,7 +286,7 @@ async def cb_handler(client: Client, query: CallbackQuery): f"Some error occurred!!", parse_mode=enums.ParseMode.MARKDOWN ) - return await query.answer('โ™ฅ๏ธ Elsa Bot โ™ฅ๏ธ') + return elif query.data == "backcb": await query.answer() @@ -297,7 +297,7 @@ async def cb_handler(client: Client, query: CallbackQuery): await query.message.edit_text( "There are no active connections!! Connect to some groups first.", ) - return await query.answer('โ™ฅ๏ธ Elsa Bot โ™ฅ๏ธ') + return buttons = [] for groupid in groupids: try: @@ -366,7 +366,7 @@ async def cb_handler(client: Client, query: CallbackQuery): ) await query.answer('Check PM, I have sent files in pm', show_alert=True) except UserIsBlocked: - await query.answer('Unblock the bot mahn !', show_alert=True) + await query.answer('Unblock the bot man !', show_alert=True) except PeerIdInvalid: await query.answer(url=f"https://t.me/{temp.U_NAME}?start={ident}_{file_id}") except Exception as e: @@ -404,10 +404,10 @@ async def cb_handler(client: Client, query: CallbackQuery): await query.answer() elif query.data == "start": buttons = [[ - InlineKeyboardButton('โž•โ†–๏ธ Add Me To Your Groups โ†—๏ธโž•', url=f'http://t.me/{temp.U_NAME}?startgroup=true') + InlineKeyboardButton('โž• Add Me To Your Groups โž•', url=f'http://t.me/{temp.U_NAME}?startgroup=true') ], [ InlineKeyboardButton('๐Ÿงžโ€โ™€๏ธ Search ๐Ÿง', switch_inline_query_current_chat=''), - InlineKeyboardButton('๐Ÿ”” Updates ๐Ÿค–', url='https://t.me/Private_Botz') + InlineKeyboardButton('๐Ÿ”” Updates ๐Ÿค–', url='https://t.me/COdeHouse_TG') ], [ InlineKeyboardButton('๐Ÿ™†๐Ÿป Help ๐Ÿฆพ', callback_data='help'), InlineKeyboardButton('โ™ฅ๏ธ About โ™ฅ๏ธ', callback_data='about') @@ -418,7 +418,6 @@ async def cb_handler(client: Client, query: CallbackQuery): reply_markup=reply_markup, parse_mode=enums.ParseMode.HTML ) - await query.answer('โ™ฅ๏ธ Thank You LazyDeveloper โ™ฅ๏ธ') elif query.data == "help": buttons = [[ InlineKeyboardButton('Manual Filter', callback_data='manuelfilter'), @@ -428,7 +427,7 @@ async def cb_handler(client: Client, query: CallbackQuery): InlineKeyboardButton('Extra Mods', callback_data='extra') ], [ InlineKeyboardButton('๐Ÿ  Home', callback_data='start'), - InlineKeyboardButton('๐Ÿฆ  Status', callback_data='stats') + InlineKeyboardButton('๐Ÿ”ฎ Status', callback_data='stats') ]] reply_markup = InlineKeyboardMarkup(buttons) await query.message.edit_text( @@ -438,8 +437,8 @@ async def cb_handler(client: Client, query: CallbackQuery): ) elif query.data == "about": buttons = [[ - InlineKeyboardButton('๐Ÿ”” Updates ๐Ÿค–', url='https://t.me/LazyDeveloper'), - InlineKeyboardButton('โ™ฅ๏ธ Source', callback_data='source') + InlineKeyboardButton('๐Ÿ”” Updates ๐Ÿค–', url='https://t.me/CodeHouse_TG'), + InlineKeyboardButton('โ™ฅ๏ธ Source โ™ฅ๏ธ', callback_data='source') ], [ InlineKeyboardButton('๐Ÿ  Home', callback_data='start'), InlineKeyboardButton('๐Ÿ” Close', callback_data='close_data') @@ -565,7 +564,7 @@ async def cb_handler(client: Client, query: CallbackQuery): if str(grp_id) != str(grpid): await query.message.edit("Your Active Connection Has Been Changed. Go To /settings.") - return await query.answer('โ™ฅ๏ธ ELsa โ™ฅ๏ธ') + return if status == "True": await save_group_settings(grpid, set_type, False) @@ -612,7 +611,6 @@ async def cb_handler(client: Client, query: CallbackQuery): ] reply_markup = InlineKeyboardMarkup(buttons) await query.message.edit_reply_markup(reply_markup) - await query.answer('โ™ฅ๏ธ Elsa-Bot โ™ฅ๏ธ') async def auto_filter(client, msg, spoll=False): @@ -708,7 +706,7 @@ async def auto_filter(client, msg, spoll=False): **locals() ) else: - cap = f"Baby, Here is what i found for your query {search}" + cap = f" Here is what i found for your query {search}" if imdb and imdb.get('poster'): try: await message.reply_photo(photo=imdb.get('poster'), caption=cap[:1024], @@ -764,8 +762,8 @@ async def advantage_spell_chok(msg): movielist += [(re.sub(r'(\-|\(|\)|_)', '', i, flags=re.IGNORECASE)).strip() for i in gs_parsed] movielist = list(dict.fromkeys(movielist)) # removing duplicates if not movielist: - k = await msg.reply("Hey {Mention} ! i coudn't found anything in your {query}, ๐Ÿคทโ€โ™€๏ธ!\nPlease check your spelling once again ๐Ÿคฆโ€โ™€๏ธ... or \n Discuss your problem with our admin here ๐Ÿ‘‰ @MH_Feedback_bot ") - await asyncio.sleep(8) + k = await msg.reply("I couldn't find anything related to that๐Ÿคทโ€โ™€๏ธ!\nPlease check your spelling once again ๐Ÿคฆโ€โ™€๏ธ... \n Report admin our admin here ๐Ÿ‘‰ @MH_Feedback_bot ") + await asyncio.sleep(15) await k.delete() return SPELL_CHECK[msg.id] = movielist @@ -776,7 +774,7 @@ async def advantage_spell_chok(msg): ) ] for k, movie in enumerate(movielist)] btn.append([InlineKeyboardButton(text="Close", callback_data=f'spolling#{user}#close_spellcheck')]) - await msg.reply("Hey {Mention} ! i coudn't found anything in your {query}, ๐Ÿคทโ€โ™€๏ธ!\nPlease check your spelling once again ๐Ÿคฆโ€โ™€๏ธ... or \n Discuss your problem with our admin here ๐Ÿ‘‰ @MH_Feedback_bot ", + await msg.reply("I couldn't find anything related to that๐Ÿคทโ€โ™€๏ธ!\nPlease check your spelling once again ๐Ÿคฆโ€โ™€๏ธ... \n Report admin our admin here ๐Ÿ‘‰ @MH_Feedback_bot ", reply_markup=InlineKeyboardMarkup(btn))