diff --git a/userge/plugins/misc/upload.py b/userge/plugins/misc/upload.py index 90dd23623..be038b4dd 100644 --- a/userge/plugins/misc/upload.py +++ b/userge/plugins/misc/upload.py @@ -29,9 +29,13 @@ **Usage:** - `.upload [file or folder path]`""") + `.upload [file or folder path] -` + Available flags :: + -d upload as document""", + del_pre=True) async def uploadtotg(message: Message): - path_ = message.input_str + flags = message.flags + path_ = message.filtered_input_str if not path_: await message.edit("invalid input!, check `.help .upload`", del_in=5) return @@ -44,24 +48,24 @@ async def uploadtotg(message: Message): else: await message.delete() - await explorer(string, message.chat.id) + await explorer(string, message.chat.id, flags) -async def explorer(path: Path, chatid): +async def explorer(path: Path, chatid, flags): if path.is_file(): try: - await upload(path, chatid) + await upload(path, chatid, flags) except FloodWait as x: time.sleep(x.x) # asyncio sleep ? elif path.is_dir(): for i in path.iterdir(): - await explorer(i, chatid) + await explorer(i, chatid, flags) -async def upload(path: Path, chat_id: int): - if path.name.endswith((".mkv", ".mp4", ".webm")): +async def upload(path: Path, chat_id: int, flags): + if path.name.endswith((".mkv", ".mp4", ".webm")) and ('d' not in flags): await vid_upload(chat_id, path) else: @@ -155,6 +159,6 @@ async def get_thumb(path: str = '') -> str: async def remove_thumb(thumb: str) -> None: if os.path.exists(thumb) and \ - thumb != LOGO_PATH and \ + thumb != LOGO_PATH and \ thumb != THUMB_PATH: os.remove(thumb) diff --git a/userge/plugins/utils/pmpermit.py b/userge/plugins/utils/pmpermit.py index 770d61393..7032ddb52 100644 --- a/userge/plugins/utils/pmpermit.py +++ b/userge/plugins/utils/pmpermit.py @@ -34,6 +34,7 @@ else: noPmMessage = "Hello {fname} this is an automated message\nPlease wait untill you get approved to direct message " \ "And please dont spam untill then " +del _pm, _pmMsg @userge.on_cmd("allow", about="""\ diff --git a/userge/versions.py b/userge/versions.py index 540ddd5b7..87a926246 100644 --- a/userge/versions.py +++ b/userge/versions.py @@ -15,7 +15,7 @@ __version_mjaor__ = 0 __version_minor__ = 1 __version_micro__ = 2 -__version_beta__ = 1 +__version_beta__ = 2 __version__ = "{}.{}.{}".format(__version_mjaor__,