├── start ├── Procfile ├── sample.env ├── heroku.yml ├── AiChatBot ├── Db │ ├── __init__.py │ ├── Usersdb.py │ ├── Afkdb.py │ ├── ChatsDb.py │ └── Updatefetcher ├── Strings │ ├── __init__.py │ ├── texts.py │ ├── inline.py │ └── callbacks.py ├── modules │ ├── __init__.py │ ├── Alive.py │ ├── Ping.py │ ├── Love.py │ ├── Id.py │ ├── Telegraph.py │ ├── Gcast.py │ ├── Groups.py │ ├── ChatBot.py │ ├── Start.py │ ├── Eval.py │ └── Afk.py ├── __main__.py └── __init__.py ├── requirements.txt ├── Murali.py ├── environment.yml ├── Dockerfile ├── config.py ├── app.json ├── README.md └── setup /start: -------------------------------------------------------------------------------- 1 | python3 -m AiChatBot 2 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | worker: python -m AiChatBot 2 | -------------------------------------------------------------------------------- /sample.env: -------------------------------------------------------------------------------- 1 | API_ID= 2 | API_HASH= 3 | BOT_TOKEN= 4 | OWNER_ID= 5 | MONGO_URL= 6 | -------------------------------------------------------------------------------- /heroku.yml: -------------------------------------------------------------------------------- 1 | build: 2 | docker: 3 | worker: Dockerfile 4 | run: 5 | worker: python3 -m AiChatBot 6 | -------------------------------------------------------------------------------- /AiChatBot/Db/__init__.py: -------------------------------------------------------------------------------- 1 | from .ChatsDb import * 2 | from .Usersdb import * 3 | #from .Updatefetcher import * 4 | -------------------------------------------------------------------------------- /AiChatBot/Strings/__init__.py: -------------------------------------------------------------------------------- 1 | from .inline import * 2 | from .texts import * 3 | from .callbacks import * 4 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pyrogram==2.0.106 2 | requests==2.31.0 3 | tgcrypto==1.2.5 4 | asyncio==3.4.3 5 | python-dotenv==1.0.0 6 | motor==3.4.0 7 | telegraph==2.2.0 8 | Abg==2.3.1 9 | gitpython==3.1.43 10 | -------------------------------------------------------------------------------- /Murali.py: -------------------------------------------------------------------------------- 1 | import re 2 | from os import getenv 3 | from dotenv import load_dotenv 4 | from pyrogram import filters 5 | 6 | load_dotenv() 7 | 8 | Owner = list(map(int, getenv("Owner", "6764358144 7301077117").split())) 9 | -------------------------------------------------------------------------------- /environment.yml: -------------------------------------------------------------------------------- 1 | name: example-environment 2 | channels: 3 | - conda-forge 4 | dependencies: 5 | - python=3.11 6 | - numpy 7 | - psutil 8 | - toolz 9 | - matplotlib 10 | - dill 11 | - pandas 12 | - partd 13 | - bokeh 14 | - dask 15 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:latest 2 | 3 | RUN apt-get update -y && apt-get upgrade -y 4 | 5 | RUN pip3 install -U pip 6 | 7 | COPY . /app/ 8 | WORKDIR /app/ 9 | RUN pip3 install --upgrade pip 10 | RUN pip3 install -U -r requirements.txt 11 | 12 | CMD python3 -m AiChatBot 13 | -------------------------------------------------------------------------------- /AiChatBot/modules/__init__.py: -------------------------------------------------------------------------------- 1 | import glob 2 | from os.path import basename, dirname, isfile 3 | 4 | 5 | def __list_all_modules(): 6 | mod_paths = glob.glob(dirname(__file__) + "/*.py") 7 | 8 | all_modules = [ 9 | basename(f)[:-3] 10 | for f in mod_paths 11 | if isfile(f) and f.endswith(".py") and not f.endswith("__init__.py") 12 | ] 13 | 14 | return all_modules 15 | 16 | 17 | ALL_MODULES = sorted(__list_all_modules()) 18 | __all__ = ALL_MODULES + ["ALL_MODULES"] 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /AiChatBot/Db/Usersdb.py: -------------------------------------------------------------------------------- 1 | from AiChatBot import Chiku 2 | from motor.motor_asyncio import AsyncIOMotorClient 3 | import requests 4 | from config import * 5 | 6 | 7 | mongo_client = AsyncIOMotorClient(MONGO_URL) 8 | db = mongo_client.chatbotdbb 9 | usersdb = db.chatsdbb 10 | 11 | async def is_served_user(user_id: int) -> bool: 12 | user = await usersdb.find_one({"user_id": user_id}) 13 | if not user: 14 | return False 15 | return True 16 | 17 | 18 | async def get_served_users() -> list: 19 | users_list = [] 20 | async for user in usersdb.find({"user_id": {"$gt": 0}}): 21 | users_list.append(user) 22 | return users_list 23 | 24 | 25 | async def add_served_user(user_id: int): 26 | is_served = await is_served_user(user_id) 27 | if is_served: 28 | return 29 | return await usersdb.insert_one({"user_id": user_id}) 30 | -------------------------------------------------------------------------------- /config.py: -------------------------------------------------------------------------------- 1 | import os 2 | from os import getenv 3 | 4 | 5 | API_ID = int(os.environ.get("API_ID")) 6 | 7 | 8 | API_HASH = os.environ.get("API_HASH") 9 | 10 | 11 | BOT_TOKEN = os.environ.get("BOT_TOKEN") 12 | 13 | 14 | OWNER_ID = list( 15 | map(int, getenv("OWNER_ID", "6764358144").split()) 16 | ) 17 | 18 | #Fill Only Username Without @ 19 | SUPPORT_GROUP = getenv( 20 | "SUPPORT_GROUP", "MuraliBotz" 21 | ) 22 | 23 | MONGO_URL = os.environ.get("MONGO_URL") 24 | 25 | LOGGER_ID = int(getenv("LOGGER_ID", "-1002242562595")) 26 | 27 | # set True if you want yo set bot commands automatically 28 | SETCMD = getenv("SETCMD", "True") 29 | 30 | # upstream repo 31 | UPSTREAM_REPO = getenv( 32 | "UPSTREAM_REPO", 33 | "https://github.com/MuraliBotz/ChikuChatBot", 34 | ) 35 | 36 | UPSTREAM_BRANCH = getenv("UPSTREAM_BRANCH", "main") 37 | 38 | # GIT TOKEN ( if your edited repo is private) 39 | GIT_TOKEN = getenv("GIT_TOKEN", None) 40 | -------------------------------------------------------------------------------- /AiChatBot/modules/Alive.py: -------------------------------------------------------------------------------- 1 | from AiChatBot import Chiku 2 | from pyrogram import client, filters 3 | import requests 4 | from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton 5 | from AiChatBot.modules.Ping import get_readable_time 6 | import time 7 | 8 | _boot_ = time.time() 9 | 10 | @Chiku.on_cmd("alive") 11 | async def alive(client, message): 12 | response = requests.get("https://nekos.best/api/v2/neko").json() 13 | M = response["results"][0]["url"] 14 | bot_uptime = int(time.time() - _boot_) 15 | Uptime = f"{get_readable_time(bot_uptime)}" 16 | await message.reply_photo(M, caption=f"{Chiku.mention} ɪꜱ ꜱᴛɪʟʟ ᴀʟɪᴠᴇ ʙᴀʙʏ ❤️\n\nɪ ᴅɪᴅɴ'ᴛ ꜱʟᴇᴘᴛ ꜰʀᴏᴍ {Uptime} ", reply_markup=InlineKeyboardMarkup( 17 | [ 18 | [ 19 | InlineKeyboardButton( 20 | text="ᴀᴅᴅ ᴍᴇ ᴛᴏ ʏᴏᴜʀ ɢʀᴏᴜᴘ 💓", 21 | url=f"https://t.me/{Chiku.username}?startgroup=true", 22 | ), 23 | ], 24 | ] 25 | )) 26 | -------------------------------------------------------------------------------- /AiChatBot/Db/Afkdb.py: -------------------------------------------------------------------------------- 1 | from config import MONGO_URL 2 | from motor.motor_asyncio import AsyncIOMotorClient 3 | 4 | mongo = AsyncIOMotorClient(MONGO_URL) 5 | db = mongo.CHIKUBOTDATABASEAFK 6 | afkdb = db.afk 7 | 8 | async def is_afk(user_id: int) -> bool: 9 | user = await afkdb.find_one({"user_id": user_id}) 10 | if not user: 11 | return False, {} 12 | return True, user["reason"] 13 | 14 | 15 | async def add_afk(user_id: int, mode): 16 | await afkdb.update_one( 17 | {"user_id": user_id}, {"$set": {"reason": mode}}, upsert=True 18 | ) 19 | 20 | 21 | async def remove_afk(user_id: int): 22 | user = await afkdb.find_one({"user_id": user_id}) 23 | if user: 24 | return await afkdb.delete_one({"user_id": user_id}) 25 | 26 | 27 | async def get_afk_users() -> list: 28 | users = afkdb.find({"user_id": {"$gt": 0}}) 29 | if not users: 30 | return [] 31 | users_list = [] 32 | for user in await users.to_list(length=1000000000): 33 | users_list.append(user) 34 | return users_list 35 | -------------------------------------------------------------------------------- /AiChatBot/Db/ChatsDb.py: -------------------------------------------------------------------------------- 1 | from AiChatBot import Chiku 2 | from motor.motor_asyncio import AsyncIOMotorClient 3 | import requests 4 | from config import * 5 | 6 | 7 | mongo_client = AsyncIOMotorClient(MONGO_URL) 8 | db = mongo_client.chatbotdbb 9 | chatsdb = db.chatsdbb 10 | 11 | 12 | async def get_served_chats() -> list: 13 | chats = chatsdb.find({"chat_id": {"$lt": 0}}) 14 | if not chats: 15 | return [] 16 | chats_list = [] 17 | for chat in await chats.to_list(length=1000000000): 18 | chats_list.append(chat) 19 | return chats_list 20 | 21 | 22 | async def is_served_chat(chat_id: int) -> bool: 23 | chat = await chatsdb.find_one({"chat_id": chat_id}) 24 | if not chat: 25 | return False 26 | return True 27 | 28 | 29 | async def add_served_chat(chat_id: int): 30 | is_served = await is_served_chat(chat_id) 31 | if is_served: 32 | return 33 | return await chatsdb.insert_one({"chat_id": chat_id}) 34 | 35 | 36 | async def remove_served_chat(chat_id: int): 37 | is_served = await is_served_chat(chat_id) 38 | if not is_served: 39 | return 40 | return await chatsdb.delete_one({"chat_id": chat_id}) 41 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "𝐂𝐡𝐢𝐤𝐮 𝐂𝐡𝐚𝐭 𝐁𝐨𝐭", 3 | "description": "Telegram Bot using Pyrogram", 4 | "repository": "https://github.com/MuraliBotz/ChikuBot", 5 | "env": { 6 | "API_ID": { 7 | "description": "Your Telegram API ID", 8 | "required": true 9 | }, 10 | "API_HASH": { 11 | "description": "Your Telegram API Hash", 12 | "required": true 13 | }, 14 | "BOT_TOKEN": { 15 | "description": "Your Telegram Bot Token", 16 | "required": true 17 | }, 18 | "OWNER_ID": { 19 | "description": "Your Telegram User ID (Owner)", 20 | "required": true 21 | }, 22 | "LOGGER_ID": { 23 | "description": "A telegram group id add your bot in that group and promote to admin", 24 | "required": true 25 | }, 26 | "SUPPORT_GROUP": { 27 | "description": "Enter Your Telegram Group Username Without @", 28 | "required": true 29 | }, 30 | "MONGO_URL": { 31 | "description": "Your mongo db url for database", 32 | "required": true 33 | } 34 | }, 35 | "buildpacks": [ 36 | { 37 | "url": "heroku/python" 38 | } 39 | ], 40 | "stack": "heroku-22" 41 | } 42 | 43 | -------------------------------------------------------------------------------- /AiChatBot/Strings/texts.py: -------------------------------------------------------------------------------- 1 | TEXT1 = """**ᴀғᴋ **😅 2 | 3 | /afk - ᴀᴡᴀʏ ғʀᴏᴍ ᴋᴇʏʙᴏᴀʀᴅ 4 | /brb - sᴀᴍᴇ ʟɪᴋᴇ ᴀғᴋ ᴄᴍɴᴅ 5 | 6 | ᴇxᴀᴍᴘʟᴇ :- /afk [ᴛʏᴘᴇ ᴀɴʏ ʀᴇᴀsᴏɴ] 7 | """ 8 | 9 | TEXT2 = """**ᴀʟɪᴠᴇ ** 10 | 11 | /alive - ᴛᴏ ᴄʜᴇᴄᴋ ʙᴏᴛ ɪꜱ ᴀʟɪᴠᴇ ᴏʀ ᴅᴇᴀᴅ 12 | 13 | """ 14 | 15 | TEXT3 = """**ɪᴅ ** 16 | 17 | /id - ɢᴇᴛ ʏᴏᴜʀ ᴜꜱᴇʀ ɪᴅ 18 | """ 19 | 20 | TEXT4 = """**ᴘɪɴɢᴄʜᴀᴛʙᴏᴛ ** 26 | 27 | /chatbot - ʏᴏᴜ ᴡɪʟʟ ɢᴇᴛ ᴀɴ ʙᴜᴛᴛᴏɴ ᴛᴏ ᴇɴᴀʙʟᴇ ᴏʀ ᴅɪꜱᴀʙʟᴇ ᴄʜᴀᴛʙᴏᴛ ɪɴ ʏᴏᴜʀ ɢʀᴏᴜᴘ 28 | 29 | """ 30 | 31 | TEXT6 = """**ꜱᴛᴀʀᴛ** 32 | 33 | /start - 😅 34 | 35 | """ 36 | 37 | TEXT7 = """**ᴅᴇᴠᴇʟᴏᴘᴇʀ ᴄᴏᴍᴍᴀɴᴅꜱ** 38 | 39 | /murali - ʀᴜɴ ʏᴏᴜʀ ᴘʏᴛʜᴏɴ ᴄᴏᴅᴇꜱ 40 | /shh - ɪɴꜱᴛᴀʟʟ ᴀɴʏ ᴘᴀᴄᴋᴀɢᴇ 41 | /stats - ᴛᴏ ᴄʜᴇᴄᴋ ᴄᴜʀʀᴇɴᴛ ꜱᴛᴀᴛꜱ ᴏꜰ ʙᴏᴛ 42 | /broadcast - ʙʀᴏᴀᴅᴄᴀꜱᴛ ʏᴏᴜʀ ᴍᴇꜱꜱᴀɢᴇ ᴛᴏ ᴀʟʟ ᴄʜᴀᴛꜱ + ᴜꜱᴇʀꜱ 43 | 44 | """ 45 | 46 | TEXT8 = """**ᴛᴇʟᴇɢʀᴀᴘʜ ** 47 | 48 | /tgm - ᴜᴘʟᴏᴀᴅ ʏᴏᴜʀ ᴍᴇᴅɪᴀ ᴏɴ ᴛᴇʟᴇɢʀᴀᴘʜ 49 | 50 | """ 51 | 52 | TEXT9 = """**ʟᴏᴠᴇ** 53 | 54 | /love - 💓 55 | 56 | """ 57 | 58 | 59 | START_TEXT = """ʜᴇʟʟᴏ {0} ❣️ 60 | 61 | ❥ ɪᴍ {1} 62 | ᴀ ᴏᴘᴇɴ ꜱᴏᴜʀᴄᴇ ᴀɪ ᴄʜᴀᴛ ʙᴏᴛ ᴡɪᴛʜ ᴀᴡᴇꜱᴏᴍᴇ ꜰᴇᴀᴛᴜʀᴇꜱ 💘 63 | ᴄʟɪᴄᴋ ᴛʜᴇ ʙᴇʟᴏᴡ ʜᴇʟᴘ ʙᴜᴛᴛᴏɴ ᴛᴏ ᴋɴᴏᴡ ᴀʙᴏᴜᴛ ᴍʏ ꜰᴇᴀᴛᴜʀᴇꜱ 64 | 65 | **ᴍʏ ꜱᴜᴘᴘᴏʀᴛᴇᴅ ʟᴀɴɢᴜᴀɢᴇꜱ ᴀʀᴇ**: 66 | ᴇɴɢʟɪꜱʜ ᴀɴᴅ ᴄʜɪɴᴇꜱᴇ 67 | 68 | """ 69 | 70 | -------------------------------------------------------------------------------- /AiChatBot/__main__.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import importlib 3 | from pyrogram import idle 4 | from AiChatBot import Chiku 5 | from pyrogram.types import BotCommand 6 | from AiChatBot.modules import ALL_MODULES 7 | from config import LOGGER_ID, SETCMD 8 | 9 | loop = asyncio.get_event_loop() 10 | 11 | # all Fixed 12 | 13 | 14 | 15 | async def Murali(): 16 | await Chiku.start() 17 | for all_module in ALL_MODULES: 18 | importlib.import_module("AiChatBot.modules." + all_module) 19 | print("𝐂𝐇𝐈𝐊𝐔 𝐁𝐎𝐓 𝐇𝐀𝐒 𝐁𝐄𝐄𝐍 𝐒𝐓𝐀𝐑𝐓𝐄𝐃 ✨") 20 | print("𝐃𝐨𝐧𝐭 𝐅𝐨𝐫𝐠𝐞𝐭 𝐓𝐨 𝐕𝐢𝐬𝐢𝐭 @𝐌𝐮𝐫𝐚𝐥𝐢𝐁𝐨𝐭𝐳 ⭐") 21 | if SETCMD: 22 | try: 23 | await Chiku.set_bot_commands( 24 | [ 25 | BotCommand("alive", "ᴄʜᴇᴄᴋ ʙᴏᴛ ɪꜱ ᴀʟɪᴠᴇ ᴏʀ ᴅᴇᴀᴅ"), 26 | BotCommand("id", "ᴄʜᴇᴄᴋ ʏᴏᴜʀ ɪᴅ"), 27 | BotCommand("ping", "ᴄʜᴇᴄᴋ ʙᴏᴛ ᴘɪɴɢ"), 28 | BotCommand("chatbot", "ᴇɴᴀʙʟᴇ ᴏʀ ᴅɪꜱᴀʙʟᴇ ᴄʜᴀᴛʙᴏᴛ "), 29 | BotCommand("start", "ꜱᴛᴀʀᴛ ᴄʜɪᴋᴜ ʙᴏᴛ"), 30 | BotCommand("tgm", "ᴜᴘʟᴏᴀᴅ ꜰɪʟᴇ ᴛᴏ ᴛᴇʟᴇɢʀᴀᴘʜ ") 31 | ] 32 | ) 33 | except Exception as e: 34 | print(f"Failed to set bot commands: {e}") 35 | pass 36 | await idle() 37 | 38 | if __name__ == "__main__": 39 | loop.run_until_complete(Murali()) 40 | 41 | 42 | -------------------------------------------------------------------------------- /AiChatBot/modules/Ping.py: -------------------------------------------------------------------------------- 1 | from AiChatBot import Chiku 2 | from pyrogram import filters 3 | import time 4 | from datetime import datetime 5 | import requests 6 | 7 | def get_readable_time(seconds: int) -> str: 8 | count = 0 9 | ping_time = "" 10 | time_list = [] 11 | time_suffix_list = ["s", "m", "h", "days"] 12 | while count < 4: 13 | count += 1 14 | if count < 3: 15 | remainder, result = divmod(seconds, 60) 16 | else: 17 | remainder, result = divmod(seconds, 24) 18 | if seconds == 0 and remainder == 0: 19 | break 20 | time_list.append(int(result)) 21 | seconds = int(remainder) 22 | for i in range(len(time_list)): 23 | time_list[i] = str(time_list[i]) + time_suffix_list[i] 24 | if len(time_list) == 4: 25 | ping_time += time_list.pop() + ", " 26 | time_list.reverse() 27 | ping_time += ":".join(time_list) 28 | return ping_time 29 | 30 | _boot_ = time.time() 31 | 32 | @Chiku.on_cmd("ping") 33 | async def pingbot(client, message): 34 | start = datetime.now() 35 | Hello = (datetime.now() - start).microseconds / 1000 36 | response = requests.get("https://nekos.best/api/v2/neko").json() 37 | m = response["results"][0]["url"] 38 | bot_uptime = int(time.time() - _boot_) 39 | Uptime = f"{get_readable_time(bot_uptime)}" 40 | await message.reply_photo(m, caption=f"{Chiku.mention} \n\nᴘɪɴɢ ᴘᴏɴɢ `{Hello}` ms\nᴜᴘᴛɪᴍᴇ - {Uptime}") 41 | 42 | -------------------------------------------------------------------------------- /AiChatBot/modules/Love.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, filters 2 | import random 3 | from AiChatBot import Chiku 4 | 5 | def get_random_message(love_percentage): 6 | if love_percentage <= 30: 7 | return random.choice([ 8 | "ʟᴏᴠᴇ ɪs ɪɴ ᴛʜᴇ ᴀɪʀ ʙᴜᴛ ɴᴇᴇᴅs ᴀ ʟɪᴛᴛʟᴇ sᴘᴀʀᴋ.", 9 | "ᴀ ɢᴏᴏᴅ sᴛᴀʀᴛ ʙᴜᴛ ᴛʜᴇʀᴇ's ʀᴏᴏᴍ ᴛᴏ ɢʀᴏᴡ.", 10 | "ɪᴛ's ᴊᴜsᴛ ᴛʜᴇ ʙᴇɢɪɴɴɪɴɢ ᴏғ sᴏᴍᴇᴛʜɪɴɢ ʙᴇᴀᴜᴛɪғᴜʟ." 11 | ]) 12 | elif love_percentage <= 70: 13 | return random.choice([ 14 | "ᴀ sᴛʀᴏɴɢ ᴄᴏɴɴᴇᴄᴛɪᴏɴ ɪs ᴛʜᴇʀᴇ. ᴋᴇᴇᴘ ɴᴜʀᴛᴜʀɪɴɢ ɪᴛ.", 15 | "ʏᴏᴜ'ᴠᴇ ɢᴏᴛ ᴀ ɢᴏᴏᴅ ᴄʜᴀɴᴄᴇ. ᴡᴏʀᴋ ᴏɴ ɪᴛ.", 16 | "ʟᴏᴠᴇ ɪs ʙʟᴏssᴏᴍɪɴɢ, ᴋᴇᴇᴘ ɢᴏɪɴɢ." 17 | ]) 18 | elif love_percentage <= 90: 19 | return random.choice([ 20 | "ʏᴏᴜ ᴀʀᴇ ᴀ ɢʀᴇᴀᴛ ᴘᴀɪʀ, ᴋᴇᴇᴘ ɪᴛ ᴜᴘ!", 21 | "ʏᴏᴜʀ ʙᴏɴᴅ ɪs sᴛʀᴏɴɢ ᴀɴᴅ ᴠɪʙʀᴀɴᴛ.", 22 | "ᴀʟᴍᴏsᴛ ᴘᴇʀғᴇᴄᴛ ᴛᴏɢᴇᴛʜᴇʀ." 23 | ]) 24 | else: 25 | return random.choice([ 26 | "ᴡᴏᴡ! ɪᴛ's ᴀ ᴍᴀᴛᴄʜ ᴍᴀᴅᴇ ɪɴ ʜᴇᴀᴠᴇɴ!", 27 | "ᴘᴇʀғᴇᴄᴛ ᴍᴀᴛᴄʜ! ᴄʜᴇʀɪsʜ ᴛʜɪs ʙᴏɴᴅ.", 28 | "ᴅᴇsᴛɪɴᴇᴅ ᴛᴏ ʙᴇ ᴛᴏɢᴇᴛʜᴇʀ. ᴄᴏɴɢʀᴀᴛᴜʟᴀᴛɪᴏɴs!" 29 | ]) 30 | 31 | @Chiku.on_cmd("love") 32 | async def love_command(client, message): 33 | command, *args = message.text.split(" ") 34 | if not len(args) >= 2: 35 | return await message.reply_text("Please enter two names after /love command.") 36 | 37 | name1 = args[0].strip() 38 | name2 = args[1].strip() 39 | love_percentage = random.randint(10, 100) 40 | love_message = get_random_message(love_percentage) 41 | response = f"{name1}💕 + {name2}💕 = {love_percentage}%\n\n{love_message}" 42 | await message.reply_text(response) 43 | 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 | 6 | 7 |
8 | 9 |
10 | 11 | 12 | 13 | 14 | [![MURALI](https://github-stats-alpha.vercel.app/api?username=MURALIBOTZ&cc=255&tc=fff&ic=ff69b4&bc=870 "MURALIBOTZ")](https://github-stats-alpha.vercel.app/api?username=MURALIBOTZ&cc=000&tc=fff&ic=fff&bc=000"MURALIBOTZ) 15 | 16 | 17 | 18 |

𝐂𝐇𝐈𝐊𝐔 💓

19 | 20 | ᴀ ꜰᴀꜱᴛ ᴀɴᴅ ᴘᴏᴡᴇʀꜰᴜʟ ᴀɪ ᴄʜᴀᴛʙᴏᴛ ᴡɪᴛʜ ᴀᴡᴇꜱᴏᴍᴇ ꜰᴇᴀᴛᴜʀᴇꜱ 💘 21 | 22 | 23 | ![image](https://telegra.ph/file/a8f5426d7e5c50d023164.png) 24 | 25 | 26 | ─「 ᴅᴇᴩʟᴏʏ ᴏɴ ʜᴇʀᴏᴋᴜ 」─ 27 | 28 | 29 | sᴛᴀʀ ᴛʜɪs ʀᴇᴘᴏ ⭐ ᴀɴᴅ ғᴏʀᴋ ᴛʜᴇɴ ᴅᴇᴘʟᴏʏ 🥀 30 | 31 |

32 | 33 | 34 | ![vdo](https://media.giphy.com/media/r7bt4IqTe6PJ6sYTLU/giphy.gif) 35 | 36 | 37 | 38 | 39 | ## ᴄʀᴇᴅɪᴛs 40 | 41 | - [ᴍᴜʀᴀʟɪ](https://t.me/MuraliBotz) 42 | - [Aᴄᴏʙᴏᴛ](https://acobot.ai) 43 | - [ᴘʏʀᴏɢʀᴀᴍ ](https://GitHub.com/pyrogram) 44 | - [ᴀʙɢ](https://github.com/Abishnoi69/Abg) 45 | - [ᴍᴏɴɢᴏ ᴅʙ](https://www.mongodb.org) 46 | 47 | 48 | -------------------------------------------------------------------------------- /AiChatBot/__init__.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import logging 3 | import time 4 | from importlib import import_module 5 | from os import listdir, path 6 | from dotenv import load_dotenv 7 | import config 8 | import pymongo 9 | from pyrogram import Client 10 | from config import API_ID, API_HASH, BOT_TOKEN, OWNER_ID 11 | from pyrogram.enums import ParseMode, ChatMemberStatus 12 | from Abg import patch 13 | 14 | loop = asyncio.get_event_loop() 15 | load_dotenv() 16 | boot = time.time() 17 | 18 | 19 | logging.basicConfig( 20 | format="[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s", 21 | level=logging.INFO, 22 | ) 23 | 24 | logging.getLogger("pyrogram").setLevel(logging.ERROR) 25 | logging.getLogger("pymongo").setLevel(logging.ERROR) 26 | 27 | # Hehehe 28 | 29 | class ChikuBot(Client): 30 | def __init__(self): 31 | super().__init__( 32 | name="Chikubot", 33 | api_id=config.API_ID, 34 | api_hash=config.API_HASH, 35 | lang_code="en", 36 | bot_token=config.BOT_TOKEN, 37 | in_memory=True, 38 | parse_mode=ParseMode.DEFAULT, 39 | ) 40 | 41 | async def start(self): 42 | await super().start() 43 | self.id = self.me.id 44 | self.name = self.me.first_name + " " + (self.me.last_name or "") 45 | self.username = self.me.username 46 | self.mention = self.me.mention 47 | try: 48 | await self.resolve_peer(config.LOGGER_ID) 49 | await self.send_message(config.LOGGER_ID, f"๏ {self.mention} sᴛᴀʀᴛᴇᴅ ➛ \n\n๏ ɴᴀᴍᴇ ➛ {self.name}\n๏ ɪᴅ ➛ {self.id}\n๏ ᴜsᴇʀɴᴀᴍᴇ ➛ @{self.username} \n\n||ᴍᴀᴅᴇ ʙʏ ᴍᴜʀᴀʟɪ 🥀 ||") 50 | except: 51 | pass 52 | 53 | async def stop(self): 54 | await super().stop() 55 | 56 | 57 | 58 | 59 | Chiku = ChikuBot() 60 | 61 | 62 | 63 | #from AiChatBot.Db import git 64 | 65 | #Up = git() 66 | 67 | -------------------------------------------------------------------------------- /AiChatBot/modules/Id.py: -------------------------------------------------------------------------------- 1 | from AiChatBot import Chiku 2 | from pyrogram import filters, client 3 | from pyrogram.enums import ParseMode 4 | 5 | 6 | @Chiku.on_cmd("id") 7 | async def getid(client, message): 8 | chat = message.chat 9 | your_id = message.from_user.id 10 | message_id = message.id 11 | reply = message.reply_to_message 12 | 13 | text = f"**[ᴍᴇssᴀɢᴇ ɪᴅ:]({message.link})** `{message_id}`\n" 14 | text += f"**[ʏᴏᴜʀ ɪᴅ:](tg://user?id={your_id})** `{your_id}`\n" 15 | 16 | if not message.command: 17 | message.command = message.text.split() 18 | 19 | if not message.command: 20 | message.command = message.text.split() 21 | 22 | if len(message.command) == 2: 23 | try: 24 | split = message.text.split(None, 1)[1].strip() 25 | user_id = (await client.get_users(split)).id 26 | text += f"**[ᴜsᴇʀ ɪᴅ:](tg://user?id={user_id})** `{user_id}`\n" 27 | 28 | except Exception: 29 | return await message.reply_text("ᴛʜɪs ᴜsᴇʀ ᴅᴏᴇsɴ'ᴛ ᴇxɪsᴛ.", quote=True) 30 | 31 | text += f"**[ᴄʜᴀᴛ ɪᴅ:](https://t.me/{chat.username})** `{chat.id}`\n\n" 32 | 33 | if ( 34 | not getattr(reply, "empty", True) 35 | and not message.forward_from_chat 36 | and not reply.sender_chat 37 | ): 38 | text += f"**[ʀᴇᴘʟɪᴇᴅ ᴍᴇssᴀɢᴇ ɪᴅ:]({reply.link})** `{reply.id}`\n" 39 | text += f"**[ʀᴇᴘʟɪᴇᴅ ᴜsᴇʀ ɪᴅ:](tg://user?id={reply.from_user.id})** `{reply.from_user.id}`\n\n" 40 | 41 | if reply and reply.forward_from_chat: 42 | text += f"ᴛʜᴇ ғᴏʀᴡᴀʀᴅᴇᴅ ᴄʜᴀɴɴᴇʟ, {reply.forward_from_chat.title}, ʜᴀs ᴀɴ ɪᴅ ᴏғ `{reply.forward_from_chat.id}`\n\n" 43 | print(reply.forward_from_chat) 44 | 45 | if reply and reply.sender_chat: 46 | text += f"ɪᴅ ᴏғ ᴛʜᴇ ʀᴇᴘʟɪᴇᴅ ᴄʜᴀᴛ/ᴄʜᴀɴɴᴇʟ, ɪs `{reply.sender_chat.id}`" 47 | print(reply.sender_chat) 48 | 49 | await message.reply_text( 50 | text, 51 | disable_web_page_preview=True, 52 | parse_mode=ParseMode.DEFAULT, 53 | ) 54 | -------------------------------------------------------------------------------- /AiChatBot/modules/Telegraph.py: -------------------------------------------------------------------------------- 1 | import os 2 | from pyrogram import filters 3 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup 4 | from telegraph import upload_file 5 | from AiChatBot import Chiku 6 | 7 | #credit - Vivek Kumar 8 | 9 | @Chiku.on_cmd(["tgm", "tgt", "telegraph", "tl"]) 10 | async def get_link_group(client, message): 11 | if not message.reply_to_message: 12 | return await message.reply_text( 13 | "Pʟᴇᴀsᴇ ʀᴇᴘʟʏ ᴛᴏ ᴀ ᴍᴇᴅɪᴀ ᴛᴏ ᴜᴘʟᴏᴀᴅ ᴏɴ Tᴇʟᴇɢʀᴀᴘʜ" 14 | ) 15 | 16 | media = message.reply_to_message 17 | file_size = 0 18 | if media.photo: 19 | file_size = media.photo.file_size 20 | elif media.video: 21 | file_size = media.video.file_size 22 | elif media.document: 23 | file_size = media.document.file_size 24 | 25 | if file_size > 5 * 1024 * 1024: 26 | return await message.reply_text("Pʟᴇᴀsᴇ ᴘʀᴏᴠɪᴅᴇ ᴀ ᴍᴇᴅɪᴀ ғɪʟᴇ ᴜɴᴅᴇʀ 𝟻MB.") 27 | try: 28 | text = await message.reply("Pʀᴏᴄᴇssɪɴɢ...") 29 | 30 | async def progress(current, total): 31 | await text.edit_text(f"📥 Dᴏᴡɴʟᴏᴀᴅɪɴɢ... {current * 100 / total:.1f}%") 32 | 33 | try: 34 | local_path = await media.download(progress=progress) 35 | await text.edit_text("📤Uᴘʟᴏᴀᴅɪɴɢ ᴛᴏ ᴛᴇʟᴇɢʀᴀᴘʜ...") 36 | upload_path = upload_file(local_path) 37 | await text.edit_text( 38 | f"🌐 | [ᴛᴇʟᴇɢʀᴀᴘʜ ʟɪɴᴋ](https://telegra.ph{upload_path[0]})", 39 | reply_markup=InlineKeyboardMarkup( 40 | [ 41 | [ 42 | InlineKeyboardButton( 43 | "ᴛᴇʟᴇɢʀᴀᴘʜ ʟɪɴᴋ", 44 | url=f"https://telegra.ph{upload_path[0]}", 45 | ) 46 | ] 47 | ] 48 | ), 49 | ) 50 | try: 51 | os.remove(local_path) 52 | except Exception: 53 | pass 54 | except Exception as e: 55 | await text.edit_text(f"❌ Fɪʟᴇ ᴜᴘʟᴏᴀᴅ ғᴀɪʟᴇᴅ\n\nRᴇᴀsᴏɴ: {e}") 56 | try: 57 | os.remove(local_path) 58 | except Exception: 59 | pass 60 | return 61 | except Exception: 62 | pass -------------------------------------------------------------------------------- /AiChatBot/modules/Gcast.py: -------------------------------------------------------------------------------- 1 | from AiChatBot import Chiku 2 | import asyncio 3 | from pyrogram import filters 4 | from config import OWNER_ID 5 | from Murali import Owner 6 | from pyrogram.errors import FloodWait 7 | from AiChatBot.Db import get_served_chats, get_served_users 8 | 9 | @Chiku.on_cmd(["gcast", "broadcast"]) 10 | async def broadcast_message(client, message): 11 | if message.from_user.id not in Owner and message.from_user.id not in OWNER_ID: 12 | return await message.reply_text( 13 | "»ʜᴇʜᴇ ᴏɴʟʏ ᴍʏ ᴏᴡɴᴇʀ ᴄᴀɴ ʙʀᴏᴀᴅᴄᴀsᴛ" 14 | ) 15 | 16 | if message.reply_to_message: 17 | msg_id = message.reply_to_message.id 18 | query = None 19 | else: 20 | if len(message.command) < 2: 21 | return await message.reply_text(f"**Usage:**\n`/broadcast [message]` or reply to a message") 22 | query = message.text.split(None, 1)[1] 23 | if not query: 24 | return await message.reply_text("Please provide a message to broadcast.") 25 | msg_id = None 26 | 27 | sent_chats = 0 28 | chats = [] 29 | schats = await get_served_chats() 30 | for chat in schats: 31 | chats.append(int(chat["chat_id"])) 32 | for chat_id in chats: 33 | 34 | try: 35 | if msg_id: 36 | await client.forward_messages(chat_id, message.chat.id, msg_id) 37 | else: 38 | await client.send_message(chat_id, text=query) 39 | sent_chats += 1 40 | except FloodWait as e: 41 | await asyncio.sleep(e.value) 42 | except Exception: 43 | continue 44 | 45 | await message.reply_text(f"Broadcasted message to {sent_chats} chats.") 46 | 47 | sent_users = 0 48 | users = [] 49 | susers = await get_served_users() 50 | for user in susers: 51 | users.append(int(user["user_id"])) 52 | for user_id in users: 53 | try: 54 | if msg_id: 55 | await client.forward_messages(user_id, message.chat.id, msg_id) 56 | else: 57 | await client.send_message(user_id, text=query) 58 | sent_users += 1 59 | except FloodWait as e: 60 | await asyncio.sleep(e.value) 61 | except Exception: 62 | continue 63 | 64 | await message.reply_text(f"Broadcasted message to {sent_users} users.") 65 | 66 | -------------------------------------------------------------------------------- /AiChatBot/Db/Updatefetcher: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import shlex 3 | from typing import Tuple 4 | from git import Repo, Git 5 | from git.exc import GitCommandError, InvalidGitRepositoryError 6 | import os 7 | import config 8 | 9 | 10 | os.environ['GIT_PYTHON_GIT_EXECUTABLE'] = '/usr/bin/git' 11 | 12 | Git.refresh() 13 | 14 | def install_req(cmd: str) -> Tuple[str, str, int, int]: 15 | async def install_requirements(): 16 | args = shlex.split(cmd) 17 | process = await asyncio.create_subprocess_exec( 18 | *args, 19 | stdout=asyncio.subprocess.PIPE, 20 | stderr=asyncio.subprocess.PIPE, 21 | ) 22 | stdout, stderr = await process.communicate() 23 | return ( 24 | stdout.decode("utf-8", "replace").strip(), 25 | stderr.decode("utf-8", "replace").strip(), 26 | process.returncode, 27 | process.pid, 28 | ) 29 | 30 | return asyncio.get_event_loop().run_until_complete(install_requirements()) 31 | 32 | def git(): 33 | REPO_LINK = config.UPSTREAM_REPO 34 | if config.GIT_TOKEN: 35 | GIT_USERNAME = REPO_LINK.split("com/")[1].split("/")[0] 36 | TEMP_REPO = REPO_LINK.split("https://")[1] 37 | UPSTREAM_REPO = f"https://{GIT_USERNAME}:{config.GIT_TOKEN}@{TEMP_REPO}" 38 | else: 39 | UPSTREAM_REPO = config.UPSTREAM_REPO 40 | try: 41 | repo = Repo() 42 | except GitCommandError: 43 | print("Invalid Git Command") 44 | except InvalidGitRepositoryError: 45 | repo = Repo.init() 46 | if "origin" in repo.remotes: 47 | origin = repo.remote("origin") 48 | else: 49 | origin = repo.create_remote("origin", UPSTREAM_REPO) 50 | origin.fetch() 51 | repo.create_head( 52 | config.UPSTREAM_BRANCH, 53 | origin.refs[config.UPSTREAM_BRANCH], 54 | ) 55 | repo.heads[config.UPSTREAM_BRANCH].set_tracking_branch( 56 | origin.refs[config.UPSTREAM_BRANCH] 57 | ) 58 | repo.heads[config.UPSTREAM_BRANCH].checkout(True) 59 | try: 60 | repo.create_remote("origin", config.UPSTREAM_REPO) 61 | except BaseException: 62 | pass 63 | nrs = repo.remote("origin") 64 | nrs.fetch(config.UPSTREAM_BRANCH) 65 | try: 66 | nrs.pull(config.UPSTREAM_BRANCH) 67 | except GitCommandError: 68 | repo.git.reset("--hard", "FETCH_HEAD") 69 | install_req("pip3 install --no-cache-dir -r requirements.txt") 70 | print(f"𝐒𝐮𝐜𝐜𝐞𝐬𝐬𝐟𝐮𝐥𝐥𝐲 𝐅𝐞𝐭𝐜𝐡𝐞𝐝 𝐔𝐩𝐝𝐚𝐭𝐞𝐬 𝐅𝐫𝐨𝐦 𝐂𝐡𝐢𝐤𝐮 𝐁𝐨𝐭 💓.") 71 | 72 | -------------------------------------------------------------------------------- /AiChatBot/modules/Groups.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, filters 2 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message 3 | from AiChatBot import Chiku as app 4 | from config import LOGGER_ID as LOG_GROUP_ID 5 | from AiChatBot.Db import get_served_chats, remove_served_chat, add_served_chat 6 | 7 | import requests 8 | 9 | 10 | @app.on_message(filters.new_chat_members, group=2) 11 | async def on_new_chat_members(client: Client, message: Message): 12 | if (await client.get_me()).id in [user.id for user in message.new_chat_members]: 13 | added_by = message.from_user.mention if message.from_user else "ᴜɴᴋɴᴏᴡɴ ᴜsᴇʀ" 14 | 15 | response = requests.get("https://nekos.best/api/v2/neko").json() 16 | image_url = response["results"][0]["url"] 17 | served_chats = len(await get_served_chats()) 18 | chat_id = message.chat.id 19 | if message.chat.username: 20 | chatusername = f"{message.chat.username}" 21 | else: 22 | chatusername = await client.export_chat_invite_link(message.chat.id) 23 | 24 | msg = ( 25 | f"❄️ ʙᴏᴛ #ᴀᴅᴅᴇᴅ ᴛᴏ ɴᴇᴡ ɢʀᴏᴜᴘ \n\n" 26 | f"┏━━━━━━━━━━━━━━━━━┓\n" 27 | f"┣★ **ᴄʜᴀᴛ** › : {message.chat.title}\n" 28 | f"┣★ **ᴄʜᴀᴛ ɪᴅ** › : {chat_id}\n" 29 | f"┣★ **ᴄʜᴀᴛ ᴜɴᴀᴍᴇ** › : @{message.chat.username}\n" 30 | f"┣★ **ɢʀᴏᴜᴘ ʟɪɴᴋ** › : [ᴛᴏᴜᴄʜ]({chatusername}) \n" 31 | # f"┣★ **ɢʀᴏᴜᴘ ᴍᴇᴍʙᴇʀs** › : {count}\n" 32 | f"┣★ **ᴛᴏᴛᴀʟ ᴄʜᴀᴛ** › : {served_chats}\n" 33 | f"┣★ **ᴀᴅᴅᴇᴅ ʙʏ** › : {added_by} \n" 34 | f"┗━━━━━━━━━★ " 35 | ) 36 | await app.send_photo(LOG_GROUP_ID, photo=image_url, caption=msg) 37 | 38 | await add_served_chat(chat_id) 39 | 40 | @app.on_message(filters.left_chat_member) 41 | async def on_left_chat_member(_, message: Message): 42 | if (await app.get_me()).id == message.left_chat_member.id: 43 | remove_by = message.from_user.mention if message.from_user else "𝐔ɴᴋɴᴏᴡɴ 𝐔sᴇʀ" 44 | title = message.chat.title 45 | username = f"@{message.chat.username}" if message.chat.username else "𝐏ʀɪᴠᴀᴛᴇ 𝐂ʜᴀᴛ" 46 | response = requests.get("https://nekos.best/api/v2/neko").json() 47 | image_url = response["results"][0]["url"] 48 | chat_id = message.chat.id 49 | left = ( 50 | f"❄️ ʙᴏᴛ #ʟᴇғᴛ_ɢʀᴏᴜᴘ \n\n" 51 | f"๏ ɢʀᴏᴜᴘ ɴᴀᴍᴇ ➠ {title}\n" 52 | f"๏ ɢʀᴏᴜᴘ ɪᴅ ➠ {chat_id}\n" 53 | f"๏ ʙᴏᴛ ʀᴇᴍᴏᴠᴇᴅ ʙʏ ➠ {remove_by}\n" 54 | ) 55 | await app.send_photo(LOG_GROUP_ID, photo=image_url, caption=left) 56 | await remove_served_chat(chat_id) 57 | 58 | -------------------------------------------------------------------------------- /AiChatBot/Strings/inline.py: -------------------------------------------------------------------------------- 1 | from AiChatBot import Chiku 2 | from config import OWNER_ID, SUPPORT_GROUP 3 | from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton 4 | from typing import Union 5 | 6 | 7 | def small_caps(text): 8 | conversion = str.maketrans("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 9 | "ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡxʏᴢᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡxʏᴢ") 10 | return text.translate(conversion) 11 | 12 | 13 | 14 | HELP_BUTTON = InlineKeyboardMarkup([ 15 | [ 16 | InlineKeyboardButton(text=small_caps("Afk"), callback_data="afk"), 17 | InlineKeyboardButton(text=small_caps("Alive"), callback_data="alive"), 18 | InlineKeyboardButton(text=small_caps("id"), callback_data="id") 19 | ], 20 | [ 21 | InlineKeyboardButton(text=small_caps("ping"), callback_data="ping"), 22 | InlineKeyboardButton(text=small_caps("Chatbot"), callback_data="chatbott"), 23 | InlineKeyboardButton(text=small_caps("start"), callback_data="start") 24 | ], 25 | [ 26 | InlineKeyboardButton(text=small_caps("Dev"), callback_data="dev"), 27 | InlineKeyboardButton(text=small_caps("T-Graph"), callback_data="telegraph"), 28 | InlineKeyboardButton(text=small_caps("Love"), callback_data="love") 29 | ], 30 | [ 31 | InlineKeyboardButton(text=small_caps("Back"), callback_data="gotomain"), 32 | InlineKeyboardButton(text=small_caps("close"), callback_data="close"), 33 | 34 | ] 35 | ]) 36 | 37 | INHELPBUTTON = InlineKeyboardMarkup([ 38 | [ 39 | InlineKeyboardButton(text=small_caps("Back"), callback_data="gohelp"), 40 | InlineKeyboardButton(text=small_caps("close"), callback_data="close"), 41 | 42 | ] 43 | ]) 44 | 45 | def START_BUTTON(OWNER: Union[bool, int] = None): 46 | button = InlineKeyboardMarkup( 47 | [ 48 | [ 49 | InlineKeyboardButton( 50 | text="ᴀᴅᴅ ᴍᴇ ᴛᴏ ʏᴏᴜʀ ɢʀᴏᴜᴘ 💓", 51 | url=f"https://t.me/{Chiku.username}?startgroup=true", 52 | ), 53 | ], 54 | [ 55 | InlineKeyboardButton( 56 | text="ʜᴇʟᴘ & ᴄᴏᴍᴍᴀɴᴅꜱ ", 57 | callback_data="gohelp", 58 | ), 59 | ], 60 | [ 61 | InlineKeyboardButton( 62 | text="ᴅᴇᴠᴇʟᴏᴘᴇʀ ", 63 | user_id=OWNER, 64 | ), 65 | InlineKeyboardButton( 66 | text="ꜱᴜᴘᴘᴏʀᴛ", 67 | url=f"https://t.me/{SUPPORT_GROUP}", 68 | ), 69 | ], 70 | ] 71 | ) 72 | return button 73 | 74 | -------------------------------------------------------------------------------- /setup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pprint (){ 4 | cred='\033[0;31m' 5 | cgreen='\033[0;32m' 6 | cyellow='\033[0;33m' 7 | cblue='\033[0;34m' 8 | cpurple='\033[0;35m' 9 | eval "export color='$cpurple'" 10 | [ ! -z $2 ] && eval "export color=\"\$$2\"" 11 | printf "$color $1" 12 | } 13 | 14 | color_reset(){ printf '\033[0;37m';} 15 | 16 | yesnoprompt(){ 17 | old_stty_cfg=$(stty -g) 18 | stty raw -echo ; answer=$(head -c 1) 19 | stty $old_stty_cfg 20 | echo "$answer" | grep -iq "^y" 21 | } 22 | 23 | update() { 24 | pprint "\n\nUpdating package list.. " 25 | sudo apt update 2>&1 | grep "can be upgraded" &>/dev/null 26 | if [ $? -eq 0 ]; then 27 | pprint "UPDATE AVAILABLE" "cgreen" 28 | pprint "\n\nDo you want to automatically upgrade (y/n)?" 29 | if yesnoprompt; then 30 | pprint "\n\nUpgrading packages.. " 31 | sudo apt upgrade -y &>/dev/null && 32 | pprint "DONE!\n\n" "cgreen" || (pprint "FAIL.\n\n" "cred"; exit 1) 33 | else 34 | echo 35 | fi 36 | else 37 | pprint "ALREADY UP TO DATE\n\n" "cgreen" 38 | fi 39 | } 40 | 41 | packages(){ 42 | if ! command -v pip &>/dev/null; then 43 | pprint "Couldn't found pip, installing now..." 44 | sudo apt install python3-pip -y 2>pypilog.txt 1>/dev/null && 45 | pprint "SUCCESS.\n\n" "cgreen" || (pprint "FAIL.\n\n" "cred"; exit 1) 46 | fi 47 | 48 | if ! command -v ffmpeg &>/dev/null; then 49 | pprint "Couldn't found ffmpeg, installing now..." 50 | if sudo apt install ffmpeg -y &>/dev/null;then 51 | pprint "SUCCESS.\n\n" "cgreen" 52 | else 53 | pprint "FAIL.\n\n" "cred" 54 | pprint "You need to install ffmpeg manually in order to deploy YukkiMusic, exiting...\n" "cblue" 55 | exit 1 56 | fi 57 | fi 58 | 59 | # Check ffmpeg version and warn user if necessary. 60 | fv=$(grep -Po 'version (3.*?) ' <<< $(ffmpeg -version)) && 61 | pprint "Playing live streams not going to work since you have ffmpeg $fv, live streams are supported by version 4+.\n" "cblue" 62 | } 63 | 64 | 65 | 66 | installation(){ 67 | pprint "\n\nUpgrading pip and installing dependency packages..." 68 | pip3 install -U pip &>>pypilog.txt && 69 | pip3 install -U -r requirements.txt &>>pypilog.txt && 70 | pprint "DONE.\n" "cgreen" && return 71 | pprint "FAIL.\n" "cred" 72 | exit 1 73 | } 74 | 75 | clear 76 | pprint "Welcome to ChikuBot Setup Installer\n\n" 77 | pprint "If you see any error during Installation Process, Please refer to these files for logs: " 78 | pprint "\nFor node js errors , Checkout nodelog.txt" 79 | pprint "\nFor pypi packages errors , Checkout pypilog.txt" 80 | sleep 1 81 | pprint "\n\nScript needs sudo privileges in order to update & install packages.\n" 82 | sudo test 83 | 84 | update 85 | packages 86 | node 87 | installation 88 | pprint "\n\n\n\n\nChikuBot Installation Completed !" "cgreen" 89 | sleep 1 90 | clear 91 | 92 | pprint "\nEnter Your Values Below\n\n\n" 93 | pprint "API ID: "; color_reset; read api_id 94 | pprint "\nAPI HASH: "; color_reset; read api_hash 95 | pprint "\nBOT TOKEN: "; color_reset; read bot_token 96 | pprint "\nOWNER ID:"; color_reset; read ownid 97 | pprint "\nMONGO URL: "; color_reset; read mongo_url 98 | 99 | 100 | pprint "\n\nProcessing your vars, wait a while !" "cgreen" 101 | 102 | if [ -f .env ]; then 103 | rm .env 104 | fi 105 | 106 | echo """API_ID = $api_id 107 | API_HASH = $api_hash 108 | BOT_TOKEN = $bot_token 109 | MONGO_URL= $mongo_urk 110 | OWNER_ID = $ownid""" > .env 111 | clear 112 | 113 | pprint "\n\n\nThanks for using ChikuBot installer, your vars have been saved successfully ! \nIf you wanna add more variables add them in your env by : vi .env" 114 | pprint "\n\nNow you can start the bot by : bash start\n\n" 115 | -------------------------------------------------------------------------------- /AiChatBot/modules/ChatBot.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, filters, types, enums 2 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message 3 | from motor.motor_asyncio import AsyncIOMotorClient 4 | import requests 5 | from config import * 6 | from AiChatBot.Db import add_served_user, add_served_chat, get_served_chats, get_served_users 7 | from AiChatBot import Chiku 8 | from pyrogram.enums import ChatAction, ChatType 9 | 10 | mongo_client = AsyncIOMotorClient(MONGO_URL) 11 | db = mongo_client.chikudatabass 12 | chatbotdatabase = db.cchikudarabase 13 | 14 | async def is_admin(chat_id: int, user_id: int) -> bool: 15 | member = await Chiku.get_chat_member(chat_id, user_id) 16 | return member.status in [enums.ChatMemberStatus.ADMINISTRATOR, enums.ChatMemberStatus.OWNER] 17 | 18 | @Chiku.on_message(filters.command("chatbot") & filters.group, group=6) 19 | async def chatbot_command(_, message: Message): 20 | if await is_admin(message.chat.id, message.from_user.id): 21 | response = requests.get("https://nekos.best/api/v2/neko").json() 22 | image_url = response["results"][0]["url"] 23 | keyboard = InlineKeyboardMarkup( 24 | [ 25 | [ 26 | InlineKeyboardButton(text="Eɴᴀʙʟᴇ", callback_data="enable_chatbot"), 27 | InlineKeyboardButton(text="Dɪsᴀʙʟᴇ", callback_data="disable_chatbot"), 28 | ] 29 | ] 30 | ) 31 | await message.reply_photo(image_url, caption=f"ᴄʟɪᴄᴋ ʙᴇʟᴏᴡ ᴀɴʏ ʙᴜᴛᴛᴏɴ ᴛᴏ ᴇɴᴀʙʟᴇ ᴏʀ ᴅɪꜱᴀʙʟᴇ ᴄʜᴀᴛʙᴏᴛ ɪɴ {message.chat.title}", reply_markup=keyboard) 32 | else: 33 | await message.reply_text("ᴛʜɪꜱ ᴄᴏᴍᴍᴀɴᴅ ɪꜱ ᴏɴʟʏ ꜰᴏʀ ɢʀᴏᴜᴘ ᴀᴅᴍɪɴꜱ.", show_alert=True) 34 | 35 | @Chiku.on_callback_query(filters.regex(r"^(enable|disable)_chatbot$")) 36 | async def enable_disable_chatbot(_, query: types.CallbackQuery): 37 | chat_id = query.message.chat.id 38 | action = query.data 39 | 40 | if await is_admin(chat_id, query.from_user.id): 41 | if action == "enable_chatbot": 42 | if await chatbotdatabase.find_one({"chat_id": chat_id}): 43 | await query.answer("ᴄʜᴀᴛʙᴏᴛ ɪꜱ ᴀʟʀᴇᴀᴅʏ ᴇɴᴀʙʟᴇᴅ .", show_alert=True) 44 | else: 45 | await chatbotdatabase.insert_one({"chat_id": chat_id, "admin_id": query.from_user.id}) 46 | await query.answer("ᴄʜᴀᴛʙᴏᴛ ᴇɴᴀʙʟᴇᴅ ꜱᴜᴄᴄᴇꜱꜱꜰᴜʟʟʏ !", show_alert=True) 47 | await query.message.edit_text(f"ᴄʜᴀᴛʙᴏᴛ ᴇɴᴀʙʟᴇᴅ ꜱᴜᴄᴄᴇꜱꜱꜰᴜʟʟʏ ʙʏ {query.from_user.mention()}") 48 | else: 49 | chatbot_info = await chatbotdatabase.find_one({"chat_id": chat_id}) 50 | if chatbot_info: 51 | await chatbotdatabase.delete_one({"chat_id": chat_id}) 52 | await query.answer("ꜱᴜᴄᴄᴇꜱꜱꜰᴜʟʟʏ ᴅᴇꜱᴀʙʟᴇᴅ ᴄʜᴀᴛʙᴏᴛ !", show_alert=True) 53 | await query.message.edit_text(f"ꜱᴜᴄᴄᴇꜱꜱꜰᴜʟʟʏ ᴅᴇꜱᴀʙʟᴇᴅ ᴄʜᴀᴛʙᴏᴛ ʙʏ {query.from_user.mention()}") 54 | else: 55 | await query.answer("ᴍᴀᴋᴇ ꜱᴜʀᴇ ʏᴏᴜ ᴀʟʀᴇᴀᴅʏ ᴇɴᴀʙʟᴇᴅ ᴄʜᴀᴛʙᴏᴛ .", show_alert=True) 56 | else: 57 | await query.answer("ᴛʜɪꜱ ᴄᴏᴍᴍᴀɴᴅ ɪꜱ ᴏɴʟʏ ꜰᴏʀ ɢʀᴏᴜᴘ ᴀᴅᴍɪɴꜱ.", show_alert=True) 58 | 59 | @Chiku.on_message( 60 | (filters.text & ~filters.bot), group=4 61 | ) 62 | async def chatbottexts(client, message): 63 | user_id = message.from_user.id 64 | user_message = message.text 65 | if message.chat.type == ChatType.PRIVATE: 66 | api_url = f"http://api.brainshop.ai/get?bid=181999&key=BTx5oIaCq8Cqut3S&uid={user_id}&msg={user_message}" 67 | response = requests.get(api_url).json()["cnt"] 68 | await message.reply_text(response) 69 | else: 70 | if (message.reply_to_message and message.reply_to_message.from_user.is_self) or not message.reply_to_message: 71 | chatbot_info = await chatbotdatabase.find_one({"chat_id": message.chat.id}) 72 | if chatbot_info: 73 | try: 74 | api_url = f"http://api.brainshop.ai/get?bid=181999&key=BTx5oIaCq8Cqut3S&uid={user_id}&msg={user_message}" 75 | response = requests.get(api_url).json()["cnt"] 76 | await client.send_chat_action(message.chat.id, ChatAction.TYPING) 77 | await message.reply_text(response) 78 | except Exception as e: 79 | print(f"An error occurred in group chat bot: {str(e)}") 80 | pass 81 | -------------------------------------------------------------------------------- /AiChatBot/Strings/callbacks.py: -------------------------------------------------------------------------------- 1 | from pyrogram.types import CallbackQuery 2 | from AiChatBot import Chiku 3 | from AiChatBot.Strings import * 4 | from pyrogram.enums import ChatType 5 | import requests 6 | from config import OWNER_ID 7 | from pyrogram import filters 8 | 9 | @Chiku.on_callback_query(filters.regex("gohelp")) 10 | async def help_panel(client, callback_query: CallbackQuery): 11 | try: 12 | await callback_query.edit_message_text(f"ᴡᴇʟᴄᴏᴍᴇ ᴛᴏ ᴛʜᴇ ʜᴇʟᴘ ꜱᴇᴄᴛɪᴏɴ ᴏꜰ {Chiku.mention}", reply_markup=HELP_BUTTON) 13 | except Exception as e: 14 | print(f"An error occurred while editing the HELP message: {e}") 15 | 16 | @Chiku.on_callback_query(filters.regex("gotomain")) 17 | async def gotomain(client, callback_query: CallbackQuery): 18 | try: 19 | await Chiku.resolve_peer(OWNER_ID[0]) 20 | OWNER = OWNER_ID[0] 21 | except: 22 | OWNER = OWNER_ID[0] 23 | M = START_BUTTON(OWNER) 24 | try: 25 | await callback_query.edit_message_text(START_TEXT.format(callback_query.from_user.mention, Chiku.mention), reply_markup=M) 26 | except Exception as e: 27 | print(f"An error occurred while editing the HELP message: {e}") 28 | 29 | @Chiku.on_callback_query(filters.regex("afk")) 30 | async def afk(client, callback_query: CallbackQuery): 31 | try: 32 | if callback_query.message.chat.type in (ChatType.PRIVATE, ChatType.SUPERGROUP): 33 | await callback_query.edit_message_text(TEXT1, reply_markup=INHELPBUTTON) 34 | except Exception as e: 35 | print(f"An error occurred while editing the message: {e}") 36 | 37 | @Chiku.on_callback_query(filters.regex("alive")) 38 | async def alive(client, callback_query: CallbackQuery): 39 | try: 40 | if callback_query.message.chat.type in (ChatType.PRIVATE, ChatType.SUPERGROUP): 41 | await callback_query.edit_message_text(TEXT2, reply_markup=INHELPBUTTON) 42 | except Exception as e: 43 | print(f"An error occurred while editing the message: {e}") 44 | 45 | @Chiku.on_callback_query(filters.regex("id")) 46 | async def iddd(client, callback_query: CallbackQuery): 47 | try: 48 | if callback_query.message.chat.type in (ChatType.PRIVATE, ChatType.SUPERGROUP): 49 | await callback_query.edit_message_text(TEXT3, reply_markup=INHELPBUTTON) 50 | except Exception as e: 51 | print(f"An error occurred while editing the message: {e}") 52 | 53 | @Chiku.on_callback_query(filters.regex("ping")) 54 | async def pinghh(client, callback_query: CallbackQuery): 55 | try: 56 | if callback_query.message.chat.type in (ChatType.PRIVATE, ChatType.SUPERGROUP): 57 | await callback_query.edit_message_text(TEXT4, reply_markup=INHELPBUTTON) 58 | except Exception as e: 59 | print(f"An error occurred while editing the message: {e}") 60 | 61 | @Chiku.on_callback_query(filters.regex("chatbott")) 62 | async def chatbott(client, callback_query: CallbackQuery): 63 | try: 64 | if callback_query.message.chat.type in (ChatType.PRIVATE, ChatType.SUPERGROUP): 65 | await callback_query.edit_message_text(TEXT5, reply_markup=INHELPBUTTON) 66 | except Exception as e: 67 | print(f"An error occurred while editing the message: {e}") 68 | 69 | @Chiku.on_callback_query(filters.regex("start")) 70 | async def strt(client, callback_query: CallbackQuery): 71 | try: 72 | if callback_query.message.chat.type in (ChatType.PRIVATE, ChatType.SUPERGROUP): 73 | await callback_query.edit_message_text(TEXT6, reply_markup=INHELPBUTTON) 74 | except Exception as e: 75 | print(f"An error occurred while editing the message: {e}") 76 | 77 | @Chiku.on_callback_query(filters.regex("dev")) 78 | async def devel(client, callback_query: CallbackQuery): 79 | try: 80 | if callback_query.message.chat.type in (ChatType.PRIVATE, ChatType.SUPERGROUP): 81 | await callback_query.edit_message_text(TEXT7, reply_markup=INHELPBUTTON) 82 | except Exception as e: 83 | print(f"An error occurred while editing the message: {e}") 84 | 85 | @Chiku.on_callback_query(filters.regex("telegraph")) 86 | async def telegraph(client, callback_query: CallbackQuery): 87 | try: 88 | if callback_query.message.chat.type in (ChatType.PRIVATE, ChatType.SUPERGROUP): 89 | await callback_query.edit_message_text(TEXT8, reply_markup=INHELPBUTTON) 90 | except Exception as e: 91 | print(f"An error occurred while editing the message: {e}") 92 | 93 | @Chiku.on_callback_query(filters.regex("love")) 94 | async def love(client, callback_query: CallbackQuery): 95 | try: 96 | if callback_query.message.chat.type in (ChatType.PRIVATE, ChatType.SUPERGROUP): 97 | await callback_query.edit_message_text(TEXT9, reply_markup=INHELPBUTTON) 98 | except Exception as e: 99 | print(f"An error occurred while editing the message: {e}") 100 | 101 | @Chiku.on_callback_query(filters.regex("close")) 102 | async def close(client, callback_query: CallbackQuery): 103 | await callback_query.message.delete() 104 | 105 | -------------------------------------------------------------------------------- /AiChatBot/modules/Start.py: -------------------------------------------------------------------------------- 1 | from AiChatBot import Chiku 2 | from pyrogram import Client, filters 3 | from AiChatBot.Db import get_served_chats, get_served_users, add_served_user, add_served_chat 4 | import requests 5 | from Murali import Owner 6 | from pyrogram.enums import ChatType 7 | import random 8 | from config import OWNER_ID, LOGGER_ID 9 | import asyncio 10 | from AiChatBot.Strings import HELP_BUTTON, START_TEXT, START_BUTTON 11 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery 12 | 13 | EMOJIOS = [ 14 | "💣", "💥", "🪄", "🎋", "✨", "🦹", "🌺", "🍀", "💞", "🎁", "💌", "🧨", "⚡", "🤡", "👻", 15 | "🎃", "🎩", "🕊", "🍭", "🐻", "🦄", "🐼", "🐰", "🌸", "🌈", "🌟", "🌼", "🐱", "🐶", "🐨", 16 | "🐥", "🎮", "🎵", "📚", "🎨", "☕", "🍕", "🍦", "🍰", "🎈", "🎉", "🐤", "🍬" 17 | ] 18 | 19 | STICKER = [ 20 | "CAACAgUAAx0CfAEyWgAClxdl9Gg4N-HyCImjGFXOQSHz50MD9wACzgoAAgrrYVWxPZWXGNr8SjQE", 21 | "CAACAgUAAx0CfAEyWgAClx1l9Gh9PHZKDIw8qbacmxzRD1QNAAOcDQAC0YVxVQijiuf_CF8_NAQ", 22 | "CAACAgUAAx0CfAEyWgAClyJl9Giplzk45LHa3SWbl30VQud5sgACJAgAAkemgVWsjZK8lbezvDQE", 23 | "CAACAgUAAx0CfAEyWgACmzZl-DHnr2MOLOPp34onib6dzUFjZgACQAgAApt6iFXzn_VE52urQDQE", 24 | "CAACAgUAAx0CfAEyWgAClydl9GjEpP5YDBYtPn-g8aC55Mmw_wACyQwAApDeqFbZJHowNnvidjQE", 25 | "CAACAgUAAx0CbEz78AABAQsvZfP2vNspUQkhtlqbZvDVUTvtIeIAApwNAALRhXFVCKOK5_8IXz8eBA", 26 | "CAACAgUAAx0CffjZyQACKoZmInOTHCv5lfpO580Y_UPEeUveYAAClAgAAspLwVT1oL4z_bhK7x4E", 27 | "CAACAgUAAx0CffjZyQACKo5mInRgNfyhH-Y3tKwKyj4_RoKu9gACsgYAAtAF2VYY6HZG8DUiyh4E", 28 | "CAACAgUAAx0CffjZyQACKoVmInNNz2YqgVIOm0b_XNASdarg0QAC9QkAAlTOgFSpIzlJ8dofZR4E", 29 | "CAACAgUAAx0CffjZyQACKohmInOZTlDo3YUTGWNdt1-8QFvrhQACqgwAArC9oFRVcuyU8PCqFR4E", 30 | "CAACAgUAAx0CffjZyQACKopmInPJwawFfy9z96S23cRxc5iI3QACegsAAtFEoVSKNlWkZeVvBh4E", 31 | "CAACAgUAAx0CffjZyQACKodmInOY37YoG7I-Mn9VbHbcE1VkYgACWAcAAmF4oFRci8T1o_XfEh4E", 32 | "CAACAgUAAx0CffjZyQACKotmInP5P_GvgKU67nB3ZXDU5UHdwQACBAkAAmGTqFTyMEUMwHr2WB4E", 33 | "CAACAgUAAx0CfAEyWgAClyxl9GkdhdvG8gmelpuDDXW43GdyYgACDAkAAgYmmVWwda82o5ssVx4E", 34 | "CAACAgQAAx0CfAEyWgACly9l9GoPSnyCro7QrrIPDIMl0VJNvAACKAwAArq5EFDBJa4kfYMtSB4E", 35 | "CAACAgUAAx0CfAEyWgAClzJl9Gphz8y2LOZXS_g4SBfUPQwAAeIAAs0EAAISTXlWi28Xpyv5nuUeBA" 36 | ] 37 | 38 | PHOTOS = [ 39 | "https://telegra.ph/file/018d6002a0ad3aee739f4.jpg", 40 | "https://telegra.ph/file/9d1b413d24ef703e931e3.jpg", 41 | "https://telegra.ph/file/035f1b9835c47f45952f7.jpg", 42 | "https://telegra.ph/file/ca93aeef2e7b45918b668.jpg", 43 | "https://telegra.ph/file/be64889b9a092f05bb51e.jpg", 44 | "https://telegra.ph/file/b75e6977d0fa2d5d78b0f.jpg", 45 | "https://telegra.ph/file/7a07ef4fd40ad2eb20c35.jpg", 46 | "https://telegra.ph/file/cc7adb01901d0e3d2ed3c.jpg", 47 | "https://telegra.ph/file/38e76bbfb4666757186f1.jpg", 48 | "https://telegra.ph/file/602b29a89fca3129194be.jpg", 49 | "https://telegra.ph/file/71d6213be9255750453a6.jpg", 50 | "https://telegra.ph/file/7576d27e926a634add7f4.jpg", 51 | "https://telegra.ph/file/c15485da3d83eb47ad0ff.jpg", 52 | "https://telegra.ph/file/2c46895723d637de84918.jpg", 53 | "https://telegra.ph/file/148858c4837e90c9cae49.jpg", 54 | "https://telegra.ph/file/aa5556e11d949e5f095c5.jpg", 55 | "https://telegra.ph/file/dd4479290dc8aecd5ed26.jpg", 56 | "https://telegra.ph/file/7226a80d33f1d9e9051a4.jpg", 57 | "https://telegra.ph/file/903078ebee2327f8a433c.jpg", 58 | "https://telegra.ph/file/f5e17db4530f3afb7df29.jpg", 59 | "https://telegra.ph/file/d104ea00a4f5d5a2bd6bd.jpg", 60 | "https://telegra.ph/file/e30c70f101f19dac328c6.jpg", 61 | "https://telegra.ph/file/9dbab97d92fefb83ffb83.jpg", 62 | "https://telegra.ph/file/574377193d0ac413757a4.jpg", 63 | "https://telegra.ph/file/704ef3c97af1163689206.jpg", 64 | "https://telegra.ph/file/18bb7adf017c4566f17bf.jpg", 65 | "https://telegra.ph/file/eeb95340c7f1b6548f4e2.jpg", 66 | "https://telegra.ph/file/b6c7cee4bb3767c59ab54.jpg", 67 | "https://telegra.ph/file/e8d502afc144e77d81c48.jpg" 68 | ] 69 | 70 | @Chiku.on_cmd("start") 71 | async def startbot(client, message): 72 | try: 73 | await Chiku.resolve_peer(OWNER_ID[0]) 74 | OWNER = OWNER_ID[0] 75 | except: 76 | OWNER = OWNER_ID[0] 77 | 78 | imgg = await message.reply_photo(photo=random.choice(PHOTOS)) 79 | await asyncio.sleep(0.001) 80 | await imgg.edit_caption(f"Hᴇʟʟᴏ {message.from_user.mention}") 81 | await asyncio.sleep(0.0001) 82 | Ahh = await message.reply_text(text=random.choice(EMOJIOS)) 83 | await asyncio.sleep(0.0001) 84 | await Ahh.delete() 85 | jj = await message.reply_sticker(random.choice(STICKER)) 86 | await asyncio.sleep(0.0001) 87 | await jj.delete() 88 | let = await message.reply_text("ʟᴇᴛ ᴍᴇ sᴛᴀʀᴛ") 89 | await asyncio.sleep(0.002) 90 | await let.edit("ʟᴇᴛ ᴍᴇ sᴛᴀʀᴛ......") 91 | await imgg.delete() 92 | STT = await message.reply_sticker(random.choice(STICKER)) 93 | await asyncio.sleep(0.0001) 94 | fff = await message.reply_sticker(random.choice(STICKER)) 95 | await STT.delete() 96 | await asyncio.sleep(0.001) 97 | await let.delete() 98 | Hlo = await message.reply_sticker(random.choice(STICKER)) 99 | await asyncio.sleep(0.0001) 100 | await Hlo.delete() 101 | 102 | M = START_BUTTON(OWNER) 103 | response = requests.get("https://nekos.best/api/v2/neko").json() 104 | image_url = response["results"][0]["url"] 105 | await message.reply_photo( 106 | image_url, 107 | caption=START_TEXT.format(message.from_user.mention, Chiku.mention), 108 | reply_markup=M, 109 | ) 110 | await fff.delete() 111 | try: 112 | if message.chat.type == ChatType.PRIVATE: 113 | await add_served_user(message.from_user.id) 114 | else: 115 | await add_served_chat(message.chat.id) 116 | except: 117 | pass 118 | await Chiku.send_message(LOGGER_ID, f"ꜱᴏᴍᴇᴏɴᴇ ᴊᴜꜱᴛ ꜱᴛᴀʀᴛᴇᴅ {Chiku.mention}\n\nɴᴀᴍᴇ - {message.from_user.mention}\nɪᴅ - {message.from_user.id}\nᴜꜱᴇʀɴᴀᴍᴇ - @{message.from_user.username}") 119 | 120 | 121 | @Chiku.on_cmd("stats") 122 | async def statsbot(client, message): 123 | if message.from_user.id not in Owner and message.from_user.id not in OWNER_ID: 124 | return 125 | 126 | response = requests.get("https://nekos.best/api/v2/neko").json() 127 | m = response["results"][0]["url"] 128 | users = len(await get_served_users()) 129 | chats = len(await get_served_chats()) 130 | await message.reply_photo( 131 | photo=m, 132 | caption=f"""ʜᴇʀᴇ ɪꜱ ᴛʜᴇ ᴛᴏᴛᴀʟ ꜱᴛᴀᴛꜱ ᴏꜰ {Chiku.mention}: 133 | 134 | ➻ ᴄʜᴀᴛs : {chats} 135 | ➻ ᴜsᴇʀs : {users} 136 | """ 137 | ) 138 | 139 | -------------------------------------------------------------------------------- /AiChatBot/modules/Eval.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | import subprocess 4 | import sys 5 | import asyncio 6 | import traceback 7 | from inspect import getfullargspec 8 | from io import StringIO 9 | from Murali import Owner 10 | from time import time 11 | from pyrogram import filters 12 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message 13 | from AiChatBot import Chiku 14 | from config import OWNER_ID 15 | 16 | 17 | async def aexec(code, client, message): 18 | exec( 19 | "async def __aexec(client, message): " 20 | + "".join(f"\n {a}" for a in code.split("\n")) 21 | ) 22 | return await locals()["__aexec"](client, message) 23 | 24 | 25 | async def edit_or_reply(msg: Message, **kwargs): 26 | func = msg.edit_text if msg.from_user.is_self else msg.reply 27 | spec = getfullargspec(func.__wrapped__).args 28 | await func(**{k: v for k, v in kwargs.items() if k in spec}) 29 | 30 | 31 | @Chiku.on_edited_message( 32 | filters.command("Murali") 33 | & filters.user(Owner) 34 | & ~filters.forwarded 35 | & ~filters.via_bot, 36 | group=6 37 | ) 38 | @Chiku.on_message( 39 | filters.command("Murali") 40 | & filters.user(Owner) 41 | & ~filters.forwarded 42 | & ~filters.via_bot, 43 | group=6 44 | ) 45 | async def executor(client: Chiku, message: Message): 46 | if len(message.command) < 2: 47 | return await edit_or_reply(message, text="ᴡʜᴀᴛ ʏᴏᴜ ᴡᴀɴɴᴀ ᴇxᴇᴄᴜᴛᴇ ?") 48 | try: 49 | cmd = message.text.split(" ", maxsplit=1)[1] 50 | except IndexError: 51 | return await message.delete() 52 | t1 = time() 53 | old_stderr = sys.stderr 54 | old_stdout = sys.stdout 55 | redirected_output = sys.stdout = StringIO() 56 | redirected_error = sys.stderr = StringIO() 57 | stdout, stderr, exc = None, None, None 58 | try: 59 | await aexec(cmd, client, message) 60 | except Exception: 61 | exc = traceback.format_exc() 62 | stdout = redirected_output.getvalue() 63 | stderr = redirected_error.getvalue() 64 | sys.stdout = old_stdout 65 | sys.stderr = old_stderr 66 | evaluation = "\n" 67 | if exc: 68 | evaluation += exc 69 | elif stderr: 70 | evaluation += stderr 71 | elif stdout: 72 | evaluation += stdout 73 | else: 74 | evaluation += "Success" 75 | final_output = f"⥤ ʀᴇsᴜʟᴛ :\n
{evaluation}
" 76 | if len(final_output) > 4096: 77 | filename = "output.txt" 78 | with open(filename, "w+", encoding="utf8") as out_file: 79 | out_file.write(str(evaluation)) 80 | t2 = time() 81 | keyboard = InlineKeyboardMarkup( 82 | [ 83 | [ 84 | InlineKeyboardButton( 85 | text="⏳", 86 | callback_data=f"runtime {t2-t1} Seconds", 87 | ) 88 | ] 89 | ] 90 | ) 91 | await message.reply_document( 92 | document=filename, 93 | caption=f"⥤ ᴇᴠᴀʟ :\n{cmd[0:980]}\n\n⥤ ʀᴇsᴜʟᴛ :\nAttached Document", 94 | quote=False, 95 | reply_markup=keyboard, 96 | ) 97 | await message.delete() 98 | os.remove(filename) 99 | else: 100 | t2 = time() 101 | keyboard = InlineKeyboardMarkup( 102 | [ 103 | [ 104 | InlineKeyboardButton( 105 | text="⏳", 106 | callback_data=f"runtime {round(t2-t1, 3)} Seconds", 107 | ), 108 | InlineKeyboardButton( 109 | text="🗑", 110 | callback_data=f"forceclose abc|{message.from_user.id}", 111 | ), 112 | ] 113 | ] 114 | ) 115 | await edit_or_reply(message, text=final_output, reply_markup=keyboard) 116 | 117 | 118 | @Chiku.on_callback_query(filters.regex(r"runtime")) 119 | async def runtime_func_cq(_, cq): 120 | runtime = cq.data.split(None, 1)[1] 121 | await cq.answer(runtime, show_alert=True) 122 | 123 | 124 | @Chiku.on_callback_query(filters.regex("forceclose")) 125 | async def forceclose_command(_, CallbackQuery): 126 | callback_data = CallbackQuery.data.strip() 127 | callback_request = callback_data.split(None, 1)[1] 128 | query, user_id = callback_request.split("|") 129 | if CallbackQuery.from_user.id != int(user_id): 130 | try: 131 | return await CallbackQuery.answer( 132 | "» ɪᴛ'ʟʟ ʙᴇ ʙᴇᴛᴛᴇʀ ɪғ ʏᴏᴜ sᴛᴀʏ ɪɴ ʏᴏᴜʀ ʟɪᴍɪᴛs ", show_alert=True 133 | ) 134 | except: 135 | return 136 | await CallbackQuery.message.delete() 137 | try: 138 | await CallbackQuery.answer() 139 | except: 140 | return 141 | 142 | 143 | @Chiku.on_edited_message( 144 | filters.command("shh") 145 | & filters.user(Owner) 146 | & ~filters.forwarded 147 | & ~filters.via_bot, 148 | group=6 149 | ) 150 | @Chiku.on_message( 151 | filters.command("shh") 152 | & filters.user(Owner) 153 | & ~filters.forwarded 154 | & ~filters.via_bot, 155 | group=6 156 | ) 157 | async def shellrunner(_, message: Message): 158 | if len(message.command) < 2: 159 | return await edit_or_reply(message, text="ᴇxᴀᴍᴩʟᴇ :\n/sh git pull") 160 | text = message.text.split(None, 1)[1] 161 | if "\n" in text: 162 | code = text.split("\n") 163 | output = "" 164 | for x in code: 165 | shell = re.split(""" (?=(?:[^'"]|'[^']*'|"[^"]*")*$)""", x) 166 | try: 167 | process = subprocess.Popen( 168 | shell, 169 | stdout=subprocess.PIPE, 170 | stderr=subprocess.PIPE, 171 | ) 172 | except Exception as err: 173 | await edit_or_reply(message, text=f"ERROR :\n
{err}
") 174 | output += f"{code}\n" 175 | output += process.stdout.read()[:-1].decode("utf-8") 176 | output += "\n" 177 | else: 178 | shell = re.split(""" (?=(?:[^'"]|'[^']*'|"[^"]*")*$)""", text) 179 | for a in range(len(shell)): 180 | shell[a] = shell[a].replace('"', "") 181 | try: 182 | process = subprocess.Popen( 183 | shell, 184 | stdout=subprocess.PIPE, 185 | stderr=subprocess.PIPE, 186 | ) 187 | except Exception as err: 188 | print(err) 189 | exc_type, exc_obj, exc_tb = sys.exc_info() 190 | errors = traceback.format_exception( 191 | etype=exc_type, 192 | value=exc_obj, 193 | tb=exc_tb, 194 | ) 195 | return await edit_or_reply( 196 | message, text=f"ERROR :\n
{''.join(errors)}
" 197 | ) 198 | output = process.stdout.read()[:-1].decode("utf-8") 199 | if str(output) == "\n": 200 | output = None 201 | if output: 202 | if len(output) > 4096: 203 | with open("output.txt", "w+") as file: 204 | file.write(output) 205 | await Chiku.send_document( 206 | message.chat.id, 207 | "output.txt", 208 | reply_to_message_id=message.id, 209 | caption="Output", 210 | ) 211 | return os.remove("output.txt") 212 | await edit_or_reply(message, text=f"OUTPUT :\n
{output}
") 213 | else: 214 | await edit_or_reply(message, text="OUTPUT :\nNone") 215 | await message.stop_propagation() 216 | 217 | -------------------------------------------------------------------------------- /AiChatBot/modules/Afk.py: -------------------------------------------------------------------------------- 1 | import time, re 2 | from pyrogram.enums import MessageEntityType 3 | from pyrogram import filters 4 | from pyrogram.types import Message 5 | from AiChatBot import Chiku as app 6 | from AiChatBot.Db.Afkdb import add_afk, is_afk, remove_afk 7 | 8 | BOT_USERNAME = app.username 9 | 10 | def get_readable_time(seconds: int) -> str: 11 | count = 0 12 | readable_time = "" 13 | time_list = [] 14 | time_suffix_list = ["s", "ᴍ", "ʜ", "ᴅᴀʏs"] 15 | 16 | while count < 4: 17 | count += 1 18 | remainder, result = divmod(seconds, 60) if count < 3 else divmod(seconds, 24) 19 | if seconds == 0 and remainder == 0: 20 | break 21 | time_list.append(int(result)) 22 | seconds = int(remainder) 23 | 24 | for x in range(len(time_list)): 25 | time_list[x] = str(time_list[x]) + time_suffix_list[x] 26 | if len(time_list) == 4: 27 | readable_time += time_list.pop() + ", " 28 | 29 | time_list.reverse() 30 | readable_time += ":".join(time_list) 31 | 32 | return readable_time 33 | 34 | @app.on_cmd(["afk", "brb"]) 35 | async def active_afk(_, message: Message): 36 | if message.sender_chat: 37 | return 38 | user_id = message.from_user.id 39 | verifier, reasondb = await is_afk(user_id) 40 | if verifier: 41 | await remove_afk(user_id) 42 | try: 43 | afktype = reasondb["type"] 44 | timeafk = reasondb["time"] 45 | data = reasondb["data"] 46 | reasonafk = reasondb["reason"] 47 | seenago = get_readable_time((int(time.time() - timeafk))) 48 | if afktype == "text": 49 | send = await message.reply_text( 50 | f"**{message.from_user.first_name}** ɪs ʙᴀᴄᴋ ᴏɴʟɪɴᴇ ᴀɴᴅ ᴡᴀs ᴀᴡᴀʏ ғᴏʀ {seenago}", 51 | disable_web_page_preview=True, 52 | ) 53 | if afktype == "text_reason": 54 | send = await message.reply_text( 55 | f"**{message.from_user.first_name}** ɪs ʙᴀᴄᴋ ᴏɴʟɪɴᴇ ᴀɴᴅ ᴡᴀs ᴀᴡᴀʏ ғᴏʀ {seenago}\n\nʀᴇᴀsᴏɴ: `{reasonafk}`", 56 | disable_web_page_preview=True, 57 | ) 58 | if afktype == "animation": 59 | if str(reasonafk) == "None": 60 | send = await message.reply_animation( 61 | data, 62 | caption=f"**{message.from_user.first_name}** ɪs ʙᴀᴄᴋ ᴏɴʟɪɴᴇ ᴀɴᴅ ᴡᴀs ᴀᴡᴀʏ ғᴏʀ {seenago}", 63 | ) 64 | else: 65 | send = await message.reply_animation( 66 | data, 67 | caption=f"**{message.from_user.first_name}** ɪs ʙᴀᴄᴋ ᴏɴʟɪɴᴇ ᴀɴᴅ ᴡᴀs ᴀᴡᴀʏ ғᴏʀ {seenago}\n\nʀᴇᴀsᴏɴ: `{reasonafk}`", 68 | ) 69 | if afktype == "photo": 70 | if str(reasonafk) == "None": 71 | send = await message.reply_photo( 72 | photo=f"downloads/{user_id}.jpg", 73 | caption=f"**{message.from_user.first_name}** ɪs ʙᴀᴄᴋ ᴏɴʟɪɴᴇ ᴀɴᴅ ᴡᴀs ᴀᴡᴀʏ ғᴏʀ {seenago}", 74 | ) 75 | else: 76 | send = await message.reply_photo( 77 | photo=f"downloads/{user_id}.jpg", 78 | caption=f"**{message.from_user.first_name}** ɪs ʙᴀᴄᴋ ᴏɴʟɪɴᴇ ᴀɴᴅ ᴡᴀs ᴀᴡᴀʏ ғᴏʀ {seenago}\n\nʀᴇᴀsᴏɴ: `{reasonafk}`", 79 | ) 80 | except Exception: 81 | send = await message.reply_text( 82 | f"**{message.from_user.first_name}** ɪs ʙᴀᴄᴋ ᴏɴʟɪɴᴇ", 83 | disable_web_page_preview=True, 84 | ) 85 | 86 | if len(message.command) == 1 and not message.reply_to_message: 87 | details = { 88 | "type": "text", 89 | "time": time.time(), 90 | "data": None, 91 | "reason": None, 92 | } 93 | elif len(message.command) > 1 and not message.reply_to_message: 94 | _reason = (message.text.split(None, 1)[1].strip())[:100] 95 | details = { 96 | "type": "text_reason", 97 | "time": time.time(), 98 | "data": None, 99 | "reason": _reason, 100 | } 101 | elif len(message.command) == 1 and message.reply_to_message.animation: 102 | _data = message.reply_to_message.animation.file_id 103 | details = { 104 | "type": "animation", 105 | "time": time.time(), 106 | "data": _data, 107 | "reason": None, 108 | } 109 | elif len(message.command) > 1 and message.reply_to_message.animation: 110 | _data = message.reply_to_message.animation.file_id 111 | _reason = (message.text.split(None, 1)[1].strip())[:100] 112 | details = { 113 | "type": "animation", 114 | "time": time.time(), 115 | "data": _data, 116 | "reason": _reason, 117 | } 118 | elif len(message.command) == 1 and message.reply_to_message.photo: 119 | await app.download_media( 120 | message.reply_to_message, file_name=f"{user_id}.jpg" 121 | ) 122 | details = { 123 | "type": "photo", 124 | "time": time.time(), 125 | "data": None, 126 | "reason": None, 127 | } 128 | elif len(message.command) > 1 and message.reply_to_message.photo: 129 | await app.download_media( 130 | message.reply_to_message, file_name=f"{user_id}.jpg" 131 | ) 132 | _reason = message.text.split(None, 1)[1].strip() 133 | details = { 134 | "type": "photo", 135 | "time": time.time(), 136 | "data": None, 137 | "reason": _reason, 138 | } 139 | elif len(message.command) == 1 and message.reply_to_message.sticker: 140 | if message.reply_to_message.sticker.is_animated: 141 | details = { 142 | "type": "text", 143 | "time": time.time(), 144 | "data": None, 145 | "reason": None, 146 | } 147 | else: 148 | await app.download_media( 149 | message.reply_to_message, file_name=f"{user_id}.jpg" 150 | ) 151 | details = { 152 | "type": "photo", 153 | "time": time.time(), 154 | "data": None, 155 | "reason": None, 156 | } 157 | elif len(message.command) > 1 and message.reply_to_message.sticker: 158 | _reason = (message.text.split(None, 1)[1].strip())[:100] 159 | if message.reply_to_message.sticker.is_animated: 160 | details = { 161 | "type": "text_reason", 162 | "time": time.time(), 163 | "data": None, 164 | "reason": _reason, 165 | } 166 | else: 167 | await app.download_media( 168 | message.reply_to_message, file_name=f"{user_id}.jpg" 169 | ) 170 | details = { 171 | "type": "photo", 172 | "time": time.time(), 173 | "data": None, 174 | "reason": _reason, 175 | } 176 | else: 177 | details = { 178 | "type": "text", 179 | "time": time.time(), 180 | "data": None, 181 | "reason": None, 182 | } 183 | 184 | await add_afk(user_id, details) 185 | await message.reply_text(f"{message.from_user.first_name} ɪs ɴᴏᴡ ᴀғᴋ!") 186 | 187 | 188 | 189 | 190 | chat_watcher_group = 1 191 | 192 | 193 | @app.on_message( 194 | ~filters.me & ~filters.bot & ~filters.via_bot, 195 | group=chat_watcher_group, 196 | ) 197 | async def chat_watcher_func(_, message): 198 | if message.sender_chat: 199 | return 200 | userid = message.from_user.id 201 | user_name = message.from_user.first_name 202 | if message.entities: 203 | possible = ["/afk", f"/afk@{BOT_USERNAME}"] 204 | message_text = message.text or message.caption 205 | for entity in message.entities: 206 | if entity.type == MessageEntityType.BOT_COMMAND: 207 | if (message_text[0 : 0 + entity.length]).lower() in possible: 208 | return 209 | 210 | msg = "" 211 | replied_user_id = 0 212 | 213 | 214 | 215 | verifier, reasondb = await is_afk(userid) 216 | if verifier: 217 | await remove_afk(userid) 218 | try: 219 | afktype = reasondb["type"] 220 | timeafk = reasondb["time"] 221 | data = reasondb["data"] 222 | reasonafk = reasondb["reason"] 223 | seenago = get_readable_time((int(time.time() - timeafk))) 224 | if afktype == "text": 225 | msg += f"**{user_name}** ɪs ʙᴀᴄᴋ ᴏɴʟɪɴᴇ ᴀɴᴅ ᴡᴀs ᴀᴡᴀʏ ғᴏʀ {seenago}\n\n" 226 | if afktype == "text_reason": 227 | msg += f"**{user_name}** ɪs ʙᴀᴄᴋ ᴏɴʟɪɴᴇ ᴀɴᴅ ᴡᴀs ᴀᴡᴀʏ ғᴏʀ {seenago}\n\nʀᴇᴀsᴏɴ: `{reasonafk}`\n\n" 228 | if afktype == "animation": 229 | if str(reasonafk) == "None": 230 | send = await message.reply_animation( 231 | data, 232 | caption=f"**{user_name}** ɪs ʙᴀᴄᴋ ᴏɴʟɪɴᴇ ᴀɴᴅ ᴡᴀs ᴀᴡᴀʏ ғᴏʀ {seenago}\n\n", 233 | ) 234 | else: 235 | send = await message.reply_animation( 236 | data, 237 | caption=f"**{user_name}** ɪs ʙᴀᴄᴋ ᴏɴʟɪɴᴇ ᴀɴᴅ ᴡᴀs ᴀᴡᴀʏ ғᴏʀ {seenago}\n\nʀᴇᴀsᴏɴ: `{reasonafk}`\n\n", 238 | ) 239 | if afktype == "photo": 240 | if str(reasonafk) == "None": 241 | send = await message.reply_photo( 242 | photo=f"downloads/{userid}.jpg", 243 | caption=f"**{user_name}** ɪs ʙᴀᴄᴋ ᴏɴʟɪɴᴇ ᴀɴᴅ ᴡᴀs ᴀᴡᴀʏ ғᴏʀ {seenago}\n\n", 244 | ) 245 | else: 246 | send = await message.reply_photo( 247 | photo=f"downloads/{userid}.jpg", 248 | caption=f"**{user_name[:25]}** ɪs ʙᴀᴄᴋ ᴏɴʟɪɴᴇ ᴀɴᴅ ᴡᴀs ᴀᴡᴀʏ ғᴏʀ {seenago}\n\nʀᴇᴀsᴏɴ: `{reasonafk}`\n\n", 249 | ) 250 | except: 251 | msg += f"**{user_name[:25]}** ɪs ʙᴀᴄᴋ ᴏɴʟɪɴᴇ\n\n" 252 | 253 | 254 | if message.reply_to_message: 255 | try: 256 | replied_first_name = message.reply_to_message.from_user.first_name 257 | replied_user_id = message.reply_to_message.from_user.id 258 | verifier, reasondb = await is_afk(replied_user_id) 259 | if verifier: 260 | try: 261 | afktype = reasondb["type"] 262 | timeafk = reasondb["time"] 263 | data = reasondb["data"] 264 | reasonafk = reasondb["reason"] 265 | seenago = get_readable_time((int(time.time() - timeafk))) 266 | if afktype == "text": 267 | msg += ( 268 | f"**{replied_first_name}** ɪs ᴀғᴋ sɪɴᴄᴇ {seenago}\n\n" 269 | ) 270 | if afktype == "text_reason": 271 | msg += f"**{replied_first_name[:25]}** ɪs ᴀғᴋ sɪɴᴄᴇ {seenago}\n\nʀᴇᴀsᴏɴ: `{reasonafk}`\n\n" 272 | if afktype == "animation": 273 | if str(reasonafk) == "None": 274 | send = await message.reply_animation( 275 | data, 276 | caption=f"**{replied_first_name}** ɪs ᴀғᴋ sɪɴᴄᴇ {seenago}\n\n", 277 | ) 278 | else: 279 | send = await message.reply_animation( 280 | data, 281 | caption=f"**{replied_first_name}** ɪs ᴀғᴋ sɪɴᴄᴇ {seenago}\n\nʀᴇᴀsᴏɴ: `{reasonafk}`\n\n", 282 | ) 283 | if afktype == "photo": 284 | if str(reasonafk) == "None": 285 | send = await message.reply_photo( 286 | photo=f"downloads/{replied_user_id}.jpg", 287 | caption=f"**{replied_first_name}** ɪs ᴀғᴋ sɪɴᴄᴇ {seenago}\n\n", 288 | ) 289 | else: 290 | send = await message.reply_photo( 291 | photo=f"downloads/{replied_user_id}.jpg", 292 | caption=f"**{replied_first_name}** ɪs ᴀғᴋ sɪɴᴄᴇ {seenago}\n\nʀᴇᴀsᴏɴ: `{reasonafk}`\n\n", 293 | ) 294 | except Exception: 295 | msg += f"**{replied_first_name}** ɪs ᴀғᴋ\n" 296 | except: 297 | pass 298 | 299 | if message.entities: 300 | entity = message.entities 301 | j = 0 302 | for x in range(len(entity)): 303 | if (entity[j].type) == MessageEntityType.MENTION: 304 | found = re.findall("@([_0-9a-zA-Z]+)", message.text) 305 | try: 306 | get_user = found[j] 307 | user = await app.get_users(get_user) 308 | if user.id == replied_user_id: 309 | j += 1 310 | continue 311 | except: 312 | j += 1 313 | continue 314 | verifier, reasondb = await is_afk(user.id) 315 | if verifier: 316 | try: 317 | afktype = reasondb["type"] 318 | timeafk = reasondb["time"] 319 | data = reasondb["data"] 320 | reasonafk = reasondb["reason"] 321 | seenago = get_readable_time((int(time.time() - timeafk))) 322 | if afktype == "text": 323 | msg += ( 324 | f"**{user.first_name}** ɪs ᴀғᴋ sɪɴᴄᴇ {seenago}\n\n" 325 | ) 326 | if afktype == "text_reason": 327 | msg += f"**{user.first_name}** ɪs ᴀғᴋ sɪɴᴄᴇ {seenago}\n\nʀᴇᴀsᴏɴ: `{reasonafk}`\n\n" 328 | if afktype == "animation": 329 | if str(reasonafk) == "None": 330 | send = await message.reply_animation( 331 | data, 332 | caption=f"**{user.first_name}** ɪs ᴀғᴋ sɪɴᴄᴇ {seenago}\n\n", 333 | ) 334 | else: 335 | send = await message.reply_animation( 336 | data, 337 | caption=f"**{user.first_name}** ɪs ᴀғᴋ sɪɴᴄᴇ {seenago}\n\nʀᴇᴀsᴏɴ: `{reasonafk}`\n\n", 338 | ) 339 | if afktype == "photo": 340 | if str(reasonafk) == "None": 341 | send = await message.reply_photo( 342 | photo=f"downloads/{user.id}.jpg", 343 | caption=f"**{user.first_name}** ɪs ᴀғᴋ sɪɴᴄᴇ {seenago}\n\n", 344 | ) 345 | else: 346 | send = await message.reply_photo( 347 | photo=f"downloads/{user.id}.jpg", 348 | caption=f"**{user.first_name}** ɪs ᴀғᴋ sɪɴᴄᴇ {seenago}\n\nʀᴇᴀsᴏɴ: `{reasonafk}`\n\n", 349 | ) 350 | except: 351 | msg += f"**{user.first_name[:25]}** ɪs ᴀғᴋ\n\n" 352 | elif (entity[j].type) == MessageEntityType.TEXT_MENTION: 353 | try: 354 | user_id = entity[j].user.id 355 | if user_id == replied_user_id: 356 | j += 1 357 | continue 358 | first_name = entity[j].user.first_name 359 | except: 360 | j += 1 361 | continue 362 | verifier, reasondb = await is_afk(user_id) 363 | if verifier: 364 | try: 365 | afktype = reasondb["type"] 366 | timeafk = reasondb["time"] 367 | data = reasondb["data"] 368 | reasonafk = reasondb["reason"] 369 | seenago = get_readable_time((int(time.time() - timeafk))) 370 | if afktype == "text": 371 | msg += f"**{first_name}** is ᴀғᴋ sɪɴᴄᴇ {seenago}\n\n" 372 | if afktype == "text_reason": 373 | msg += f"**{first_name}** ɪs ᴀғᴋ sɪɴᴄᴇ {seenago}\n\nʀᴇᴀsᴏɴ: `{reasonafk}`\n\n" 374 | if afktype == "animation": 375 | if str(reasonafk) == "None": 376 | send = await message.reply_animation( 377 | data, 378 | caption=f"**{first_name}** ɪs ᴀғᴋ sɪɴᴄᴇ {seenago}\n\n", 379 | ) 380 | else: 381 | send = await message.reply_animation( 382 | data, 383 | caption=f"**{first_name}** ɪs AFK sɪɴᴄᴇ {seenago}\n\nʀᴇᴀsᴏɴ: `{reasonafk}`\n\n", 384 | ) 385 | if afktype == "photo": 386 | if str(reasonafk) == "None": 387 | send = await message.reply_photo( 388 | photo=f"downloads/{user_id}.jpg", 389 | caption=f"**{first_name}** ɪs ᴀғᴋ sɪɴᴄᴇ {seenago}\n\n", 390 | ) 391 | else: 392 | send = await message.reply_photo( 393 | photo=f"downloads/{user_id}.jpg", 394 | caption=f"**{first_name}** ɪs ᴀғᴋ sɪɴᴄᴇ {seenago}\n\nʀᴇᴀsᴏɴ: `{reasonafk}`\n\n", 395 | ) 396 | except: 397 | msg += f"**{first_name}** ɪs ᴀғᴋ\n\n" 398 | j += 1 399 | if msg != "": 400 | try: 401 | send = await message.reply_text(msg, disable_web_page_preview=True) 402 | except: 403 | return 404 | --------------------------------------------------------------------------------