Fix when session is None

This commit is contained in:
yasirarism 2023-05-16 06:49:59 +00:00 committed by GitHub
parent 802c8f013e
commit 84089c3241
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View file

@ -80,7 +80,7 @@ python3 --version
``` ```
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 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. - Install requirements.txt, if using python 3.11, you need pass `--break-system-packages` parameter or use venv when install.<br/>
*Python < 3.10* *Python < 3.10*
``` ```
pip3 install -r requirements.txt pip3 install -r requirements.txt
@ -89,7 +89,7 @@ pip3 install -r requirements.txt
``` ```
pip3 install -r requirements.txt --break-system-packages pip3 install -r requirements.txt --break-system-packages
``` ```
- Setting your config.env or via environment. Make sure you fill all required env/ - Setting your config.env or via environment. Make sure you fill all required env.
- Run Bot - Run Bot
``` ```
bash start.sh bash start.sh

View file

@ -56,6 +56,8 @@ if USER_SESSION:
UBOT_ID = user.me.id UBOT_ID = user.me.id
UBOT_NAME = user.me.first_name UBOT_NAME = user.me.first_name
UBOT_USERNAME = user.me.username UBOT_USERNAME = user.me.username
else:
None, None, None = UBOT_ID, UBOT_NAME, UBOT_USERNAME
BOT_ID = app.me.id BOT_ID = app.me.id
BOT_NAME = app.me.first_name BOT_NAME = app.me.first_name
BOT_USERNAME = app.me.username BOT_USERNAME = app.me.username

View file

@ -67,7 +67,7 @@ async def start_bot():
else: else:
await app.send_message( await app.send_message(
i, i,
f"BOT STARTED with Pyrogram v{__version__}..\nBot: {BOT_NAME}\n\nwith Pyrogram v{__version__} (Layer {layer}) started on @{BOT_USERNAME}.\n\n<code>{bot_modules}</code>", f"BOT STARTED with Pyrogram v{__version__} as {BOT_NAME}\n\nwith Pyrogram v{__version__} (Layer {layer}) started on @{BOT_USERNAME}.\n\n<code>{bot_modules}</code>",
) )
except Exception as e: except Exception as e:
LOGGER.error(str(e)) LOGGER.error(str(e))