-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Open
sourcery-ai
wants to merge
8
commits into
King-Userbot
Choose a base branch
from
sourcery/pull-72
base: King-Userbot
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5a7ece0
Update www.py
ABKeceX c78256e
Update king.py
ABKeceX 652e4cb
Update chat.py
ABKeceX 3864577
Update salam.py
ABKeceX dc49d17
Update help.py
ABKeceX 93dfbf7
Update app.json
ABKeceX 698165e
'Refactored by Sourcery'
aa69145
pylint: auto fixes
apisuserbot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,23 +108,23 @@ async def log(log_text): | |
@register(outgoing=True, pattern="^.kickme$") | ||
async def kickme(leave): | ||
""" Basically it's .kickme command """ | ||
await leave.edit(f"`⚡️ King {ALIVE_NAME} Telah Meninggalkan Grup...`") | ||
await leave.edit(f"`⚡️ Lord {ALIVE_NAME} Telah Meninggalkan Grup...`") | ||
await leave.client.kick_participant(leave.chat_id, 'me') | ||
|
||
|
||
@register(outgoing=True, pattern="^.leave$") | ||
async def kickme(leave): | ||
""" Basically it's .leave command """ | ||
await leave.edit(f"`⚡️ King {ALIVE_NAME} Telah Keluar Grup...`") | ||
await leave.edit(f"`⚡️ **Lord** {ALIVE_NAME} Telah Keluar Grup...`") | ||
await leave.client.kick_participant(leave.chat_id, 'me') | ||
|
||
|
||
@register(outgoing=True, pattern="^.keluar$") | ||
async def kickme(leave): | ||
""" Basically it's .keluar command """ | ||
await leave.edit("`Keluar ajalah anjg , GC AMPAS GAK GUNA INI ...`") | ||
await leave.edit("`Keluar ajalah anjg , **MEMBER** AMPAS GAK GUNA INI ...`") | ||
sleep(7) | ||
await leave.edit(f"`⚡️ King {ALIVE_NAME} Telah Keluar Grup...`") | ||
await leave.edit(f"`⚡️ **Lord** {ALIVE_NAME} Telah Keluar Grup...`") | ||
await leave.client.kick_participant(leave.chat_id, 'me') | ||
|
||
|
||
|
@@ -266,10 +266,10 @@ async def fetch_info(chat, event): | |
msg_info = None | ||
print("Exception:", e) | ||
# No chance for IndexError as it checks for msg_info.messages first | ||
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) | ||
creator_id = msg_info.users[0].id if creator_valid else None | ||
creator_firstname = msg_info.users[0].first_name if creator_valid and msg_info.users[ | ||
0].first_name is not None else "Akun Terhapus" | ||
|
@@ -334,7 +334,7 @@ async def fetch_info(chat, event): | |
except Exception as e: | ||
print("Exception:", e) | ||
if bots_list: | ||
for bot in bots_list: | ||
for _ in bots_list: | ||
bots += 1 | ||
|
||
caption = "<b>🤖 INFORMASI OBROLAN:</b>\n" | ||
|
@@ -389,7 +389,6 @@ async def fetch_info(chat, event): | |
caption += f", <code>{slowmode_time}s</code>\n\n" | ||
else: | ||
caption += "\n\n" | ||
if not broadcast: | ||
caption += f"Supergrup: {supergroup}\n\n" | ||
if hasattr(chat_obj_info, "Terbatas"): | ||
caption += f"Terbatas: {restricted}\n" | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
else: | ||
# https://lonamiwebs.github.io/Telethon/methods/channels/invite_to_channel.html | ||
for user_id in to_add_users.split(" "): | ||
|
@@ -438,7 +436,8 @@ async def _(event): | |
)) | ||
except Exception as e: | ||
await event.reply(str(e)) | ||
await event.edit("`Sukses Menambahkan Pengguna Ke Obrolan`") | ||
|
||
await event.edit("`Sukses Menambahkan Pengguna Ke Obrolan`") | ||
|
||
CMD_HELP.update( | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,14 +34,14 @@ async def help(event): | |
for i in CMD_HELP: | ||
string += "`" + str(i) | ||
string += "`\t| " | ||
await event.edit("⚡𝗞𝗶𝗻𝗴-𝙐𝙎𝙀𝙍𝘽𝙊𝙏⚡\n\n" | ||
f"**◑» King** {DEFAULTUSER}\n**◑» Plugins :** `{len(plugins)}`\n\n" | ||
await event.edit("⚡**『AB』**-𝙐𝙎𝙀𝙍𝘽𝙊𝙏⚡\n\n" | ||
f"**◑» Lord** {DEFAULTUSER}\n**◑» Plugins :** `{len(plugins)}`\n\n" | ||
"**❒ Main Menu ↯**\n" | ||
f"╰►| {string} ◄─") | ||
await event.reply( | ||
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** ' | ||
) | ||
|
||
Comment on lines
-42
to
+44
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 asyncio.sleep(1000) | ||
await event.delete() | ||
# fixes by apis | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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-ifs
)boolean-if-exp-identity
)for-index-underscore
)