From eeb54ea656851a52c912339ea984f0e23c328a47 Mon Sep 17 00:00:00 2001 From: Santiago Ramirez Date: Thu, 12 Oct 2023 05:36:05 +0000 Subject: [PATCH] chore: caps --- bot/commands/config.py | 23 ----------------------- bot/commands/play_song.py | 1 + bot/commands/play_video.py | 5 +++-- bot/helpers/nums.py | 10 ++++++++++ bot/helpers/progress.py | 12 ------------ 5 files changed, 14 insertions(+), 37 deletions(-) create mode 100644 bot/helpers/nums.py diff --git a/bot/commands/config.py b/bot/commands/config.py index 5ac41bc..e69de29 100755 --- a/bot/commands/config.py +++ b/bot/commands/config.py @@ -1,23 +0,0 @@ -import os - -# from tinydb import TinyDB, Query -from pyrogram.types import Message -from bot import assistant, kreacher -from pyrogram import filters, Client -from bot.decorators.permissions import only_admins - -# from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup - -c = os.path.dirname(os.path.abspath(__file__)) - - -@kreacher.on_message(filters.regex(pattern="^[!?/]config")) -@only_admins -async def _(client: Client, message: Message): - # registry = os.path.join(c, "../dbs/registry.json") - # db = TinyDB(registry) - # groups = db.table("groups") - # user = groups.search(Query().id == message.chat.id) - common = await assistant.get - if len(common) > 0: - print(common) diff --git a/bot/commands/play_song.py b/bot/commands/play_song.py index f39eb3f..993b815 100755 --- a/bot/commands/play_song.py +++ b/bot/commands/play_song.py @@ -157,6 +157,7 @@ async def _(client: Client, message: Message): file_name=file_name, progress=progress, progress_args=(client, message.chat.id, _message.id), + block=False, ) if VOICE_CHATS.get(message.chat.id) is None: await _message.edit("🪄 **__Joining the voice chat...__**") diff --git a/bot/commands/play_video.py b/bot/commands/play_video.py index 487f0cf..00e3a53 100755 --- a/bot/commands/play_video.py +++ b/bot/commands/play_video.py @@ -206,12 +206,13 @@ async def _(client: Client, message: Message): file_name=file_name, progress=progress, progress_args=(client, message.chat.id, _message.id), + block=False, ) if VOICE_CHATS.get(message.chat.id) is None: - await _message.edit("**__Joining the voice chat...__** \u23F3") + await _message.edit("🪄 **__Joining the voice chat...__**") await tgcalls.start(message.chat.id) VOICE_CHATS[message.chat.id] = tgcalls - await sleep(2) + await sleep(2) await VOICE_CHATS[message.chat.id].start_video( media, enable_experimental_lip_sync=True, repeat=False ) diff --git a/bot/helpers/nums.py b/bot/helpers/nums.py new file mode 100644 index 0000000..21f8597 --- /dev/null +++ b/bot/helpers/nums.py @@ -0,0 +1,10 @@ +def bytes_to_string(byte_count): + """Converts a byte count to a string (in KB, MB...)""" + suffix_index = 0 + while byte_count >= 1024: + byte_count /= 1024 + suffix_index += 1 + + return "{:.2f}{}".format( + byte_count, [" bytes", "KB", "MB", "GB", "TB"][suffix_index] + ) diff --git a/bot/helpers/progress.py b/bot/helpers/progress.py index 490c9ab..c998fab 100755 --- a/bot/helpers/progress.py +++ b/bot/helpers/progress.py @@ -1,18 +1,6 @@ import logging -def bytes_to_string(byte_count): - """Converts a byte count to a string (in KB, MB...)""" - suffix_index = 0 - while byte_count >= 1024: - byte_count /= 1024 - suffix_index += 1 - - return "{:.2f}{}".format( - byte_count, [" bytes", "KB", "MB", "GB", "TB"][suffix_index] - ) - - async def progress(current_bytes, total_bytes, client, chat_id, message_id): try: percentage = round(((current_bytes / total_bytes) * 100), 2)