Skip to content
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
wants to merge 8 commits into
base: King-Userbot
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 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
12 changes: 6 additions & 6 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "King-Userbot",
"description": "[King-Userbot] USERBOT TELEGRAM.",
"logo": "https://telegra.ph/file/632a843c5fbb0756e5b4e.jpg",
"name": "Cok-Userbot",
"description": "[Cok-Userbot] USERBOT TELEGRAM.",
"logo": "https://telegra.ph/file/1cdbbd432ccb206eb4c9b.jpg",
"keywords": [
"telegram",
"userbot",
Expand All @@ -11,7 +11,7 @@
],
"repository": "https://github.com/apisuserbot/King-Userbot",
"telegram": "https://t.me/PacarFerdilla",
"success_url": "https://t.me/KingUserbotSupport",
"success_url": "https://t.me/yangmutebabi",
"stack": "container",
"env": {
"API_KEY": {
Expand All @@ -23,7 +23,7 @@
"required": true
},
"STRING_SESSION": {
"description": "Dapatkan String Session di repl caranya ada di repo, jika tidak tau bisa ke @KingUserbotSupport lalu ketik #string",
"description": "Dapatkan String Session di repl caranya ada di repo, jika tidak tau bisa ke @yangmutebabi",
"required": true
},
"HEROKU_APP_NAME": {
Expand Down Expand Up @@ -151,7 +151,7 @@
},
"DEFAULT_BIO": {
"description": "Default Bio Mu.",
"value": "⚡️𝗞𝗶𝗻𝗴-𝙐𝙎𝙀𝙍𝘽𝙊𝙏⚡️",
"value": "<b>𖣘COK-𝙐𝙎𝙀𝙍𝘽𝙊𝙏𖣘<b>",
"required": false
},
"ALIVE_NAME": {
Expand Down
21 changes: 10 additions & 11 deletions userbot/modules/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')


Expand Down Expand Up @@ -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)
Copy link
Author

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:

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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -427,7 +426,6 @@ async def _(event):
))
except Exception as e:
await event.reply(str(e))
await event.edit("`Sukses Menambahkan Pengguna Ke Obrolan`")
Copy link
Author

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:

else:
# https://lonamiwebs.github.io/Telethon/methods/channels/invite_to_channel.html
for user_id in to_add_users.split(" "):
Expand All @@ -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(
{
Expand Down
10 changes: 5 additions & 5 deletions userbot/modules/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Author

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:

await asyncio.sleep(1000)
await event.delete()
# fixes by apis
Expand Down
7 changes: 4 additions & 3 deletions userbot/modules/king.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ async def typewriter(typew):
async def _(event):
event.pattern_match.group(1)
await event.edit(
f"`Halo {ALIVE_NAME} Saya Adalah Bot King Yang Menjaga Akun ini`"
f"`Agar Terhindar Dari Orang Orang Jahat Di Telegram`"
f"`Halo {ALIVE_NAME} Saya Adalah Bot Lord Yang Berada diAkun ini`"
f"`Agar Terhindar Dari Orang Orang Random Di Telegram`"
f"`Hai kakak manis, bolehkah mengirimkan pap tengktop xD`"
f"\n---------------------------------------------------"
f"\n__**(C) copyright 2021 King-Userbot USERBOT TELEGRAM**__"
f"\n\n**My King :** `{ALIVE_NAME}`")
f"\n\n**My Lord :** `{ID} `")

CMD_HELP.update(
{
Expand Down
4 changes: 2 additions & 2 deletions userbot/modules/salam.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ async def typewriter(typew):
@register(outgoing=True, pattern="^.Ass(?: |$)(.*)")
async def typewriter(typew):
typew.pattern_match.group(1)
await typew.edit(f"**Halo bro saya {DEFAULTUSER} salam kenal 😁**")
await typew.edit(f"**Halo bro,kak saya {DEFAULTUSER} salam kenal 😁😎**")
sleep(2)
await typew.edit("`Assalamualaikum Waruhmatulahi Wabarukatuh...`")


@register(outgoing=True, pattern="^.Waa(?: |$)(.*)")
async def typewriter(typew):
typew.pattern_match.group(1)
await typew.edit("**iyaa bro**")
await typew.edit("**Iyaa bro,kak**")
sleep(2)
await typew.edit("`Walaikumsalam Waruhmatulahi Wabarukatuh...`")

Expand Down
14 changes: 8 additions & 6 deletions userbot/modules/www.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async def pingme(pong):
uptime = await get_readable_time((time.time() - StartTime))
start = datetime.now()
await pong.edit("⚡")
await pong.edit("__**...💠KING💠...**__")
await pong.edit("__**...💠AB KING💠...**__")
await pong.edit("__**.....USERBOT.....**__")
await pong.edit("__**......MOHON MENUNGGU......**__")
await pong.edit("**0% ▒▒▒▒▒▒▒▒▒▒**")
Expand Down Expand Up @@ -114,19 +114,22 @@ async def pingme(pong):
start = datetime.now()
await pong.edit("**Memulai Test Sinyal**")
await pong.edit("**..Mohon menunggu..**")
await pong.edit("**...❤️‍🔥『AB』 Ӄᴇꮯᴇꪎꤪ Lord❤️‍🔥...**")
await pong.edit("**...................**")
await pong.edit("**DUARRR!**")
await pong.edit("**DUARRR MEMEK!**")
await pong.edit("**................**")
await pong.edit("**¸„.-•~¹°”¹⁸⁺ˆ˜¨『A̶̢̹̩̯̗̰̣͔̠͛̐͒͛̐̒̐̌ ̸̝͎̦́̔͠Β̸͌͂̑̆𖣘』×፝֟͜×◦𖤍𝙰͠ɴᴛͫʜͣ𒆜𓆩ɴʀᵈ᭄𓆪ꗄ¨˜ˆ¹⁸⁺”°¹~•-.„¸**")
await pomg.edit("**....Sabar Lord.......**")
await pong.edit("⚡️")
end = datetime.now()
duration = (end - start).microseconds / 1000
await pong.edit(f"卍════〠 **TEST PING** 〠════卍\n"
await pong.edit(f"卍════〠 **TEST PING TOD** 〠════卍\n"
f"═⎆ **Ping:** "
f"`%sms` \n"
f"═⎆ **Sisa Waktu:** "
f"`{uptime}` \n"
f"**✠➲ King:** `{ALIVE_NAME}`" % (duration))

f"**✠➲ Lord:** `{ALIVE_NAME}`" % (duration))
f"═⎆ **Pesan:Pap Tengktopnya Kakak🥰🥰** "

@register(outgoing=True, pattern="^.sinyal$")
async def pingme(pong):
Expand All @@ -149,7 +152,6 @@ async def pingme(pong):
f"`{uptime}` \n"
f"__|━|⎆__ **My king :** `{ALIVE_NAME}`" % (duration))


@register(outgoing=True, pattern="^.uping$")
async def pingme(pong):
""" For .uping command, ping the userbot from any chat. """
Expand Down