12 |
13 |
14 |
15 |
16 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/TeamTeleRoid/add_user_to_db.py:
--------------------------------------------------------------------------------
1 | # (c) @PredatorHackerzZ
2 |
3 | from configs import Config
4 | from handlers.database import db
5 | from pyrogram import Client
6 | from pyrogram.types import Message
7 |
8 |
9 | async def AddUserToDatabase(bot: Client, cmd: Message):
10 | if not await db.is_user_exist(cmd.from_user.id):
11 | await db.add_user(cmd.from_user.id)
12 | if Config.LOG_CHANNEL is not None:
13 | await bot.send_message(
14 | int(Config.LOG_CHANNEL),
15 | f"#NEW_USER: \n\nNew User [{cmd.from_user.first_name}](tg://user?id={cmd.from_user.id}) started @{Config.BOT_USERNAME} !!"
16 | )
17 |
--------------------------------------------------------------------------------
/TeamTeleRoid/broadcast_handlers.py:
--------------------------------------------------------------------------------
1 | # (c) @PredatorHackerzZ
2 |
3 | import time
4 | import string
5 | import random
6 | import datetime
7 | import aiofiles
8 | import asyncio
9 | import traceback
10 | import aiofiles.os
11 | from configs import Config
12 | from pyrogram.errors import FloodWait, InputUserDeactivated, UserIsBlocked, PeerIdInvalid
13 |
14 | broadcast_ids = {}
15 |
16 |
17 | async def send_msg(user_id, message):
18 | try:
19 | if Config.BROADCAST_AS_COPY is False:
20 | await message.forward(chat_id=user_id)
21 | elif Config.BROADCAST_AS_COPY is True:
22 | await message.copy(chat_id=user_id)
23 | return 200, None
24 | except FloodWait as e:
25 | await asyncio.sleep(e.x)
26 | return send_msg(user_id, message)
27 | except InputUserDeactivated:
28 | return 400, f"{user_id} : deactivated\n"
29 | except UserIsBlocked:
30 | return 400, f"{user_id} : blocked the bot\n"
31 | except PeerIdInvalid:
32 | return 400, f"{user_id} : user id invalid\n"
33 | except Exception as e:
34 | return 500, f"{user_id} : {traceback.format_exc()}\n"
35 |
36 |
37 | async def main_broadcast_handler(m, db):
38 | all_users = await db.get_all_users()
39 | broadcast_msg = m.reply_to_message
40 | while True:
41 | broadcast_id = ''.join([random.choice(string.ascii_letters) for i in range(3)])
42 | if not broadcast_ids.get(broadcast_id):
43 | break
44 | out = await m.reply_text(
45 | text=f"Broadcast Started! You will be notified with log file when all the users are notified."
46 | )
47 | start_time = time.time()
48 | total_users = await db.total_users_count()
49 | done = 0
50 | failed = 0
51 | success = 0
52 | broadcast_ids[broadcast_id] = dict(
53 | total=total_users,
54 | current=done,
55 | failed=failed,
56 | success=success
57 | )
58 | async with aiofiles.open('broadcast.txt', 'w') as broadcast_log_file:
59 | async for user in all_users:
60 | sts, msg = await send_msg(
61 | user_id=int(user['id']),
62 | message=broadcast_msg
63 | )
64 | if msg is not None:
65 | await broadcast_log_file.write(msg)
66 | if sts == 200:
67 | success += 1
68 | else:
69 | failed += 1
70 | if sts == 400:
71 | await db.delete_user(user['id'])
72 | done += 1
73 | if broadcast_ids.get(broadcast_id) is None:
74 | break
75 | else:
76 | broadcast_ids[broadcast_id].update(
77 | dict(
78 | current=done,
79 | failed=failed,
80 | success=success
81 | )
82 | )
83 | if broadcast_ids.get(broadcast_id):
84 | broadcast_ids.pop(broadcast_id)
85 | completed_in = datetime.timedelta(seconds=int(time.time() - start_time))
86 | await asyncio.sleep(3)
87 | await out.delete()
88 | if failed == 0:
89 | await m.reply_text(
90 | text=f"broadcast completed in `{completed_in}`\n\nTotal users {total_users}.\nTotal done {done}, {success} success and {failed} failed.",
91 | quote=True
92 | )
93 | else:
94 | await m.reply_document(
95 | document='broadcast.txt',
96 | caption=f"broadcast completed in `{completed_in}`\n\nTotal users {total_users}.\nTotal done {done}, {success} success and {failed} failed.",
97 | quote=True
98 | )
99 | await aiofiles.os.remove('broadcast.txt')
100 |
--------------------------------------------------------------------------------
/TeamTeleRoid/check_user_status.py:
--------------------------------------------------------------------------------
1 | # (c) Mr. Vishal & @AbirHasan2005 @PredatorHackerzZ
2 |
3 | import datetime
4 | from configs import Config
5 | from handlers.database import Database
6 |
7 | db = Database(Config.DATABASE_URL, Config.BOT_USERNAME)
8 |
9 |
10 | async def handle_user_status(bot, cmd):
11 | chat_id = cmd.from_user.id
12 | if not await db.is_user_exist(chat_id):
13 | await db.add_user(chat_id)
14 | await bot.send_message(
15 | Config.LOG_CHANNEL,
16 | f"#NEW_USER: \n\nNew User [{cmd.from_user.first_name}](tg://user?id={cmd.from_user.id}) started @{Config.BOT_USERNAME} !!"
17 | )
18 |
19 | ban_status = await db.get_ban_status(chat_id)
20 | if ban_status["is_banned"]:
21 | if (
22 | datetime.date.today() - datetime.date.fromisoformat(ban_status["banned_on"])
23 | ).days > ban_status["ban_duration"]:
24 | await db.remove_ban(chat_id)
25 | else:
26 | await cmd.reply_text("𝐘𝐨𝐮 𝐚𝐫𝐞 𝐁𝐚𝐧𝐧𝐞𝐝 𝐭𝐨 𝐔𝐬𝐞 𝐓𝐡𝐢𝐬 𝐁𝐨𝐭 😝", quote=True)
27 | return
28 | await cmd.continue_propagation()
29 |
--------------------------------------------------------------------------------
/TeamTeleRoid/database.py:
--------------------------------------------------------------------------------
1 | # (c) @PredatorHackerzZ
2 |
3 | import datetime
4 | import motor.motor_asyncio
5 | from configs import Config
6 |
7 |
8 | class Database:
9 |
10 | def __init__(self, uri, database_name):
11 | self._client = motor.motor_asyncio.AsyncIOMotorClient(uri)
12 | self.db = self._client[database_name]
13 | self.col = self.db.users
14 |
15 | def new_user(self, id):
16 | return dict(
17 | id=id,
18 | join_date=datetime.date.today().isoformat(),
19 | ban_status=dict(
20 | is_banned=False,
21 | ban_duration=0,
22 | banned_on=datetime.date.max.isoformat(),
23 | ban_reason=''
24 | )
25 | )
26 |
27 | async def add_user(self, id):
28 | user = self.new_user(id)
29 | await self.col.insert_one(user)
30 |
31 | async def is_user_exist(self, id):
32 | user = await self.col.find_one({'id': int(id)})
33 | return True if user else False
34 |
35 | async def total_users_count(self):
36 | count = await self.col.count_documents({})
37 | return count
38 |
39 | async def get_all_users(self):
40 | all_users = self.col.find({})
41 | return all_users
42 |
43 | async def delete_user(self, user_id):
44 | await self.col.delete_many({'id': int(user_id)})
45 |
46 | async def remove_ban(self, id):
47 | ban_status = dict(
48 | is_banned=False,
49 | ban_duration=0,
50 | banned_on=datetime.date.max.isoformat(),
51 | ban_reason=''
52 | )
53 | await self.col.update_one({'id': id}, {'$set': {'ban_status': ban_status}})
54 |
55 | async def ban_user(self, user_id, ban_duration, ban_reason):
56 | ban_status = dict(
57 | is_banned=True,
58 | ban_duration=ban_duration,
59 | banned_on=datetime.date.today().isoformat(),
60 | ban_reason=ban_reason
61 | )
62 | await self.col.update_one({'id': user_id}, {'$set': {'ban_status': ban_status}})
63 |
64 | async def get_ban_status(self, id):
65 | default = dict(
66 | is_banned=False,
67 | ban_duration=0,
68 | banned_on=datetime.date.max.isoformat(),
69 | ban_reason=''
70 | )
71 | user = await self.col.find_one({'id': int(id)})
72 | return user.get('ban_status', default)
73 |
74 | async def get_all_banned_users(self):
75 | banned_users = self.col.find({'ban_status.is_banned': True})
76 | return banned_users
77 |
78 |
79 | db = Database(Config.DATABASE_URL, Config.BOT_USERNAME)
80 |
--------------------------------------------------------------------------------
/TeamTeleRoid/forcesub.py:
--------------------------------------------------------------------------------
1 | # (c) @PredatorHackerzZ
2 |
3 | import asyncio
4 | from configs import Config
5 | from pyrogram import Client
6 | from pyrogram.errors import FloodWait, UserNotParticipant
7 | from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, Message
8 |
9 |
10 | async def ForceSub(bot: Client, cmd: Message):
11 | try:
12 | user = await bot.get_chat_member(chat_id=(int(Config.UPDATES_CHANNEL) if Config.UPDATES_CHANNEL.startswith("-100") else Config.UPDATES_CHANNEL), user_id=cmd.from_user.id)
13 | if user.status == "kicked":
14 | await bot.send_message(
15 | chat_id=cmd.from_user.id,
16 | text="𝐘𝐨𝐮 𝐚𝐫𝐞 𝐁𝐚𝐧𝐧𝐞𝐝 𝐭𝐨 𝐮𝐬𝐞 𝐦𝐞. 𝐂𝐨𝐧𝐭𝐚𝐜𝐭 𝐦𝐲 [𝐒𝐮𝐩𝐩𝐨𝐫𝐭 𝐆𝐫𝐨𝐮𝐩](https://t.me/TeleRoid14).",
17 | parse_mode="markdown",
18 | disable_web_page_preview=True
19 | )
20 | return 400
21 | except UserNotParticipant:
22 | try:
23 | invite_link = await bot.create_chat_invite_link(chat_id=(int(Config.UPDATES_CHANNEL) if Config.UPDATES_CHANNEL.startswith("-100") else Config.UPDATES_CHANNEL))
24 | except FloodWait as e:
25 | await asyncio.sleep(e.x)
26 | invite_link = await bot.create_chat_invite_link(chat_id=(int(Config.UPDATES_CHANNEL) if Config.UPDATES_CHANNEL.startswith("-100") else Config.UPDATES_CHANNEL))
27 | except Exception as err:
28 | print(f"Unable to do Force Subscribe to {Config.UPDATES_CHANNEL}\n\nError: {err}")
29 | return 200
30 | await bot.send_message(
31 | chat_id=cmd.from_user.id,
32 | text="**𝐏𝐥𝐞𝐚𝐬𝐞 𝐉𝐨𝐢𝐧 𝐌𝐲 𝐔𝐩𝐝𝐚𝐭𝐞𝐬 𝐂𝐡𝐚𝐧𝐧𝐞𝐥 𝐭𝐨 𝐮𝐬𝐞 𝐭𝐡𝐢𝐬 𝐁𝐨𝐭!**\n\n"
33 | "𝐃𝐮𝐞 𝐭𝐨 𝐎𝐯𝐞𝐫𝐥𝐨𝐚𝐝, 𝐎𝐧𝐥𝐲 𝐂𝐡𝐚𝐧𝐧𝐞𝐥 𝐒𝐮𝐛𝐬𝐜𝐫𝐢𝐛𝐞𝐫𝐬 𝐜𝐚𝐧 𝐮𝐬𝐞 𝐭𝐡𝐞 𝐁𝐨𝐭!",
34 | reply_markup=InlineKeyboardMarkup(
35 | [
36 | [
37 | InlineKeyboardButton("⭕ 𝐉𝐨𝐢𝐧 𝐔𝐩𝐝𝐚𝐭𝐞𝐬 𝐂𝐡𝐚𝐧𝐧𝐞𝐥 ⭕", url=invite_link.invite_link)
38 | ],
39 | [
40 | InlineKeyboardButton("🔄 𝐑𝐞𝐟𝐫𝐞𝐬𝐡 🔄", callback_data="refreshForceSub")
41 | ]
42 | ]
43 | ),
44 | parse_mode="markdown"
45 | )
46 | return 400
47 | except Exception:
48 | await bot.send_message(
49 | chat_id=cmd.from_user.id,
50 | text="𝐒𝐨𝐦𝐞𝐭𝐡𝐢𝐧𝐠 𝐰𝐞𝐧𝐭 𝐖𝐫𝐨𝐧𝐠. 𝐂𝐨𝐧𝐭𝐚𝐜𝐭 𝐦𝐲 [𝐒𝐮𝐩𝐩𝐨𝐫𝐭 𝐆𝐫𝐨𝐮𝐩](https://t.me/TeleRoid14).",
51 | parse_mode="markdown",
52 | disable_web_page_preview=True
53 | )
54 | return 400
55 | return 200
56 |
--------------------------------------------------------------------------------
/TeamTeleRoid/helpers.py:
--------------------------------------------------------------------------------
1 | # (c) @AbirHasan2005
2 |
3 | from base64 import standard_b64encode, standard_b64decode
4 |
5 |
6 | def str_to_b64(__str: str) -> str:
7 | str_bytes = __str.encode('ascii')
8 | bytes_b64 = standard_b64encode(str_bytes)
9 | b64 = bytes_b64.decode('ascii')
10 | return b64
11 |
12 |
13 | def b64_to_str(b64: str) -> str:
14 | bytes_b64 = b64.encode('ascii')
15 | bytes_str = standard_b64decode(bytes_b64)
16 | __str = bytes_str.decode('ascii')
17 | return __str
18 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "This is Inline BotList Search Bot by @AbirHasan2005 for TeleGram",
3 | "description": "This is Inline Channel Messages Search Bot by @PredatorHackerZ in Pyrogram by @AbirHasan2005",
4 | "keywords": [
5 | "telegram",
6 | "channel",
7 | "messages",
8 | "search",
9 | "bot"
10 | ],
11 | "repository": "https://github.com/PredatorHackerzZ/MessageSearchBot",
12 | "website": "https://telegram.dog/TheTeleRoid",
13 | "success_url": "https://t.me/PHListBot",
14 | "env": {
15 | "API_ID": {
16 | "description": "Get this value from my.telegram.org or @TeleORG_Bot"
17 | },
18 | "API_HASH": {
19 | "description": "Get this value from my.telegram.org or @TeleORG_Bot"
20 | },
21 | "USER_SESSION_STRING": {
22 | "description": "Get this from @StringSessionGen_Bot"
23 | },
24 | "BOT_SESSION_NAME": {
25 | "description": "Any Session Name for Bot."
26 | },
27 | "BOT_TOKEN": {
28 | "description": "Get this from @BotFather"
29 | },
30 | "BOT_USERNAME": {
31 | "description": "Your Bot Username which you sent to @BotFather (Without [@])"
32 | },
33 | "BROADCAST_AS_COPY": {
34 | "description": "Nothing to Put here."
35 | },
36 | "BOT_OWNER": {
37 | "description": "Bot Owner UserID"
38 | },
39 | "DATABASE_URL": {
40 | "description": "MongoDB Database URI for Saving UserID for Broadcast."
41 | },
42 | "UPDATES_CHANNEL": {
43 | "description": "ID of a Channel which you want to do Force Sub to use the bot. Example: -100123456789",
44 | "required": false
45 | },
46 | "CHANNEL_ID": {
47 | "description": "Channel ID for Searching Messages."
48 | }
49 | },
50 | "buildpacks": [
51 | {
52 | "url": "heroku/python"
53 | }
54 | ],
55 | "formation": {
56 | "worker": {
57 | "quantity": 1,
58 | "size": "free"
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/configs.py:
--------------------------------------------------------------------------------
1 | # (c) @PredatorHackerzZ
2 |
3 | import os
4 |
5 |
6 | class Config(object):
7 | API_ID = int(os.environ.get("API_ID", 12345))
8 | API_HASH = os.environ.get("API_HASH", "")
9 | BOT_TOKEN = os.environ.get("BOT_TOKEN", "")
10 | BOT_SESSION_NAME = os.environ.get("BOT_SESSION_NAME", "PHListBot")
11 | USER_SESSION_STRING = os.environ.get("USER_SESSION_STRING", "")
12 | CHANNEL_ID = int(os.environ.get("CHANNEL_ID", -100))
13 | BOT_USERNAME = os.environ.get("BOT_USERNAME")
14 | BOT_OWNER = int(os.environ.get("BOT_OWNER"))
15 | UPDATES_CHANNEL = os.environ.get("UPDATES_CHANNEL", None)
16 | ABOUT_BOT_TEXT = """This is a TeleGram BotList Search Bot of @TheTeleRoid And Some Other Bots Available On TeleGram.
17 |
18 | 🤖 My Name: @PHListBot
19 |
20 | 📝 Language : Python V3
21 |
22 | 📚 Library: Pyrogram
23 |
24 | 📡 Server: Heroku
25 |
26 | 👨💻 Modified By: @HelpLessBoi
27 |
28 | 🌀 Github Repo: Click Me
29 |
30 | 👥 Bots Support: @TeleRoid14
31 |
32 | 📢 Bots Updates: @TeleRoidGroup
33 | """
34 |
35 | ABOUT_HELP_TEXT = """👨💻 Developers : @𝐏𝐫𝐞𝐝𝐚𝐭𝐨𝐫𝐇𝐚𝐜𝐤𝐞𝐫𝐳𝐙
36 |
37 | Bots are simply Telegram accounts operated by software – not people – and they'll often have AI features. They can do anything – teach, play, search, broadcast, remind, connect, integrate with other services, or even pass commands to the Internet of Things.
38 |
39 | Choose Your Bot Category Here 🤗
40 |
41 | ☛ RENAMER_BOTS
42 | ☛ FILE_TO_LINK_BOTS
43 | ☛ GDRIVE_BOTS
44 | ☛ URL_UPLOADER_BOTS
45 | ☛ YOUTUBE_DOWNLOAD_BOTS
46 | ☛ FILE_CONVERTOR_BOTS
47 | ☛ UNZIP_BOTS
48 | ☛ SCREENSHOT_BOT
49 | ☛ GOOGLE_TRANSLATION_BOTS
50 | ☛ TORRENT_DOWNLOADER_BOTS
51 | ☛ DMCA_REMOVAL_BOTS
52 | ☛ WATERMARK_BOT
53 | ☛ VIDEO_MERGER_BOTS
54 |
55 | **These Bots can Do Multiple things with different Functions**:-
56 |
57 | 🌀 I will help you to find Best Telegram Bots.
58 |
59 | 🌀 If you Get Any Error In Searching Please Report at **@TeleRoid14**.
60 |
61 | 🌀 Our Project Channel: @TeleRoidGroup.
62 |
63 | 🌀 All Bots Based On Users and Developer Demands.
64 |
65 | 🤖 Join For All Available Bots On Telegram: @TGRobot_List.
66 | """
67 |
68 | HOME_TEXT = """
69 | 👋 Hey !{}, This is Online Search Botlist Bot @PHListBot.
70 |
71 | Modified By : @PredatorHackerzZ
72 |
73 | Credits goes to Everyone Who Supported.
74 |
75 | Made With ❤ By @TheTeleRoid
76 | """
77 |
78 |
79 | START_MSG = """
80 | 👋 Hey !{}, This is Online Search Botlist Bot @PHListBot.
81 |
82 | Modified By : @PredatorHackerzZ
83 |
84 | Credits goes to Everyone Who Supported.
85 |
86 | Made With ❤ By @TheTeleRoid
87 | """
88 | ADD_BOTS = """Heya! {} If You Want to Add Your Bots In @PHListBot then Contact Admin From Below Given Groups"""
89 |
90 |
91 |
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | # (c) @PredatorHackerzZ
2 | # I just made this for searching a channel message from inline.
3 | # Maybe you can use this for something else.
4 | # I first made this for @TGBotListBot ...
5 | # Edit according to your use.
6 |
7 | from configs import Config
8 | from pyrogram import Client, filters, idle
9 | from pyrogram.errors import QueryIdInvalid
10 | from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery, InlineQuery, InlineQueryResultArticle, \
11 | InputTextMessageContent
12 | from TeamTeleRoid.forcesub import ForceSub
13 |
14 | # Bot Client for Inline Search
15 | Bot = Client(
16 | session_name=Config.BOT_SESSION_NAME,
17 | api_id=Config.API_ID,
18 | api_hash=Config.API_HASH,
19 | bot_token=Config.BOT_TOKEN
20 | )
21 |
22 | # User Client for Searching in Channel.
23 | User = Client(
24 | session_name=Config.USER_SESSION_STRING,
25 | api_id=Config.API_ID,
26 | api_hash=Config.API_HASH
27 | )
28 |
29 |
30 | @Bot.on_message(filters.private & filters.command("start"))
31 | async def start_handler(_, event: Message):
32 |
33 | await event.reply_text(Config.START_MSG.format(event.from_user.mention),
34 | reply_markup=InlineKeyboardMarkup([
35 | [InlineKeyboardButton("Bots Channel", url="https://t.me/TeleRoidGroup"),
36 | InlineKeyboardButton("Support Group", url="https://t.me/TeleRoid14")],
37 | [InlineKeyboardButton("♻ Help", callback_data="Help_msg"),
38 | InlineKeyboardButton("👥 About", callback_data="About_msg")],
39 | [InlineKeyboardButton(" Add Your Bots Here ", callback_data="addbots")],
40 | [InlineKeyboardButton("Search Inline", switch_inline_query_current_chat=""), InlineKeyboardButton("Go Inline", switch_inline_query="")]
41 | ])
42 | )
43 |
44 | @Bot.on_message(filters.private & filters.command("help"))
45 | async def help_handler(_, event: Message):
46 |
47 | await event.reply_text(Config.ABOUT_HELP_TEXT.format(event.from_user.mention),
48 | reply_markup=InlineKeyboardMarkup([
49 | [InlineKeyboardButton("🚸 Pᴏᴡᴇʀᴇᴅ Bʏ", url="https://t.me/MoviesFlixers_DL"),
50 | InlineKeyboardButton("🌱 Inspired Channel ", url="https://t.me/TGRobot_List"),
51 | InlineKeyboardButton("👥 About", callback_data="About_msg")],
52 | [InlineKeyboardButton("Search Inline", switch_inline_query_current_chat=""), InlineKeyboardButton("Go Inline", switch_inline_query="")]
53 | ])
54 | )
55 |
56 | @Bot.on_inline_query()
57 | async def inline_handlers(_, event: InlineQuery):
58 | answers = list()
59 | # If Search Query is Empty
60 | if event.query == "":
61 | answers.append(
62 | InlineQueryResultArticle(
63 | title="This is Inline BotList Search Bot 🔍",
64 | description="You Can Search All Bots Available On TeleGram.",
65 | thumb_url="https://telegra.ph/file/cb4099b549491a622c481.jpg",
66 | input_message_content=InputTextMessageContent(
67 | message_text="A dream does not become reality through magic; it takes sweat, determination, and hard work."\n
68 |
69 | "@TheTeleRoid || @Space_X_Bots"\n
70 |
71 | "🔴 YouTube Channel :"\n
72 |
73 | "https://youtube.com/channel/UCeAteLGyraSil9pErMFTZAg "\n
74 |
75 | "👥 BotChat : @TeleRoid14 "\n
76 |
77 |
78 | " Follow Our Bot Updates Channel : @TeleRoidGroup",\n
79 | disable_web_page_preview=True
80 | ),
81 | reply_markup=InlineKeyboardMarkup([
82 | [InlineKeyboardButton("Search Here", switch_inline_query_current_chat="")],
83 | [InlineKeyboardButton("TeleRoid Bots", url="https://t.me/joinchat/t1ko_FOJxhFiOThl"),
84 | InlineKeyboardButton("Bots Channel", url="https://t.me/TeleRoidGroup")],
85 | [InlineKeyboardButton("TeleGram Bots", url="https://t.me/TGRobot_List")]
86 | ])
87 | )
88 | )
89 | # Search Channel Message using Search Query Words
90 | else:
91 | async for message in User.search_messages(chat_id=Config.CHANNEL_ID, limit=50, query=event.query):
92 | if message.text:
93 | thumb = None
94 | f_text = message.text
95 | msg_text = message.text.html
96 | if "|||" in message.text:
97 | thumb = message.text.split("|||",1)[1].strip()
98 | f_text = message.text.split("|||",1)[0]
99 | msg_text = message.text.html.split("|||",1)[0]
100 | answers.append(InlineQueryResultArticle(
101 | title="{}".format(f_text.split("\n", 1)[0]),
102 | description="{}".format(f_text.split("\n", 2)[-1]),
103 | thumb_url=thumb,
104 | reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("Search Again", switch_inline_query_current_chat=""), InlineKeyboardButton("Go Inline", switch_inline_query="")]]),
105 | input_message_content=InputTextMessageContent(
106 | message_text=msg_text,
107 | parse_mode="html",
108 | disable_web_page_preview=True
109 | )
110 | ))
111 | try:
112 | await event.answer(
113 | results=answers,
114 | cache_time=0
115 | )
116 | print(f"[{Config.BOT_SESSION_NAME}] - Answered Successfully - {event.from_user.first_name}")
117 | except QueryIdInvalid:
118 | print(f"[{Config.BOT_SESSION_NAME}] - Failed to Answer - {event.from_user.first_name}")
119 |
120 |
121 | @Bot.on_callback_query()
122 | async def button(bot, cmd: CallbackQuery):
123 | cb_data = cmd.data
124 | if "About_msg" in cb_data:
125 | await cmd.message.edit(
126 | text=Config.ABOUT_BOT_TEXT,
127 | disable_web_page_preview=True,
128 | reply_markup=InlineKeyboardMarkup(
129 | [
130 | [
131 | InlineKeyboardButton("💢 Github", callback_data="https://github.com/PredatorHackerzZ/MessageSearchBot"),
132 | InlineKeyboardButton("🚸 Powered By", url="https://t.me/MoviesFlixers_DL")
133 | ],
134 | [
135 | InlineKeyboardButton("👨💻 Developer ", url="https://t.me/TheTeleRoid"),
136 | InlineKeyboardButton("🏠 Home", callback_data="gohome")
137 | ]
138 | ]
139 | ),
140 | parse_mode="html"
141 | )
142 | elif "Help_msg" in cb_data:
143 | await cmd.message.edit(
144 | text=Config.ABOUT_HELP_TEXT,
145 | disable_web_page_preview=True,
146 | reply_markup=InlineKeyboardMarkup(
147 | [
148 | [
149 | InlineKeyboardButton("👥 About", callback_data="About_msg"),
150 | InlineKeyboardButton("💢 Github Repo", url="https://t.me/Moviesflixers_DL")
151 | ],
152 | [
153 | InlineKeyboardButton("Bot List", url="https://t.me/joinchat/t1ko_FOJxhFiOThl"),
154 | InlineKeyboardButton("🏠 Home", callback_data="gohome")
155 | ]
156 | ]
157 | ),
158 | parse_mode="html"
159 | )
160 | elif "gohome" in cb_data:
161 | await cmd.message.edit(
162 | text=Config.START_MSG.format(cmd.from_user.mention),
163 | disable_web_page_preview=True,
164 | reply_markup=InlineKeyboardMarkup(
165 | [
166 | [
167 | InlineKeyboardButton("🛑 Support 🛑", url="https://t.me/TeleRoid14"),
168 | InlineKeyboardButton("⭕ Channel ⭕", url="https://t.me/TeleRoidGroup")
169 | ],
170 | [
171 | InlineKeyboardButton("👥 Help", callback_data="Help_msg"),
172 | InlineKeyboardButton("♻ About", callback_data="About_msg")
173 | ],
174 | [
175 | InlineKeyboardButton("+ Add Your Bots Here + ", callback_data="addbots")
176 | ],
177 | [
178 | InlineKeyboardButton("Search Inline ⤵", switch_inline_query_current_chat=""),
179 | InlineKeyboardButton("Go Inline", switch_inline_query="")
180 | ]
181 | ]
182 | ),
183 | parse_mode="html"
184 | )
185 | elif "addbots" in cb_data:
186 | await cmd.message.edit(
187 | text=Config.ADD_BOTS,
188 | disable_web_page_preview=True,
189 | reply_markup=InlineKeyboardMarkup(
190 | [
191 | [
192 | InlineKeyboardButton("👥 TeleRoid Support 👥", url="https://t.me/TeleRoid14"),
193 | InlineKeyboardButton("👥 Space X Bots 👥", url="https://t.me/Sources_Codes")
194 | ],
195 | [
196 | InlineKeyboardButton("👥 CodeXBotz 👥", url="https://t.me/CodeXBotZSupport"),
197 | InlineKeyboardButton("👥 Universal Bots 👥", url="https://t.me/JV_Community")
198 | ],
199 | [
200 | InlineKeyboardButton("👥 Heiman Support 👥", url="https://t.me/HeimanSupport"),
201 | InlineKeyboardButton("👥 TGRobot Support👥", url="https://t.me/joinchat/rqSonBIiCP01NWI1")
202 | ],
203 | [
204 | InlineKeyboardButton("🏠 Home ", callback_data="gohome")
205 | ]
206 | ]
207 | ),
208 | parse_mode="html"
209 | )
210 |
211 | # Start Clients
212 | Bot.start()
213 | User.start()
214 | # Loop Clients till Disconnects
215 | idle()
216 | # After Disconnects,
217 | # Stop Clients
218 | Bot.stop()
219 | User.stop()
220 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | pyrogram==1.4.16
2 | TgCrypto
3 | motor
4 | aiofiles
5 | dnspython
6 | psutil
7 | sqlalchemy==1.3.23
8 |
--------------------------------------------------------------------------------
/start.sh:
--------------------------------------------------------------------------------
1 | echo "Cloning Repo...."
2 | git clone https://github.com/PredatorHackerzZ/MessageSearchBot.git /MessageSearchBot
3 | cd /MessageSearchBot
4 | pip3 install -r requirements.txt
5 | echo "Starting Bot...."
6 | python3 main.py
7 |
--------------------------------------------------------------------------------