diff --git a/bot/plugins/channel.py b/DonLee_Robot/Modules/Channel/Connect_Channel.py similarity index 92% rename from bot/plugins/channel.py rename to DonLee_Robot/Modules/Channel/Connect_Channel.py index 2ea646b89..03dff69a2 100644 --- a/bot/plugins/channel.py +++ b/DonLee_Robot/Modules/Channel/Connect_Channel.py @@ -1,3 +1,8 @@ +# (C) AlbertEinstein_TG +# Copyright permission under MIT License +# All rights reserved by PR0FESS0R-99 +# License -> https://github.com/PR0FESS0R-99/DonLee_Robot/blob/main/LICENSE + import random import string import asyncio @@ -5,15 +10,14 @@ from pyrogram import Client, filters from pyrogram.errors import UserAlreadyParticipant, FloodWait -from bot import VERIFY # pylint: disable=import-error -from bot.bot import Bot # pylint: disable=import-error -from bot.database import Database # pylint: disable=import-error -from bot.plugins.auto_filter import recacher # pylint: disable=import-error +from DonLee_Robot import VERIFY +from DonLee_Robot.donlee_robot import DonLee_Robot +from DonLee_Robot.Modules.Filters import Database, recacher db = Database() @Client.on_message(filters.command(["add"]) & filters.group, group=1) -async def connect(bot: Bot, update): +async def connect(bot: DonLee_Robot, update): """ A Funtion To Handle Incoming /add Command TO COnnect A Chat With Group """ @@ -113,6 +117,7 @@ async def connect(bot: Bot, update): file_id = file_id.video.file_id file_name = msgs.video.file_name[0:-4] file_caption = msgs.caption if msgs.caption else "" + file_size = msgs.video.file_size file_type = "video" elif msgs.audio: @@ -127,6 +132,7 @@ async def connect(bot: Bot, update): file_id = file_id.audio.file_id file_name = msgs.audio.file_name[0:-4] file_caption = msgs.caption if msgs.caption else "" + file_size = msgs.audio.file_size file_type = "audio" elif msgs.document: @@ -141,6 +147,7 @@ async def connect(bot: Bot, update): file_id = file_id.document.file_id file_name = msgs.document.file_name[0:-4] file_caption = msgs.caption if msgs.caption else "" + file_size = msgs.document.file_size file_type = "document" for i in ["_", "|", "-", "."]: # Work Around @@ -164,6 +171,7 @@ async def connect(bot: Bot, update): unique_id=unique_id, file_name=file_name, file_caption=file_caption, + file_size=file_size, file_type=file_type, file_link=file_link, chat_id=channel_id, @@ -190,7 +198,7 @@ async def connect(bot: Bot, update): @Client.on_message(filters.command(["del"]) & filters.group, group=1) -async def disconnect(bot: Bot, update): +async def disconnect(bot: DonLee_Robot, update): """ A Funtion To Handle Incoming /del Command TO Disconnect A Chat With A Group """ @@ -255,7 +263,7 @@ async def disconnect(bot: Bot, update): @Client.on_message(filters.command(["delall"]) & filters.group, group=1) -async def delall(bot: Bot, update): +async def delall(bot: DonLee_Robot, update): """ A Funtion To Handle Incoming /delall Command TO Disconnect All Chats From A Group """ @@ -280,8 +288,8 @@ async def delall(bot: Bot, update): await update.reply_text("Sucessfully Deleted All Connected Chats From This Group....") -@Client.on_message(filters.channel & (filters.video | filters.audio | filters.document), group=0) -async def new_files(bot: Bot, update): +@Client.on_message(filters.channel & (filters.video | filters.audio | filters.document) & ~filters.edited, group=0) +async def new_files(bot: DonLee_Robot, update): """ A Funtion To Handle Incoming New Files In A Channel ANd Add Them To Respective Channels.. """ @@ -296,19 +304,22 @@ async def new_files(bot: Bot, update): file_id = update.video.file_id file_name = update.video.file_name[0:-4] file_caption = update.caption if update.caption else "" + file_size = update.video.file_size elif update.audio: file_type = "audio" file_id = update.audio.file_id file_name = update.audio.file_name[0:-4] file_caption = update.caption if update.caption else "" + file_size = update.audio.file_size elif update.document: file_type = "document" file_id = update.document.file_id file_name = update.document.file_name[0:-4] file_caption = update.caption if update.caption else "" - + file_size = update.document.file_size + for i in ["_", "|", "-", "."]: # Work Around try: file_name = file_name.replace(i, " ") @@ -338,6 +349,7 @@ async def new_files(bot: Bot, update): unique_id=unique_id, file_name=file_name, file_caption=file_caption, + file_size = file_size, file_type=file_type, file_link=file_link, chat_id=channel_id, @@ -348,3 +360,4 @@ async def new_files(bot: Bot, update): await db.add_filters(data) return +runing = """Team mo tech""" diff --git a/DonLee_Robot/Modules/Channel/__init__.py b/DonLee_Robot/Modules/Channel/__init__.py new file mode 100644 index 000000000..66db6e99d --- /dev/null +++ b/DonLee_Robot/Modules/Channel/__init__.py @@ -0,0 +1,2 @@ +DEPLOY = "💡 DEPLOY NOW 💡" +HEROKU = "https://youtu.be/lI71HsWzTKE" diff --git a/DonLee_Robot/Modules/Commands/Commands.py b/DonLee_Robot/Modules/Commands/Commands.py new file mode 100644 index 000000000..4cf97e936 --- /dev/null +++ b/DonLee_Robot/Modules/Commands/Commands.py @@ -0,0 +1,170 @@ +# (c) @SpEcHIDe +# (c) @AlbertEinsteinTG +# (c) @Muhammed_RK, @Mo_Tech_YT , @Mo_Tech_Group, @MT_Botz +# Copyright permission under MIT License +# All rights reserved by PR0FESS0R-99 +# License -> https://github.com/PR0FESS0R-99/DonLee_Robot/blob/main/LICENSE + +from pyrogram import filters, Client +from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery +from pyrogram.errors import UserNotParticipant +from DonLee_Robot import Translation, LOGGER, Mo_Tech_YT +from DonLee_Robot.Modules.Filters import Database +from DonLee_Robot.donlee_robot import DonLee_Robot +from DonLee_Robot.Modules import DEPLOY, HEROKU +db = Database() + +@DonLee_Robot.on_message(filters.command(["start"]) & filters.private, group=1) +async def start(bot, update): + update_channel = Mo_Tech_YT.MO_TECH_YT_15 + if update_channel: + try: + user = await bot.get_chat_member(update_channel, update.chat.id) + if user.status == "kicked out": + await update.reply_text("😔 Sorry Dude, You are **🅱︎🅰︎🅽︎🅽︎🅴︎🅳︎ 🤣🤣🤣**") + return + except UserNotParticipant: + #await update.reply_text(f"Join @{update_channel} To Use Me") + await update.reply_text( + text=Mo_Tech_YT.MO_TECH_YT_14, + reply_markup=InlineKeyboardMarkup([ + [ InlineKeyboardButton(text=" 📢 Join My Update Channel 📢", url=f"https://t.me/{Mo_Tech_YT.MO_TECH_YT_15}")] + ]) + ) + return + except Exception: + await update.reply_text(f"This bot should be the admin on your update channel\n\n💢 ഈ ചാനലിൽ @{Mo_Tech_YT.MO_TECH_YT_15} ബോട്ടിനെ അഡ്മിൻ ആക്. എന്നിട്ട് /start കൊടുക്\n\n🗣️ any Doubt @Mo_Tech_Group") + return + try: + file_uid = update.command[1] + except IndexError: + file_uid = False + + if file_uid: + file_id, file_name, file_caption, file_type = await db.get_file(file_uid) + + if (file_id or file_type) == None: + return + + caption = file_caption if file_caption != ("" or None) else ("" + file_name + "") + try: + await update.reply_cached_media( + file_id, + quote=True, + caption = caption, + parse_mode="html", + reply_markup=InlineKeyboardMarkup( + [ + [ + Mo_Tech_YT.MO_TECH_YT_02 + ( + DEPLOY, url=HEROKU + ) + ] + ] + ) + ) + except Exception as e: + await update.reply_text(f"Error:\n{e}", True, parse_mode="html") + LOGGER(__name__).error(e) + return + + buttons = [ + [ + Mo_Tech_YT.MO_TECH_YT_02 + ( + '📢Update Channel', url='t.me/Mo_Tech_YT' + ), + Mo_Tech_YT.MO_TECH_YT_02 + ( + '💡More Botz', url='t.me/MT_Botz' + ) + ], + [ + Mo_Tech_YT.MO_TECH_YT_02 + ( + DEPLOY, url=HEROKU + ) + ], + [ + Mo_Tech_YT.MO_TECH_YT_02 + ( + '🚶Help', callback_data='help' + ) + ] + ] + + + reply_markup = InlineKeyboardMarkup(buttons) + + await bot.send_message( + chat_id=update.chat.id, + text=Translation.START_TEXT.format( + update.from_user.first_name), + reply_markup=reply_markup, + parse_mode="html", + reply_to_message_id=update.message_id + ) + +@DonLee_Robot.on_message(filters.command(["help"]) & filters.private, group=1) +async def help(bot, update): + buttons = [ + [ + Mo_Tech_YT.MO_TECH_YT_02 + ( + DEPLOY, url=HEROKU + ) + ], + [ + Mo_Tech_YT.MO_TECH_YT_02 + ( + '🏡 Home', callback_data='start' + ), + Mo_Tech_YT.MO_TECH_YT_02 + ( + 'About💡', callback_data='about' + ) + ] + ] + + reply_markup = InlineKeyboardMarkup(buttons) + + await bot.send_message( + chat_id=update.chat.id, + text=Translation.HELP_TEXT, + reply_markup=reply_markup, + parse_mode="html", + reply_to_message_id=update.message_id + ) + + +@DonLee_Robot.on_message(filters.command(["about"]) & filters.private, group=1) +async def about(bot, update): + + buttons = [ + [ + Mo_Tech_YT.MO_TECH_YT_02 + ( + DEPLOY, url=HEROKU + ) + ], + [ + Mo_Tech_YT.MO_TECH_YT_02 + ( + '🏠 Home', callback_data='start' + ), + Mo_Tech_YT.MO_TECH_YT_02 + ( + 'Close ❌️', callback_data='close' + ) + ] + ] + reply_markup = InlineKeyboardMarkup(buttons) + + await bot.send_message( + chat_id=update.chat.id, + text=Translation.ABOUT_TEXT, + reply_markup=reply_markup, + parse_mode="html", + reply_to_message_id=update.message_id + ) diff --git a/bot/plugins/callback.py b/DonLee_Robot/Modules/Filters/Callback.py similarity index 86% rename from bot/plugins/callback.py rename to DonLee_Robot/Modules/Filters/Callback.py index 3276f681e..13ea1bf76 100644 --- a/bot/plugins/callback.py +++ b/DonLee_Robot/Modules/Filters/Callback.py @@ -1,28 +1,26 @@ +# (C) AlbertEinstein_TG +# (C) @Nacbots IMDB SUPPORT ADDED +# (E) @Muhammed_RK, @Mo_Tech_YT , @Mo_Tech_Group, @MT_Botz +# (E) @Jackbro007 +# Copyright permission under MIT License +# All rights reserved by PR0FESS0R-99 +# License -> https://github.com/PR0FESS0R-99/DonLee_Robot/blob/main/LICENSE + import re import time import asyncio - from pyrogram import Client, filters from pyrogram.errors import FloodWait, UserNotParticipant from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery - -from bot import start_uptime, Translation, VERIFY # pylint: disable=import-error -from bot.plugins.auto_filter import ( # pylint: disable=import-error - FIND, - INVITE_LINK, - ACTIVE_CHATS, - recacher, - gen_invite_links - ) -from bot.plugins.settings import( # pylint: disable=import-error - remove_emoji -) -from bot.database import Database # pylint: disable=import-error - +from DonLee_Robot.donlee_robot import DonLee_Robot +from DonLee_Robot import start_uptime, Translation, VERIFY +from DonLee_Robot.Modules.Filters import FIND, INVITE_LINK, ACTIVE_CHATS, recacher, gen_invite_links +from DonLee_Robot.Modules.Settings import remove_emoji +from DonLee_Robot.Modules.Filters import Database +from DonLee_Robot.Modules import DEPLOY, HEROKU db = Database() - -@Client.on_callback_query(filters.regex(r"navigate\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"navigate\((.+)\)"), group=2) async def cb_navg(bot, update: CallbackQuery): """ A Callback Funtion For The Next Button Appearing In Results @@ -52,7 +50,7 @@ async def cb_navg(bot, update: CallbackQuery): VERIFY[str(chat_id)] = admin_list if not ((user_id == ruser_id) or (user_id in admin_list)): # Checks if user is same as requested user or is admin - await update.answer("Nice Try ;)",show_alert=True) + await update.answer("Ask for your own movie 🤗",show_alert=True) return @@ -81,7 +79,7 @@ async def cb_navg(bot, update: CallbackQuery): if ((index_val + 1 )== max_pages) or ((index_val + 1) == len(results)): # Max Pages temp_results.append([ - InlineKeyboardButton("⏪ Back", callback_data=f"navigate({index_val}|back|{query})") + InlineKeyboardButton("⪻⪻", callback_data=f"navigate({index_val}|back|{query})") ]) elif int(index_val) == 0: @@ -89,13 +87,27 @@ async def cb_navg(bot, update: CallbackQuery): else: temp_results.append([ - InlineKeyboardButton("⏪ Back", callback_data=f"navigate({index_val}|back|{query})"), - InlineKeyboardButton("Next ⏩", callback_data=f"navigate({index_val}|next|{query})") + InlineKeyboardButton("⪻⪻", callback_data=f"navigate({index_val}|back|{query})"), + InlineKeyboardButton("⪼⪼", callback_data=f"navigate({index_val}|next|{query})") ]) - + + len_result = len(results) + page_btn = "⓵ ❷ ❸ ❹ ❺" + if index_val+1 == 2 : + page_btn = "❶ ⓶ ❸ ❹ ❺" + elif index_val+1 == 3 : + page_btn = "❶ ❷ ⓷ ❹ ❺" #Being a pro🤣😂 + elif index_val+1 == 4 : + page_btn = "❶ ❷ ❸ ⓸ ❺" + elif index_val+1 == 5 : + page_btn = "❶ ❷ ❸ ❹ ⓹" + + cutter = len_result if len_result < max_pages else max_pages + page_btn = page_btn[:cutter*2] + if not int(index_val) == 0: temp_results.append([ - InlineKeyboardButton(f"🔰 Page {index_val + 1}/{len(results) if len(results) < max_pages else max_pages} 🔰", callback_data="ignore") + InlineKeyboardButton(f"📑 {page_btn} 📑", callback_data="ignore") ]) if show_invite and int(index_val) !=0 : @@ -142,26 +154,40 @@ async def cb_navg(bot, update: CallbackQuery): reply_markup = InlineKeyboardMarkup(temp_results) - text=f"Found {leng} Results For Your Query: {query}" - + text=f"🎬 Title : {query}\n🗃️ Total Files {len_result if len_result <= max_pages*8 else max_pages*8}" + try: - await update.message.edit( - text, + await update.message.edit_caption( + caption=text, reply_markup=reply_markup, parse_mode="html" ) - - except FloodWait as f: # Flood Wait Caused By Spamming Next/Back Buttons - await asyncio.sleep(f.x) - await update.message.edit( + except Exception as e: + print(e) + try: + await update.message.edit( text, reply_markup=reply_markup, parse_mode="html" - ) - + ) + + except FloodWait as f: # Flood Wait Caused By Spamming Next/Back Buttons + await asyncio.sleep(f.x) + try: + await update.message.edit_caption( + caption=text, + reply_markup=reply_markup, + parse_mode="html" + ) + except Exception : + await update.message.edit( + text, + reply_markup=reply_markup, + parse_mode="html" + ) -@Client.on_callback_query(filters.regex(r"settings"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"settings"), group=2) async def cb_settings(bot, update: CallbackQuery): """ A Callback Funtion For Back Button in /settings Command @@ -226,7 +252,7 @@ async def cb_settings(bot, update: CallbackQuery): -@Client.on_callback_query(filters.regex(r"warn\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"warn\((.+)\)"), group=2) async def cb_warn(bot, update: CallbackQuery): """ A Callback Funtion For Acknowledging User's About What Are They Upto @@ -286,7 +312,7 @@ async def cb_warn(bot, update: CallbackQuery): -@Client.on_callback_query(filters.regex(r"channel_list\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"channel_list\((.+)\)"), group=2) async def cb_channel_list(bot, update: CallbackQuery): """ A Callback Funtion For Displaying All Channel List And Providing A Menu To Navigate @@ -387,7 +413,7 @@ async def cb_channel_list(bot, update: CallbackQuery): -@Client.on_callback_query(filters.regex(r"info\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"info\((.+)\)"), group=2) async def cb_info(bot, update: CallbackQuery): """ A Callback Funtion For Displaying Details Of The Connected Chat And Provide @@ -485,7 +511,7 @@ async def cb_info(bot, update: CallbackQuery): -@Client.on_callback_query(filters.regex(r"^connect\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"^connect\((.+)\)"), group=2) async def cb_connect(bot, update: CallbackQuery): """ A Callback Funtion Helping The user To Make A Chat Active Chat Which Will @@ -559,7 +585,7 @@ async def cb_connect(bot, update: CallbackQuery): -@Client.on_callback_query(filters.regex(r"disconnect\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"disconnect\((.+)\)"), group=2) async def cb_disconnect(bot, update: CallbackQuery): """ A Callback Funtion Helping The user To Make A Chat inactive Chat Which Will @@ -632,7 +658,7 @@ async def cb_disconnect(bot, update: CallbackQuery): -@Client.on_callback_query(filters.regex(r"c_delete\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"c_delete\((.+)\)"), group=2) async def cb_channel_delete(bot, update: CallbackQuery): """ A Callback Funtion For Delete A Channel Connection From A Group Chat History @@ -684,7 +710,7 @@ async def cb_channel_delete(bot, update: CallbackQuery): -@Client.on_callback_query(filters.regex(r"f_delete\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"f_delete\((.+)\)"), group=2) async def cb_filters_delete(bot, update: CallbackQuery): """ A Callback Funtion For Delete A Specific Channel's Filters Connected To A Group @@ -730,7 +756,7 @@ async def cb_filters_delete(bot, update: CallbackQuery): -@Client.on_callback_query(filters.regex(r"types\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"types\((.+)\)"), group=2) async def cb_types(bot, update: CallbackQuery): """ A Callback Funtion For Changing The Result Types To Be Shown In While Sending Results @@ -814,7 +840,7 @@ async def cb_types(bot, update: CallbackQuery): -@Client.on_callback_query(filters.regex(r"toggle\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"toggle\((.+)\)"), group=2) async def cb_toggle(bot, update: CallbackQuery): """ A Callback Funtion Support handler For types() @@ -928,7 +954,7 @@ async def cb_toggle(bot, update: CallbackQuery): -@Client.on_callback_query(filters.regex(r"config\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"config\((.+)\)"), group=2) async def cb_config(bot, update: CallbackQuery): """ A Callback Funtion For Chaning The Number Of Total Pages / @@ -952,7 +978,7 @@ async def cb_config(bot, update: CallbackQuery): mf_count = settings["configs"]["max_results"] mr_count = settings["configs"]["max_per_page"] show_invite = settings["configs"]["show_invite_link"] - pm_file_chat = settings["configs"]["pm_fchat"] + pm_file_chat = settings["configs"].get("pm_fchat", False) accuracy_point = settings["configs"].get("accuracy", 0.80) text=f"Configure Your {chat_name} Group's Filter Settings...\n" @@ -1042,7 +1068,7 @@ async def cb_config(bot, update: CallbackQuery): -@Client.on_callback_query(filters.regex(r"mr_count\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"mr_count\((.+)\)"), group=2) async def cb_max_buttons(bot, update: CallbackQuery): """ A Callback Funtion For Changing The Count Of Result To Be Shown Per Page @@ -1070,13 +1096,13 @@ async def cb_max_buttons(bot, update: CallbackQuery): [ InlineKeyboardButton ( - "10 Filters", callback_data=f"set(per_page|10|{chat_id}|{count})" + "8 Filters", callback_data=f"set(per_page|8|{chat_id}|{count})" ) ], [ InlineKeyboardButton ( - "15 Filters", callback_data=f"set(per_page|15|{chat_id}|{count})" + "16 Filters", callback_data=f"set(per_page|16|{chat_id}|{count})" ) ], [ @@ -1113,7 +1139,7 @@ async def cb_max_buttons(bot, update: CallbackQuery): -@Client.on_callback_query(filters.regex(r"mp_count\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"mp_count\((.+)\)"), group=2) async def cb_max_page(bot, update: CallbackQuery): """ A Callback Funtion For Changing The Count Of Maximum Result Pages To Be Shown @@ -1180,7 +1206,7 @@ async def cb_max_page(bot, update: CallbackQuery): -@Client.on_callback_query(filters.regex(r"mf_count\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"mf_count\((.+)\)"), group=2) async def cb_max_results(bot, update: CallbackQuery): """ A Callback Funtion For Changing The Count Of Maximum Files TO Be Fetched From Database @@ -1252,7 +1278,7 @@ async def cb_max_results(bot, update: CallbackQuery): -@Client.on_callback_query(filters.regex(r"show_invites\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"show_invites\((.+)\)"), group=2) async def cb_show_invites(bot, update: CallbackQuery): """ A Callback Funtion For Enabling Or Diabling Invite Link Buttons @@ -1313,7 +1339,7 @@ async def cb_show_invites(bot, update: CallbackQuery): -@Client.on_callback_query(filters.regex(r"inPM\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"inPM\((.+)\)"), group=2) async def cb_pm_file(bot, update: CallbackQuery): """ A Callback Funtion For Enabling Or Diabling File Transfer Through Bot PM @@ -1374,7 +1400,7 @@ async def cb_pm_file(bot, update: CallbackQuery): -@Client.on_callback_query(filters.regex(r"accuracy\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"accuracy\((.+)\)"), group=2) async def cb_accuracy(bot, update: CallbackQuery): """ A Callaback Funtion to control the accuracy of matching results @@ -1449,7 +1475,7 @@ async def cb_accuracy(bot, update: CallbackQuery): -@Client.on_callback_query(filters.regex(r"set\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"set\((.+)\)"), group=2) async def cb_set(bot, update: CallbackQuery): """ A Callback Funtion Support For config() @@ -1540,8 +1566,18 @@ async def cb_set(bot, update: CallbackQuery): ) +@DonLee_Robot.on_callback_query(filters.regex("instructions"), group=2) +async def my_instructs(bot, update: CallbackQuery): + #Callback Function for instructions when no results are available + + global VERIFY + chat_id = update.message.chat.id + user_id = update.from_user.id + await update.answer("Check if your spelling is correct first and then try adding the year and quality of the movie 😉. If you still didn'get your movie add the language 😁. If there is no result it just is'nt available 😌.", show_alert=True) + return + -@Client.on_callback_query(filters.regex(r"status\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"status\((.+)\)"), group=2) async def cb_status(bot, update: CallbackQuery): """ A Callback Funtion For Showing Overall Status Of A Group @@ -1586,7 +1622,7 @@ async def cb_status(bot, update: CallbackQuery): -@Client.on_callback_query(filters.regex(r"about\((.+)\)"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"about\((.+)\)"), group=2) async def cb_about(bot, update: CallbackQuery): """ A Callback Funtion For Showing About Section In Bot Setting Menu @@ -1601,14 +1637,13 @@ async def cb_about(bot, update: CallbackQuery): text=f"Bot's Status\n" text+=f"\nBot's Uptime: {time_formatter(time.time() - start_uptime)}\n" text+=f"\nBot Funtion: Auto Filter Files\n" - text+=f"""\nBot Support: @CrazyBotszGrp\n""" - text+="""\nSource Code: Source""" + text+=f"""\nBot Group: Mo Tech\n""" buttons = [ [ InlineKeyboardButton ( - "My Dev ⚡", url="https://t.me/AlbertEinstein_TG" + "My Dev ⚡", url="t.me/Mrk_yt" ), InlineKeyboardButton @@ -1630,56 +1665,94 @@ async def cb_about(bot, update: CallbackQuery): text, reply_markup=reply_markup, parse_mode="html" ) - - -@Client.on_callback_query(filters.regex(r"^(start|help|about|close)$"), group=2) +@DonLee_Robot.on_callback_query(filters.regex(r"^(start|help|about|mods|channel|main|malayalam_imdb|english_imdb|help_me|close)$"), group=2) async def callback_data(bot, update: CallbackQuery): - + query_data = update.data - + runing = "hi" if query_data == "start": - buttons = [[ - InlineKeyboardButton('My Dev 👨‍🔬', url='https://t.me/AlbertEinstein_TG'), - InlineKeyboardButton('Source Code 🧾', url ='https://github.com/AlbertEinsteinTG/Adv-Auto-Filter-Bot') - ],[ - InlineKeyboardButton('Support 🛠', url='https://t.me/CrazyBotszGrp') - ],[ - InlineKeyboardButton('Help ⚙', callback_data="help") - ]] + buttons = [ + [ + InlineKeyboardButton + ( + '📢Update Channel', url='t.me/Mo_Tech_YT' + ), + InlineKeyboardButton + ( + '💡More Botz', url='t.me/MT_Botz' + ) + ], + [ + InlineKeyboardButton + ( + DEPLOY, url=HEROKU + ) + ], + [ + InlineKeyboardButton + ( + '🚶Help🚶', callback_data='help' + ) + ] + ] reply_markup = InlineKeyboardMarkup(buttons) await update.message.edit_text( Translation.START_TEXT.format(update.from_user.mention), reply_markup=reply_markup, - parse_mode="html", - disable_web_page_preview=True + parse_mode="html" ) elif query_data == "help": - buttons = [[ - InlineKeyboardButton('Home ⚡', callback_data='start'), - InlineKeyboardButton('About 🚩', callback_data='about') - ],[ - InlineKeyboardButton('Close 🔐', callback_data='close') - ]] - + buttons = [ + [ + InlineKeyboardButton + ( + DEPLOY, url=HEROKU + ) + ], + [ + InlineKeyboardButton + ( + '🏡Home', callback_data='start' + ), + InlineKeyboardButton + ( + 'About💡', callback_data='about' + ) + ] + ] + reply_markup = InlineKeyboardMarkup(buttons) await update.message.edit_text( - Translation.HELP_TEXT, + Translation.HELP_TEXT.format(runing), reply_markup=reply_markup, - parse_mode="html", - disable_web_page_preview=True + parse_mode="html" ) elif query_data == "about": - buttons = [[ - InlineKeyboardButton('Home ⚡', callback_data='start'), - InlineKeyboardButton('Close 🔐', callback_data='close') - ]] + buttons = [ + [ + InlineKeyboardButton + ( + DEPLOY, url=HEROKU + ) + ], + [ + InlineKeyboardButton + ( + '🏠Home', callback_data='start' + ), + InlineKeyboardButton + ( + 'Close❎️', callback_data='close' + ) + ] + ] reply_markup = InlineKeyboardMarkup(buttons) @@ -1690,6 +1763,9 @@ async def callback_data(bot, update: CallbackQuery): ) + elif query_data == "help_me": + await update.answer("Do not add the word MOVIE with your movie name 😉.\nദയവ് ചെയ്ത് സിനിമയുടെ പേരിന്റെ കൂടെ Movie എന്ന വാക്ക് ഇടരുത് 😝.", show_alert=True) + elif query_data == "close": await update.message.delete() @@ -1707,4 +1783,3 @@ def time_formatter(seconds: float) -> str: ((str(minutes) + "m, ") if minutes else "") + \ ((str(seconds) + "s") if seconds else "") return tmp - diff --git a/bot/plugins/auto_filter.py b/DonLee_Robot/Modules/Filters/Filter.py similarity index 55% rename from bot/plugins/auto_filter.py rename to DonLee_Robot/Modules/Filters/Filter.py index c5248420e..f550f7542 100644 --- a/bot/plugins/auto_filter.py +++ b/DonLee_Robot/Modules/Filters/Filter.py @@ -1,38 +1,96 @@ +# (C) AlbertEinstein_TG +# (C) @Nacbots +# (E) @Muhammed_RK, @Mo_Tech_YT , @Mo_Tech_Group, @MT_Botz +# (M) @Jackbro007 +# Copyright permission under MIT License +# All rights reserved by PR0FESS0R-99 +# License -> https://github.com/PR0FESS0R-99/DonLee_Robot/blob/main/LICENSE + import re import logging import asyncio - +from time import time from pyrogram import Client, filters from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery from pyrogram.errors import ButtonDataInvalid, FloodWait - -from bot.database import Database # pylint: disable=import-error -from bot.bot import Bot # pylint: disable=import-error - +from DonLee_Robot.Modules.Filters.Main import Database +from DonLee_Robot.donlee_robot import DonLee_Robot +from DonLee_Robot import Translation, Mo_Tech_YT +import imdb FIND = {} INVITE_LINK = {} ACTIVE_CHATS = {} db = Database() -@Bot.on_message(filters.text & filters.group, group=0) +@DonLee_Robot.on_message(filters.text & filters.group & ~filters.bot, group=0) async def auto_filter(bot, update): """ A Funtion To Handle Incoming Text And Reply With Appropriate Results """ group_id = update.chat.id + the_query = update.text + query = re.sub(r"[1-2]\d{3}", "", update.text) # Targetting Only 1000 - 2999 😁 + tester = 2 + + for i in Mo_Tech_YT.MO_TECH_YT_05 : + if i in the_query.split() : + for a in Mo_Tech_YT.MO_TECH_YT_08 : + if a in the_query.split() : + tester = 0 + break + else : + tester = 1 + if tester==0 : + break + + if tester==1 : + buttons = [[ + InlineKeyboardButton("Help🥴",callback_data="help_me") + ]] + reply_markup = InlineKeyboardMarkup(buttons) + await bot.send_message( + chat_id=update.chat.id, + text="Please dont send the word Movie with your Movie name 😪\nTry Reading the help box below 👇🏽", + reply_markup=reply_markup, + parse_mode="html", + reply_to_message_id=update.message_id) + return + + for i in Mo_Tech_YT.MO_TECH_YT_06.split() : + if i in the_query.lower() : + buttons = [[ + InlineKeyboardButton("Help🥴",callback_data="help_me") + ]] + reply_markup = InlineKeyboardMarkup(buttons) + await bot.send_message( + text=" കിട്ടോ, അയക്കോ, ഉണ്ടോ, തരുമോ എന്ന് ഒന്നും ചോദിക്കേണ്ട സിനിമയുടെ പേര് മാത്രം കൃത്യമായി അയക്കുക 😪", + chat_id=update.chat.id, + reply_to_message_id=update.message_id, + parse_mode="html", + reply_markup=reply_markup) + return + + for i in "#admins #admin #complaint #report @admin @admins".split(): + if i in the_query.lower() : + await update.forward(chat_id=Mo_Tech_YT.MO_TECH_YT_09) + await bot.send_message( + chat_id=update.chat.id, + text="Your report was successfully sent to admins please wait for a reply 😉", + reply_to_message_id=update.message_id, + parse_mode="html") + return if re.findall(r"((^\/|^,|^\.|^[\U0001F600-\U000E007F]).*)", update.text): return - - if ("https://" or "http://") in update.text: - return - - query = re.sub(r"[1-2]\d{3}", "", update.text) # Targetting Only 1000 - 2999 😁 + + for a in "https:// http:// thanks thank tnx tnq tq tqsm #".split(): + if a in update.text.lower(): + return if len(query) < 2: return - + results = [] global ACTIVE_CHATS @@ -64,7 +122,26 @@ async def auto_filter(bot, update): file_name = filter.get("file_name") file_type = filter.get("file_type") file_link = filter.get("file_link") + file_size = int(filter.get("file_size", "0")) + + # from B to MiB + + if file_size < 1024: + file_size = f"[{file_size} B]" + elif file_size < (1024**2): + file_size = f" {str(round(file_size/1024, 2))} KB " + elif file_size < (1024**3): + file_size = f" {str(round(file_size/(1024**2), 2))} MB " + elif file_size < (1024**4): + file_size = f"{str(round(file_size/(1024**3), 2))} GB " + + + file_size = "" if file_size == ("[0 B]") else file_size + + # add emoji down below inside " " if you want.. + + if file_type == "video": if allow_video: pass @@ -99,18 +176,41 @@ async def auto_filter(bot, update): bot_ = FIND.get("bot_details") file_link = f"https://t.me/{bot_.username}?start={unique_id}" - - results.append( + if not Mo_Tech_YT.MO_TECH_YT_07: + button_text = f"[{file_size}]📽️ {file_name}" + results.append( + [ - InlineKeyboardButton(file_name, url=file_link) + + InlineKeyboardButton(button_text, url=file_link) + ] + ) + else: + results.append( + [ + InlineKeyboardButton(f"{file_name}", url=file_link), + InlineKeyboardButton(f"{file_size}", url=file_link) + ] + ) + else: - return # return if no files found for that query + pass # return if no files found for that query - if len(results) == 0: # double check + if len(results) == 0 : # double check + buttons = [[ + InlineKeyboardButton("Instructions 📑",callback_data="instructions") + ]] + reply_markup = InlineKeyboardMarkup(buttons) + await bot.send_message( + chat_id=update.chat.id, + text=f"Sorry I couldn't find anything for {the_query} 🤧\nTry Reading the instructions below 👇🏽", + reply_markup=reply_markup, + parse_mode="html", + reply_to_message_id=update.message_id) return else: @@ -125,16 +225,20 @@ async def auto_filter(bot, update): FIND[query] = {"results": result, "total_len": len_results, "max_pages": max_pages} # TrojanzHex's Idea Of Dicts😅 # Add next buttin if page count is not equal to 1 - if len_result != 1: + page_btn = "⓵ ❷ ❸ ❹ ❺ " + cutter = len_result if len_result < max_pages else max_pages + page_btn = page_btn[:cutter*2] + + if len_result != 1: result[0].append( [ - InlineKeyboardButton("Next ⏩", callback_data=f"navigate(0|next|{query})") + InlineKeyboardButton("⪼⪼", callback_data=f"navigate(0|next|{query})") ] ) # Just A Decaration result[0].append([ - InlineKeyboardButton(f"🔰 Page 1/{len_result if len_result < max_pages else max_pages} 🔰", callback_data="ignore") + InlineKeyboardButton(f"📑 {page_btn} 📑", callback_data="ignore") ]) @@ -181,22 +285,49 @@ async def auto_filter(bot, update): reply_markup = InlineKeyboardMarkup(result[0]) + #To find any number in the query and remove it. + year = 2021 + for i in the_query.split(): + try : + year = int(i) + the_query = the_query.replace(i,"") + except : + pass + for i in "movie malayalam english tamil kannada telugu subtitles esub esubs".split(): + if i in the_query.lower().split(): + the_query = the_query.replace(i,"") + try: - await bot.send_message( + ia = imdb.IMDb() + my_movie=the_query + movies = ia.search_movie(my_movie) + #print(f"{movies[0].movieID} {movies[0]['title']}") + movie_url = movies[0].get_fullsizeURL() + + await bot.send_photo( + photo=movie_url, + caption=f"""🎬 Title : {query}\n🗃️ Total Files : {len_results if len_results <= max_pages*8 else max_pages*8}""", + reply_markup=reply_markup, + chat_id=update.chat.id, + reply_to_message_id=update.message_id, + parse_mode="html" + ) + + except Exception as e: + print(e) + + try: + await bot.send_message( chat_id = update.chat.id, - text=f"Found {(len_results)} Results For Your Query: {query}", + text=f"📀 Title : {query} \n🗃️ Total Files : {len_results if len_results <= max_pages*8 else max_pages*8}", reply_markup=reply_markup, parse_mode="html", reply_to_message_id=update.message_id ) - except ButtonDataInvalid: - print(result[0]) + except ButtonDataInvalid: + print(result[0]) - except Exception as e: - print(e) - - async def gen_invite_links(db, group_id, bot, update): """ A Funtion To Generate Invite Links For All Active @@ -225,7 +356,7 @@ async def gen_invite_links(db, group_id, bot, update): return -async def recacher(group_id, ReCacheInvite=True, ReCacheActive=False, bot=Bot, update=Message): +async def recacher(group_id, ReCacheInvite=True, ReCacheActive=False, bot=DonLee_Robot, update=Message): """ A Funtion To rechase invite links and active chats of a specific chat """ @@ -265,5 +396,4 @@ async def recacher(group_id, ReCacheInvite=True, ReCacheActive=False, bot=Bot, u achatId.append(int(x["chat_id"])) ACTIVE_CHATS[str(group_id)] = achatId - return - + return diff --git a/bot/database/database.py b/DonLee_Robot/Modules/Filters/Main.py similarity index 96% rename from bot/database/database.py rename to DonLee_Robot/Modules/Filters/Main.py index 8241abfa8..ecceb08a8 100644 --- a/bot/database/database.py +++ b/DonLee_Robot/Modules/Filters/Main.py @@ -1,21 +1,17 @@ -import motor.motor_asyncio # pylint: disable=import-error -from bot import DB_URI - -class Singleton(type): - __instances__ = {} - - def __call__(cls, *args, **kwargs): - if cls not in cls.__instances__: - cls.__instances__[cls] = super(Singleton, cls).__call__(*args, **kwargs) - - return cls.__instances__[cls] +# (C) AlbertEinstein_TG +# (E) PR0FESS0R_99 +# Copyright permission under MIT License +# All rights reserved by PR0FESS0R-99 +# License -> https://github.com/PR0FESS0R-99/DonLee_Robot/blob/main/LICENSE +import motor.motor_asyncio # pylint: disable=import-error +from DonLee_Robot.Simple_Config import Mo_Tech_YT -class Database(metaclass=Singleton): +class Database: def __init__(self): - self._client = motor.motor_asyncio.AsyncIOMotorClient(DB_URI) - self.db = self._client["Adv_Auto_Filter"] + self._client = motor.motor_asyncio.AsyncIOMotorClient(Mo_Tech_YT.MO_TECH_YT_03) + self.db = self._client[Mo_Tech_YT.MO_TECH_YT_04] self.col = self.db["Main"] self.acol = self.db["Active_Chats"] self.fcol = self.db["Filter_Collection"] @@ -446,7 +442,7 @@ async def get_filters(self, group_id: int, keyword: str): filters = [] pipeline= { - '$text':{'$search': keyword} + 'group_id': int(group_id), '$text':{'$search': keyword} } @@ -477,12 +473,14 @@ async def get_file(self, unique_id: str): file = await self.fcol.find_one({"unique_id": unique_id}) file_id = None file_type = None + file_name = None + file_caption = None if file: file_id = file.get("file_id") file_name = file.get("file_name") file_type = file.get("file_type") - file_caption = file.get("caption") + file_caption = file.get("file_caption") return file_id, file_name, file_caption, file_type @@ -499,5 +497,3 @@ async def tf_count(self, group_id: int): A Funtion to count total filters of a group """ return await self.fcol.count_documents({"group_id": group_id}) - - diff --git a/DonLee_Robot/Modules/Filters/__init__.py b/DonLee_Robot/Modules/Filters/__init__.py new file mode 100644 index 000000000..ded8c2fa9 --- /dev/null +++ b/DonLee_Robot/Modules/Filters/__init__.py @@ -0,0 +1,2 @@ +from .Main import Database +from .Filter import FIND, INVITE_LINK, ACTIVE_CHATS, recacher, gen_invite_links, recacher diff --git a/bot/plugins/settings.py b/DonLee_Robot/Modules/Settings/Settings.py similarity index 64% rename from bot/plugins/settings.py rename to DonLee_Robot/Modules/Settings/Settings.py index a8fd1c5fa..a3cc3c41c 100644 --- a/bot/plugins/settings.py +++ b/DonLee_Robot/Modules/Settings/Settings.py @@ -1,14 +1,17 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- # (c) @AlbertEinsteinTG +# (c) @Muhammed_RK, @MRK_YT, @Mo_Tech_Group, @MT_Botz +# Copyright permission under MIT License +# All rights reserved by PR0FESS0R-99 +# License -> https://github.com/PR0FESS0R-99/DonLee_Robot/blob/main/LICENSE import re -from pyrogram import Client, filters +from pyrogram import filters +from pyrogram import Client as DonLee_Robot from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup -from bot import VERIFY # pylint: disable=import-error +from DonLee_Robot import VERIFY # pylint: disable=import-error -@Client.on_message(filters.command(["settings"]) & filters.group, group=1) +@DonLee_Robot.on_message(filters.command(["settings"]) & filters.group, group=1) async def settings(bot, update): chat_id = update.chat.id @@ -29,59 +32,31 @@ async def settings(bot, update): bot_info = await bot.get_me() bot_first_name= bot_info.first_name - text =f"{bot_first_name}'s Settings Pannel.....\n" + text =f"{bot_first_name}'s Settings Pannel.....\n" text+=f"\nYou Can Use This Menu To Change Connectivity And Know Status Of Your Every Connected Channel, Change Filter Types, Configure Filter Results And To Know Status Of Your Group..." - buttons = [ - [ - InlineKeyboardButton - ( - "Channels", callback_data=f"channel_list({chat_id})" - ), - - InlineKeyboardButton - ( - "Filter Types", callback_data=f"types({chat_id})" - ) - ], - [ - InlineKeyboardButton - ( - "Configure 🛠", callback_data=f"config({chat_id})" - ) - ], - [ - InlineKeyboardButton - ( - "Status", callback_data=f"status({chat_id})" - ), - - InlineKeyboardButton - ( - "About", callback_data=f"about({chat_id})" - ) - ], - [ - InlineKeyboardButton - ( - "Close 🔐", callback_data="close" - ) - ] - ] + buttons = [[ + InlineKeyboardButton("Channels", callback_data=f"channel_list({chat_id})"), + InlineKeyboardButton("Filter Types", callback_data=f"types({chat_id})") + ],[ + InlineKeyboardButton("Configure 🛠", callback_data=f"config({chat_id})") + ],[ + InlineKeyboardButton("Status", callback_data=f"status({chat_id})"), + InlineKeyboardButton("About", callback_data=f"about({chat_id})") + ],[ + InlineKeyboardButton("Close 🔐", callback_data="close") + ]] reply_markup = InlineKeyboardMarkup(buttons) await bot.send_message ( - chat_id=chat_id, text=text, reply_markup=reply_markup, parse_mode="html", reply_to_message_id=update.message_id - ) - def remove_emoji(string): emoji_pattern = re.compile("[" u"\U0001F600-\U0001F64F" diff --git a/DonLee_Robot/Modules/Settings/__init__.py b/DonLee_Robot/Modules/Settings/__init__.py new file mode 100644 index 000000000..906cb95ec --- /dev/null +++ b/DonLee_Robot/Modules/Settings/__init__.py @@ -0,0 +1,3 @@ +from .Settings import( + remove_emoji +) diff --git a/DonLee_Robot/Modules/__init__.py b/DonLee_Robot/Modules/__init__.py new file mode 100644 index 000000000..160190019 --- /dev/null +++ b/DonLee_Robot/Modules/__init__.py @@ -0,0 +1,2 @@ +from .Filters import Database +from .Channel import DEPLOY, HEROKU diff --git a/DonLee_Robot/Simple_Config.py b/DonLee_Robot/Simple_Config.py new file mode 100644 index 000000000..d5804b07a --- /dev/null +++ b/DonLee_Robot/Simple_Config.py @@ -0,0 +1,19 @@ +import os +from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton +class Mo_Tech_YT(object): + MO_TECH_YT_01 = InlineKeyboardMarkup + MO_TECH_YT_02 = InlineKeyboardButton + MO_TECH_YT_03 = os.environ.get("DB_URI") + MO_TECH_YT_04 = os.environ.get("DB_NAME", "mOtech") + MO_TECH_YT_05 = os.environ.get("EXPELL").split() + MO_TECH_YT_06 = os.environ.get("KITTUMO") + MO_TECH_YT_07 = bool(os.environ.get("SIZE_BUTTON")) + MO_TECH_YT_08 = os.environ.get("IN_EXPELL").split() + MO_TECH_YT_09 = set(int(x) for x in os.environ.get("OWNER_ID", "").split()) + MO_TECH_YT_10 = int(os.environ.get("APP_ID")) + MO_TECH_YT_11 = os.environ.get("API_HASH") + MO_TECH_YT_12 = os.environ.get("BOT_TOKEN") + MO_TECH_YT_13 = os.environ.get("PHOTTO", "https://telegra.ph/file/7d04d3370126136c9c7a9.jpg") + MO_TECH_YT_14 = os.environ.get("FSUB_TEXT", "Join My Update Channel") + MO_TECH_YT_15 = os.environ.get("FORCES_SUB", "Mo_Tech_YT") + MO_TECH_YT_16 = os.environ.get("USER_SESSION") diff --git a/DonLee_Robot/Translation.py b/DonLee_Robot/Translation.py new file mode 100644 index 000000000..bc379f9c3 --- /dev/null +++ b/DonLee_Robot/Translation.py @@ -0,0 +1,53 @@ +import os +class Translation(object): + + START_TEXT = """🙋‍♂️Hey {}!! + +Am Just A Pro Auto Filter Bot....😉 + +Just Add Me To Your Group And Channel And Connect Them And See My Pevers 🔥🔥😝 + +Subscribe to the update channel to learn about my updates and activity... + +Press /help to know about available commands🤪 + +Maintained By @Mo_Tech_YT""" + + HELP_TEXT = """ +Notice +Imdb Poster Imdb is available on this bot +Rating Not Available + +Bot Commands (Works Only In Groups) + +☞ /add chat_id - To Connect A Group With A Channel (Bot Should Be Admin With Full Previlages In Both Group And Channel) + +☞ /del chat_id - To disconnect A Group With A Channel + +☞ /delall - This Command Will Disconnect All Connected Channel With The Group And Deletes All Its File From DB + +☞ /settings - This Command Will Display You A Settings Pannel Instance Which Can Be Used To Tweek Bot's Settings Accordingly + + ☞ Channel - Button Will Show You All The Connected Chats With The Group And Will Show Buttons Correspnding To There Order For Furthur Controls + + ☞ Filter Types - Button Will Show You The 3 Filter Option Available In Bot... Pressing Each Buttons Will Either Enable or Disable Them And This Will Take Into Action As Soon As You Use Them Without The Need Of A Restart + + ☞ Configure - Button Will Helps You To Change No. of Pages/ Buttons Per Page/ Total Result Without Acutally Editing The Repo... Also It Provide Option To Enable/Disable For Showing Invite Link In Each Results + + ☞ Status - Button Will Shows The Stats Of Your Channel + +Maintained By @Mo_Tech_YT""" + + ABOUT_TEXT = """ +➥ 🤖Bot : Adv Auto Filter Bot v2.9 + +➥ 😎Creator : @AlbertEinstein_TG + +➥ 👨‍💻Editor : @Mrk_YT + +➥ 🗣️Language : Python3 + +➥ 📚Library : Pyrogram Asyncio 1.13.0 + +➥ 📖Source Code : 💥Click Me +""" diff --git a/bot/user.py b/DonLee_Robot/User.py similarity index 74% rename from bot/user.py rename to DonLee_Robot/User.py index 6962cc876..1a8fe30b4 100644 --- a/bot/user.py +++ b/DonLee_Robot/User.py @@ -1,28 +1,30 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# (c) @AlbertEinsteinTG - -from pyrogram import Client, __version__ - -from . import API_HASH, APP_ID, LOGGER, \ - USER_SESSION - - -class User(Client): - def __init__(self): - super().__init__( - USER_SESSION, - api_hash=API_HASH, - api_id=APP_ID, - workers=4 - ) - self.LOGGER = LOGGER - - async def start(self): - await super().start() - usr_bot_me = await self.get_me() - return (self, usr_bot_me.id) - - async def stop(self, *args): - await super().stop() - self.LOGGER(__name__).info("Bot stopped. Bye.") +# (c) @AlbertEinsteinTG +# (c) @Muhammed_RK, @MRK_YT, @Mo_Tech_Group, @MT_Botz +# Copyright permission under MIT License +# All rights reserved by PR0FESS0R-99 +# License -> https://github.com/PR0FESS0R-99/DonLee_Robot/blob/main/LICENSE + +from pyrogram import Client, __version__ + +from . import API_HASH, APP_ID, LOGGER, \ + USER_SESSION + + +class User(Client): + def __init__(self): + super().__init__( + USER_SESSION, + api_hash=API_HASH, + api_id=APP_ID, + workers=4 + ) + self.LOGGER = LOGGER + + async def start(self): + await super().start() + usr_bot_me = await self.get_me() + return (self, usr_bot_me.id) + + async def stop(self, *args): + await super().stop() + self.LOGGER(__name__).info("Bot stopped. Bye.") diff --git a/bot/__init__.py b/DonLee_Robot/__init__.py similarity index 69% rename from bot/__init__.py rename to DonLee_Robot/__init__.py index 23d2a30c8..4802b191d 100644 --- a/bot/__init__.py +++ b/DonLee_Robot/__init__.py @@ -1,45 +1,41 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# (c) @AlbertEinsteinTG - -import os -import logging -import time - -from logging.handlers import RotatingFileHandler - -from .translation import Translation - -# Change Accordingly While Deploying To A VPS -APP_ID = int(os.environ.get("APP_ID")) - -API_HASH = os.environ.get("API_HASH") - -BOT_TOKEN = os.environ.get("BOT_TOKEN") - -DB_URI = os.environ.get("DB_URI") - -USER_SESSION = os.environ.get("USER_SESSION") - -VERIFY = {} - -logging.basicConfig( - level=logging.INFO, - format="[%(asctime)s - %(levelname)s] - %(name)s - %(message)s", - datefmt='%d-%b-%y %H:%M:%S', - handlers=[ - RotatingFileHandler( - "autofilterbot.txt", - maxBytes=50000000, - backupCount=10 - ), - logging.StreamHandler() - ] -) -logging.getLogger("pyrogram").setLevel(logging.WARNING) - -start_uptime = time.time() - - -def LOGGER(name: str) -> logging.Logger: - return logging.getLogger(name) +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# (c) @AlbertEinsteinTG & MRK_YT + +import os +import logging +import time + +from logging.handlers import RotatingFileHandler + +from .Translation import Translation +from .Simple_Config import Mo_Tech_YT + +# Change Accordingly While Deploying To A VPS +APP_ID = Mo_Tech_YT.MO_TECH_YT_10 +API_HASH = Mo_Tech_YT.MO_TECH_YT_11 +BOT_TOKEN = Mo_Tech_YT.MO_TECH_YT_12 +USER_SESSION = Mo_Tech_YT.MO_TECH_YT_16 + +VERIFY = {} + +logging.basicConfig( + level=logging.INFO, + format="[%(asctime)s - %(levelname)s] - %(name)s - %(message)s", + datefmt='%d-%b-%y %H:%M:%S', + handlers=[ + RotatingFileHandler( + "autofilterbot.txt", + maxBytes=50000000, + backupCount=10 + ), + logging.StreamHandler() + ] +) +logging.getLogger("pyrogram").setLevel(logging.WARNING) + +start_uptime = time.time() + + +def LOGGER(name: str) -> logging.Logger: + return logging.getLogger(name) diff --git a/DonLee_Robot/__main__.py b/DonLee_Robot/__main__.py new file mode 100644 index 000000000..fece727cc --- /dev/null +++ b/DonLee_Robot/__main__.py @@ -0,0 +1,10 @@ +# (c) @AlbertEinsteinTG +# (c) @Muhammed_RK, @MRK_YT, @Mo_Tech_Group, @MT_Botz +# Copyright permission under MIT License +# All rights reserved by PR0FESS0R-99 +# License -> https://github.com/PR0FESS0R-99/DonLee_Robot/blob/main/LICENSE + +from .donlee_robot import DonLee_Robot + +app = DonLee_Robot() +app.run() diff --git a/bot/bot.py b/DonLee_Robot/donlee_robot.py similarity index 84% rename from bot/bot.py rename to DonLee_Robot/donlee_robot.py index e90f1f018..a0283205c 100644 --- a/bot/bot.py +++ b/DonLee_Robot/donlee_robot.py @@ -1,40 +1,40 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# (c) @SpEcHIDe - -from pyrogram import Client, __version__ - -from . import API_HASH, APP_ID, LOGGER, BOT_TOKEN - -from .user import User - -class Bot(Client): - USER: User = None - USER_ID: int = None - - def __init__(self): - super().__init__( - "bot", - api_hash=API_HASH, - api_id=APP_ID, - plugins={ - "root": "bot/plugins" - }, - workers=4, - bot_token=BOT_TOKEN, - sleep_threshold=10 - ) - self.LOGGER = LOGGER - - async def start(self): - await super().start() - bot_details = await self.get_me() - self.set_parse_mode("html") - self.LOGGER(__name__).info( - f"@{bot_details.username} started! " - ) - self.USER, self.USER_ID = await User().start() - - async def stop(self, *args): - await super().stop() - self.LOGGER(__name__).info("Bot stopped. Bye.") +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# (c) @SpEcHIDe + +from pyrogram import Client, __version__ + +from . import API_HASH, APP_ID, LOGGER, BOT_TOKEN + +from .User import User + +class DonLee_Robot(Client): + USER: User = None + USER_ID: int = None + + def __init__(self): + super().__init__( + "DonLee_Robot", + api_hash=API_HASH, + api_id=APP_ID, + plugins={ + "root": "DonLee_Robot/Modules" + }, + workers=400, + bot_token=BOT_TOKEN, + sleep_threshold=10 + ) + self.LOGGER = LOGGER + + async def start(self): + await super().start() + bot_details = await self.get_me() + self.set_parse_mode("html") + self.LOGGER(__name__).info( + f"@{bot_details.username} started! " + ) + self.USER, self.USER_ID = await User().start() + + async def stop(self, *args): + await super().stop() + self.LOGGER(__name__).info("Bot stopped. Bye.") diff --git a/Procfile b/Procfile index 5765bf02b..3bf2661c4 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -worker: python3 -m bot \ No newline at end of file +worker: python3 -m DonLee_Robot diff --git a/Readme.md b/Readme.md index f8392e3c5..86213a755 100644 --- a/Readme.md +++ b/Readme.md @@ -1,28 +1,80 @@ -# Adv Auto Filter Bot V2 +# [DONLEE_ROBOT](https://telegram.dog/Donlee_Robot)

- - + + - - + +

-__This Is Just An Simple Advance Auto Filter Bot Complete Rewritten Version Of [Adv-Filter-Bot](https://github.com/AlbertEinsteinTG/Adv-Auto-Filter-Bot)..__ +-------- -__Just Sent Any Text As Query It Will Search For All Connected Chat's Files In Its MongoDB And Reply You With The Message Link As A Button__ +This Is Just An Simple Advance Auto Filter Bot Complete Rewritten Version Of [Adv-Auto-Filter-Bot-v1](https://github.com/CrazyBotsz/Adv-Auto-Filter-Bot) +Just Sent Any Text As Query It Will Search For All Connected Chat's Files In Its MongoDB And Reply You With The Message Link As A Button -## Usage +------ -**__How To Use Me!?__** +#### FEATURE -* -> Add me to any group and make me admin
-* -> Add me to your channel as admin with full previlages +* IMDB Poster Available +* Spelling Mode +* Main Text Mode (Kitto, Undo, Ille, Therumo) +* Button Mode +* Movie Text Mode (movie, Movie) + +-------- +##### Available DonLee Bots + +
Auto Filter Orginal +

+
+ +### Notice +* This [Deploy button](https://heroku.com/deploy?template=https://github.com/PR0FESS0R-99/DonLee_bot/tree/main) is the original +* Click [Deploy Video](https://youtu.be/uAHl5jvnrhk) to watch the video + +#### Deploy Video + + + +#### Deploy To Heroku +PR0FESS0R-99 +

+
+ +
Auto Filter 3 Editing Repo +

+
+ +### Notice +* This [Deploy button](https://heroku.com/deploy?template=https://github.com/PR0FESS0R-99/DonLee_bot/tree/MoTech) is the original +* Click [Deploy Video](https://youtu.be/lI71HsWzTKE) to watch the video + +#### Deploy Video + + + +#### Deploy To Heroku +PR0FESS0R-99 + + +

+
+ +---- + +##### Usage + +**How To Use Me!?** + +* Add me to any group and make me admin
+* Add me to your channel as admin with full previlages **Bot Commands (Works Only In Groups) :** @@ -41,69 +93,44 @@ OR      `/del @Username` - * -> `/delall`                - To delete all connections of a group and deletes all its file from DB + * `/delall`                - To delete all connections of a group and deletes all its file from DB - * -> `/settings`            - To disaply a Settings Pannel Instance which can be used to tweek bot's settings accordingly + * `/settings`            - To disaply a Settings Pannel Instance which can be used to tweek bot's settings accordingly - * -> Channel - Button will show you all the connected chats with the group along with there index buttons correspnding to there order for furthur controls... + * Channel - Button will show you all the connected chats with the group along with there index buttons correspnding to there order for furthur controls... - * -> Filter Types - Button will show you the 3 filter types available in bot... Pressing each buttons will either enable or disable them and this will take into action as soon as you use them...without the need of a restart.... + * Filter Types - Button will show you the 3 filter types available in bot... Pressing each buttons will either enable or disable them and this will take into action as soon as you use them...without the need of a restart.... - * -> Configure - Button will help you to change no. of pages/ buttons per page/ total result without acutally editing the repo... Also it provide option to Enable/Disable showing Invite Link in each results + * Configure - Button will help you to change no. of pages/ buttons per page/ total result without acutally editing the repo... Also it provide option to Enable/Disable showing Invite Link in each results - * -> Status - Button will show the stats of your current group + * Status - Button will show the stats of your current group -### Pre Requisites ------------------ -* ->__Your Bot Token From [@BotFather](http://www.telegram.dog/BotFather)__ - -* ->__Your APP ID And API Harsh From [Telegram](http://www.my.telegram.org) or [@UseTGXBot](http://www.telegram.dog/UseTGXBot)__ +##### Main Pre Requisites -* ->__Your User Session String Obtained From [@PyrogramStringBot](http://www.telegram.dog/PyrogramStringBot)__ +* Your Bot Token From [@BotFather](https://youtu.be/cB4UduCcNWs)__ -* ->__Mongo DB URL Obtained From [Mongo DB](http://www.mongodb.com)__ +* Your APP ID And API Harsh From [Telegram](https://youtu.be/5eEsvLAKVc0) or [@MT_MytelegramOrg_Bit](https://youtu.be/5eEsvLAKVc0) -#### PR's Are Very Welcome +* Your User Session String Obtained From [Telegram Bot](https://youtu.be/WUN_12-dYOM) -## Deploy -You can deploy this bot anywhere. +* Mongo DB URL Obtained From [Mongo DB](https://youtu.be/gBLTsH-IXr0) -**[Watch Deploying Tutorial...](https://youtu.be/KTearEPhumc)** - -
Deploy To Heroku -

-
- - Deploy - -

-
- -
Deploy To VPS -

-

-git clone https://github.com/AlbertEinsteinTG/Adv-Auto-Filter-Bot-V2/tree/blob/main
-cd Adv-Auto-Filter-Bot-ReMaster
-pip3 install -r requirements.txt
-# Change The Vars Of bot/__init__.py File Accordingly
-python3 -m bot
-
-

-
- -## Support -Join Our [Telegram Group](https://www.telegram.dog/CrazyBotszGrp) For Support/Assistance And Our [Channel](https://www.telegram.dog/CrazyBotsz) For Updates. +---- +##### Support +Join Our [Telegram Group](https://www.telegram.dog/Mo_Tech_Group) For Support/Assistance And Our [Channel](https://www.telegram.dog/Mo_Tech_YT) For Updates. Report Bugs, Give Feature Requests There.. Do Fork And Star The Repository If You Liked It. - -## Disclaimer +---- +##### Disclaimer [![GNU Affero General Public License v3.0](https://www.gnu.org/graphics/agplv3-155x51.png)](https://www.gnu.org/licenses/agpl-3.0.en.html#header) -Licensed under [GNU AGPL v3.0.](https://github.com/AlbertEinsteinTG/Adv-Auto-Filter-Bot-V2/blob/main/LICENSE) +Licensed under [GNU AGPL v3.0.](https://github.com/PR0FESS0R-99/DonLee_Robot/blob/main/LICENSE) Selling The Codes To Other People For Money Is *Strictly Prohibited*. - - +---- ## Credits - Thanks To Dan For His Awsome [Libary](https://github.com/pyrogram/pyrogram) - Thanks To SpEcHiDe For His Awesome [DeleteMessagesRoBot](https://github.com/SpEcHiDe/DeleteMessagesRoBot) + - [Thanks To AlbertEinsteinTG 👀](https://github.com/AlbertEinsteinTG) + - [PR0FESS0R-99](https://github.com/PR0FESS0R-99), [Mo_Tech_Group](https://telegram.dog/Mo_Tech_Group), [MT_Botz](https://telegram.dog/MT_Botz) diff --git a/app.json b/app.json index 70fdbee45..d06882916 100644 --- a/app.json +++ b/app.json @@ -1,24 +1,28 @@ { - "name": "Auto Filter Bot V2", - "description": "A Filter Bot Which Doesnt Need Manuall Filter Adding", - "logo": "https://telegra.ph/file/667e15c821117633d07bd.png", + "name": "DonLee AutoFilter V2.9", + "description": "iam Adv Auto Filter Bot Version 2.9", + "logo": "https://telegra.ph/file/92daa86a5ceb28fa6962d.jpg", "keywords": [ "Auto", "Filter", - "Mongo DB" + "v2.9" ], - "website": "https://github.com/AlbertEinsteinTG", - "repository": "https://github.com/AlbertEinsteinTG/Adv-Auto-Filter-Bot-V2", - "success_url": "https://telegram.dog/CrazyBotsz", + "website": "https://youtube.com/channel/UCmGBpXoM-OEm-FacOccVKgQ", + "repository": "https://github.com/PR0FESS0R-99/DonLee_Robot/tree/MoTech", + "success_url": "https://youtube.com/channel/UCmGBpXoM-OEm-FacOccVKgQ", "env": { "APP_ID": { - "description": "Your APP ID From my.telegram.org or @UseTGXBot", + "description": "Your APP ID From my.telegram.org or @MT_MytelegramOrg_Bot", "value": "" }, "API_HASH": { - "description": "Your API Hash From my.telegram.org or @UseTGXBot", + "description": "Your API Hash From my.telegram.org or @MT_MytelegramOrg_Bot", "value": "" }, + "BOT_NAME": { + "description": "Enter Your Bot Name From @BotFather", + "value": "DonLee_Robot" + }, "BOT_TOKEN": { "description": "Your Bot Token From @BotFather", "value": "" @@ -27,8 +31,38 @@ "description": "Your Mongo DB URL Obtained From mongodb.com", "value": "" }, + "SIZE_BUTTON": { + "description": "How To Use This Key Watch Tutorial Video - ()", + "value": "", + "required": false + }, + "FSUB_TEXT": { + "description": "Forces Subscribers Text", + "value": "", + "required": false + }, + "KITTUMO": { + "description": "Ayakko kitto sadhanangal 🤣", + "value": "ayakko kitto kittumo tharo tharumo ayakkamo send undo undaavo" + }, + "EXPELL": { + "description": "The words if contained should be rejected", + "value": "movie Movie" + }, + "IN_EXPELL": { + "description": "The words in Expelled you're okay with", + "value": "scary Scary emoji Emoji" + }, + "OWNER_ID": { + "description": "You're id From @MT_Id_Bot", + "value": "1876193641" + }, "USER_SESSION": { - "description": "A Pyrogram User Session String. Generated From @PyrogramStringBot", + "description": "A Pyrogram User Session String. Generated From @MT_usersession_Bot", + "value": "" + }, + "FORCES_SUB": { + "description": "update Channel UserName (Without @)", "value": "" } }, diff --git a/bot/__main__.py b/bot/__main__.py deleted file mode 100644 index 576ddf439..000000000 --- a/bot/__main__.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# (c) @AlbertEinsteinTG - -from .bot import Bot - -app = Bot() -app.run() \ No newline at end of file diff --git a/bot/database/__init__.py b/bot/database/__init__.py deleted file mode 100644 index ef3f969bc..000000000 --- a/bot/database/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .database import Database diff --git a/bot/plugins/commands.py b/bot/plugins/commands.py deleted file mode 100644 index 363c690ed..000000000 --- a/bot/plugins/commands.py +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# (c) @AlbertEinsteinTG - -from pyrogram import filters, Client -from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery -from bot import Translation # pylint: disable=import-error -from bot.database import Database # pylint: disable=import-error - -db = Database() - -@Client.on_message(filters.command(["start"]) & filters.private, group=1) -async def start(bot, update): - - try: - file_uid = update.command[1] - except IndexError: - file_uid = False - - if file_uid: - file_id, file_name, file_caption, file_type = await db.get_file(file_uid) - - if (file_id or file_type) == None: - return - - caption = file_caption if file_caption != ("" or None) else ("" + file_name + "") - - if file_type == "document": - - await bot.send_document( - chat_id=update.chat.id, - document = file_id, - caption = caption, - parse_mode="html", - reply_to_message_id=update.message_id, - reply_markup=InlineKeyboardMarkup( - [ - [ - InlineKeyboardButton - ( - 'Developers', url="https://t.me/CrazyBotsz" - ) - ] - ] - ) - ) - - elif file_type == "video": - - await update.bot.send_video( - chat_id=update.chat.id, - video = file_id, - caption = caption, - parse_mode="html", - reply_markup=InlineKeyboardMarkup( - [ - [ - InlineKeyboardButton - ( - 'Developers', url="https://t.me/CrazyBotsz" - ) - ] - ] - ) - ) - - elif file_type == "audio": - - await update.bot.send_audio( - chat_id=update.chat.id, - audio = file_id, - caption = caption, - parse_mode="html", - reply_markup=InlineKeyboardMarkup( - [ - [ - InlineKeyboardButton - ( - 'Developers', url="https://t.me/CrazyBotsz" - ) - ] - ] - ) - ) - - else: - print(file_type) - - return - - buttons = [[ - InlineKeyboardButton('Developers', url='https://t.me/CrazyBotsz'), - InlineKeyboardButton('Source Code 🧾', url ='https://github.com/AlbertEinsteinTG/Adv-Auto-Filter-Bot-V2') - ],[ - InlineKeyboardButton('Support 🛠', url='https://t.me/CrazyBotszGrp') - ],[ - InlineKeyboardButton('Help ⚙', callback_data="help") - ]] - - reply_markup = InlineKeyboardMarkup(buttons) - - await bot.send_message( - chat_id=update.chat.id, - text=Translation.START_TEXT.format( - update.from_user.first_name), - reply_markup=reply_markup, - parse_mode="html", - reply_to_message_id=update.message_id - ) - - -@Client.on_message(filters.command(["help"]) & filters.private, group=1) -async def help(bot, update): - buttons = [[ - InlineKeyboardButton('Home ⚡', callback_data='start'), - InlineKeyboardButton('About 🚩', callback_data='about') - ],[ - InlineKeyboardButton('Close 🔐', callback_data='close') - ]] - - reply_markup = InlineKeyboardMarkup(buttons) - - await bot.send_message( - chat_id=update.chat.id, - text=Translation.HELP_TEXT, - reply_markup=reply_markup, - parse_mode="html", - reply_to_message_id=update.message_id - ) - - -@Client.on_message(filters.command(["about"]) & filters.private, group=1) -async def about(bot, update): - - buttons = [[ - InlineKeyboardButton('Home ⚡', callback_data='start'), - InlineKeyboardButton('Close 🔐', callback_data='close') - ]] - reply_markup = InlineKeyboardMarkup(buttons) - - await bot.send_message( - chat_id=update.chat.id, - text=Translation.ABOUT_TEXT, - reply_markup=reply_markup, - disable_web_page_preview=True, - parse_mode="html", - reply_to_message_id=update.message_id - ) diff --git a/bot/translation.py b/bot/translation.py deleted file mode 100644 index b72093ebb..000000000 --- a/bot/translation.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# (c) @AlbertEinsteinTG - -class Translation(object): - - START_TEXT = """Hey {}!! -Am Just A Advance Auto Filter Bot....😉 - -Just Add Me To Your Group And Channel And Connect Them And See My Pevers 🔥🔥😝 - -For More Details Click Help Button Below.. -@CrazyBotsz -""" - - HELP_TEXT = """ -How To Use Me!? - - --> Add Me To Any Group And Make Me Admin --> Add Me To Your Desired Channel - - -Bot Commands (Works Only In Groups) : - - -> /add chat_id - OR - To Connect A Group With A Channel (Bot Should Be Admin With Full Previlages In Both Group And Channel) - /add @Username - - -> /del chat_id - OR - To disconnect A Group With A Channel - /del @Username - - -> /delall - This Command Will Disconnect All Connected Channel With The Group And Deletes All Its File From DB - - -> /settings - This Command Will Display You A Settings Pannel Instance Which Can Be Used To Tweek Bot's Settings Accordingly - - -> Channel - Button Will Show You All The Connected Chats With The Group And Will Show Buttons Correspnding To There Order For Furthur Controls - - -> Filter Types - Button Will Show You The 3 Filter Option Available In Bot... Pressing Each Buttons Will Either Enable or Disable Them And This Will Take Into Action As Soon As You Use Them Without The Need Of A Restart - - -> Configure - Button Will Helps You To Change No. of Pages/ Buttons Per Page/ Total Result Without Acutally Editing The Repo... Also It Provide Option To Enable/Disable For Showing Invite Link In Each Results - - -> Status - Button Will Shows The Stats Of Your Channel - -@CrazyBotsz -""" - - ABOUT_TEXT = """➥ Name : Auto Filter Bot - -➥ Creator : AlbertEinstein_TG - -➥ Language : Python3 - -➥ Library : Pyrogram Asyncio 1.13.0 - -➥ Source Code : Click Me -""" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 57971149c..c56223baa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,7 @@ Motor Pyrogram Pymongo Requests -TgCrypto +TgCrypto +IMDbPY +asyncio +aiofiles