-
-
Notifications
You must be signed in to change notification settings - Fork 3
Sourcery refactored DOGE-TR branch #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: DOGE-TR
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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: | ||
|
Comment on lines
-339
to
+337
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return opt_file | ||
| return storage["name"] if storage else None | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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__}" | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lines
|
||
|
|
||
| doge.version = __version__ | ||
| if gvar("BOT_TOKEN"): | ||
|
|
@@ -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: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| 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) | ||
|
|
@@ -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
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return await event.client.send_message( | ||
| event.chat_id, | ||
| f"🛑 #ZATEN_BANLI\ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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)) | ||
| ), | ||
| ) | ||
|
|
||
|
|
@@ -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
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| if reason is not None: | ||
| banned_msg += f"\n**⛓ Sebep:** `{reason}`" | ||
| await doge.bot.send_message(user.id, banned_msg) | ||
|
|
||
There was a problem hiding this comment.
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.resultrefactored with the following changes:reintroduce-else)assign-if-exp)