├── LICENSE ├── Procfile ├── README.md ├── Script.py ├── app.py ├── bot.py ├── config.py ├── plugins ├── TechifyBots.txt ├── broadcast.py ├── callback.py ├── commands.py ├── db.py ├── fsub.py └── main.py ├── requirements.txt ├── run cmd.txt └── runtime.txt /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Techify Bots 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | worker: python3 bot.py -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | AI Bot 3 |

4 | 5 |

🩷 Thanks for Being Here 🩷

6 | 7 | 8 | 9 | ### 🥰 FEATURES 10 | 11 |
Tap On Me For Bot Features 12 | 13 | - Work in groups as well as in PM 14 | - Log channel to store all results 15 | - No need to use command while talking to AI in private 16 | - Broadcast available 17 | - Fsub available 18 | - Fully modified repo 19 | - Deploy To Koyeb + Heroku + Railway. 20 | - [Developer support](https://telegram.me/TechifySupport) 24x7 21 |
22 | 23 | 24 | ### 🔥 VARIABLES 25 | 26 |
Tap On Me For Environment Variable 27 | 28 | - `API_ID` : Get From [Here](https://youtu.be/y5FwAobQ-Kc) 29 | - `API_HASH` : Get From [Here](https://youtu.be/y5FwAobQ-Kc) 30 | - `BOT_TOKEN` : Get From [BotFather](https://youtu.be/aJILCCXfNVM) 31 | - `ADMIN` : Your Telegram User ID 32 | - `DB_URI` : MongoDB Database get from [here](https://youtu.be/j8LIuM7vv18) 33 | - `LOG_CHANNEL` : Your Log channel ID. 34 | - `AUTH_CHANNELS` : Your FSUB channel ID. 35 | - `GOOGLE_API_KEY` : Your Gemini [API](https://youtube.com/shorts/M_HODruvqd0). 36 |
37 | 38 | ### 😍 COMMANDS 39 | 40 |
Tap On Me For Commands 41 | 42 | ``` 43 | start - Start The Bot 44 | ask - Ask anything to AI 45 | broadcast - (admin only) Broadcast message to bot users 46 | stats - (admin only) check bots stats 47 | ``` 48 |
49 | 50 | ### 👀 IMP 51 | 52 | If you are facing any issue while using the bot even after entering the correct API then update the [model](https://github.com/TechifyBots/AI-Bot/blob/main/plugins%2Fmain.py#L50). Get the free models from [here](https://ai.google.dev/gemini-api/docs/rate-limits) 53 | 54 | ### 🥳 CREDIT 55 | 56 | - [TechifyBots](https://github.com/TechifyBots) 57 | 58 | ### 😇 [SUPPORT](https://techifybots.github.io/PayWeb) 59 | 60 | ### 🥳 [DEVELOPER](https://instagram.com/TechifyRahul) 61 | 62 | ### 📌 NOTE 63 | 64 | 𝘊𝘰𝘱𝘺𝘪𝘯𝘨 𝘰𝘳 𝘚𝘦𝘭𝘭𝘪𝘯𝘨 𝘵𝘩𝘪𝘴 𝘳𝘦𝘱𝘰 𝘪𝘴 𝘴𝘵𝘳𝘪𝘤𝘵𝘭𝘺 𝘱𝘳𝘰𝘩𝘪𝘣𝘪𝘵𝘦𝘥.
-------------------------------------------------------------------------------- /Script.py: -------------------------------------------------------------------------------- 1 | class text(object): 2 | START = """{}, 3 | 4 | Welcome to AI Bot – Your Smart Virtual Assistant! 5 | 6 | I'm here to assist you with anything you need – from answering questions to solving tasks. 7 | 8 | Tap ‘Help’ below to explore all the features! 9 | 10 |
ᴍᴀɪɴᴛᴀɪɴᴇᴅ ʙʏ : ʀᴀʜᴜʟ
""" 11 | 12 | LOG = """#New_User 13 | 14 | User: {} 15 | ID: {}""" 16 | 17 | ABOUT = """📜 Cʜᴇᴄᴋ Aʙᴏᴜᴛ: 18 | 19 | Lɪʙʀᴀʀʏ: Pʏʀᴏɢʀᴀᴍ 📚 20 | Lᴀɴɢᴜᴀɢᴇ: Pʏᴛʜᴏɴ 🐍 21 | Sᴇʀᴠᴇʀ: Rᴇɴᴅᴇʀ 🌐 22 | Bᴜɪʟᴅ Sᴛᴀᴛᴜs: V1.3 🚀 23 | Sᴏᴜʀᴄᴇ Cᴏᴅᴇ: Aᴠᴀɪʟᴀʙʟᴇ (Fʀᴇᴇ) 💻 24 | 25 |
ᴍᴀɪɴᴛᴀɪɴᴇᴅ ʙʏ : ʀᴀʜᴜʟ
""" 26 | 27 | HELP = """✨ --ᴜsᴇs ᴏꜰ ᴄᴏᴍᴍᴀɴᴅs-- 28 | 29 | • /ask - ɪꜰ ʏᴏᴜ ᴀʀᴇ ᴜsɪɴɢ ᴛʜɪs ʙᴏᴛ ɪɴ ɢʀᴏᴜᴘ ᴜsᴇ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴛᴏ ᴀsᴋ ᴀɴʏᴛʜɪɴɢ 30 | 31 | ᴇx: `/ask what is AI?` 32 | 33 | ɴᴏᴛᴇ : ɪɴ ᴘʀɪᴠᴀᴛᴇ ʏᴏᴜ ᴅᴏɴ'ᴛ ɴᴇᴇᴅ ᴛᴏ ᴜsᴇ ᴛʜɪs""" 34 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask 2 | app = Flask(__name__) 3 | 4 | @app.route('/') 5 | def hello_world(): 6 | return 'TechifyBots' 7 | 8 | 9 | if __name__ == "__main__": 10 | app.run() 11 | -------------------------------------------------------------------------------- /bot.py: -------------------------------------------------------------------------------- 1 | import os 2 | from pyrogram import Client 3 | from aiohttp import web 4 | from config import API_ID, API_HASH, BOT_TOKEN 5 | 6 | r = web.RouteTableDef() 7 | 8 | @r.get("/", allow_head=True) 9 | async def root_route_handler(request): 10 | return web.Response(text='

I am Alive

', content_type='text/html') 11 | 12 | async def web_server(): 13 | app = web.Application(client_max_size=30000000) 14 | app.add_routes(r) 15 | return app 16 | 17 | class Bot(Client): 18 | def __init__(self): 19 | super().__init__( 20 | "techifybots", 21 | api_id=API_ID, 22 | api_hash=API_HASH, 23 | bot_token=BOT_TOKEN, 24 | plugins=dict(root="plugins"), 25 | workers=200, 26 | sleep_threshold=15 27 | ) 28 | 29 | async def start(self): 30 | app = web.AppRunner(await web_server()) 31 | await app.setup() 32 | 33 | ba = "0.0.0.0" 34 | port = int(os.environ.get("PORT", 8080)) or 8080 # Default to 8080 if PORT is not set 35 | 36 | try: 37 | await web.TCPSite(app, ba, port).start() 38 | print(f"Web server started on http://{ba}:{port}") 39 | except Exception as e: 40 | print(f"Error starting the web server: {e}") 41 | 42 | await super().start() 43 | me = await self.get_me() 44 | self.username = '@' + me.username 45 | print(f'Bot Started Powered By {self.username}') 46 | 47 | async def stop(self, *args): 48 | await super().stop() 49 | print('Bot Stopped Bye') 50 | 51 | Bot().run() -------------------------------------------------------------------------------- /config.py: -------------------------------------------------------------------------------- 1 | import os 2 | from typing import List 3 | 4 | API_ID = os.environ.get("API_ID", "") 5 | API_HASH = os.environ.get("API_HASH", "") 6 | BOT_TOKEN = os.environ.get("BOT_TOKEN", "") 7 | ADMIN = int(os.environ.get("ADMIN", "")) 8 | 9 | LOG_CHANNEL = int(os.environ.get("LOG_CHANNEL", "")) 10 | 11 | DB_URI = os.environ.get("DB_URI", "") 12 | DB_NAME = os.environ.get("DB_NAME", "") 13 | 14 | IS_FSUB = os.environ.get("IS_FSUB", "False").lower() == "true" # Set "True" For Enable Force Subscribe 15 | AUTH_CHANNELS = list(map(int, os.environ.get("AUTH_CHANNEL", "-100xxxxxxxxx -100xxxxxxx").split())) # Add Multiple channel id 16 | 17 | GOOGLE_API_KEY = os.environ.get("GOOGLE_API_KEY", "") 18 | -------------------------------------------------------------------------------- /plugins/TechifyBots.txt: -------------------------------------------------------------------------------- 1 | # © TechifyBots 2 | -------------------------------------------------------------------------------- /plugins/broadcast.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, filters 2 | from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton 3 | from pyrogram.errors import FloodWait, UserIsBlocked, PeerIdInvalid, InputUserDeactivated 4 | import asyncio 5 | import re 6 | from config import ADMIN 7 | from .db import tb 8 | 9 | def parse_button_markup(text: str): 10 | lines = text.split("\n") 11 | buttons = [] 12 | final_text_lines = [] 13 | 14 | for line in lines: 15 | match = re.fullmatch(r"\[(.+?)\]\((https?://[^\s]+)\)", line.strip()) 16 | if match: 17 | buttons.append([InlineKeyboardButton(match[1], url=match[2])]) 18 | else: 19 | final_text_lines.append(line) 20 | 21 | return InlineKeyboardMarkup(buttons) if buttons else None, "\n".join(final_text_lines).strip() 22 | 23 | 24 | @Client.on_message(filters.command("broadcast") & filters.private & filters.user(ADMIN)) 25 | async def broadcasting_func(client: Client, message: Message): 26 | if not message.reply_to_message: 27 | return await message.reply("Reply to a message to broadcast.") 28 | 29 | msg = await message.reply_text("Processing broadcast...") 30 | to_copy_msg = message.reply_to_message 31 | users_list = await tb.get_all_users() 32 | 33 | completed = 0 34 | failed = 0 35 | 36 | raw_text = to_copy_msg.caption or to_copy_msg.text or "" 37 | reply_markup, cleaned_text = parse_button_markup(raw_text) 38 | 39 | for i, user in enumerate(users_list): 40 | user_id = user.get("user_id") 41 | if not user_id: 42 | continue 43 | try: 44 | if to_copy_msg.text: 45 | await client.send_message(user_id, cleaned_text, reply_markup=reply_markup) 46 | elif to_copy_msg.photo: 47 | await client.send_photo(user_id, to_copy_msg.photo.file_id, caption=cleaned_text, reply_markup=reply_markup) 48 | elif to_copy_msg.video: 49 | await client.send_video(user_id, to_copy_msg.video.file_id, caption=cleaned_text, reply_markup=reply_markup) 50 | elif to_copy_msg.document: 51 | await client.send_document(user_id, to_copy_msg.document.file_id, caption=cleaned_text, reply_markup=reply_markup) 52 | else: 53 | await to_copy_msg.copy(user_id) 54 | completed += 1 55 | except (UserIsBlocked, PeerIdInvalid, InputUserDeactivated): 56 | await tb.delete_user(user_id) 57 | failed += 1 58 | except FloodWait as e: 59 | await asyncio.sleep(e.value) 60 | try: 61 | await to_copy_msg.copy(user_id) 62 | completed += 1 63 | except: 64 | failed += 1 65 | except Exception as e: 66 | print(f"Broadcast to {user_id} failed: {e}") 67 | failed += 1 68 | 69 | await msg.edit(f"Total: {i + 1}\nCompleted: {completed}\nFailed: {failed}") 70 | await asyncio.sleep(0.1) 71 | 72 | await msg.edit( 73 | f"😶‍🌫 Broadcast Completed\n\n👥 Total Users: {len(users_list)}\n✅ Successful: {completed}\n🤯 Failed: {failed}", 74 | reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("🎭 Close", callback_data="close")]]) 75 | ) -------------------------------------------------------------------------------- /plugins/callback.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client 2 | from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup 3 | from Script import text 4 | 5 | @Client.on_callback_query() 6 | async def callback_query_handler(client, query: CallbackQuery): 7 | if query.data == "start": 8 | await query.message.edit_text( 9 | text.START.format(query.from_user.mention), 10 | disable_web_page_preview=True, 11 | reply_markup=InlineKeyboardMarkup([ 12 | [InlineKeyboardButton("ᴀʙᴏᴜᴛ", callback_data="about"), 13 | InlineKeyboardButton("ʜᴇʟᴘ", callback_data="help")], 14 | [InlineKeyboardButton("♻ ᴅᴇᴠᴇʟᴏᴘᴇʀ ♻", url="https://telegram.me/TechifyRahul")] 15 | ]) 16 | ) 17 | 18 | elif query.data == "help": 19 | await query.message.edit_text( 20 | text.HELP, 21 | disable_web_page_preview=True, 22 | reply_markup=InlineKeyboardMarkup([ 23 | [InlineKeyboardButton("ᴜᴩᴅᴀᴛᴇꜱ", url="https://telegram.me/Techifybots"), 24 | InlineKeyboardButton("ꜱᴜᴩᴩᴏʀᴛ", url="https://telegram.me/TechifySupport")], 25 | [InlineKeyboardButton("ʙᴀᴄᴋ", callback_data="start"), 26 | InlineKeyboardButton("ᴄʟᴏꜱᴇ", callback_data="close")] 27 | ]) 28 | ) 29 | 30 | elif query.data == "about": 31 | await query.message.edit_text( 32 | text.ABOUT, 33 | disable_web_page_preview=True, 34 | reply_markup=InlineKeyboardMarkup([ 35 | [InlineKeyboardButton("💥 ʀᴇᴘᴏ", url="https://github.com/TechifyBots/AI-Bot"), 36 | InlineKeyboardButton("👨‍💻 ᴏᴡɴᴇʀ", url="https://telegram.me/TechifyRahul")], 37 | [InlineKeyboardButton("ʙᴀᴄᴋ", callback_data="start"), 38 | InlineKeyboardButton("ᴄʟᴏꜱᴇ", callback_data="close")] 39 | ]) 40 | ) 41 | 42 | elif query.data == "close": 43 | await query.message.delete() -------------------------------------------------------------------------------- /plugins/commands.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, filters 2 | from pyrogram.errors import * 3 | from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup 4 | from config import * 5 | import asyncio 6 | from Script import text 7 | from .db import tb 8 | from .fsub import get_fsub 9 | 10 | @Client.on_message(filters.command("start")) 11 | async def start_cmd(client, message): 12 | if await tb.get_user(message.from_user.id) is None: 13 | await tb.add_user(message.from_user.id, message.from_user.first_name) 14 | await client.send_message( 15 | LOG_CHANNEL, 16 | text.LOG.format(message.from_user.mention, message.from_user.id) 17 | ) 18 | if IS_FSUB and not await get_fsub(client, message):return 19 | await message.reply_text( 20 | text.START.format(message.from_user.mention), 21 | reply_markup=InlineKeyboardMarkup([ 22 | [InlineKeyboardButton('ᴀʙᴏᴜᴛ', callback_data='about'), 23 | InlineKeyboardButton('ʜᴇʟᴘ', callback_data='help')], 24 | [InlineKeyboardButton('♻ ᴅᴇᴠᴇʟᴏᴘᴇʀ ♻', url='https://telegram.me/TechifyRahul')] 25 | ]), 26 | disable_web_page_preview=True 27 | ) 28 | 29 | @Client.on_message(filters.command("stats") & filters.private & filters.user(ADMIN)) 30 | async def total_users(client, message): 31 | try: 32 | users = await tb.get_all_users() 33 | await message.reply(f"👥 **Total Users:** {len(users)}",reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("🎭 Close", callback_data="close")]])) 34 | except Exception as e: 35 | r=await message.reply(f"❌ *Error:* `{str(e)}`") 36 | await asyncio.sleep(30) 37 | await r.delete() -------------------------------------------------------------------------------- /plugins/db.py: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | from config import DB_URI, DB_NAME 3 | from motor import motor_asyncio 4 | 5 | client: motor_asyncio.AsyncIOMotorClient[Any] = motor_asyncio.AsyncIOMotorClient(DB_URI) 6 | db = client[DB_NAME] 7 | 8 | class Techifybots: 9 | def __init__(self): 10 | self.users = db["users"] 11 | self.cache: dict[int, dict[str, Any]] = {} 12 | 13 | async def add_user(self, user_id: int, name: str) -> dict[str, Any] | None: 14 | try: 15 | user: dict[str, Any] = {"user_id": user_id, "name": name} 16 | await self.users.insert_one(user) 17 | self.cache[user_id] = user 18 | return user 19 | except Exception as e: 20 | print("Error in addUser: ", e) 21 | 22 | async def get_user(self, user_id: int) -> dict[str, Any] | None: 23 | try: 24 | if user_id in self.cache: 25 | return self.cache[user_id] 26 | user = await self.users.find_one({"user_id": user_id}) 27 | return user 28 | except Exception as e: 29 | print("Error in getUser: ", e) 30 | return None 31 | 32 | async def get_all_users(self) -> list[dict[str, Any]]: 33 | try: 34 | users: list[dict[str, Any]] = [] 35 | async for user in self.users.find(): 36 | users.append(user) 37 | return users 38 | except Exception as e: 39 | print("Error in getAllUsers: ", e) 40 | return [] 41 | 42 | async def delete_user(self, user_id: int) -> bool: 43 | try: 44 | result = await self.users.delete_one({"user_id": user_id}) 45 | self.cache.pop(user_id, None) 46 | return result.deleted_count > 0 47 | except Exception as e: 48 | print("Error in delete_user: ", e) 49 | return False 50 | 51 | tb = Techifybots() -------------------------------------------------------------------------------- /plugins/fsub.py: -------------------------------------------------------------------------------- 1 | from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton 2 | from config import AUTH_CHANNELS 3 | from pyrogram import Client 4 | from pyrogram.types import Message 5 | from typing import List 6 | from pyrogram.errors import UserNotParticipant 7 | 8 | async def get_fsub(bot: Client, message: Message) -> bool: 9 | tb = await bot.get_me() 10 | user_id = message.from_user.id 11 | not_joined_channels = [] 12 | for channel_id in AUTH_CHANNELS: 13 | try: 14 | await bot.get_chat_member(channel_id, user_id) 15 | except UserNotParticipant: 16 | chat = await bot.get_chat(channel_id) 17 | invite_link = chat.invite_link or await bot.export_chat_invite_link(channel_id) 18 | not_joined_channels.append((chat.title, invite_link)) 19 | if not_joined_channels: 20 | join_buttons = [] 21 | for i in range(0, len(not_joined_channels), 2): 22 | row = [] 23 | for j in range(2): 24 | if i + j < len(not_joined_channels): 25 | title, link = not_joined_channels[i + j] 26 | button_text = f"{i + j + 1}. {title}" 27 | row.append(InlineKeyboardButton(button_text, url=link)) 28 | join_buttons.append(row) 29 | join_buttons.append([InlineKeyboardButton("🔄 Try Again", url=f"https://telegram.me/{tb.username}?start=start")]) 30 | await message.reply(f"**🎭 {message.from_user.mention}, As I see, you haven’t joined my channel yet.\nPlease join by clicking the button below.**", reply_markup=InlineKeyboardMarkup(join_buttons)) 31 | return False 32 | return True -------------------------------------------------------------------------------- /plugins/main.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, filters 2 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup 3 | import requests 4 | from config import * 5 | import google.generativeai as genai 6 | import asyncio 7 | 8 | genai.configure(api_key=GOOGLE_API_KEY) 9 | 10 | responses_dict = {} 11 | 12 | @Client.on_message(filters.private & filters.command("ask")) 13 | async def askcmd(client, message): 14 | await message.reply_text( 15 | text="**You don't need to use this command here. Ask me directly.\n\nEx:** `Who Is Lord Shiva?`\n**Ok ?? Let's Try 😏**" 16 | ) 17 | 18 | @Client.on_message(filters.command("ask") & filters.group) 19 | async def group_ai_reply(client, message): 20 | if len(message.command) == 1: 21 | return await message.reply_text( 22 | "⚠️ **Please provide a query after the command.**\n\nExample: `/ask What is AI?`", 23 | quote=True 24 | ) 25 | await handle_gemini_mode(client, message) 26 | 27 | @Client.on_message(filters.private & filters.text & ~filters.command(["start", "ask"])) 28 | async def handle_ai_query(client, message): 29 | await handle_gemini_mode(client, message) 30 | 31 | async def handle_gemini_mode(client, message): 32 | user_input = message.text.strip() 33 | s = await message.reply_sticker("CAACAgQAAxkBAAIFqGc04PwJshM42NKq2lOFn-q5lQtqAAJuDwAC4eqxUNoxB5joJxGiHgQ") 34 | 35 | generation_config = { 36 | "temperature": 0.9, 37 | "top_p": 1, 38 | "top_k": 1, 39 | "max_output_tokens": 2048, 40 | } 41 | 42 | safety_settings = [ 43 | {"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"}, 44 | {"category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_MEDIUM_AND_ABOVE"}, 45 | {"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"}, 46 | {"category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"}, 47 | ] 48 | 49 | model = genai.GenerativeModel( 50 | model_name="gemini-2.0-flash-lite", 51 | generation_config=generation_config, 52 | safety_settings=safety_settings 53 | ) 54 | 55 | try: 56 | prompt_parts = [user_input] 57 | response = model.generate_content(prompt_parts) 58 | 59 | if hasattr(response, 'text') and response.text: 60 | await client.send_message( 61 | LOG_CHANNEL, 62 | text=f"👤 {message.from_user.mention} (`{message.from_user.id}`)\n\n" 63 | f"**Query:** `{user_input}`\n\n**AI Generated Response (Gemini):**\n{response.text}", 64 | reply_markup=InlineKeyboardMarkup( 65 | [[InlineKeyboardButton('Close', callback_data='close')]] 66 | ) 67 | ) 68 | ai_message = await message.reply_text( 69 | f"**{message.from_user.mention},** {response.text}", 70 | reply_markup=InlineKeyboardMarkup( 71 | [[InlineKeyboardButton("ʟᴇᴀʀɴ ᴄᴏᴅɪɴɢ 👨‍💻", url="https://techifybots.blogspot.com")]] 72 | ) 73 | ) 74 | 75 | # Delete the sticker immediately after the bot sends the message 76 | await s.delete() 77 | 78 | # Wait for 5 minutes before deleting both the user and bot messages 79 | await asyncio.sleep(300) # Sleep for 5 minutes (300 seconds) 80 | await message.delete() # Delete the user's message 81 | await ai_message.delete() # Delete the bot's reply 82 | 83 | else: 84 | await message.reply_text("⚠️ The AI model couldn't generate a response. Please try again.") 85 | except Exception as e: 86 | await message.reply_text("⚠️ An error occurred while processing your query. Please try again.") 87 | print(f"Error in Gemini Mode: {e}") 88 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pyrofork>=2.3.58 2 | tgcrypto 3 | motor 4 | requests 5 | google-generativeai 6 | aiohttp 7 | 8 | # For Web Deployable 9 | Flask==1.1.2 10 | gunicorn==20.1.0 11 | Jinja2==3.0.3 12 | werkzeug==2.0.2 13 | itsdangerous==2.0.1 14 | -------------------------------------------------------------------------------- /run cmd.txt: -------------------------------------------------------------------------------- 1 | gunicorn app:app & python3 bot.py 2 | -------------------------------------------------------------------------------- /runtime.txt: -------------------------------------------------------------------------------- 1 | python-3.13.1 --------------------------------------------------------------------------------