diff --git a/README.md b/README.md index e61e7f30..862615ba 100644 --- a/README.md +++ b/README.md @@ -59,13 +59,43 @@ You can check demo this repo in this bot [MissKatyPyro](https://t.me/MissKatyRoB * `API_ID`: Get this value from [telegram.org](https://my.telegram.org/apps) * `API_HASH`: Get this value from [telegram.org](https://my.telegram.org/apps) * `DATABASE_URI`: [mongoDB](https://www.mongodb.com) URI. Get this value from [mongoDB](https://www.mongodb.com). For more help watch this [video](https://youtu.be/1G1XwEOnxxo) -* `DATABASE_NAME`: Name of the database in [mongoDB](https://www.mongodb.com). For more help watch this [video](https://youtu.be/1G1XwEOnxxo) * `LOG_CHANNEL` : A channel to log the activities of bot. Make sure bot is an admin in the channel. -* `USER_SESSION` : Session string for Userbot. -### Optional Variables -Check by yourself in config files. -## Deploy (Must Use Docker to Run This Bot, since i had make it built in all requirements) +### Optional Variables +* `USER_SESSION` : Session string for Userbot. +* `DATABASE_NAME`: Name of the database in MongoDB +* `COMMAND_HANDLER`: List of handler bot command splitted by space. Ex: `. !` > so bot will respond with `.cmd` or `!cmd` +* `SUDO`: User ID that have access to bot, split by space +* `OPENAI_API`: Get it from OpenAI Web +* `CURRENCY_API`: Get API Key from https://app.exchangerate-api.com/sign-up + +## Deploy (Recommended using Docker/Docker Compose) + +#### Build And Run Using Legacy Method +- Make sure minimum python version is 3.8 to prevent some errors. Check it with this command: +``` +python3 --version +``` +- Install all dependency that needed bot to run. *(need root access, you can skip this if your server didn't have root access but some plugins will not work)* +``` +apt update -y & apt install libjpeg-dev zlib1g-dev libwebp-dev python3-pip python3-lxml git wget curl ffmpeg locales tzdata neofetch mediainfo speedtest-cli -y +``` +- Install requirements.txt, if using python 3.11, you need pass `--break-system-packages` parameter. +*Python < 3.10* +``` +pip3 install -r requirements.txt +``` +*Python 3.11* +``` +pip3 install -r requirements.txt --break-system-packages +``` +- Setting your config.env or via environment. Make sure you fill all required env/ +- Run Bot +``` +bash start.sh +``` + +#### Build And Run Using Docker - Start Docker daemon (Skip if already running): ``` diff --git a/misskaty/__init__.py b/misskaty/__init__.py index 1542b41f..e11b553e 100644 --- a/misskaty/__init__.py +++ b/misskaty/__init__.py @@ -51,10 +51,11 @@ jobstores = {"default": MongoDBJobStore(client=pymonclient, database="MissKatyDB scheduler = AsyncIOScheduler(jobstores=jobstores, timezone=TZ) app.start() -user.start() +if USER_SESSION: + user.start() + UBOT_ID = user.me.id + UBOT_NAME = user.me.first_name + UBOT_USERNAME = user.me.username BOT_ID = app.me.id BOT_NAME = app.me.first_name BOT_USERNAME = app.me.username -UBOT_ID = user.me.id -UBOT_NAME = user.me.first_name -UBOT_USERNAME = user.me.username diff --git a/misskaty/__main__.py b/misskaty/__main__.py index edcbf3ee..f47e422b 100644 --- a/misskaty/__main__.py +++ b/misskaty/__main__.py @@ -24,7 +24,7 @@ from misskaty import ( scheduler ) from misskaty.plugins import ALL_MODULES -from misskaty.vars import SUDO +from misskaty.vars import SUDO, USER_SESSION from utils import auto_clean LOGGER = getLogger(__name__) @@ -59,10 +59,16 @@ async def start_bot(): try: LOGGER.info("[INFO]: SENDING ONLINE STATUS") for i in SUDO: - await app.send_message( - i, - f"USERBOT AND BOT STARTED with Pyrogram v{__version__}..\nUserBot: {UBOT_NAME}\nBot: {BOT_NAME}\n\nwith Pyrogram v{__version__} (Layer {layer}) started on @{BOT_USERNAME}.\n\n{bot_modules}", - ) + if USER_SESSION: + await app.send_message( + i, + f"USERBOT AND BOT STARTED with Pyrogram v{__version__}..\nUserBot: {UBOT_NAME}\nBot: {BOT_NAME}\n\nwith Pyrogram v{__version__} (Layer {layer}) started on @{BOT_USERNAME}.\n\n{bot_modules}", + ) + else: + await app.send_message( + i, + f"BOT STARTED with Pyrogram v{__version__}..\nBot: {BOT_NAME}\n\nwith Pyrogram v{__version__} (Layer {layer}) started on @{BOT_USERNAME}.\n\n{bot_modules}", + ) except Exception as e: LOGGER.error(str(e)) scheduler.start() diff --git a/misskaty/plugins/dev.py b/misskaty/plugins/dev.py index e8c5258b..5b170ec4 100644 --- a/misskaty/plugins/dev.py +++ b/misskaty/plugins/dev.py @@ -22,7 +22,7 @@ from psutil import virtual_memory from pyrogram import enums, filters, Client, __version__ as pyrover from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message from pyrogram.raw.types import UpdateBotStopped -from pykeyboard import InlineKeyboard +from pykeyboard import InlineKeyboard, InlineButton from misskaty import app, user, botStartTime, misskaty_version, BOT_NAME from misskaty.helper.http import http diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..f3c64338 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,30 @@ +emoji +git+https://github.com/yasirarism/pyrofork +tgcrypto +pymongo +python-dotenv +motor[srv]>=3.1.2 +requests +bs4 +aiohttp +chevron +gTTS +regex +apscheduler +pytz +pykeyboard +pySmartDL +psutil +python-dateutil +telegraph +hachoir +Pillow>=9.5.0 +httpx[http2] +git+https://github.com/yasirarism/vcsi +git+https://github.com/yasirarism/iytdl +deep-translator +telethon +pyrate_limiter +cachetools +cfscrape +openai \ No newline at end of file