-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
Cok-Userbot (Sourcery refactored) #73
base: King-Userbot
Are you sure you want to change the base?
Conversation
692eb2a
to
698165e
Compare
userbot/modules/chat.py
Outdated
first_msg_valid = True if msg_info and msg_info.messages and msg_info.messages[ | ||
0].id == 1 else False | ||
first_msg_valid = bool(msg_info and msg_info.messages and msg_info.messages[ | ||
0].id == 1) | ||
# Same for msg_info.users | ||
creator_valid = True if first_msg_valid and msg_info.users else False | ||
creator_valid = bool(first_msg_valid and msg_info.users) |
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 fetch_info
refactored with the following changes:
- Merge repeated if statements into single if (
merge-repeated-ifs
) - Simplify boolean if expression (
boolean-if-exp-identity
) - Replace unused for index with underscore (
for-index-underscore
)
@@ -427,7 +426,6 @@ async def _(event): | |||
)) | |||
except Exception as e: | |||
await event.reply(str(e)) | |||
await event.edit("`Sukses Menambahkan Pengguna Ke Obrolan`") |
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 _
refactored with the following changes:
- Hoist repeated code outside conditional statement (
hoist-statement-from-if
)
f"**◑» Perintah Plugin** \n\n" | ||
f"**Contoh : Ketik** `.help afk` **Untuk Informasi Pengunaan Plugin Afk\nAtau Bisa Juga Ketik** `.helpme` **Untuk Help Button Lain-Nya** \n\n" | ||
f"**USERBOT TELEGRAM** ") | ||
'**◑» Perintah Plugin** \n\n**Contoh : Ketik** `.help afk` **Untuk Informasi Pengunaan Plugin Afk\nAtau Bisa Juga Ketik** `.helpme` **Untuk Help Button Lain-Nya** \n\n**USERBOT TELEGRAM** ' | ||
) | ||
|
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 help
refactored with the following changes:
- Replace f-string with no interpolated values with string (
remove-redundant-fstring
)
Signed-off-by: apisuserbot <[email protected]>
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 0.78%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
Pull Request #72 refactored by Sourcery.
Since the original Pull Request was opened as a fork in a contributor's
repository, we are unable to create a Pull Request branching from it.
To incorporate these changes, you can either:
Merge this Pull Request instead of the original, or
Ask your contributor to locally incorporate these commits and push them to
the original Pull Request
Incorporate changes via command line
NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Help us improve this pull request!