Skip to content

Commit

Permalink
Update:
Browse files Browse the repository at this point in the history
- Identify deployed branch.
  • Loading branch information
Nubuki-all committed Apr 7, 2024
1 parent 49d7761 commit 498a081
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
8 changes: 7 additions & 1 deletion bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
from telethon.sessions import StringSession
from telethon.utils import pack_bot_file_id

from .config import conf
from .config import conf, _bot

_bot.repo_branch = subprocess.check_output(["git rev-parse --abbrev-ref HEAD"], shell=True).decode().strip() if os.path.exists(".git") else None

batch_lock = asyncio.Lock()
bot_id = conf.BOT_TOKEN.split(":", 1)[0]
Expand Down Expand Up @@ -108,6 +110,10 @@
logging.getLogger("apscheduler.executors.default").setLevel(logging.WARNING)
logging.getLogger("FastTelethon").setLevel(logging.INFO)
# logging.getLogger("telethon.messagebox").setLevel(logging.NOTSET + 1)
no_verbose = ["telethon.client.updates", "telethon.client.users", "pyrogram.session.session", "pyrogram.connection.connection"]
if _bot.repo_branch == "stable":
for item in no_verbose:
logging.getLogger(item).setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.INFO)
LOGS = logging.getLogger(__name__)

Expand Down
1 change: 1 addition & 0 deletions bot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def __init__(self):
self.only_owner_pm = False
self.pause_status = 0
self.paused = False
self.repo_branch = None
self.sas = False
self.sqs = False
self.started = False
Expand Down
4 changes: 3 additions & 1 deletion bot/workers/handlers/stuff.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import psutil

from bot import Button, botStartTime, dt, subprocess, version_file
from bot.config import conf
from bot.config import _bot, conf
from bot.fun.emojis import enmoji
from bot.utils.bot_utils import add_temp_user, get_readable_file_size, rm_temp_user
from bot.utils.bot_utils import time_formatter as tf
Expand Down Expand Up @@ -42,6 +42,7 @@ async def status(event, args, client):
Requires no arguments."""
if not user_is_allowed(event.sender_id):
return await event.delete()
branch = _bot.repo_branch or "❓"
last_commit = "UNAVAILABLE!"
if os.path.exists(".git"):
try:
Expand Down Expand Up @@ -73,6 +74,7 @@ async def status(event, args, client):
disk = psutil.disk_usage("/").percent
await event.reply(
f"**Version:** `{vercheck}`\n"
f"**Branch:** `{branch}`\n"
f"**Commit Date:** `{last_commit}`\n\n"
f"**Bot Uptime:** `{currentTime}`\n"
f"**System Uptime:** `{ostime}`\n\n"
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.2.0-beta.0.6.24 (beta)
v2.2.0-beta.0.6.25

0 comments on commit 498a081

Please sign in to comment.