From fdb7faf4a08b1f97d07281a9463ac124694fc7db Mon Sep 17 00:00:00 2001
From: Sourcery AI <>
Date: Sun, 27 Feb 2022 21:09:06 +0000
Subject: [PATCH 1/2] 'Refactored by Sourcery'
---
bin/cmrudl.py | 7 +-
sample_config.py | 5 +-
userbot/__init__.py | 4 +-
userbot/__main__.py | 6 +-
userbot/assistant/bot_pms.py | 55 +++--
userbot/assistant/botcontrols.py | 19 +-
userbot/assistant/botmanagers.py | 11 +-
userbot/assistant/buttonmaker.py | 2 +-
userbot/assistant/hide.py | 4 +-
userbot/assistant/iyoutube.py | 24 +-
userbot/assistant/secret.py | 4 +-
userbot/assistant/sendbot.py | 17 +-
userbot/assistant/troll.py | 4 +-
userbot/core/client.py | 10 +-
userbot/core/cmdinfo.py | 10 +-
userbot/core/events.py | 9 +-
userbot/core/helpers.py | 2 +-
userbot/core/inlinebot.py | 78 ++-----
userbot/core/managers.py | 2 +-
userbot/helpers/functions/calculate.py | 9 +-
userbot/helpers/functions/functions.py | 22 +-
userbot/helpers/functions/imgtools.py | 8 +-
userbot/helpers/functions/jikan.py | 30 ++-
userbot/helpers/functions/nekos.py | 3 +-
userbot/helpers/functions/utils.py | 2 +-
userbot/helpers/functions/utube.py | 47 ++--
userbot/helpers/google_image_download.py | 60 ++---
userbot/helpers/memeshelper.py | 3 +-
userbot/helpers/nsfw.py | 2 +-
userbot/helpers/progress.py | 25 +-
userbot/helpers/utils/events.py | 2 +-
userbot/helpers/utils/format.py | 10 +-
userbot/helpers/utils/paste.py | 10 +-
userbot/plugins/admin.py | 2 +-
userbot/plugins/afk.py | 2 +-
userbot/plugins/alive.py | 2 +-
userbot/plugins/android.py | 18 +-
userbot/plugins/antispambot.py | 3 +-
userbot/plugins/app.py | 6 +-
userbot/plugins/archive.py | 14 +-
userbot/plugins/autoprofile.py | 12 +-
userbot/plugins/blacklistwords.py | 2 +-
userbot/plugins/carbon.py | 2 +-
userbot/plugins/climate.py | 10 +-
userbot/plugins/contacts.py | 7 +-
userbot/plugins/corecmds.py | 282 ++++++++++++-----------
userbot/plugins/countries.py | 30 +--
userbot/plugins/custom.py | 94 ++++----
userbot/plugins/dictionary.py | 26 +--
userbot/plugins/download.py | 11 +-
userbot/plugins/evaluators.py | 6 +-
userbot/plugins/feds.py | 14 +-
userbot/plugins/ffmpeg.py | 2 +-
userbot/plugins/figlet.py | 3 +-
userbot/plugins/fileconverts.py | 21 +-
userbot/plugins/filesummary.py | 15 +-
userbot/plugins/filters.py | 33 ++-
userbot/plugins/gdrive.py | 29 ++-
userbot/plugins/git.py | 4 +-
userbot/plugins/google.py | 8 +-
userbot/plugins/gps.py | 3 +-
userbot/plugins/groupactions.py | 8 +-
62 files changed, 553 insertions(+), 622 deletions(-)
diff --git a/bin/cmrudl.py b/bin/cmrudl.py
index dd5acea..5d1996a 100644
--- a/bin/cmrudl.py
+++ b/bin/cmrudl.py
@@ -227,9 +227,7 @@ def handle_data(self, data):
self.jsobj = m.group(1)
def result(self):
- if not self.jsobj:
- return None
- return self.jsobj
+ return None if not self.jsobj else self.jsobj
parser = TheHTMLParser()
parser.feed(html)
@@ -336,8 +334,7 @@ def create_file_name_temp(self, storage):
return ".%s.%s" % (__prog__, urllib_quote(storage["hash"]))
def create_file_name(self, storage):
- opt_file = self.options.file
- if opt_file:
+ if opt_file := self.options.file:
return opt_file
return storage["name"] if storage else None
diff --git a/sample_config.py b/sample_config.py
index 0cda945..24f543e 100644
--- a/sample_config.py
+++ b/sample_config.py
@@ -19,6 +19,8 @@
from telethon.tl.types import ChatBannedRights
+
+
class Config(object):
LOGGER = True
@@ -64,7 +66,7 @@ class Config(object):
"THUMB_IMAGE", "https://telegra.ph/file/6086da8c041f5de3227ed.jpg"
)
# Specify NO_LOAD with plugin names for not loading in userbot
- NO_LOAD = [x for x in os.environ.get("NO_LOAD", "").split()]
+ NO_LOAD = list(os.environ.get("NO_LOAD", "").split())
# Specify command handler that should be used for the plugins
# This should be a valid "regex" pattern
CMDSET = os.environ.get("CMDSET", r".")
@@ -109,6 +111,7 @@ class Config(object):
BOTLOG_CHATID = 0
+
class Production(Config):
LOGGER = False
diff --git a/userbot/__init__.py b/userbot/__init__.py
index 9b8aab4..e4a199e 100644
--- a/userbot/__init__.py
+++ b/userbot/__init__.py
@@ -18,7 +18,7 @@
__version__ = "1.0"
__license__ = "GNU Affero General Public License v3.0"
__author__ = "DogeUserBot < https://github.com/DOG-E/DogeUserBot >"
-__copyright__ = "©️ Copyright 2021, " + __author__
+__copyright__ = f"©️ Copyright 2021, {__author__}"
doge.version = __version__
if gvar("BOT_TOKEN"):
@@ -59,7 +59,7 @@
else:
Config.PM_LOGGER_GROUP_ID = int(gvar("PM_LOGGER_GROUP_ID"))
elif str(Config.PM_LOGGER_GROUP_ID)[0] != "-":
- Config.PM_LOGGER_GROUP_ID = int("-" + str(Config.PM_LOGGER_GROUP_ID))
+ Config.PM_LOGGER_GROUP_ID = int(f"-{str(Config.PM_LOGGER_GROUP_ID)}")
try:
diff --git a/userbot/__main__.py b/userbot/__main__.py
index 604b110..ab4807e 100644
--- a/userbot/__main__.py
+++ b/userbot/__main__.py
@@ -30,9 +30,9 @@
try:
- LOGS.info(f"⏳ STARTING DOGE USERBOT 🐾")
+ LOGS.info("⏳ STARTING DOGE USERBOT 🐾")
doge.loop.run_until_complete(setup_bot())
- LOGS.info(f"✅ STARTUP COMPLETED 🐾")
+ LOGS.info("✅ STARTUP COMPLETED 🐾")
except Exception as e:
LOGS.error(f"🚨 {e}")
exit()
@@ -71,7 +71,7 @@ async def startup_process():
await load_plugins("plugins")
await load_plugins("assistant")
LOGS.info(userbot.__copyright__)
- LOGS.info("🔐 Licensed under the terms of the " + userbot.__license__)
+ LOGS.info(f"🔐 Licensed under the terms of the {userbot.__license__}")
LOGS.info(
f"\
\n➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖\
diff --git a/userbot/assistant/bot_pms.py b/userbot/assistant/bot_pms.py
index 811afbd..5e5285c 100644
--- a/userbot/assistant/bot_pms.py
+++ b/userbot/assistant/bot_pms.py
@@ -95,12 +95,12 @@ async def bot_start(event):
mention = f"[{chat.first_name}](tg://user?id={chat.id})"
my_mention = f"[{user.first_name}](tg://user?id={user.id})"
first = chat.first_name
- last = chat.last_name if chat.last_name else ""
+ last = chat.last_name or ""
fullname = f"{first} {last}" if last else first
username = f"@{chat.username}" if chat.username else mention
userid = chat.id
my_first = user.first_name
- my_last = user.last_name if user.last_name else ""
+ my_last = user.last_name or ""
my_fullname = f"{my_first} {my_last}" if my_last else my_first
my_username = f"@{user.username}" if user.username else my_mention
if chat.id != OWNER_ID:
@@ -129,21 +129,20 @@ async def bot_start(event):
)
)
buttons = [
- (Button.url(f"📣 Kᴀɴᴀʟ ", "https://t.me/DogeUserBot"),),
+ (Button.url("📣 Kᴀɴᴀʟ ", "https://t.me/DogeUserBot"),),
(
- Button.url(f"💬 Sᴜᴘᴘᴏʀᴛ ", "https://t.me/DogeSup"),
- Button.url(f"🧩 Pʟᴜɢɪɴ ", "https://t.me/DogePlugin"),
+ Button.url("💬 Sᴜᴘᴘᴏʀᴛ ", "https://t.me/DogeSup"),
+ Button.url("🧩 Pʟᴜɢɪɴ ", "https://t.me/DogePlugin"),
),
]
+
else:
start_msg = "**🐶 Wow!\
\n🐾 Merhaba {}!\n\
\n💬 Sana nasıl yardımcı olabilirim?**".format(
my_mention
)
- buttons = [
- (Button.inline(f"🐕🦺 ʏᴀʀᴅɪᴍ", data="mainmenu"),),
- ]
+ buttons = [(Button.inline("🐕\u200d🦺 ʏᴀʀᴅɪᴍ", data="mainmenu"), )]
try:
await event.client.send_message(
chat.id,
@@ -239,12 +238,14 @@ async def bot_pms_edit(event): # sourcery no-metrics
users = get_user_reply(event.id)
if users is None:
return
- reply_msg = None
- for user in users:
- if user.chat_id == str(chat.id):
- reply_msg = user.message_id
- break
- if reply_msg:
+ if reply_msg := next(
+ (
+ user.message_id
+ for user in users
+ if user.chat_id == str(chat.id)
+ ),
+ None,
+ ):
await event.client.send_message(
OWNER_ID,
"**⬆️ Bu mesaj şu kullanıcı tarafından düzenlendi.** {} :\n".format(
@@ -303,11 +304,15 @@ async def handler(event):
except Exception as e:
LOGS.error(str(e))
if users_1 is not None:
- reply_msg = None
- for user in users_1:
- if user.chat_id != OWNER_ID:
- reply_msg = user.message_id
- break
+ reply_msg = next(
+ (
+ user.message_id
+ for user in users_1
+ if user.chat_id != OWNER_ID
+ ),
+ None,
+ )
+
try:
if reply_msg:
users = get_user_id(reply_msg)
@@ -343,16 +348,18 @@ async def bot_start(event):
users = get_user_id(reply_to)
if users is None:
return await info_msg.edit(
- f"**🚨 Hᴀᴛᴀ:**\n🙁 'Üzgünüm! Bu kullanıcıyı veritabanımda bulamadım.`"
+ "**🚨 Hᴀᴛᴀ:**\\n🙁 'Üzgünüm! Bu kullanıcıyı veritabanımda bulamadım.`"
)
+
for usr in users:
user_id = int(usr.chat_id)
user_name = usr.first_name
break
if user_id is None:
return await info_msg.edit(
- f"**🚨 Hᴀᴛᴀ:**\n🙁 'Üzgünüm! Bu kullanıcıyı veritabanımda bulamadım.`"
+ "**🚨 Hᴀᴛᴀ:**\\n🙁 'Üzgünüm! Bu kullanıcıyı veritabanımda bulamadım.`"
)
+
uinfo = f"**👤 Bu mesaj şu kişi tarafından gönderildi:** {_format.mentionuser(user_name, user_id)}\
\n**ℹ️ Kullanıcı İsmi:** {user_name}\
\n**🆔 Kullanıcı ID'si:** `{user_id}`"
@@ -363,13 +370,13 @@ async def send_flood_alert(user_) -> None:
# sourcery no-metrics
buttons = [
(
- Button.inline(f"🚫 Bᴀɴ", data=f"bot_pm_ban_{user_.id}"),
+ Button.inline("🚫 Bᴀɴ", data=f"bot_pm_ban_{user_.id}"),
Button.inline(
- f"➖ Boᴛ AɴᴛɪFʟooᴅ'ᴜ Kᴀᴘᴀᴛ",
- data="toggle_bot-antiflood_off",
+ "➖ Boᴛ AɴᴛɪFʟooᴅ'ᴜ Kᴀᴘᴀᴛ", data="toggle_bot-antiflood_off"
),
)
]
+
found = False
if FloodConfig.ALERT and (user_.id in FloodConfig.ALERT.keys()):
found = True
diff --git a/userbot/assistant/botcontrols.py b/userbot/assistant/botcontrols.py
index e166d44..610899d 100644
--- a/userbot/assistant/botcontrols.py
+++ b/userbot/assistant/botcontrols.py
@@ -111,14 +111,16 @@ async def bot_broadcast(event):
if count % 5 == 0:
try:
prog_ = (
- f"**🔊 Yayın Yapılıyor...**\n\n"
- + progress_str(
- total=bot_users_count,
- current=count + len(blocked_users),
+ (
+ "**🔊 Yayın Yapılıyor...**\\n\\n"
+ + progress_str(
+ total=bot_users_count,
+ current=count + len(blocked_users),
+ )
)
+ f"\n\n• **✅ Başarılı:** `{count}`\n"
- + f"• **❌ Hatalı** `{len(blocked_users)}`"
- )
+ ) + f"• **❌ Hatalı** `{len(blocked_users)}`"
+
await br_cast.edit(prog_)
except FloodWaitError as e:
await sleep(e.seconds)
@@ -126,7 +128,7 @@ async def bot_broadcast(event):
b_info = "🔊 ➡️ {} tane kullanıcı için mesajı başarıyla yayınladı.".format(
count
)
- if len(blocked_users) != 0:
+ if blocked_users:
b_info += f"\n🚫 {len(blocked_users)} tane kullanıcı {BOT_USERNAME} botunu engellemiş ya da botla olan mesajları silmiş. Bu yüzden bot kullanıcıları listesinden silindi."
b_info += "⏱ Tamamlanma Süresi: {}.".format(
time_formatter((end_ - start_).seconds)
@@ -187,8 +189,7 @@ async def ban_botpms(event):
if user_id == OWNER_ID:
return await event.reply("**🚨 Seni yasaklayamam.**")
- check = check_is_black_list(user.id)
- if check:
+ if check := check_is_black_list(user.id):
return await event.client.send_message(
event.chat_id,
f"🛑 #ZATEN_BANLI\
diff --git a/userbot/assistant/botmanagers.py b/userbot/assistant/botmanagers.py
index 8916e8d..ac24400 100644
--- a/userbot/assistant/botmanagers.py
+++ b/userbot/assistant/botmanagers.py
@@ -50,9 +50,12 @@ def progress_str(total: int, current: int) -> str:
return prog_arg.format(
"Progress",
percentage,
- "".join((Config.FINISHED_PROGRESS_STR for i in range(floor(percentage / 5)))),
"".join(
- (Config.UNFINISHED_PROGRESS_STR for i in range(20 - floor(percentage / 5)))
+ Config.FINISHED_PROGRESS_STR for _ in range(floor(percentage / 5))
+ ),
+ "".join(
+ Config.UNFINISHED_PROGRESS_STR
+ for _ in range(20 - floor(percentage / 5))
),
)
@@ -81,8 +84,8 @@ async def unban_user_from_bot(user, reason, reply_to=None):
rem_user_from_bl(user.id)
except Exception as e:
LOGS.error(str(e))
- banned_msg = f"**👀 Bu bottan yasaklanmıştınız.\
- /nℹ️ Şimdi sahibime mesaj göndermeye devam edebeilirsin!**"
+ banned_msg = "**👀 Bu bottan yasaklanmıştınız.\\\x1f /nℹ️ Şimdi sahibime mesaj göndermeye devam edebeilirsin!**"
+
if reason is not None:
banned_msg += f"\n**⛓ Sebep:** `{reason}`"
await doge.tgbot.send_message(user.id, banned_msg)
diff --git a/userbot/assistant/buttonmaker.py b/userbot/assistant/buttonmaker.py
index b37c757..05247b2 100644
--- a/userbot/assistant/buttonmaker.py
+++ b/userbot/assistant/buttonmaker.py
@@ -102,7 +102,7 @@ async def button(event):
if not markdown_note:
return await edl(event, "`🔲 Butonda hangi metni kullanmalıyım?`")
- doginput = "Inline buttons " + markdown_note
+ doginput = f"Inline buttons {markdown_note}"
results = await event.client.inline_query(BOT_USERNAME, doginput)
await results[0].click(event.chat_id, reply_to=reply_to_id, hide_via=True)
await event.delete()
diff --git a/userbot/assistant/hide.py b/userbot/assistant/hide.py
index 02f12d2..b0d3ac4 100644
--- a/userbot/assistant/hide.py
+++ b/userbot/assistant/hide.py
@@ -23,7 +23,7 @@ async def on_plug_in_callback_query_handler(event):
try:
reply_pop_up_alert = jsondata[f"{timestamp}"]["text"]
except KeyError:
- reply_pop_up_alert = f"🚨 Bu mesaj artık Doge sunucusunda yok."
+ reply_pop_up_alert = "🚨 Bu mesaj artık Doge sunucusunda yok."
else:
- reply_pop_up_alert = f"🚨 Bu mesaj artık Doge sunucusunda yok."
+ reply_pop_up_alert = "🚨 Bu mesaj artık Doge sunucusunda yok."
await event.answer(reply_pop_up_alert, cache_time=0, alert=True)
diff --git a/userbot/assistant/iyoutube.py b/userbot/assistant/iyoutube.py
index fc50a0d..4eb20b6 100644
--- a/userbot/assistant/iyoutube.py
+++ b/userbot/assistant/iyoutube.py
@@ -75,9 +75,10 @@ async def yt_inline(event):
input_url = (reply.text).strip()
if not input_url:
return await edl(
- event, f"**📺 Geçerli bir YouTube URL'sine girin veya cevap verin!**"
+ event, "**📺 Geçerli bir YouTube URL'sine girin veya cevap verin!**"
)
+
dogevent = await eor(
event, "**🔎 Şunun için YouTube'da arama yapıyorm:** `{}`...".format(input_url)
)
@@ -97,7 +98,7 @@ async def yt_inline(event):
await dogevent.delete()
await results[0].click(event.chat_id, reply_to=reply_to_id, hide_via=True)
else:
- await dogevent.edit(f"**🚨 Üzgünüm! Hiçbir sonuç bulamadım.**")
+ await dogevent.edit("**🚨 Üzgünüm! Hiçbir sonuç bulamadım.**")
@doge.tgbot.on(
@@ -270,7 +271,7 @@ async def ytdl_callback(c_q: CallbackQuery):
parse_mode="html",
)
elif choosen_btn == "listall":
- await c_q.answer(f"➡️ Görünüm olarak şu değiştirildi: 📜 Liste", alert=False)
+ await c_q.answer("➡️ Görünüm olarak şu değiştirildi: 📜 Liste", alert=False)
list_res = "".join(
search_data.get(vid_s).get("list_view") for vid_s in search_data
)
@@ -284,23 +285,16 @@ async def ytdl_callback(c_q: CallbackQuery):
await c_q.edit(
file=await get_ytthumb(search_data.get("1").get("video_id")),
buttons=[
- (
- Button.url(
- f"↗️ Açᴍᴀᴋ Içɪɴ Tıᴋʟᴀʏıɴ",
- url=telegraph,
- )
- ),
- (
- Button.inline(
- f"📊 Dᴇᴛᴀʏʟᴀʀı Göʀ",
- data=f"ytdl_detail_{data_key}_{page}",
- )
+ Button.url("↗️ Açᴍᴀᴋ Içɪɴ Tıᴋʟᴀʏıɴ", url=telegraph),
+ Button.inline(
+ "📊 Dᴇᴛᴀʏʟᴀʀı Göʀ", data=f"ytdl_detail_{data_key}_{page}"
),
],
)
+
else: # Detailed
index = 1
- await c_q.answer(f"➡️ Görünüm şu olarak değiştirildi: 📊 Detaylı", alert=False)
+ await c_q.answer("➡️ Görünüm şu olarak değiştirildi: 📊 Detaylı", alert=False)
first = search_data.get(str(index))
await c_q.edit(
text=first.get("message"),
diff --git a/userbot/assistant/secret.py b/userbot/assistant/secret.py
index 86c99ea..cc5089b 100644
--- a/userbot/assistant/secret.py
+++ b/userbot/assistant/secret.py
@@ -33,7 +33,7 @@ async def on_plug_in_callback_query_handler(event):
\n👀 Bu senin için değil!\
\n🤡 Git ve kendi işini yap."
except KeyError:
- reply_pop_up_alert = f"🚨 Bu mesaj artık Doge sunucusunda yok."
+ reply_pop_up_alert = "🚨 Bu mesaj artık Doge sunucusunda yok."
else:
- reply_pop_up_alert = f"🚨 Bu mesaj artık Doge sunucusunda yok."
+ reply_pop_up_alert = "🚨 Bu mesaj artık Doge sunucusunda yok."
await event.answer(reply_pop_up_alert, cache_time=0, alert=True)
diff --git a/userbot/assistant/sendbot.py b/userbot/assistant/sendbot.py
index 15ff015..d783354 100644
--- a/userbot/assistant/sendbot.py
+++ b/userbot/assistant/sendbot.py
@@ -27,19 +27,18 @@ async def botmsg(event):
reply_message = await event.get_reply_message()
reply_to_id = await reply_id(event)
if not text:
- if reply_message.media:
- media = await reply_message.download_media()
- if reply_message.text:
- await doge.tgbot.send_file(chat, media, caption=reply_message.text)
- else:
- await doge.tgbot.send_file(chat, media)
- return await event.delete()
-
- else:
+ if not reply_message.media:
return await edl(
event,
"__Bot üzerinden ne göndermeliyim? Bana bir metin verin ya da mesajı yanıtlayın.__",
)
+ media = await reply_message.download_media()
+ if reply_message.text:
+ await doge.tgbot.send_file(chat, media, caption=reply_message.text)
+ else:
+ await doge.tgbot.send_file(chat, media)
+ return await event.delete()
+
await doge.tgbot.send_message(chat, text, reply_to=reply_to_id)
await event.delete()
diff --git a/userbot/assistant/troll.py b/userbot/assistant/troll.py
index bc7b6e7..177bc99 100644
--- a/userbot/assistant/troll.py
+++ b/userbot/assistant/troll.py
@@ -33,7 +33,7 @@ async def on_plug_in_callback_query_handler(event):
encrypted_tcxt = message["text"]
reply_pop_up_alert = encrypted_tcxt
except KeyError:
- reply_pop_up_alert = f"🚨 Bu mesaj artık Doge sunucusunda yok."
+ reply_pop_up_alert = "🚨 Bu mesaj artık Doge sunucusunda yok."
else:
- reply_pop_up_alert = f"🚨 Bu mesaj artık Doge sunucusunda yok."
+ reply_pop_up_alert = "🚨 Bu mesaj artık Doge sunucusunda yok."
await event.answer(reply_pop_up_alert, cache_time=0, alert=True)
diff --git a/userbot/core/client.py b/userbot/core/client.py
index 84cb2b1..7fc0b96 100644
--- a/userbot/core/client.py
+++ b/userbot/core/client.py
@@ -209,11 +209,10 @@ async def wrapper(check):
markdown=False,
title="🐶 Doɢᴇ UsᴇʀBoᴛ Hᴀᴛᴀ Rᴀᴘᴏʀᴜ 🐾",
)
- text = "**🐶 Doɢᴇ UsᴇʀBoᴛ Hᴀᴛᴀ Rᴀᴘᴏʀᴜ 🐾**"
- text += "\n\n"
+ text = "**🐶 Doɢᴇ UsᴇʀBoᴛ Hᴀᴛᴀ Rᴀᴘᴏʀᴜ 🐾**" + "\n\n"
text += f"**🚨 Hata Raporu:** [{new['error']}]({pastelink})"
text += "\n\n"
- link = f"[BURAYA](https://t.me/DogeSup)"
+ link = "[BURAYA](https://t.me/DogeSup)"
text += "__💬 Eğer isterseniz buraya bildirebilirisiniz.__"
text += "\n\n"
text += "🐾 Bu mesajı {} ilet.".format(link)
@@ -349,11 +348,10 @@ async def wrapper(check):
markdown=False,
title="🐶 Doɢᴇ Asɪsᴛᴀɴ Hᴀᴛᴀ Rᴀᴘᴏʀᴜ 🐾",
)
- text = "**🐶 Doɢᴇ Asɪsᴛᴀɴ Hᴀᴛᴀ Rᴀᴘᴏʀᴜ 🐾**"
- text += "\n\n"
+ text = "**🐶 Doɢᴇ Asɪsᴛᴀɴ Hᴀᴛᴀ Rᴀᴘᴏʀᴜ 🐾**" + "\n\n"
text += f"**🚨 Hata Raporu:** [{new['error']}]({pastelink})"
text += "\n\n"
- link = f"[BURAYA](https://t.me/DogeSup)"
+ link = "[BURAYA](https://t.me/DogeSup)"
text += "__💬 Eğer isterseniz buraya bildirebilirisiniz.__"
text += "\n\n"
text += "🐾 Bu mesajı {} ilet.".format(link)
diff --git a/userbot/core/cmdinfo.py b/userbot/core/cmdinfo.py
index c73c728..d87d74a 100644
--- a/userbot/core/cmdinfo.py
+++ b/userbot/core/cmdinfo.py
@@ -45,7 +45,7 @@ def _format_about(
del about["d"]
if "f" in about:
- tmp_chelp += f"\n\n**🐾 Aʏᴀʀ:**"
+ tmp_chelp += "\\n\\n**🐾 Aʏᴀʀ:**"
if isinstance(about["f"], dict):
for f_n, f_d in about["f"].items():
tmp_chelp += f"\n ▫️ `{f_n}`: __{f_d.lower()}__"
@@ -54,7 +54,7 @@ def _format_about(
del about["f"]
if "o" in about:
- tmp_chelp += f"\n\n**🐾 Sᴇçᴇɴᴇᴋʟᴇʀ:**"
+ tmp_chelp += "\\n\\n**🐾 Sᴇçᴇɴᴇᴋʟᴇʀ:**"
if isinstance(about["o"], dict):
for o_n, o_d in about["o"].items():
tmp_chelp += f"\n ▫️ `{o_n}`: __{o_d.lower()}__"
@@ -63,7 +63,7 @@ def _format_about(
del about["o"]
if "t" in about:
- tmp_chelp += f"\n\n**🐾 Dᴇsᴛᴇᴋʟᴇɴᴇɴ Tüʀʟᴇʀ:**"
+ tmp_chelp += "\\n\\n**🐾 Dᴇsᴛᴇᴋʟᴇɴᴇɴ Tüʀʟᴇʀ:**"
if isinstance(about["t"], list):
for _opt in about["t"]:
tmp_chelp += f"\n `{_opt}` ,"
@@ -72,7 +72,7 @@ def _format_about(
del about["t"]
if "u" in about:
- tmp_chelp += f"\n\n**🐾 Kᴜʟʟᴀɴıᴍ:**"
+ tmp_chelp += "\\n\\n**🐾 Kᴜʟʟᴀɴıᴍ:**"
if isinstance(about["u"], list):
for ex_ in about["u"]:
tmp_chelp += f"\n `{ex_}`"
@@ -81,7 +81,7 @@ def _format_about(
del about["u"]
if "e" in about:
- tmp_chelp += f"\n\n**🐾 Öʀɴᴇᴋ:**"
+ tmp_chelp += "\\n\\n**🐾 Öʀɴᴇᴋ:**"
if isinstance(about["e"], list):
for ex_ in about["e"]:
tmp_chelp += f"\n `{ex_}`"
diff --git a/userbot/core/events.py b/userbot/core/events.py
index 8863b8a..54b299b 100644
--- a/userbot/core/events.py
+++ b/userbot/core/events.py
@@ -71,7 +71,7 @@ def filter(self, event):
is_admin = event.chat.admin_rights
if not is_creator and not is_admin:
- text = f"**🚨 Bu komutu kullanabilmek için yönetici olmalıyım!**"
+ text = "**🚨 Bu komutu kullanabilmek için yönetici olmalıyım!**"
event._client.loop.create_task(eor(event, text))
return
@@ -379,16 +379,16 @@ async def edit_message(
):
chatid = entity
if isinstance(chatid, InputPeerChannel):
- chat_id = int("-100" + str(chatid.channel_id))
+ chat_id = int(f"-100{str(chatid.channel_id)}")
elif isinstance(chatid, InputPeerChat):
- chat_id = int("-" + str(chatid.chat_id))
+ chat_id = int(f"-{str(chatid.chat_id)}")
elif isinstance(chatid, InputPeerUser):
chat_id = int(chatid.user_id)
else:
chat_id = chatid
if str(chat_id) == str(Config.BOTLOG_CHATID):
return await client.editmessage(
- entity=entity,
+ entity=chatid,
message=message,
text=text,
parse_mode=parse_mode,
@@ -399,6 +399,7 @@ async def edit_message(
buttons=buttons,
schedule=schedule,
)
+
main_msg = text
safecheck = await safe_check_text(main_msg)
if safecheck:
diff --git a/userbot/core/helpers.py b/userbot/core/helpers.py
index 6e43155..e1aa38f 100644
--- a/userbot/core/helpers.py
+++ b/userbot/core/helpers.py
@@ -39,7 +39,7 @@ async def get_chat_link(
extra = f"[{name}](tg://user?id={entity.id})"
else:
if hasattr(entity, "username") and entity.username is not None:
- username = "@" + entity.username
+ username = f"@{entity.username}"
else:
username = entity.id
if reply is not None:
diff --git a/userbot/core/inlinebot.py b/userbot/core/inlinebot.py
index 2835dfc..ad495df 100644
--- a/userbot/core/inlinebot.py
+++ b/userbot/core/inlinebot.py
@@ -49,14 +49,7 @@ def main_menu():
text = f"**🐶 [Doɢᴇ UsᴇʀBoᴛ](https://t.me/DogeUserBot)\
\n🐾 Yᴀʀᴅıᴍᴄı\n\
\n◽ Doɢᴇ oғ {mention}**"
- buttons = [
- (
- Button.inline(
- f"ℹ️️ Bɪʟɢɪ",
- data="check",
- ),
- ),
- (
+ buttons = [(Button.inline("ℹ️️ Bɪʟɢɪ", data="check"), ), (
Button.inline(
f"👮♂️ Aᴅᴍɪɴ ({len(GRP_INFO['admin'])})",
data="admin_menu",
@@ -65,8 +58,7 @@ def main_menu():
f"🐶 Doɢᴇ ({len(GRP_INFO['bot'])})",
data="bot_menu",
),
- ),
- (
+ ), (
Button.inline(
f"🎈 Eɢ̆ʟᴇɴᴄᴇ ({len(GRP_INFO['fun'])})",
data="fun_menu",
@@ -75,8 +67,7 @@ def main_menu():
f"🪀 Çᴇşɪᴛʟɪ ({len(GRP_INFO['misc'])})",
data="misc_menu",
),
- ),
- (
+ ), (
Button.inline(
f"🧰 Aʀᴀç ({len(GRP_INFO['tool'])})",
data="tool_menu",
@@ -85,14 +76,7 @@ def main_menu():
f"🍑 Hᴜʙ ({len(GRP_INFO['hub'])})",
data="hub_menu",
),
- ),
- (
- Button.inline(
- f"⛔ KAPAT ⛔",
- data="close",
- ),
- ),
- ]
+ ), (Button.inline("⛔ KAPAT ⛔", data="close"), )]
return text, buttons
@@ -115,7 +99,7 @@ def ibuild_keyboard(buttons):
def get_back_button(name):
- return [Button.inline(f"⬅️️ Gᴇʀɪ", data=f"{name}")]
+ return [Button.inline("⬅️️ Gᴇʀɪ", data=f"{name}")]
def command_in_category(cname):
@@ -208,39 +192,25 @@ def paginate_help(
modulo_page = page_number % max_num_pages
if plugins:
if len(pairs) > number_of_rows:
- pairs = pairs[
+ pairs = (pairs[
modulo_page * number_of_rows : number_of_rows * (modulo_page + 1)
- ] + [
- (
- Button.inline(
+ ] + [(Button.inline(
"⏪",
data=f"{prefix}_prev({modulo_page})_plugin",
- ),
- Button.inline(
- f"🐾 Mᴇɴᴜ",
- data="mainmenu",
- ),
- Button.inline(
+ ), Button.inline("🐾 Mᴇɴᴜ", data="mainmenu"), Button.inline(
"⏩",
data=f"{prefix}_next({modulo_page})_plugin",
- ),
- ),
- (
- Button.inline(
- f"⛔ Kᴀᴘᴀᴛ",
- data="close",
- ),
- ),
- ]
+ )), (Button.inline("⛔ Kᴀᴘᴀᴛ", data="close"), )])
else:
pairs = pairs + [
(
- Button.inline(f"🐾 Mᴇɴᴜ", data="mainmenu"),
- Button.inline(f"⛔ Kᴀᴘᴀᴛ", data="close"),
- ),
+ Button.inline("🐾 Mᴇɴᴜ", data="mainmenu"),
+ Button.inline("⛔ Kᴀᴘᴀᴛ", data="close"),
+ )
]
+
elif len(pairs) > number_of_rows:
if category_pgno < 0:
category_pgno = len(pairs) + category_pgno
@@ -259,33 +229,29 @@ def paginate_help(
),
(
Button.inline(
- f"⬅️️ Gᴇʀɪ",
+ "⬅️️ Gᴇʀɪ",
data=f"back_plugin_{category_plugins}_{category_pgno}",
),
- Button.inline(
- f"🐾 Mᴇɴᴜ",
- data="mainmenu",
- ),
- Button.inline(f"⛔ Kᴀᴘᴀᴛ", data="close"),
+ Button.inline("🐾 Mᴇɴᴜ", data="mainmenu"),
+ Button.inline("⛔ Kᴀᴘᴀᴛ", data="close"),
),
]
+
else:
if category_pgno < 0:
category_pgno = len(pairs) + category_pgno
pairs = pairs + [
(
Button.inline(
- f"⬅️️ Gᴇʀɪ",
+ "⬅️️ Gᴇʀɪ",
data=f"back_plugin_{category_plugins}_{category_pgno}",
),
- Button.inline(
- f"🐾 Mᴇɴᴜ",
- data="mainmenu",
- ),
- Button.inline(f"⛔ Kᴀᴘᴀᴛ", data="close"),
- ),
+ Button.inline("🐾 Mᴇɴᴜ", data="mainmenu"),
+ Button.inline("⛔ Kᴀᴘᴀᴛ", data="close"),
+ )
]
+
return pairs
diff --git a/userbot/core/managers.py b/userbot/core/managers.py
index de4068e..479f0fa 100644
--- a/userbot/core/managers.py
+++ b/userbot/core/managers.py
@@ -57,7 +57,7 @@ async def eor(
if aslink or deflink:
linktext = linktext or "👀 Mesaj fazla uzun olduğu için yapıştırıldı!"
response = await paste_message(text, pastetype="t")
- text = linktext + f" [HERE]({response})"
+ text = f"{linktext} [HERE]({response})"
if event.sender_id in sudo_users:
if reply_to:
return await reply_to.reply(text, link_preview=link_preview)
diff --git a/userbot/helpers/functions/calculate.py b/userbot/helpers/functions/calculate.py
index 01984a3..4387105 100644
--- a/userbot/helpers/functions/calculate.py
+++ b/userbot/helpers/functions/calculate.py
@@ -28,14 +28,13 @@ async def calcc(cmd, event, text=None):
sys.stderr = old_stderr
evaluation = ""
if exc:
- evaluation = exc
+ return exc
elif stderr:
- evaluation = stderr
+ return stderr
elif stdout:
- evaluation = stdout
+ return stdout
else:
- evaluation = text
- return evaluation
+ return text
async def aexecc(code, event):
diff --git a/userbot/helpers/functions/functions.py b/userbot/helpers/functions/functions.py
index d75a9a1..111aee4 100644
--- a/userbot/helpers/functions/functions.py
+++ b/userbot/helpers/functions/functions.py
@@ -64,7 +64,7 @@ async def get_cast(casttype, movie):
if i < 1:
mov_casttype += str(j)
elif i < 5:
- mov_casttype += ", " + str(j)
+ mov_casttype += f", {str(j)}"
else:
break
i += 1
@@ -79,7 +79,7 @@ async def get_moviecollections(movie):
for i in movie["box office"].keys():
result += f"\n• {i}: {movie['box office'][i]}"
else:
- result = f"Not data"
+ result = "Not data"
return result
@@ -87,13 +87,13 @@ async def get_moviecollections(movie):
def getSimilarWords(wordx, limit=5):
similars = []
if not path.exists("autocomplete.json"):
- words = get(f"https://sozluk.gov.tr/autocomplete.json")
+ words = get("https://sozluk.gov.tr/autocomplete.json")
open("autocomplete.json", "a+").write(words.text)
words = words.json()
else:
words = loads(open("autocomplete.json", "r").read())
for word in words:
- if word["madde"].startswith(wordx) and not word["madde"] == wordx:
+ if word["madde"].startswith(wordx) and word["madde"] != wordx:
if len(similars) > limit:
break
similars.append(word["madde"])
@@ -120,7 +120,7 @@ async def getTranslate(text, **kwargs):
# Credits: Robotlog - https://github.com/robotlog/SiriUserBot/blob/master/userbot/helps/forc.py#L5
async def fsmessage(event, text, forward=False, chat=None):
- cHat = chat if chat else event.chat_id
+ cHat = chat or event.chat_id
if not forward:
try:
e = await event.client.send_message(cHat, text)
@@ -137,7 +137,7 @@ async def fsmessage(event, text, forward=False, chat=None):
async def fsfile(event, file=None, chat=None):
- cHat = chat if chat else event.chat_id
+ cHat = chat or event.chat_id
try:
e = await event.send_file(cHat, file)
except YouBlockedUserError:
@@ -147,13 +147,13 @@ async def fsfile(event, file=None, chat=None):
async def newmsgres(conv, chat, timeout=None):
- if timeout:
- response = await conv.wait_event(
+ return (
+ await conv.wait_event(
NewMessage(incoming=True, from_users=chat), timeout=timeout
)
- else:
- response = await conv.wait_event(NewMessage(incoming=True, from_users=chat))
- return response
+ if timeout
+ else await conv.wait_event(NewMessage(incoming=True, from_users=chat))
+ )
async def clippy(borg, msg, chat_id, reply_to_id):
diff --git a/userbot/helpers/functions/imgtools.py b/userbot/helpers/functions/imgtools.py
index af80fdf..c934e08 100644
--- a/userbot/helpers/functions/imgtools.py
+++ b/userbot/helpers/functions/imgtools.py
@@ -46,8 +46,8 @@ def get_warp_length(width):
def random_color():
number_of_colors = 2
return [
- "#" + "".join(choice("0123456789ABCDEF") for j in range(6))
- for i in range(number_of_colors)
+ "#" + "".join(choice("0123456789ABCDEF") for _ in range(6))
+ for _ in range(number_of_colors)
]
@@ -125,7 +125,7 @@ async def crop_and_divide(img):
(new_width, new_height) = (0, 0)
media = []
for _ in range(1, rows + 1):
- for o in range(1, columns + 1):
+ for _ in range(1, columns + 1):
mimg = img.crop(
(
new_width,
@@ -303,7 +303,7 @@ async def dogememify_helper(CNG_FONTS, topString, bottomString, filename, endnam
bottomTextPositionY = imageSize[1] - bottomTextSize[1]
bottomTextPosition = (bottomTextPositionX, bottomTextPositionY)
draw = Draw(img)
- outlineRange = int(fontSize / 15)
+ outlineRange = fontSize // 15
for x in range(-outlineRange, outlineRange + 1):
for y in range(-outlineRange, outlineRange + 1):
draw.text(
diff --git a/userbot/helpers/functions/jikan.py b/userbot/helpers/functions/jikan.py
index 444cd62..45ef254 100644
--- a/userbot/helpers/functions/jikan.py
+++ b/userbot/helpers/functions/jikan.py
@@ -223,9 +223,9 @@ async def formatJSON(outData):
link = f"https://anilist.co/anime/{jsonData['id']}"
msg += f"[{title}]({link})"
msg += f"\n\n**Type:** {jsonData['format']}"
- msg += f"\n**Genres:** "
+ msg += "\\n**Genres:** "
for g in jsonData["genres"]:
- msg += g + " "
+ msg += f'{g} '
msg += f"\n**Status:** {jsonData['status']}"
msg += f"\n**Episodes:** {jsonData['episodes']}"
msg += f"\n**Year:** {jsonData['startDate']['year']}"
@@ -241,7 +241,7 @@ async def formatJSON(outData):
def shorten(description, info="anilist.co"):
msg = ""
if len(description) > 700:
- description = description[0:200] + "....."
+ description = description[:200] + "....."
msg += f"\n**Description:**\n{description} [Read More]({info})"
else:
msg += f"\n**Description:** \n {description}"
@@ -258,8 +258,7 @@ async def anilist_user(input_str):
"Fetch user details from anilist"
username = {"search": input_str}
result = post(anilisturl, json={"query": user_query, "variables": username}).json()
- error = result.get("errors")
- if error:
+ if error := result.get("errors"):
error_sts = error[0].get("message")
return [f"{error_sts}"]
user_data = result["data"]["User"]
@@ -327,10 +326,9 @@ def getBannerLink(mal, kitsu_search=True, anilistid=0):
}
"""
data = {"query": query, "variables": {"idMal": int(mal)}}
- image = post("https://graphql.anilist.co", json=data).json()["data"]["Media"][
- "bannerImage"
- ]
- if image:
+ if image := post("https://graphql.anilist.co", json=data).json()["data"][
+ "Media"
+ ]["bannerImage"]:
return image
return getPosterLink(mal)
@@ -339,11 +337,10 @@ async def get_anime_manga(mal_id, search_type, _user_id): # sourcery no-metrics
jikan = jikanpy.Jikan()
if search_type == "anime_anime":
result = jikan.anime(mal_id)
- trailer = result["trailer_url"]
- if trailer:
+ if trailer := result["trailer_url"]:
TRAILER = f"🎬 Trailer"
else:
- TRAILER = f"🎬 No Trailer Available"
+ TRAILER = "🎬 No Trailer Available"
studio_string = ", ".join(
studio_info["name"] for studio_info in result["studios"]
)
@@ -386,8 +383,7 @@ async def get_anime_manga(mal_id, search_type, _user_id): # sourcery no-metrics
anime_data = anime_result["data"]["Media"]
html_char = ""
for character in anime_data["characters"]["nodes"]:
- html_ = ""
- html_ += "
"
+ html_ = "" + "
"
html_ += f""""""
html_ += f""""""
html_ += "
"
@@ -411,14 +407,14 @@ async def get_anime_manga(mal_id, search_type, _user_id): # sourcery no-metrics
# Telegraph Post mejik
html_pc = ""
html_pc += f"
Developer: Information of {name}
diff --git a/userbot/plugins/custom.py b/userbot/plugins/custom.py
index c78a94c..6b2365f 100644
--- a/userbot/plugins/custom.py
+++ b/userbot/plugins/custom.py
@@ -141,7 +141,7 @@
],
},
)
-async def dbsetter(event): # sourcery no-metrics
+async def dbsetter(event): # sourcery no-metrics
"To manage vars in database"
cmd = event.pattern_match.group(1).lower()
vname = event.pattern_match.group(2)
@@ -170,13 +170,10 @@ async def dbsetter(event): # sourcery no-metrics
username = reply.chat.username
msg_id = reply.id
vinfo = f"https://t.me/{username}/{msg_id}"
- else:
- if reply.media:
- custom = await reply.forward_to(BOTLOG_CHATID)
- vinfo = f"{custom.id}"
- elif (type(reply.media) == MessageMediaDocument) or (
- type(reply.media) == MessageMediaPhoto
- ):
+ elif reply.media:
+ custom = await reply.forward_to(BOTLOG_CHATID)
+ vinfo = f"{custom.id}"
+ elif type(reply.media) in [MessageMediaDocument, MessageMediaPhoto]:
await eor(event, "`Creating link...`")
downloaded_file_name = await event.client.download_media(
reply, TEMP_DIR
@@ -188,7 +185,7 @@ async def dbsetter(event): # sourcery no-metrics
vinfo = f"https://telegra.ph{media_urls[0]}"
except AttributeError:
- return await eor(event, f"**🚨 Eʀʀoʀ:** `While making link.`")
+ return await eor(event, "**🚨 Eʀʀoʀ:** `While making link.`")
except TelegraphException as exc:
return await eor(event, f"**🚨 Eʀʀoʀ:**\n➡️ `{str(exc)}`")
@@ -292,57 +289,56 @@ async def dbsetter(event): # sourcery no-metrics
f"🔮 Value of **{apiname}** is now deleted & set to default.",
time=20,
)
- else:
- if gvar("PERMISSION_TO_ALL_GLOBAL_DATA_VARIABLES") is True:
- gvarname = vname
- gvarinfo = vinfo
- if cmd == "s":
- if not gvarinfo:
- return await edl(
- event,
- f"⚙️ Give some values which you want to save for **{gvarname}**",
- )
-
- sgvar(gvarname, gvarinfo)
- if BOTLOG_CHATID:
- await doge.tgbot.send_message(
- BOTLOG_CHATID,
- f"#SET_GLOBALDATAVAR\
- \n**⚙️ {gvarname}** is updated newly in database as below",
- )
- await doge.tgbot.send_message(BOTLOG_CHATID, gvarinfo, silent=True)
- await edl(
+ elif gvar("PERMISSION_TO_ALL_GLOBAL_DATA_VARIABLES") is True:
+ gvarname = vname
+ gvarinfo = vinfo
+ if cmd == "s":
+ if not gvarinfo:
+ return await edl(
event,
- f"⚙️ Value of **{gvarname}** is changed.",
+ f"⚙️ Give some values which you want to save for **{gvarname}**",
)
- if cmd == "g":
- gvardata = gvar(gvarname)
- await edl(event, "**I sent global data var to BOTLOG.**")
+
+ sgvar(gvarname, gvarinfo)
+ if BOTLOG_CHATID:
await doge.tgbot.send_message(
BOTLOG_CHATID,
- f"⚙️ Value of **{gvarname}** is `{gvardata}`",
+ f"#SET_GLOBALDATAVAR\
+ \n**⚙️ {gvarname}** is updated newly in database as below",
)
- elif cmd == "d":
- gvardata = gvar(gvarname)
- dgvar(gvarname)
- if BOTLOG_CHATID:
- await doge.tgbot.send_message(
- BOTLOG_CHATID,
- f"#DEL_GLOBALDATAVAR\
+ await doge.tgbot.send_message(BOTLOG_CHATID, gvarinfo, silent=True)
+ await edl(
+ event,
+ f"⚙️ Value of **{gvarname}** is changed.",
+ )
+ if cmd == "g":
+ gvardata = gvar(gvarname)
+ await edl(event, "**I sent global data var to BOTLOG.**")
+ await doge.tgbot.send_message(
+ BOTLOG_CHATID,
+ f"⚙️ Value of **{gvarname}** is `{gvardata}`",
+ )
+ elif cmd == "d":
+ gvardata = gvar(gvarname)
+ dgvar(gvarname)
+ if BOTLOG_CHATID:
+ await doge.tgbot.send_message(
+ BOTLOG_CHATID,
+ f"#DEL_GLOBALDATAVAR\
\n**{gvarname}** is deleted from database\
\n\
\n🚮 Deleted: `{gvardata}`",
- )
- await edl(
- event,
- f"⚙️ Value of **{gvarname}** is now deleted & set to default.",
- time=20,
)
- else:
- await eor(
+ await edl(
event,
- f"**🪀 Give correct VAR name from the list:\n\n**{vnlist}\n\n\n**🔮 Give correct API name from the list:\n\n**{apilist}",
+ f"⚙️ Value of **{gvarname}** is now deleted & set to default.",
+ time=20,
)
+ else:
+ await eor(
+ event,
+ f"**🪀 Give correct VAR name from the list:\n\n**{vnlist}\n\n\n**🔮 Give correct API name from the list:\n\n**{apilist}",
+ )
@doge.bot_cmd(
diff --git a/userbot/plugins/dictionary.py b/userbot/plugins/dictionary.py
index 590aa77..86ecfda 100644
--- a/userbot/plugins/dictionary.py
+++ b/userbot/plugins/dictionary.py
@@ -90,7 +90,7 @@ async def tdk(event):
if "error" in response:
await edl(dogevent, f"**I couldn't find ({inp}) in Turkish dictionary.**")
words = getSimilarWords(inp)
- if not words == "":
+ if words != "":
return await edl(
dogevent,
f"__I couldn't find ({inp}) in Turkish dictionary.__\n\n**Similar Words:** {words}",
@@ -100,29 +100,21 @@ async def tdk(event):
meaningsStr = ""
for mean in response[0]["anlamlarListe"]:
meaningsStr += f"\n**{mean['anlam_sira']}.**"
- if ("ozelliklerListe" in mean) and (
- (not mean["ozelliklerListe"][0]["tam_adi"] is None)
- or (not mean["ozelliklerListe"][0]["tam_adi"] == "")
+ if "ozelliklerListe" in mean and (
+ mean["ozelliklerListe"][0]["tam_adi"] is not None
+ or mean["ozelliklerListe"][0]["tam_adi"] != ""
):
meaningsStr += f"__({mean['ozelliklerListe'][0]['tam_adi']})__"
meaningsStr += f' ```{mean["anlam"]}```'
- if response[0]["cogul_mu"] == "0":
- cogul = "❌"
- else:
- cogul = "✅"
-
- if response[0]["ozel_mi"] == "0":
- ozel = "❌"
- else:
- ozel = "✅"
-
+ cogul = "❌" if response[0]["cogul_mu"] == "0" else "✅"
+ ozel = "❌" if response[0]["ozel_mi"] == "0" else "✅"
await eor(
dogevent,
f"**Word:** `{inp}`\n\n**Is the plural?:** {cogul}\n**Is the word a proper noun?:** {ozel}\n\n**Meanings:** {meaningsStr}",
)
words = getSimilarWords(inp)
- if not words == "":
+ if words != "":
return dogevent.edit(
f"**Word:** `{inp}`\n\n**Is the plural?:** `{cogul}`\n**Is the word a proper noun?:** {ozel}\n\n**Meanings:** {meaningsStr}\n\n**Similar Words:** {words}",
)
@@ -138,7 +130,7 @@ async def tdk(event):
)
async def tureng(event):
word = event.pattern_match.group(1)
- url = "https://tureng.com/tr/turkce-ingilizce/" + word
+ url = f"https://tureng.com/tr/turkce-ingilizce/{word}"
try:
answer = get(url)
except BaseException:
@@ -148,7 +140,7 @@ async def tureng(event):
try:
table = soup.find("table")
td = table.find_all("td", attrs={"lang": "en"})
- for val in td[0:5]:
+ for val in td[:5]:
trlated = "{} 👉 {}\n".format(trlated, val.text)
await eor(event, trlated)
except BaseException:
diff --git a/userbot/plugins/download.py b/userbot/plugins/download.py
index b2b34e5..8d9434b 100644
--- a/userbot/plugins/download.py
+++ b/userbot/plugins/download.py
@@ -45,7 +45,7 @@ async def _get_file_name(path: Path, full: bool = True) -> str:
],
},
)
-async def _(event): # sourcery no-metrics
+async def _(event): # sourcery no-metrics
"To download the replied telegram file"
mone = await eor(event, "`Downloading....`")
input_str = event.pattern_match.group(3)
@@ -70,7 +70,7 @@ async def _(event): # sourcery no-metrics
name += "_" + str(getattr(reply.document, "id", reply.id)) + ext
if path and path.exists():
if path.is_file():
- newname = str(path.stem) + "_OLD"
+ newname = f'{str(path.stem)}_OLD'
path.rename(path.with_name(newname).with_suffix(path.suffix))
file_name = path
else:
@@ -145,10 +145,11 @@ async def _(event): # sourcery no-metrics
percentage = downloader.get_progress() * 100
dspeed = downloader.get_speed()
progress_str = "`{0}{1} {2}`%".format(
- "".join("▰" for i in range(floor(percentage / 5))),
- "".join("▱" for i in range(20 - floor(percentage / 5))),
+ "".join("▰" for _ in range(floor(percentage / 5))),
+ "".join("▱" for _ in range(20 - floor(percentage / 5))),
round(percentage, 2),
)
+
estimated_total_time = downloader.get_eta(human=True)
current_message = f"Downloading the file\
\n\n**URL:** `{url}`\
@@ -223,7 +224,7 @@ async def _(event): # sourcery no-metrics
name += "_" + str(getattr(reply.document, "id", reply.id)) + ext
if path and path.exists():
if path.is_file():
- newname = str(path.stem) + "_OLD"
+ newname = f'{str(path.stem)}_OLD'
path.rename(path.with_name(newname).with_suffix(path.suffix))
file_name = path
else:
diff --git a/userbot/plugins/evaluators.py b/userbot/plugins/evaluators.py
index 2d51676..c97a3fb 100644
--- a/userbot/plugins/evaluators.py
+++ b/userbot/plugins/evaluators.py
@@ -48,8 +48,7 @@ async def _(event):
)
if BOTLOG:
await event.client.send_message(
- BOTLOG_CHATID,
- "Terminal command " + cmd + " was executed sucessfully.",
+ BOTLOG_CHATID, f"Terminal command {cmd} was executed sucessfully."
)
@@ -106,8 +105,7 @@ async def _(event):
)
if BOTLOG:
await event.client.send_message(
- BOTLOG_CHATID,
- "eval command " + cmd + " was executed sucessfully.",
+ BOTLOG_CHATID, f"eval command {cmd} was executed sucessfully."
)
diff --git a/userbot/plugins/feds.py b/userbot/plugins/feds.py
index f7f2caf..8a7075a 100644
--- a/userbot/plugins/feds.py
+++ b/userbot/plugins/feds.py
@@ -230,7 +230,7 @@ async def group_unfban(event):
],
},
)
-async def quote_search(event): # sourcery no-metrics
+async def quote_search(event): # sourcery no-metrics
"Add the federation to database."
fedgroup = event.pattern_match.group(1)
fedid = event.pattern_match.group(2)
@@ -274,9 +274,12 @@ async def quote_search(event): # sourcery no-metrics
pass
else:
text_lines = response.text.split("`")
- for fed_id in text_lines:
- if len(fed_id) == 36 and fed_id.count("-") == 4:
- fedidstoadd.append(fed_id)
+ fedidstoadd.extend(
+ fed_id
+ for fed_id in text_lines
+ if len(fed_id) == 36 and fed_id.count("-") == 4
+ )
+
except Exception as e:
await edl(
dogevent,
@@ -477,10 +480,11 @@ async def fetch_fedinfo(event):
await fsmessage(event, text=f"/fedadmins {input_str}", chat=rose)
response = await newmsgres(conv, rose)
await dogevent.edit(
- f"**FedID:** ```{input_str}```\n\n" + response.text
+ f"**FedID:** ```{input_str}```\n\n{response.text}"
if input_str
else response.text
)
+
except Exception as e:
await edl(
dogevent,
diff --git a/userbot/plugins/ffmpeg.py b/userbot/plugins/ffmpeg.py
index 2c3db64..047b1c2 100644
--- a/userbot/plugins/ffmpeg.py
+++ b/userbot/plugins/ffmpeg.py
@@ -150,7 +150,7 @@ async def ff_mpeg_trim_cmd(event):
end_time,
)
if o is None:
- return await edl(dogevent, f"**Error:** `Can't complete the process`")
+ return await edl(dogevent, "**Error:** `Can't complete the process`")
try:
c_time = time()
await event.client.send_file(
diff --git a/userbot/plugins/figlet.py b/userbot/plugins/figlet.py
index acbaf37..d723e4e 100644
--- a/userbot/plugins/figlet.py
+++ b/userbot/plugins/figlet.py
@@ -81,8 +81,7 @@ async def figlet(event):
event, f"**Invalid style selected!** __Check__ `{tr}doge figlet`."
)
- result = figlet_format(deEmojify(text), font=font)
else:
font = choice(CMDFIG)
- result = figlet_format(deEmojify(text), font=font)
+ result = figlet_format(deEmojify(text), font=font)
await eor(event, f"ㅤ \n{result}", parse_mode=_format.parse_pre)
diff --git a/userbot/plugins/fileconverts.py b/userbot/plugins/fileconverts.py
index 261bd6b..06c62d0 100644
--- a/userbot/plugins/fileconverts.py
+++ b/userbot/plugins/fileconverts.py
@@ -495,13 +495,9 @@ async def on_file_to_photo(event):
"u": "{tr}gif quality ; fps(frames per second)",
},
)
-async def _(event): # sourcery no-metrics
+async def _(event): # sourcery no-metrics
"Converts Given animated sticker to gif"
- input_str = event.pattern_match.group(1)
- if not input_str:
- quality = None
- fps = None
- else:
+ if input_str := event.pattern_match.group(1):
loc = input_str.split(";")
if len(loc) > 2:
return await edl(
@@ -537,6 +533,9 @@ async def _(event): # sourcery no-metrics
quality = loc[0].strip()
else:
return await edl(event, "Use quality of range 0 to 721")
+ else:
+ quality = None
+ fps = None
dogreply = await event.get_reply_message()
doge_event = b64decode("eFZFRXlyUHY2Z2s1T0Rsaw==")
if not dogreply or not dogreply.media or not dogreply.media.document:
@@ -616,10 +615,11 @@ async def _(event):
voice_note = False
supports_streaming = False
if input_str == "voice":
- new_required_file_caption = "voice_" + str(round(time())) + ".opus"
+ new_required_file_caption = f"voice_{str(round(time()))}.opus"
new_required_file_name = (
- TMP_DOWNLOAD_DIRECTORY + "/" + new_required_file_caption
+ f'{TMP_DOWNLOAD_DIRECTORY}/{new_required_file_caption}'
)
+
command_to_run = [
"ffmpeg",
"-i",
@@ -637,10 +637,11 @@ async def _(event):
voice_note = True
supports_streaming = True
elif input_str == "mp3":
- new_required_file_caption = "mp3_" + str(round(time())) + ".mp3"
+ new_required_file_caption = f"mp3_{str(round(time()))}.mp3"
new_required_file_name = (
- TMP_DOWNLOAD_DIRECTORY + "/" + new_required_file_caption
+ f'{TMP_DOWNLOAD_DIRECTORY}/{new_required_file_caption}'
)
+
command_to_run = [
"ffmpeg",
"-i",
diff --git a/userbot/plugins/filesummary.py b/userbot/plugins/filesummary.py
index 20f7e5d..e45c40b 100644
--- a/userbot/plugins/filesummary.py
+++ b/userbot/plugins/filesummary.py
@@ -42,11 +42,10 @@ def weird_division(n, d):
"e": "{tr}chatfs @DogeSup",
},
)
-async def _(event): # sourcery no-metrics
+async def _(event): # sourcery no-metrics
"Shows you the complete media/file summary of the that group"
entity = event.chat_id
- input_str = event.pattern_match.group(1)
- if input_str:
+ if input_str := event.pattern_match.group(1):
try:
entity = int(input_str)
except ValueError:
@@ -109,9 +108,9 @@ async def _(event): # sourcery no-metrics
largest += f" • {mediax}: {humanbytes(media_dict[mediax]['max_size'])}\n"
endtime = int(monotonic())
if endtime - starttime >= 120:
- runtime = str(round(((endtime - starttime) / 60), 2)) + " minutes"
+ runtime = f'{str(round(((endtime - starttime) / 60), 2))} minutes'
else:
- runtime = str(endtime - starttime) + " seconds"
+ runtime = f'{str(endtime - starttime)} seconds'
avghubytes = humanbytes(weird_division(totalsize, totalcount))
avgruntime = (
str(round((weird_division((endtime - starttime), totalcount)) * 1000, 2))
@@ -144,7 +143,7 @@ async def _(event): # sourcery no-metrics
"e": "{tr}userfs @MissRose_bot",
},
)
-async def _(event): # sourcery no-metrics
+async def _(event): # sourcery no-metrics
"Shows you the complete media/file summary of the that user in that group."
reply = await event.get_reply_message()
input_str = event.pattern_match.group(1)
@@ -231,9 +230,9 @@ async def _(event): # sourcery no-metrics
largest += f" • {mediax}: {humanbytes(media_dict[mediax]['max_size'])}\n"
endtime = int(monotonic())
if endtime - starttime >= 120:
- runtime = str(round(((endtime - starttime) / 60), 2)) + " minutes"
+ runtime = f'{str(round(((endtime - starttime) / 60), 2))} minutes'
else:
- runtime = str(endtime - starttime) + " seconds"
+ runtime = f'{str(endtime - starttime)} seconds'
avghubytes = humanbytes(weird_division(totalsize, totalcount))
avgruntime = (
str(round((weird_division((endtime - starttime), totalcount)) * 1000, 2))
diff --git a/userbot/plugins/filters.py b/userbot/plugins/filters.py
index 9924e03..f08a494 100644
--- a/userbot/plugins/filters.py
+++ b/userbot/plugins/filters.py
@@ -49,7 +49,7 @@ async def filter_incoming_handler(event): # sourcery no-metrics
my_fullname = f"{my_first} {my_last}" if my_last else my_first
my_username = f"@{me.username}" if me.username else my_mention
for trigger in filters:
- pattern = r"( |^|[^\w])" + escape(trigger.keyword) + r"( |$|[^\w])"
+ pattern = f"( |^|[^\\w]){escape(trigger.keyword)}( |$|[^\\w])"
if search(pattern, name, flags=IGNORECASE):
file_media = None
filter_msg = None
@@ -123,27 +123,26 @@ async def add_new_filter(event):
msg = await event.get_reply_message()
msg_id = None
if msg and msg.media and not string:
- if BOTLOG:
- await event.client.send_message(
- BOTLOG_CHATID,
- f"#FILTER\
- \nCHAT ID: {event.chat_id}\
- \nTRIGGER: {keyword}\
- \n\nThe following message is saved as the filter's reply data for the chat, please DON'T delete it !!",
- )
- msg_o = await event.client.forward_messages(
- entity=BOTLOG_CHATID,
- messages=msg,
- from_peer=event.chat_id,
- silent=True,
- )
- msg_id = msg_o.id
- else:
+ if not BOTLOG:
return await eor(
event,
"__Saving media as reply to the filter requires the__ `PRIVATE_GROUP_BOT_API_ID` __to be set.__",
)
+ await event.client.send_message(
+ BOTLOG_CHATID,
+ f"#FILTER\
+ \nCHAT ID: {event.chat_id}\
+ \nTRIGGER: {keyword}\
+ \n\nThe following message is saved as the filter's reply data for the chat, please DON'T delete it !!",
+ )
+ msg_o = await event.client.forward_messages(
+ entity=BOTLOG_CHATID,
+ messages=msg,
+ from_peer=event.chat_id,
+ silent=True,
+ )
+ msg_id = msg_o.id
elif msg and msg.text and not string:
string = msg.text
elif not string:
diff --git a/userbot/plugins/gdrive.py b/userbot/plugins/gdrive.py
index e1b71ff..d381c0b 100644
--- a/userbot/plugins/gdrive.py
+++ b/userbot/plugins/gdrive.py
@@ -175,7 +175,7 @@ async def get_file_id(input_str):
return link, "unknown"
-async def download(event, gdrive, service, uri=None): # sourcery no-metrics
+async def download(event, gdrive, service, uri=None): # sourcery no-metrics
"""Download files to local then upload"""
start = datetime.now()
reply = ""
@@ -286,7 +286,7 @@ async def download(event, gdrive, service, uri=None): # sourcery no-metrics
status = status.replace("[FILE", "[FOLDER")
folder = await create_dir(service, file_name, GDRIVE_.parent_Id)
dir_id = folder.get("id")
- webViewURL = "https://drive.google.com/drive/folders/" + dir_id
+ webViewURL = f"https://drive.google.com/drive/folders/{dir_id}"
try:
await task_directory(gdrive, service, required_file_name, dir_id)
except CancelProcess:
@@ -437,10 +437,13 @@ async def gdrive_download(
speed = round(downloaded / diff, 2)
eta = round((file_size - downloaded) / speed)
prog_str = "`[{0}{1}] {2}%`".format(
- "".join("▰" for i in range(floor(percentage / 10))),
- "".join("▱" for i in range(10 - floor(percentage / 10))),
+ "".join("▰" for _ in range(floor(percentage / 10))),
+ "".join(
+ "▱" for _ in range(10 - floor(percentage / 10))
+ ),
round(percentage, 2),
)
+
current_message = (
"**File downloading**\n\n"
f"**Name:** `{file_name}`\n"
@@ -492,14 +495,15 @@ async def gdrive_download(
status,
"".join(
Config.FINISHED_PROGRESS_STR
- for i in range(floor(percentage / 5))
+ for _ in range(floor(percentage / 5))
),
"".join(
Config.UNFINISHED_PROGRESS_STR
- for i in range(20 - floor(percentage / 5))
+ for _ in range(20 - floor(percentage / 5))
),
round(percentage, 2),
)
+
current_message = (
"**File Downloading**\n\n"
f"**Name:** `{file_name}`\n"
@@ -648,15 +652,17 @@ async def upload(gdrive, service, file_path, file_name, mimeType, dir_id=None):
eta = round((file_size - uploaded) / speed)
prog_str = "`Uploading:`\n`[{0}{1}] {2}`".format(
"".join(
- Config.FINISHED_PROGRESS_STR for i in range(floor(percentage / 10))
+ Config.FINISHED_PROGRESS_STR
+ for _ in range(floor(percentage / 10))
),
"".join(
Config.UNFINISHED_PROGRESS_STR
- for i in range(10 - floor(percentage / 10))
+ for _ in range(10 - floor(percentage / 10))
),
round(percentage, 2),
)
+
current_message = (
"**Uploading **\n\n"
f"**Name:** `{file_name}`\n"
@@ -777,11 +783,14 @@ async def check_progress_for_dl(event, gid, previous): # sourcery no-metrics
percentage = int(file.progress)
downloaded = percentage * int(file.total_length) / 100
prog_str = "**Downloading:** `[{0}{1}] {2}`".format(
- "".join("▰" for i in range(floor(percentage / 10))),
- "".join("▱" for i in range(10 - floor(percentage / 10))),
+ "".join("▰" for _ in range(floor(percentage / 10))),
+ "".join(
+ "▱" for _ in range(10 - floor(percentage / 10))
+ ),
file.progress_string(),
)
+
msg = (
"**[URL - DOWNLOAD]**\n\n"
f"**Name:** `{file.name}`\n"
diff --git a/userbot/plugins/git.py b/userbot/plugins/git.py
index 32d38ec..45889a1 100644
--- a/userbot/plugins/git.py
+++ b/userbot/plugins/git.py
@@ -60,7 +60,7 @@ async def _(event):
async with ClientSession() as session:
async with session.get(URL) as request:
if request.status == 404:
- return await edl(event, "`" + username + " not found`")
+ return await edl(event, f"`{username} not found`")
dogevent = await eor(event, "`fetching github info...`")
result = await request.json()
@@ -172,7 +172,7 @@ async def git_commit(file_name, mone):
return await mone.edit("`File Already Exists`")
if create_file:
- file_name = "userbot/plugins/" + file_name
+ file_name = f"userbot/plugins/{file_name}"
LOGS.info(file_name)
try:
repo.create_file(
diff --git a/userbot/plugins/google.py b/userbot/plugins/google.py
index c07d40d..a159858 100644
--- a/userbot/plugins/google.py
+++ b/userbot/plugins/google.py
@@ -101,13 +101,13 @@ async def gsearch(q_event):
try:
page = page[0]
page = page.replace(".p", "")
- match = match.replace(".p" + page, "")
+ match = match.replace(f".p{page}", "")
except IndexError:
page = 1
try:
lim = lim[0]
lim = lim.replace(".l", "")
- match = match.replace(".l" + lim, "")
+ match = match.replace(f".l{lim}", "")
lim = int(lim)
if lim <= 0:
lim = int(5)
@@ -150,7 +150,7 @@ async def gsearch(q_event):
if BOTLOG:
await q_event.client.send_message(
BOTLOG_CHATID,
- "Google Search query `" + match + "` was executed successfully",
+ f"Google Search query `{match}` was executed successfully",
)
@@ -332,7 +332,7 @@ async def google_search(event):
event,
"__Plox your search query exceeds 200 characters or you search query is empty.__",
)
- query = "#12" + input
+ query = f"#12{input}"
results = await event.client.inline_query("@StickerizerBot", query)
await results[0].click(event.chat_id, reply_to=reply_to_id, hide_via=True)
await event.delete()
diff --git a/userbot/plugins/gps.py b/userbot/plugins/gps.py
index 626f6e0..b94a42f 100644
--- a/userbot/plugins/gps.py
+++ b/userbot/plugins/gps.py
@@ -31,8 +31,7 @@ async def gps(event):
input_str = event.pattern_match.group(1)
dogevent = await eor(event, "`Finding...`")
geolocator = Nominatim(user_agent="DogeUserBot")
- geoloc = geolocator.geocode(input_str)
- if geoloc:
+ if geoloc := geolocator.geocode(input_str):
lon = geoloc.longitude
lat = geoloc.latitude
await event.client.send_file(
diff --git a/userbot/plugins/groupactions.py b/userbot/plugins/groupactions.py
index f97a416..9752eb0 100644
--- a/userbot/plugins/groupactions.py
+++ b/userbot/plugins/groupactions.py
@@ -239,7 +239,7 @@ async def _(event):
},
groups_only=True,
)
-async def rm_deletedacc(show): # sourcery no-metrics
+async def rm_deletedacc(show): # sourcery no-metrics
"To check deleted accounts and clean"
flag = show.pattern_match.group(1)
con = show.pattern_match.group(2).lower()
@@ -304,8 +304,9 @@ async def rm_deletedacc(show): # sourcery no-metrics
)
await sleep(e.seconds + 5)
await event.edit(
- f"__Ok the wait is over .I am cleaning all deleted accounts in this group__"
+ "__Ok the wait is over .I am cleaning all deleted accounts in this group__"
)
+
except UserAdminInvalidError:
del_a += 1
except Exception as e:
@@ -342,8 +343,9 @@ async def rm_deletedacc(show): # sourcery no-metrics
)
await sleep(e.seconds + 5)
await event.edit(
- f"__Ok the wait is over .I am cleaning all deleted accounts in restricted or banned users list in this group__"
+ "__Ok the wait is over .I am cleaning all deleted accounts in restricted or banned users list in this group__"
)
+
except Exception as e:
LOGS.error(str(e))
del_a += 1
From 54951c17a9e0206251735af6bf01362ea413c7fb Mon Sep 17 00:00:00 2001
From: TeleDoge {humanbytes(media_dict[mediax]['max_size'])}\n"
endtime = int(monotonic())
if endtime - starttime >= 120:
- runtime = f'{str(round(((endtime - starttime) / 60), 2))} minutes'
+ runtime = f"{str(round(((endtime - starttime) / 60), 2))} minutes"
else:
- runtime = f'{str(endtime - starttime)} seconds'
+ runtime = f"{str(endtime - starttime)} seconds"
avghubytes = humanbytes(weird_division(totalsize, totalcount))
avgruntime = (
str(round((weird_division((endtime - starttime), totalcount)) * 1000, 2))
@@ -143,7 +143,7 @@ async def _(event): # sourcery no-metrics
"e": "{tr}userfs @MissRose_bot",
},
)
-async def _(event): # sourcery no-metrics
+async def _(event): # sourcery no-metrics
"Shows you the complete media/file summary of the that user in that group."
reply = await event.get_reply_message()
input_str = event.pattern_match.group(1)
@@ -230,9 +230,9 @@ async def _(event): # sourcery no-metrics
largest += f" • {mediax}: {humanbytes(media_dict[mediax]['max_size'])}\n"
endtime = int(monotonic())
if endtime - starttime >= 120:
- runtime = f'{str(round(((endtime - starttime) / 60), 2))} minutes'
+ runtime = f"{str(round(((endtime - starttime) / 60), 2))} minutes"
else:
- runtime = f'{str(endtime - starttime)} seconds'
+ runtime = f"{str(endtime - starttime)} seconds"
avghubytes = humanbytes(weird_division(totalsize, totalcount))
avgruntime = (
str(round((weird_division((endtime - starttime), totalcount)) * 1000, 2))
diff --git a/userbot/plugins/gdrive.py b/userbot/plugins/gdrive.py
index d381c0b..d14a091 100644
--- a/userbot/plugins/gdrive.py
+++ b/userbot/plugins/gdrive.py
@@ -175,7 +175,7 @@ async def get_file_id(input_str):
return link, "unknown"
-async def download(event, gdrive, service, uri=None): # sourcery no-metrics
+async def download(event, gdrive, service, uri=None): # sourcery no-metrics
"""Download files to local then upload"""
start = datetime.now()
reply = ""
@@ -438,9 +438,7 @@ async def gdrive_download(
eta = round((file_size - downloaded) / speed)
prog_str = "`[{0}{1}] {2}%`".format(
"".join("▰" for _ in range(floor(percentage / 10))),
- "".join(
- "▱" for _ in range(10 - floor(percentage / 10))
- ),
+ "".join("▱" for _ in range(10 - floor(percentage / 10))),
round(percentage, 2),
)
@@ -652,8 +650,7 @@ async def upload(gdrive, service, file_path, file_name, mimeType, dir_id=None):
eta = round((file_size - uploaded) / speed)
prog_str = "`Uploading:`\n`[{0}{1}] {2}`".format(
"".join(
- Config.FINISHED_PROGRESS_STR
- for _ in range(floor(percentage / 10))
+ Config.FINISHED_PROGRESS_STR for _ in range(floor(percentage / 10))
),
"".join(
Config.UNFINISHED_PROGRESS_STR
@@ -662,7 +659,6 @@ async def upload(gdrive, service, file_path, file_name, mimeType, dir_id=None):
round(percentage, 2),
)
-
current_message = (
"**Uploading **\n\n"
f"**Name:** `{file_name}`\n"
@@ -784,13 +780,10 @@ async def check_progress_for_dl(event, gid, previous): # sourcery no-metrics
downloaded = percentage * int(file.total_length) / 100
prog_str = "**Downloading:** `[{0}{1}] {2}`".format(
"".join("▰" for _ in range(floor(percentage / 10))),
- "".join(
- "▱" for _ in range(10 - floor(percentage / 10))
- ),
+ "".join("▱" for _ in range(10 - floor(percentage / 10))),
file.progress_string(),
)
-
msg = (
"**[URL - DOWNLOAD]**\n\n"
f"**Name:** `{file.name}`\n"
diff --git a/userbot/plugins/groupactions.py b/userbot/plugins/groupactions.py
index 9752eb0..bcac07a 100644
--- a/userbot/plugins/groupactions.py
+++ b/userbot/plugins/groupactions.py
@@ -239,7 +239,7 @@ async def _(event):
},
groups_only=True,
)
-async def rm_deletedacc(show): # sourcery no-metrics
+async def rm_deletedacc(show): # sourcery no-metrics
"To check deleted accounts and clean"
flag = show.pattern_match.group(1)
con = show.pattern_match.group(2).lower()
diff --git a/userbot/plugins/speedtest.py b/userbot/plugins/speedtest.py
index 594be3b..93adcbb 100644
--- a/userbot/plugins/speedtest.py
+++ b/userbot/plugins/speedtest.py
@@ -16,7 +16,7 @@
def convert_from_bytes(size):
- power = 2 ** 10
+ power = 2**10
n = 0
units = {0: "", 1: "Kbps", 2: "Mbps", 3: "Gbps", 4: "Tbps"}
while size > power: