Skip to content

Commit

Permalink
minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
vikramisdev committed Aug 16, 2024
1 parent e2a095f commit 3ada295
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
12 changes: 8 additions & 4 deletions main/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,20 @@


class Config:
"""This class generates the configs """
pass


def isLocalHost():
"""Check if it is localhost"""
return os.path.exists("config.txt")


class Tools:
"""Use it for installing the required packages """
device = platform.uname()[0].lower()
is_linux = (device=="linux")
is_windows = (device=="windows")
is_linux = device=="linux"
is_windows = device=="windows"

@property
def clear_screen(self):
Expand All @@ -39,12 +42,13 @@ def check_command(self, args: list):
return (subprocess.run(
args,
stdout=subprocess.PIPE,
shell=True
shell=True,
check=True
)).stdout.decode()


def requirements(self):
with open("requirements.txt", "r") as f:
with open("requirements.txt", "r", encoding="UTF-8") as f:
return [x.lower().strip() for x in f.read().split("\n") if x not in ("\n", "")]


Expand Down
13 changes: 7 additions & 6 deletions main/core/methods/functions/syncpart.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def messageobject(anydict: dict):
]
try:
# the passed message object
# must be at the top
# must be at the top
return all_messages[0]
except IndexError:
return None
Expand All @@ -69,6 +69,7 @@ class Types(object):


class SyncPart(Types):
"""You must use this class with inherited Config class"""
def showdate(
self
):
Expand Down Expand Up @@ -153,7 +154,7 @@ def textlen(
"""
if self.is_bot:
raise BotMethodInvalid

frame = inspect.currentframe().f_back
m = messageobject(frame.f_locals)

Expand Down Expand Up @@ -878,21 +879,21 @@ def Ytdl(
):
"""
Just read the YoutubeDL class docs for use
params::
params: dict = {
"format": "bestaudio[ext=webm]",
"noplaylist": "true"
},
auto_init: bool = True
"""

yt = YoutubeDL(
params=params,
auto_init=auto_init
)

return yt


Expand Down Expand Up @@ -931,4 +932,4 @@ def createThread(func: callable, start_now: bool=True, *_args, **_kwargs):
if start_now:
return thread.start()
else:
return thread
return thread

0 comments on commit 3ada295

Please sign in to comment.