Skip to content

Commit

Permalink
Auto-format code [skip actions]
Browse files Browse the repository at this point in the history
  • Loading branch information
5hojib committed Jan 4, 2025
1 parent f8ee686 commit f3e8174
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
4 changes: 3 additions & 1 deletion bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
)
from socket import setdefaulttimeout
from time import time
from pytz import timezone

from apscheduler.schedulers.asyncio import AsyncIOScheduler
from aria2p import API as ariaAPI # noqa: N811
from aria2p import Client as ariaClient
from pytz import timezone
from qbittorrentapi import Client as QbClient
from tzlocal import get_localzone
from uvloop import install
Expand All @@ -43,6 +44,7 @@
bot_loop = new_event_loop()
set_event_loop(bot_loop)


class CustomFormatter(Formatter):
def formatTime( # noqa: N802
self,
Expand Down
12 changes: 9 additions & 3 deletions bot/helper/listeners/task_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ async def on_download_complete(self):
if self.metadata:
up_path = await self.proceed_metadata(
up_path,
gid
gid,
)
if self.is_cancelled:
return
Expand Down Expand Up @@ -367,7 +367,10 @@ async def on_upload_complete(
for index, (link, name) in enumerate(files.items(), start=1):
fmsg += f"{index}. <a href='{link}'>{name}</a>\n"
if len(fmsg.encode() + msg.encode()) > 4000:
await send_message(self.user_id, f"{msg}<blockquote expandable>{fmsg}</blockquote>")
await send_message(
self.user_id,
f"{msg}<blockquote expandable>{fmsg}</blockquote>",
)
if Config.LOG_CHAT_ID:
await send_message(
Config.LOG_CHAT_ID,
Expand All @@ -376,7 +379,10 @@ async def on_upload_complete(
await sleep(1)
fmsg = ""
if fmsg != "":
await send_message(self.user_id, f"{msg}<blockquote expandable>{fmsg}</blockquote>")
await send_message(
self.user_id,
f"{msg}<blockquote expandable>{fmsg}</blockquote>",
)
if Config.LOG_CHAT_ID:
await send_message(
Config.LOG_CHAT_ID,
Expand Down
8 changes: 4 additions & 4 deletions bot/modules/services.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
from time import time
from uuid import uuid4

from bot.helper.ext_utils.bot_utils import new_task
from bot.core.config_manager import Config
from bot.helper.ext_utils.bot_utils import new_task
from bot.helper.ext_utils.status_utils import get_readable_time
from bot.helper.telegram_helper.bot_commands import BotCommands
from bot.helper.telegram_helper.button_build import ButtonMaker
from bot.helper.telegram_helper.filters import CustomFilters
from bot.helper.telegram_helper.message_utils import (
edit_message,
send_file,
send_message,
)
from bot.helper.ext_utils.status_utils import get_readable_time


@new_task
Expand Down Expand Up @@ -50,7 +49,7 @@ async def start(client, message):
user_data[userid].update(data)
await database.update_user_tdata(userid, token, token_time)
msg = "Your token has been successfully generated!\n\n"
msg += f'It will be valid for {get_readable_time(int(Config.TOKEN_TIMEOUT), True)}'
msg += f"It will be valid for {get_readable_time(int(Config.TOKEN_TIMEOUT), True)}"
return await send_message(message, msg)
elif await CustomFilters.authorized(client, message):
help_command = f"/{BotCommands.HelpCommand}"
Expand All @@ -61,6 +60,7 @@ async def start(client, message):
await database.update_pm_users(message.from_user.id)
return None


@new_task
async def ping(_, message):
start_time = int(round(time() * 1000))
Expand Down
7 changes: 3 additions & 4 deletions update.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
LogRecord,
StreamHandler,
basicConfig,
error,
getLogger,
info,
)
from logging import (
error as log_error,
Expand All @@ -20,10 +18,10 @@
from os import path, remove
from subprocess import run as srun
from sys import exit
from pytz import timezone
from tzlocal import get_localzone

from pymongo.mongo_client import MongoClient
from pymongo.server_api import ServerApi
from pytz import timezone

getLogger("pymongo").setLevel(ERROR)

Expand All @@ -34,6 +32,7 @@
if path.exists("rlog.txt"):
remove("rlog.txt")


class CustomFormatter(Formatter):
def formatTime( # noqa: N802
self,
Expand Down

0 comments on commit f3e8174

Please sign in to comment.