Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions bin/cmrudl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Main.parse_storage.TheHTMLParser.result refactored with the following changes:


parser = TheHTMLParser()
parser.feed(html)
Expand Down Expand Up @@ -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:
Comment on lines -339 to +337
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Main.create_file_name refactored with the following changes:

return opt_file
return storage["name"] if storage else None

Expand Down
2 changes: 1 addition & 1 deletion sample_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Config(object):
DOGEPLUGIN = os.environ.get("DOGEPLUGIN", False)
DOGEHUB = os.environ.get("DOGEHUB", False)
# 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".")
Expand Down
11 changes: 3 additions & 8 deletions userbot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
__version__ = "1.0"
__license__ = "🔐 GNU Affero Genel Kamu Lisansı v3.0"
__author__ = "DOG-E < https://github.com/DOG-E/DogeUserBot >"
__copyright__ = "©️ Copyright 2021, " + __author__
__copyright__ = f"©️ Copyright 2021, {__author__}"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 24-72 refactored with the following changes:


doge.version = __version__
if gvar("BOT_TOKEN"):
Expand Down Expand Up @@ -61,15 +61,10 @@
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))


if gvar("TAG_LOGGER_GROUP_ID"):
TAG_LOGGER_GROUP = gvar("TAG_LOGGER_GROUP_ID")
else:
TAG_LOGGER_GROUP = Config.PM_LOGGER_GROUP_ID
Config.PM_LOGGER_GROUP_ID = int(f"-{str(Config.PM_LOGGER_GROUP_ID)}")


TAG_LOGGER_GROUP = gvar("TAG_LOGGER_GROUP_ID") or Config.PM_LOGGER_GROUP_ID
# HEROKU:
try:
if Config.HEROKU_API_KEY is not None or Config.HEROKU_APP_NAME is not None:
Expand Down
2 changes: 1 addition & 1 deletion userbot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ async def startup_process():

LOGS.info("🐶 %100 ~ DOGE USERBOT HAZIR!\n\n\n\n\n\n\n")
LOGS.info(userbot.__copyright__)
LOGS.info(userbot.__license__ + " ile korunmaktadır.")
LOGS.info(f"{userbot.__license__} ile korunmaktadır.")
LOGS.info(
f"\
\n➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖\
Expand Down
19 changes: 10 additions & 9 deletions userbot/assistant/botcontrols.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,22 +200,24 @@ 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)}`"

Comment on lines -203 to +212
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function bot_broadcast refactored with the following changes:

await br_cast.edit(prog_)
except FloodWaitError as e:
await sleep(e.seconds)
end_ = datetime.now()
b_info = "🔊 ➡️ <b> {} tane kullanıcı </b> için mesajı başarıyla yayınladı.".format(
count
)
if len(blocked_users) != 0:
if blocked_users:
b_info += f"\n🚫 <b>{len(blocked_users)} tane kullanıcı</b> {gvar('BOT_USERNAME')} botunu engellemiş ya da botla olan mesajları silmiş. Bu yüzden bot kullanıcıları listesinden silindi."
b_info += "⏱ Tamamlanma Süresi:<code> {}</code>.".format(
time_formatter((end_ - start_).seconds)
Expand Down Expand Up @@ -252,8 +254,7 @@ async def ban_botpms(event):
if user_id == int(gvar("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):
Comment on lines -255 to +257
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function ban_botpms refactored with the following changes:

return await event.client.send_message(
event.chat_id,
f"🛑 #ZATEN_BANLI\
Expand Down
15 changes: 5 additions & 10 deletions userbot/assistant/botmanagers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,11 @@ def progress_str(total: int, current: int) -> str:
"Progress",
percentage,
"".join(
(
(gvar("FINISHED_PROGRESS_STR") or "▰")
for i in range(floor(percentage / 5))
)
(gvar("FINISHED_PROGRESS_STR") or "▰") for _ in range(floor(percentage / 5))
),
"".join(
(
(gvar("UNFINISHED_PROGRESS_STR") or "▱")
for i in range(20 - floor(percentage / 5))
)
(gvar("UNFINISHED_PROGRESS_STR") or "▱")
for _ in range(20 - floor(percentage / 5))
),
)

Expand Down Expand Up @@ -88,8 +83,8 @@ async def unban_user_from_bot(user, reason, reply_to=None):
rem_user_from_bl(user.id)
except Exception as e:
LOGS.error(f"🚨 {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!**"

Comment on lines -91 to +87
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function unban_user_from_bot refactored with the following changes:

if reason is not None:
banned_msg += f"\n**⛓ Sebep:** `{reason}`"
await doge.bot.send_message(user.id, banned_msg)
Expand Down
Loading