Skip to content

Commit

Permalink
Merge pull request #1659 from Dawn-India/master
Browse files Browse the repository at this point in the history
Minor refractor
  • Loading branch information
anasty17 authored Jan 13, 2024
2 parents 023c595 + 6a554cb commit a3a0929
Show file tree
Hide file tree
Showing 75 changed files with 1,293 additions and 1,158 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
custom: ['https://ko-fi.com/anasty17']
custom: [ 'https://ko-fi.com/anasty17' ]
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Used this Command with this link or file.
2. Before/after/while Upload ..
3. Check logs
Expand Down
275 changes: 197 additions & 78 deletions README.md

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions add_to_team_drive.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
from __future__ import print_function

import argparse
import glob
import googleapiclient.discovery
import json
import os
import pickle
import progress.bar
import glob
import sys
import argparse
import time
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
import os
import pickle
from google_auth_oauthlib.flow import InstalledAppFlow

stt = time.time()

Expand Down Expand Up @@ -65,7 +66,7 @@
drive = googleapiclient.discovery.build("drive", "v3", credentials=creds)
batch = drive.new_batch_http_request()

aa = glob.glob('%s/*.json' % acc_dir)
aa = glob.glob(f'{acc_dir}/*.json')
pbar = progress.bar.Bar("Readying accounts", max=len(aa))
for i in aa:
ce = json.loads(open(i, 'r').read())['client_email']
Expand Down
26 changes: 13 additions & 13 deletions bot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
from tzlocal import get_localzone
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from pyrogram import Client as tgClient, enums
from pymongo import MongoClient
from aria2p import API as ariaAPI, Client as ariaClient
from asyncio import Lock
from dotenv import load_dotenv, dotenv_values
from time import time
from subprocess import Popen, run
from os import remove, path as ospath, environ, getcwd
from aria2p import API as ariaAPI, Client as ariaClient
from qbittorrentapi import Client as qbClient
from socket import setdefaulttimeout
from uvloop import install
from logging import (
getLogger,
FileHandler,
Expand All @@ -22,6 +13,15 @@
warning as log_warning,
ERROR,
)
from os import remove, path as ospath, environ, getcwd
from pymongo import MongoClient
from pyrogram import Client as tgClient, enums
from qbittorrentapi import Client as qbClient
from socket import setdefaulttimeout
from subprocess import Popen, run
from time import time
from tzlocal import get_localzone
from uvloop import install

# from faulthandler import enable as faulthandler_enable
# faulthandler_enable()
Expand Down Expand Up @@ -249,9 +249,9 @@

LEECH_SPLIT_SIZE = environ.get("LEECH_SPLIT_SIZE", "")
if (
len(LEECH_SPLIT_SIZE) == 0
or int(LEECH_SPLIT_SIZE) > MAX_SPLIT_SIZE
or LEECH_SPLIT_SIZE == "2097152000"
len(LEECH_SPLIT_SIZE) == 0
or int(LEECH_SPLIT_SIZE) > MAX_SPLIT_SIZE
or LEECH_SPLIT_SIZE == "2097152000"
):
LEECH_SPLIT_SIZE = MAX_SPLIT_SIZE
else:
Expand Down
40 changes: 20 additions & 20 deletions bot/__main__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
from signal import signal, SIGINT
from aiofiles.os import path as aiopath, remove
from aiofiles import open as aiopen
from os import execl as osexecl
from time import time
from sys import executable
from pyrogram.handlers import MessageHandler
from pyrogram.filters import command
from aiofiles.os import path as aiopath, remove
from asyncio import gather, create_subprocess_exec
from os import execl as osexecl
from psutil import (
disk_usage,
cpu_percent,
Expand All @@ -16,19 +11,12 @@
net_io_counters,
boot_time,
)
from pyrogram.filters import command
from pyrogram.handlers import MessageHandler
from signal import signal, SIGINT
from sys import executable
from time import time

from .helper.mirror_utils.rclone_utils.serve import rclone_serve_booter
from .helper.ext_utils.jdownloader_booter import jdownloader
from .helper.ext_utils.telegraph_helper import telegraph
from .helper.ext_utils.files_utils import clean_all, exit_clean_up
from .helper.ext_utils.bot_utils import cmd_exec, sync_to_async, create_help_buttons
from .helper.ext_utils.status_utils import get_readable_file_size, get_readable_time
from .helper.ext_utils.db_handler import DbManger
from .helper.telegram_helper.bot_commands import BotCommands
from .helper.telegram_helper.message_utils import sendMessage, editMessage, sendFile
from .helper.telegram_helper.filters import CustomFilters
from .helper.telegram_helper.button_build import ButtonMaker
from .helper.listeners.aria2_listener import start_aria2_listener
from bot import (
bot,
botStartTime,
Expand All @@ -38,6 +26,18 @@
INCOMPLETE_TASK_NOTIFIER,
scheduler,
)
from .helper.ext_utils.bot_utils import cmd_exec, sync_to_async, create_help_buttons
from .helper.ext_utils.db_handler import DbManager
from .helper.ext_utils.files_utils import clean_all, exit_clean_up
from .helper.ext_utils.jdownloader_booter import jdownloader
from .helper.ext_utils.status_utils import get_readable_file_size, get_readable_time
from .helper.ext_utils.telegraph_helper import telegraph
from .helper.listeners.aria2_listener import start_aria2_listener
from .helper.mirror_utils.rclone_utils.serve import rclone_serve_booter
from .helper.telegram_helper.bot_commands import BotCommands
from .helper.telegram_helper.button_build import ButtonMaker
from .helper.telegram_helper.filters import CustomFilters
from .helper.telegram_helper.message_utils import sendMessage, editMessage, sendFile
from .modules import (
authorize,
cancel_task,
Expand Down Expand Up @@ -210,7 +210,7 @@ async def send_incompelete_task_message(cid, msg):
LOGGER.error(e)

if INCOMPLETE_TASK_NOTIFIER and DATABASE_URL:
if notifier_dict := await DbManger().get_incomplete_tasks():
if notifier_dict := await DbManager().get_incomplete_tasks():
for cid, data in notifier_dict.items():
msg = "Restarted Successfully!" if cid == chat_id else "Bot Restarted!"
for tag, links in data.items():
Expand Down
Loading

0 comments on commit a3a0929

Please sign in to comment.