diff --git a/README.md b/README.md index 8801378..f13d338 100644 --- a/README.md +++ b/README.md @@ -6,19 +6,10 @@ [![LICENSE](https://img.shields.io/github/license/kastaid/getter)](LICENSE) ![Version](https://img.shields.io/github/manifest-json/v/kastaid/getter?label=Version) -## Disclaimer - -⚠️ **Important:** Your Telegram account may get banned. We are not responsible for any misuse of this userbot. - -If you spam, face issues with Telegram, or get your account deleted, **DON’T BLAME US!** -- No personal support. -- We won’t spoon-feed you. -- If you need help, ask in our support group, and we or others will try to help you. -- **DWYOR** (Do With Your Own Risk). - -Review the [Telegram API Terms of Service](https://core.telegram.org/api/terms). - -Thank you for trusting and using this userbot! +> [!WARNING] +> Your Telegram account may get banned if this userbot is misused. We are not responsible for any spam, violations, or account restrictions. +> +> Use it at your own risk and review the [Telegram API Terms](https://core.telegram.org/api/terms). ## Table of Contents @@ -42,7 +33,7 @@ Thank you for trusting and using this userbot! ## Requirements - Python 3.13+ -- Linux (recommended: latest Debian/Ubuntu) +- Linux (Debian/Ubuntu) - Telegram `API_ID` and `API_HASH` from [API development tools](https://my.telegram.org) ## Quick Start @@ -115,25 +106,25 @@ Deploy to Heroku with one click: Once successfully deployed, test your getter by sending `.ping` in any chat. -**Command prefix:** +**Command prefix**: - Default prefix is `.` (dot) - If you set a custom `HANDLER` in your [config](#config), use that prefix instead (e.g., `!ping`, `/ping`) - If `NO_HANDLER` is set to `True`, send commands without any prefix (e.g., `ping`) -**Get all commands:** `.help` - This will show you all available plugins, commands, and how to use them. +**Get all commands**: `.help` - This will show you all available plugins, commands, and how to use them. ## Custom Plugins Create custom plugins at `./getter/plugins/custom/plugin_name.py`. -**Dynamic plugin management:** +**Dynamic plugin management**: - Upload your `plugin_name.py` file anywhere in Telegram (plugin name must be unique) - Reply to the file with `.load` to download, activate, or update the plugin - Reply to the plugin file with `.unload [plugin_name]` to remove it -**Example plugin:** +**Example plugin**: ```python from . import kasta_cmd diff --git a/getter/__init__.py b/getter/__init__.py index 43bd96c..504559e 100644 --- a/getter/__init__.py +++ b/getter/__init__.py @@ -5,7 +5,7 @@ import sys from asyncio import set_event_loop -from concurrent.futures import ThreadPoolExecutor +from concurrent.futures.thread import ThreadPoolExecutor from pathlib import Path from platform import python_version from shutil import rmtree diff --git a/getter/core/decorators.py b/getter/core/decorators.py index cb24db8..2c6df90 100644 --- a/getter/core/decorators.py +++ b/getter/core/decorators.py @@ -182,30 +182,30 @@ async def wrapper(kst: Message) -> Callable: else: chat_type = "channel" ftext = r"\\#Getter_Error// Forward this to @kastaot" - ftext += "\n\nGetter Version: " + str(__version__) - ftext += "\nPython Version: " + str(__pyversion__) - ftext += "\nTelethon Version: " + str(__tlversion__) - ftext += "\nTelegram Layer: " + str(__layer__) + "\n\n" + ftext += "\n\nGetter Version: " + str(__version__) + ftext += "\nPython Version: " + str(__pyversion__) + ftext += "\nTelethon Version: " + str(__tlversion__) + ftext += "\nTelegram Layer: " + str(__layer__) + "\n\n" ftext += "START GETTER ERROR LOG" - ftext += "\n\nDate: " + date - ftext += "\nChat Type: " + chat_type - ftext += "\nChat ID: " + str(chat_id) - ftext += "\nChat Title: " + normalize(display_name(chat)).upper() - ftext += "\nUser ID: " + str(myself) - ftext += "\nIs Dev: " + str(kst.is_dev) - ftext += "\nIs Sudo: " + str(kst.is_sudo) - ftext += "\nReplied: " + str(kst.is_reply) - ftext += "\nMessage ID: " + str(kst.reply_to_msg_id or kst.id) - ftext += "\nMessage Link: " + str(kst.msg_link) - ftext += "\n\nEvent Trigger:\n" + ftext += "\n\nDate: " + date + ftext += "\nChat Type: " + chat_type + ftext += "\nChat ID: " + str(chat_id) + ftext += "\nChat Title: " + normalize(display_name(chat)).upper() + ftext += "\nUser ID: " + str(myself) + ftext += "\nIs Dev: " + str(kst.is_dev) + ftext += "\nIs Sudo: " + str(kst.is_sudo) + ftext += "\nReplied: " + str(kst.is_reply) + ftext += "\nMessage ID: " + str(kst.reply_to_msg_id or kst.id) + ftext += "\nMessage Link: " + str(kst.msg_link) + ftext += "\n\nEvent Trigger:\n" ftext += str(kst.text) - ftext += "\n\nTraceback Info:\n
"
+                ftext += "\n\nTraceback Info:\n
"
                 ftext += str(format_exc()).strip()
-                ftext += "
\n\nError Text:\n" + ftext += "
\n\nError Text:\n" ftext += str(sys.exc_info()[1]).strip() ftext += "\n\nEND GETTER ERROR LOG" if not Var.DEV_MODE: - ftext += "\n\nLast 5 Commits:\n
"
+                    ftext += "\n\nLast 5 Commits:\n
"
                     stdout, stderr, _, _ = await Runner('git log --pretty=format:"%an: %s" -5')
                     result = stdout + stderr
                     ftext += result + "
" @@ -234,7 +234,7 @@ async def wrapper(kst: Message) -> Callable: ) if kst.out and BOTLOGS and error_log: text = r"\\#Getter_Error//" - text += "\nAn error details: {}" + text += "\nAn error details: {}" if kst.is_private: text = text.format(error_log.msg_link) else: diff --git a/getter/core/startup.py b/getter/core/startup.py index 8c300bc..de090f1 100644 --- a/getter/core/startup.py +++ b/getter/core/startup.py @@ -40,28 +40,28 @@ IF IGNORED THIS MESSAGE THE BOT WILL NOT WORK -Chat ID: {} -Your ID: {} +Chat ID: {} +Your ID: {} -Our Channel: @kastaid +Our Channel: @kastaid """ _restart_text = r""" \\**#Getter**// **is back and alive!** -├ **Sudo:** `{}` -├ **PM-Guard:** `{}` -├ **PM-Logs:** `{}` -├ **PM-Block:** `{}` -├ **Anti-PM:** `{}` -└ **Version:** `{}` +├ **Sudo**: `{}` +├ **PM-Guard**: `{}` +├ **PM-Logs**: `{}` +├ **PM-Block**: `{}` +├ **Anti-PM**: `{}` +└ **Version**: `{}` """ _reboot_text = r""" \\**#Getter**// **is rebooted and applied!** -├ **Sudo:** `{}` -├ **PM-Guard:** `{}` -├ **PM-Logs:** `{}` -├ **PM-Block:** `{}` -├ **Anti-PM:** `{}` -└ **Version:** `{}` +├ **Sudo**: `{}` +├ **PM-Guard**: `{}` +├ **PM-Logs**: `{}` +├ **PM-Block**: `{}` +├ **Anti-PM**: `{}` +└ **Version**: `{}` """ diff --git a/getter/plugins/_watcher.py b/getter/plugins/_watcher.py index f17acb7..b9c50ae 100644 --- a/getter/plugins/_watcher.py +++ b/getter/plugins/_watcher.py @@ -21,12 +21,12 @@ gbanned_text = r""" \\#GBanned_Watch// User {} joined and quickly banned! -Reported: {} -Reason: {} +Reported: {} +Reason: {} """ gmuted_text = r""" \\#GMuted_Watch// User {} joined and quickly muted! -Reason: {} +Reason: {} """ _WATCHER_SEM = asyncio.Semaphore(2) @@ -101,8 +101,8 @@ async def JoinedHandler(kst): await ga.edit_permissions(chat.id, user.id, view_messages=False) except BaseException: pass - logs_text += f"Reported: {humanbool(is_reported)}\n" - logs_text += "Reason: {}\n".format(f"
{gban.reason}
" if gban.reason else "None given.") + logs_text += f"Reported: {humanbool(is_reported)}\n" + logs_text += "Reason: {}\n".format(f"
{gban.reason}
" if gban.reason else "None given.") await sendlog(logs_text) gmute = await is_gmute(user.id, use_cache=True) @@ -122,5 +122,5 @@ async def JoinedHandler(kst): await ga.edit_permissions(chat.id, user.id, send_messages=False) except BaseException: pass - logs_text += "Reason: {}\n".format(f"
{gban.reason}
" if gban.reason else "None given.") + logs_text += "Reason: {}\n".format(f"
{gban.reason}
" if gban.reason else "None given.") await sendlog(logs_text) diff --git a/getter/plugins/admintools.py b/getter/plugins/admintools.py index 4c7c803..2b2f2fd 100644 --- a/getter/plugins/admintools.py +++ b/getter/plugins/admintools.py @@ -58,7 +58,7 @@ async def _(kst): text = "{} banned and {} reported!{}".format( mentionuser(user.id, display_name(user), width=15, html=True), "was" if is_reported else "not", - f"\nReason:
{reason}
" if reason else "", + f"\nReason:
{reason}
" if reason else "", ) await yy.eor(text, parse_mode="html") except Exception as err: @@ -102,7 +102,7 @@ async def _(kst): text = "{} dbanned and {} reported!{}".format( mentionuser(user.id, display_name(user), width=15, html=True), "was" if is_reported else "not", - f"\nReason:
{reason}
" if reason else "", + f"\nReason:
{reason}
" if reason else "", ) await yy.eor(text, parse_mode="html") except Exception as err: @@ -168,10 +168,10 @@ async def _(kst): until_date, duration = until_time(timing[:-1], timing[-1]) try: await ga.edit_permissions(chat_id, user.id, until_date=until_date, view_messages=False) - text = "{} temporarily banned!\nDuration: {}{}".format( + text = "{} temporarily banned!\nDuration: {}{}".format( mentionuser(user.id, display_name(user), width=15, html=True), f"{timing[:-1]} {duration}", - f"\nReason:
{reason}
" if reason else "", + f"\nReason:
{reason}
" if reason else "", ) await yy.eor(text, parse_mode="html") except Exception as err: @@ -196,7 +196,7 @@ async def _(kst): await ga.edit_permissions(chat_id, user.id) text = "{} unbanned!{}".format( mentionuser(user.id, display_name(user), width=15, html=True), - f"\nReason:
{reason}
" if reason else "", + f"\nReason:
{reason}
" if reason else "", ) await yy.eor(text, parse_mode="html") except Exception as err: @@ -223,7 +223,7 @@ async def _(kst): await ga.edit_permissions(chat_id, user.id, send_messages=False) text = "{} muted!{}".format( mentionuser(user.id, display_name(user), width=15, html=True), - f"\nReason:
{reason}
" if reason else "", + f"\nReason:
{reason}
" if reason else "", ) await yy.eor(text, parse_mode="html") except Exception as err: @@ -253,7 +253,7 @@ async def _(kst): await reply.try_delete() text = "{} dmuted!{}".format( mentionuser(user.id, display_name(user), width=15, html=True), - f"\nReason:
{reason}
" if reason else "", + f"\nReason:
{reason}
" if reason else "", ) await yy.eor(text, parse_mode="html") except Exception as err: @@ -306,10 +306,10 @@ async def _(kst): until_date, duration = until_time(timing[:-1], timing[-1]) try: await ga.edit_permissions(chat_id, user.id, until_date=until_date, send_messages=False) - text = "{} temporarily muted!\nDuration: {}{}".format( + text = "{} temporarily muted!\nDuration: {}{}".format( mentionuser(user.id, display_name(user), width=15, html=True), f"{timing[:-1]} {duration}", - f"\nReason:
{reason}
" if reason else "", + f"\nReason:
{reason}
" if reason else "", ) await yy.eor(text, parse_mode="html") except Exception as err: @@ -336,7 +336,7 @@ async def _(kst): await ga.edit_permissions(chat_id, user.id, send_messages=True) text = "{} unmuted!{}".format( mentionuser(user.id, display_name(user), width=15, html=True), - f"\nReason:
{reason}
" if reason else "", + f"\nReason:
{reason}
" if reason else "", ) await yy.eor(text, parse_mode="html") except Exception as err: @@ -363,7 +363,7 @@ async def _(kst): await ga.kick_participant(chat_id, user.id) text = "{} kicked!{}".format( mentionuser(user.id, display_name(user), width=15, html=True), - f"\nReason:
{reason}
" if reason else "", + f"\nReason:
{reason}
" if reason else "", ) await yy.eor(text, parse_mode="html") except Exception as err: @@ -393,7 +393,7 @@ async def _(kst): await reply.try_delete() text = "{} dkicked!{}".format( mentionuser(user.id, display_name(user), width=15, html=True), - f"\nReason:
{reason}
" if reason else "", + f"\nReason:
{reason}
" if reason else "", ) await yy.eor(text, parse_mode="html") except Exception as err: @@ -593,7 +593,7 @@ async def _(kst): btn = "Go to message..." pinned += f"{count}. {btn}\n" count += 1 - text = f"Pinned message(s) in {normalize(title).lower()}:\n" + text = f"Pinned message(s) in {normalize(title).lower()}:\n" if not pinned: return await yy.eor("`No Pinned!`", time=5) await yy.eor(text + pinned, parts=True, parse_mode="html") @@ -853,7 +853,7 @@ async def _(kst): chat = await kst.get_chat() yy = await kst.eor("`Processing...`") total = 0 - text = f"Admins in {normalize(chat.title).lower()}:\n" + text = f"Admins in {normalize(chat.title).lower()}:\n" async for x in ga.iter_participants( chat, filter=typ.ChannelParticipantsAdmins, @@ -876,12 +876,12 @@ async def _(kst): "{i}ban [reply]/[username/mention/id] [reason]": "Ban user and report them as spam.", "{i}dban [reply] [reason]": "Ban user by reply, delete their message and report them as spam.", "{i}sban [reply]/[username/mention/id]": "Silently a ban user, delete my message and report them as spam.", - "{i}tban [reply]/[username/mention/id] [timing] [reason]": "Temporarily ban user. **timing:** 4m = 4 minutes, 3h = 3 hours, 6d = 6 days.", + "{i}tban [reply]/[username/mention/id] [timing] [reason]": "Temporarily ban user. **timing**: 4m = 4 minutes, 3h = 3 hours, 6d = 6 days.", "{i}unban [reply]/[username/mention/id] [reason]": "Unbanned user.", "{i}mute [reply]/[username/mention/id] [reason]": "Mute user.", "{i}dmute [reply] [reason]": "Mute user by reply, and delete their message.", "{i}smute [reply]/[username/mention/id]": "Silently mute user, and delete my message.", - "{i}tmute [reply]/[username/mention/id] [timing] [reason]": "Temporarily mute user. **timing:** 4m = 4 minutes, 3h = 3 hours, 6d = 6 days.", + "{i}tmute [reply]/[username/mention/id] [timing] [reason]": "Temporarily mute user. **timing**: 4m = 4 minutes, 3h = 3 hours, 6d = 6 days.", "{i}unmute [reply]/[username/mention/id] [reason]": "Unmute user.", "{i}kick [reply]/[username/mention/id] [reason]": "Kick user.", "{i}dkick [reply] [reason]": "Kick user by reply, and delete their message.", @@ -901,7 +901,7 @@ async def _(kst): "{i}unbanall": "Unban all banned users.", "{i}adminlist": """Get list all admins by type in current group. -**Examples:** +**Examples**: - Mute user for two hours. -> `{i}tmute @username 2h abuse` diff --git a/getter/plugins/afk.py b/getter/plugins/afk.py index 3192435..5717f27 100644 --- a/getter/plugins/afk.py +++ b/getter/plugins/afk.py @@ -53,7 +53,7 @@ async def _(kst): text = "I’m now AFK!" if reason: reason = escape(reason) - text += f"\nReason:
{reason}
" + text += f"\nReason:
{reason}
" await add_afk(reason, start) getter_app.add_handler( StopAFK, @@ -113,7 +113,7 @@ async def OnAFK(kst): text = "I’m on AFK!\n" text += f"Last seen {afk_time} ago." reason = f"
{afk.reason}
" if afk.reason else "No reason." - text += f"\nReason: {reason}" + text += f"\nReason: {reason}" chat_id = str(kst.chat_id) if chat_id in afk.last: try: @@ -151,7 +151,7 @@ async def handle_afk() -> None: "{i}afk [reason]/[reply]": "When you are in AFK if anyone tags you then will notify them if you're AFK unless if 'afk' or 'brb' words is exists!", "brb": """Alias for afk command, without handler! -**Note:** +**Notes**: - AFK is abbreviation for “Away From Keyboard”. - BRB also abbreviation for “Be Right Back”. - To stopping AFK just typing at anywhere. diff --git a/getter/plugins/beautify.py b/getter/plugins/beautify.py index 9589fba..964bb8c 100644 --- a/getter/plugins/beautify.py +++ b/getter/plugins/beautify.py @@ -131,8 +131,8 @@ async def _(kst): pattern="theme$", ) async def _(kst): - carbon = f"**{len(CARBON_PRESETS)} Carbon Themes:**\n" + "\n".join([f"- `{_}`" for _ in CARBON_PRESETS]) - rayso = f"**{len(RAYSO_THEMES)} Rayso Themes:**\n" + "\n".join([f"- `{_}`" for _ in RAYSO_THEMES]) + carbon = f"**{len(CARBON_PRESETS)} Carbon Themes**:\n" + "\n".join([f"- `{_}`" for _ in CARBON_PRESETS]) + rayso = f"**{len(RAYSO_THEMES)} Rayso Themes**:\n" + "\n".join([f"- `{_}`" for _ in RAYSO_THEMES]) await kst.sod(carbon) await kst.sod(rayso) diff --git a/getter/plugins/bot.py b/getter/plugins/bot.py index bec950f..012c0f7 100644 --- a/getter/plugins/bot.py +++ b/getter/plugins/bot.py @@ -38,7 +38,7 @@ async def _(kst): pattern="(uptime|up)$", ) async def _(kst): - await kst.eod(f"**Uptime:** {kst.client.uptime}") + await kst.eod(f"**Uptime**: {kst.client.uptime}") @kasta_cmd( diff --git a/getter/plugins/core.py b/getter/plugins/core.py index 7ca103b..e24c43e 100644 --- a/getter/plugins/core.py +++ b/getter/plugins/core.py @@ -41,19 +41,19 @@ invite_text = """ 🔄 INVITING... -• Invited: {} -• Failed: {} -Last Error: {} +• Invited: {} +• Failed: {} +Last Error: {} """ done_text = """ ✅ DONE INVITING -• Invited: {} -• Failed: {} -• Taken: {} +• Invited: {} +• Failed: {} +• Taken: {} -User: {} -Time: {} +User: {} +Time: {} """ done_limit_text = """ ✅ DONE INVITING GOT LIMIT @@ -64,12 +64,12 @@ Error
{}
-• Invited: {} -• Failed: {} -• Taken: {} +• Invited: {} +• Failed: {} +• Taken: {} -User: {} -Time: {} +User: {} +Time: {} """ done_error_text = """ ⚠️ DONE INVITING AN ERROR @@ -77,31 +77,31 @@ Error
{}
-• Invited: {} -• Failed: {} -• Taken: {} +• Invited: {} +• Failed: {} +• Taken: {} -User: {} -Time: {} +User: {} +Time: {} """ getmembers_text = """ ✅ Scraping {} completed in {} -ID: {} -Title: {} -Username: {} -Total: {} -Done ({}): {} -Time: {} +ID: {} +Title: {} +Username: {} +Total: {} +Done ({}): {} +Time: {} """ no_process_text = "`There is no running proccess.`" canceled_text = """ ✅ **The process has been canceled** -**Mode:** `{}` -**Current:** `{}` -**{}:** `{}` -**Time:** `{}` +**Mode**: `{}` +**Current**: `{}` +**{}**: `{}` +**Time**: `{}` """ _INVITING_LOCK, _SCRAPING_LOCK, _ADDING_LOCK = asyncio.Lock(), asyncio.Lock(), asyncio.Lock() @@ -598,7 +598,7 @@ async def get_chat_info(kst, yy, group=1): "{i}getmembers [username/link/id]/[reply] [append/a]": """Scraping members from the group and then save as csv files (members, admins, bots). Run this command in everywhere exclude the target groups. -**Note:** +**Notes**: - You must join the target if you use id, for two commands above. - Do not delete running messages if you have running process or the process will be stopped and users can't join. - Telethon (Telegram APIs) have a limit to scraping members. If you need to get more members use this command with options 'append' or 'a' example: <`{i}getmembers @username append`>. Repeat it after finished to get more members without duplicated rows. You can also combination with difference groups! diff --git a/getter/plugins/dev.py b/getter/plugins/dev.py index d0316ee..c1111c5 100644 --- a/getter/plugins/dev.py +++ b/getter/plugins/dev.py @@ -120,9 +120,9 @@ async def _(kst): humanbytes(sfolder + sfile), ) directory += f""" -Folders: {cfolder} / {hfolder} -Files: {cfile} / {hfile} -Total: {cfile + cfolder} / {htotal} +Folders: {cfolder} / {hfolder} +Files: {cfile} / {hfile} +Total: {cfile + cfolder} / {htotal} """ if len(directory) > MAX_MESSAGE_LEN: directory = strip_format(directory) @@ -149,7 +149,7 @@ async def _(kst): yy = await kst.eor("`Evaluating...`") try: out = eval(code) - result = f"Evaluate:\n
{code}
\n\n" + result = f"Evaluate:\n
{code}
\n\n" result += f"Result:\n
{out}
" await yy.sod(result, parse_mode="html") except Exception as err: @@ -183,8 +183,8 @@ async def _(kst): sys.stdout = old_stdout sys.stderr = old_stderr execute = exc or stderr or stdout or _parse_eval(value) or "Success" - result = f"Execute:\n
{code}
\n\n" - result += f"Result:\n
{execute}
" + result = f"Execute:\n
{code}
\n\n" + result += f"Result:\n
{execute}
" if len(result) > MAX_MESSAGE_LEN: with BytesIO(str.encode(strip_format(result))) as file: file.name = "exec.txt" @@ -219,11 +219,11 @@ async def _(kst): result = f"{icon}
{cmd}
\n\n" err, out = "", "" if stderr: - err = f"Error:\n
{stderr}
\n\n" + err = f"Error:\n
{stderr}
\n\n" if stdout: - out = f"Result:\n
{stdout}
" + out = f"Result:\n
{stdout}
" if not stderr and not stdout: - out = "Result:\nsuccess" + out = "Result:\nsuccess" result += err + out if len(result) > MAX_MESSAGE_LEN: with BytesIO(str.encode(strip_format(result))) as file: @@ -243,7 +243,7 @@ async def _(kst): for_dev=True, ) async def _(kst): - cmds = "**Developer Commands:**\n" + "\n".join(["- {}: {}".format(x, ", ".join(y)) for x, y in DEV_CMDS.items()]) + cmds = "**Developer Commands**:\n" + "\n".join(["- {}: {}".format(x, ", ".join(y)) for x, y in DEV_CMDS.items()]) await kst.sod(cmds) @@ -301,7 +301,7 @@ async def aexec(code, event): "{i}ls [path]/[reply]": "View all files and folders inside a directory.", "{i}eval [code]/[reply]": "Evaluate Python code.", "{i}exec [code]/[reply]": """Execute Python code. -**Exec Shortcuts:** +**Exec Shortcuts**: `fun = telethon.tl.functions` `typ = telethon.tl.types` `client = bot = event.client` @@ -311,7 +311,7 @@ async def aexec(code, event): `chat = event.chat_id` """, "{i}shell|{i}sh [command]/[reply]": """Run the linux commands. -**Shell Command Snippets:** +**Shell Command Snippets**: `echo Hello, World!` `python3 --version` `python3 -c 'import time;print(time.ctime())'` diff --git a/getter/plugins/downloader.py b/getter/plugins/downloader.py index 9335306..25e0f91 100644 --- a/getter/plugins/downloader.py +++ b/getter/plugins/downloader.py @@ -30,7 +30,7 @@ async def _(kst): return await yy.eod(f"`{resp.message.message}`") file = resp.message.media await yy.eor( - f"**Link:** `{link}`", + f"**Link**: `{link}`", file=file, force_document=False, ) @@ -54,7 +54,7 @@ async def _(kst): return await yy.eod(f"`{resp.message.message}`") file = resp.message.media await yy.eor( - f"**Link:** `{link}`", + f"**Link**: `{link}`", file=file, force_document=False, ) diff --git a/getter/plugins/fake.py b/getter/plugins/fake.py index 9a35036..7679a6f 100644 --- a/getter/plugins/fake.py +++ b/getter/plugins/fake.py @@ -20,16 +20,16 @@ fgban_text = r""" \\#GBanned// User {} in {} chats! -Date: {} -Taken: {} -Reported: {} -Reason: {} +Date: {} +Taken: {} +Reported: {} +Reason: {} Added to GBanned_Watch. """ fungban_text = r""" \\#UnGBanned// User {} in {} chats! -Taken: {} +Taken: {} Wait for 1 minutes before released. """ diff --git a/getter/plugins/games.py b/getter/plugins/games.py index 1549cc8..e832875 100644 --- a/getter/plugins/games.py +++ b/getter/plugins/games.py @@ -32,7 +32,7 @@ async def _(kst): entity=chat, ) games = [getattr(_, "title", "") for _ in res if isinstance(_, InlineResult)] - text = f"**{len(games)} Games:**\n" + "\n".join([f"- `{_}`" for _ in games]) + text = f"**{len(games)} Games**:\n" + "\n".join([f"- `{_}`" for _ in games]) text += "\n\n__Choose one, tap or copy, then put to 'game' command!__" await yy.eor(text, parts=True) except Exception as err: @@ -69,7 +69,7 @@ async def _(kst): ) await yy.try_delete() except IndexError: - await yy.eod(f"**No Results for:** `{query}`") + await yy.eod(f"**No Results for**: `{query}`") except Exception as err: await yy.eor(formatx_send(err), parse_mode="html") diff --git a/getter/plugins/globaltools.py b/getter/plugins/globaltools.py index 92f3fc2..383a481 100644 --- a/getter/plugins/globaltools.py +++ b/getter/plugins/globaltools.py @@ -54,37 +54,37 @@ gban_text = r""" \\#GBanned// User {} in {}-{}={} chats! -Date: {} -Taken: {} -Reported: {} -Reason: {} +Date: {} +Taken: {} +Reported: {} +Reason: {} Added to GBanned_Watch. """ ungban_text = r""" \\#UnGBanned// User {} in {}-{}={} chats! -Taken: {} +Taken: {} Wait for 1 minutes before released. """ gmute_text = r""" \\#GMuted// User {} in {}-{}={} groups! -Date: {} -Taken: {} -Reason: {} +Date: {} +Taken: {} +Reason: {} Added to GMuted_Watch. """ ungmute_text = r""" \\#UnGMuted// User {} in {}-{}={} groups! -Taken: {} +Taken: {} Wait for 1 minutes before released. """ gdel_text = r""" \\#GDeleted// User {} in chats! -Date: {} -Reason: {} +Date: {} +Reason: {} """ ungdel_text = r""" \\#UnGDeleted// User {} in chats! @@ -93,22 +93,22 @@ """ reason_text = r""" \\#{}// Reason for {} updated! -Previous Reason:
{}
-New Reason:
{}
+Previous Reason:
{}
+New Reason:
{}
""" gkick_text = r""" \\#GKicked// User {} in {}-{}={} chats! -Taken: {} -Reason: {} +Taken: {} +Reason: {} """ gpromote_text = r""" \\#GPromoted// User {} in {}-{}={} {}! -Title: {} -Taken: {} +Title: {} +Taken: {} """ gdemote_text = r""" \\#GDemoted// User {} in {}-{}={} {}! -Taken: {} +Taken: {} """ _GBAN_LOCK = asyncio.Lock() _UNGBAN_LOCK = asyncio.Lock() diff --git a/getter/plugins/help.py b/getter/plugins/help.py index 42466ea..39a7ed0 100644 --- a/getter/plugins/help.py +++ b/getter/plugins/help.py @@ -30,19 +30,17 @@ ┣ Commands{}Sudo{} ┗━━━━━━━━━━━━━━━━━━━━━━━━ -~ All plugins name and commands: +~ All plugins name and commands: {} -
Usage: {}help [plugin_name] -Tips: +
Usage: {}help [plugin_name] +Tips: - To check how fast response use {}ping - Get details about ur self use {}test - Collect ur stats by using {}stats - Get users ids use {}id - Get users info use {}info
- -(c) @kastaid #getter """ @@ -55,22 +53,15 @@ async def _(kst): yy = await kst.eor("`Loading...`") plugin_name = (await ga.get_text(kst)).lower() if plugin_name: - name = None if plugin_name in plugins_help: name = plugin_name else: - for _ in plugin_name.split(): - if _ in plugins_help: - name = _ - break + name = next((i for i in plugin_name.split() if i in plugins_help), None) if name: cmds = plugins_help[name] - text = f"**{len(cmds)} Help For {name.upper()}** <`{hl}help {name}`>\n\n" + text = f"**{len(cmds)} Help for {name.upper()}** <`{hl}help {name}`>\n\n" for cmd, desc in cmds.items(): - # cmd --> cmd.split(maxsplit=1)[0] - # args --> cmd.split(maxsplit=1)[1] text += "**❯** `{}`\n{}\n\n".format(cmd.replace("{i}", hl), desc.strip().replace("{i}", hl)) - text += "(c) @kastaid #getter" return await yy.sod(text) return await yy.sod( f"**404 Plugin Not Found ➞** `{plugin_name}`\nType `{hl}help` to see valid plugins name." diff --git a/getter/plugins/info.py b/getter/plugins/info.py index 4400f9f..5ae5424 100644 --- a/getter/plugins/info.py +++ b/getter/plugins/info.py @@ -47,9 +47,9 @@ async def _(kst): dc = await kst.client(fun.help.GetNearestDcRequest()) await kst.eor( - f"├ **Country:** `{dc.country}`\n" - f"├ **Nearest Datacenter:** `{dc.nearest_dc}`\n" - f"└ **This Datacenter:** `{dc.this_dc}`", + f"├ **Country**: `{dc.country}`\n" + f"├ **Nearest Datacenter**: `{dc.nearest_dc}`\n" + f"└ **This Datacenter**: `{dc.this_dc}`", ) @@ -200,30 +200,30 @@ async def _(kst): allowed_users = len(await all_allow()) stop_time = monotonic() - start_time graph = """Stats for {} -├ Private: {} -┊ ├ Users: {} -┊ ├ Bots: {} -├ Groups: {} -├ Channels: {} -├ Admin Groups: {} -┊ ├ Creator: {} -┊ ├ Admin Rights: {} -├ Admin Channels: {} -┊ ├ Creator: {} -┊ ├ Admin Rights: {} -├ Unread: {} -├ Unread Mentions: {} -├ Archived: {} -├ Blocked Users: {} -├ Gifs Saved: {} -├ Stickers Pack Installed: {} -├ Stickers Pack Created: {} -├ Bots Created: {} -├ Gbanned Users: {} -├ Gmuted Users: {} -├ Sudo Users: {} -├ Allowed Users PM: {} -└ It Took: {}s""".format( +├ Private: {} +┊ ├ Users: {} +┊ ├ Bots: {} +├ Groups: {} +├ Channels: {} +├ Admin Groups: {} +┊ ├ Creator: {} +┊ ├ Admin Rights: {} +├ Admin Channels: {} +┊ ├ Creator: {} +┊ ├ Admin Rights: {} +├ Unread: {} +├ Unread Mentions: {} +├ Archived: {} +├ Blocked Users: {} +├ Gifs Saved: {} +├ Stickers Pack Installed: {} +├ Stickers Pack Created: {} +├ Bots Created: {} +├ Gbanned Users: {} +├ Gmuted Users: {} +├ Sudo Users: {} +├ Allowed Users PM: {} +└ It Took: {}s""".format( ga.full_name, private_chats, private_chats - bots, @@ -269,19 +269,19 @@ async def _(kst): if kst.is_reply: user_id, msg_id = (await kst.get_reply_message()).sender_id, kst.reply_to_msg_id if kst.is_private: - ids = f"├ **User ID:** `{user_id}`\n" + ids = f"├ **User ID**: `{user_id}`\n" else: - ids = f"├ **Chat ID:** `{chat_id}`\n" - ids += f"├ **User ID:** `{user_id}`\n" - ids += f"└ **Message ID:** `{msg_id}`" + ids = f"├ **Chat ID**: `{chat_id}`\n" + ids += f"├ **User ID**: `{user_id}`\n" + ids += f"└ **Message ID**: `{msg_id}`" else: if user_id: - ids = f"├ **User ID:** `{user_id}`\n" - ids += f"├ **Chat ID:** `{chat_id}`\n" + ids = f"├ **User ID**: `{user_id}`\n" + ids += f"├ **Chat ID**: `{chat_id}`\n" else: - ids = "├ **User ID:** " if kst.is_private else "├ **Chat ID:** " + ids = "├ **User ID**: " if kst.is_private else "├ **Chat ID**: " ids += f"`{chat_id}`\n" - ids += f"└ **Message ID:** `{kst.id}`" + ids += f"└ **Message ID**: `{kst.id}`" await kst.eor(ids) @@ -307,9 +307,9 @@ async def _(kst): collect = [_.title + "\n" for _ in chat.chats] whois = display_name(await ga.get_entity(user.id)) if collect: - text = f"{len(collect)} Groups in common with: {whois}\n" + "".join(collect) + text = f"{len(collect)} Groups in common with: {whois}\n" + "".join(collect) else: - text = f"0 Groups in common with: {whois}" + text = f"0 Groups in common with: {whois}" await yy.eor(text, parts=True, parse_mode="html") except Exception as err: await yy.eor(formatx_send(err), parse_mode="html") @@ -341,36 +341,36 @@ async def _(kst): try: async with ga.conversation(CREATED_BOT) as conv: resp = await conv_created(conv, user_id) - created = f"\n├ Created: {resp}" + created = f"\n├ Created: {resp}" await ga.delete_dialog(CREATED_BOT, revoke=True) except BaseException: pass dc_id = (user.photo and user.photo.dc_id) or 0 first_name = escape(user.first_name).replace("\u2060", "") last_name = ( - user.last_name and "\n├ Last Name: {}".format(user.last_name.replace("\u2060", "")) + user.last_name and "\n├ Last Name: {}".format(user.last_name.replace("\u2060", "")) ) or "" - username = (user.username and f"\n├ Username: @{user.username}") or "" + username = (user.username and f"\n├ Username: @{user.username}") or "" user_pictures = (await ga.get_profile_photos(user_id, limit=0)).total or 0 user_status = get_user_status(user) user_bio = escape(full_user.about or "") if not is_full: caption = f"""USER INFORMATION -├ ID: {user_id}{created} -├ DC ID: {dc_id} -├ First Name: {first_name}{last_name}{username} -├ Profile: Link -├ Pictures: {user_pictures} -├ Last Seen: {user_status} -├ Is Premium: {humanbool(user.premium)} -├ Is Bot: {humanbool(user.bot)} -├ Is Blocked: {humanbool(full_user.blocked)} -├ Is Contact: {humanbool(user.contact)} -├ Is Deleted: {humanbool(user.deleted)} -├ Is Private Forward: {humanbool(full_user.private_forward_name)} -├ Is Scam: {humanbool(user.scam)} -├ Groups In Common: {full_user.common_chats_count} -└ Bio: +├ ID: {user_id}{created} +├ DC ID: {dc_id} +├ First Name: {first_name}{last_name}{username} +├ Profile: Link +├ Pictures: {user_pictures} +├ Last Seen: {user_status} +├ Is Premium: {humanbool(user.premium)} +├ Is Bot: {humanbool(user.bot)} +├ Is Blocked: {humanbool(full_user.blocked)} +├ Is Contact: {humanbool(user.contact)} +├ Is Deleted: {humanbool(user.deleted)} +├ Is Private Forward: {humanbool(full_user.private_forward_name)} +├ Is Scam: {humanbool(user.scam)} +├ Groups In Common: {full_user.common_chats_count} +└ Bio:
{user_bio}
""" else: is_rose_fban = await get_rose_fban(kst, user_id) @@ -381,35 +381,35 @@ async def _(kst): is_sudo = user_id in await jdata.sudo_users() is_allowed = bool(await is_allow(user_id)) caption = """USER INFORMATION -├ ID: {}{} -├ DC ID: {} -├ First Name: {}{}{} -├ Language: {} -├ Profile: Link -├ Pictures: {} -├ Last Seen: {} -├ Is Premium: {} -├ Is Bot: {} -├ Is Blocked: {} -├ Is Contact: {} -├ Is Deleted: {} -├ Is Private Forward: {} -├ Is Scam: {} -├ Is Fake: {} -├ Is Restricted: {} -├ Is Support: {} -├ Is Verified: {} -├ Is Mutual Contact: {} -├ Is Emoji Status: {} -├ Is Rose Fban: {} -├ Is SpamWatch Banned: {} -├ Is CAS Banned: {} -├ Is Gbanned: {} -├ Is Gmuted: {} -├ Is Sudo: {} -├ Is Allowed PM: {} -├ Groups In Common: {} -└ Bio: +├ ID: {}{} +├ DC ID: {} +├ First Name: {}{}{} +├ Language: {} +├ Profile: Link +├ Pictures: {} +├ Last Seen: {} +├ Is Premium: {} +├ Is Bot: {} +├ Is Blocked: {} +├ Is Contact: {} +├ Is Deleted: {} +├ Is Private Forward: {} +├ Is Scam: {} +├ Is Fake: {} +├ Is Restricted: {} +├ Is Support: {} +├ Is Verified: {} +├ Is Mutual Contact: {} +├ Is Emoji Status: {} +├ Is Rose Fban: {} +├ Is SpamWatch Banned: {} +├ Is CAS Banned: {} +├ Is Gbanned: {} +├ Is Gmuted: {} +├ Is Sudo: {} +├ Is Allowed PM: {} +├ Groups In Common: {} +└ Bio:
{}
""".format( user_id, created, @@ -481,16 +481,16 @@ async def _(kst): maps = (await ga.get_messages(chat_id, limit=0, filter=typ.InputMessagesFilterGeo())).total contact = (await ga.get_messages(chat_id, limit=0, filter=typ.InputMessagesFilterContacts())).total text = f"""{total} TOTAL MESSAGES -├ Photo: {photo} -├ Video: {video} -├ Music: {music} -├ Voice Note: {voice_note} -├ Video Note: {video_note} -├ Document: {files} -├ URL: {urls} -├ Gif: {gifs} -├ Map: {maps} -└ Contact: {contact}""" +├ Photo: {photo} +├ Video: {video} +├ Music: {music} +├ Voice Note: {voice_note} +├ Video Note: {video_note} +├ Document: {files} +├ URL: {urls} +├ Gif: {gifs} +├ Map: {maps} +└ Contact: {contact}""" await yy.eor(text, parse_mode="html") @@ -590,62 +590,62 @@ async def get_chat_info(kst, chat): except BaseException: pass caption = "CHAT INFORMATION\n" - caption += f"├ ID: {chat.id}\n" + caption += f"├ ID: {chat.id}\n" if chat_title: - caption += f"├ {chat_type} Name: {chat_title}\n" + caption += f"├ {chat_type} Name: {chat_title}\n" if chat.username: - caption += f"├ Username: @{chat.username}\n" + caption += f"├ Username: @{chat.username}\n" else: - caption += f"├ {chat_type} Type: Private\n" + caption += f"├ {chat_type} Type: Private\n" if creator_username: - caption += f"├ Creator: {creator_username}\n" + caption += f"├ Creator: {creator_username}\n" elif creator_valid: - caption += f"├ Creator: {creator_firstname}\n" + caption += f"├ Creator: {creator_firstname}\n" if created: - caption += f"├ Created: {created.date().strftime('%b %d, %Y')} - {created.time()}\n" + caption += f"├ Created: {created.date().strftime('%b %d, %Y')} - {created.time()}\n" else: - caption += f"├ Created: {chat.date.date().strftime('%b %d, %Y')} - {chat.date.time()}\n" - caption += f"├ DC ID: {dc_id}\n" + caption += f"├ Created: {chat.date.date().strftime('%b %d, %Y')} - {chat.date.time()}\n" + caption += f"├ DC ID: {dc_id}\n" if exp_count: chat_level = int((1 + sqrt(1 + 7 * exp_count / 14)) / 2) - caption += f"├ {chat_type} Level: {chat_level}\n" + caption += f"├ {chat_type} Level: {chat_level}\n" if msgs_viewable: - caption += f"├ Viewable Messages: {msgs_viewable}\n" + caption += f"├ Viewable Messages: {msgs_viewable}\n" if msgs_sent: - caption += f"├ Messages Sent: {msgs_sent}\n" + caption += f"├ Messages Sent: {msgs_sent}\n" elif msgs_sent_alt: - caption += f"├ Messages Sent: {msgs_sent_alt}\n" + caption += f"├ Messages Sent: {msgs_sent_alt}\n" if members: - caption += f"├ Members: {members}\n" + caption += f"├ Members: {members}\n" if admins: - caption += f"├ Administrators: {admins}\n" + caption += f"├ Administrators: {admins}\n" if full.bot_info: - caption += f"├ Bots: {len(full.bot_info)}\n" + caption += f"├ Bots: {len(full.bot_info)}\n" if members_online: - caption += f"├ Currently Online: {members_online}\n" + caption += f"├ Currently Online: {members_online}\n" if restricted_users: - caption += f"├ Restricted Users: {restricted_users}\n" + caption += f"├ Restricted Users: {restricted_users}\n" if banned_users: - caption += f"├ Banned Users: {banned_users}\n" + caption += f"├ Banned Users: {banned_users}\n" if group_stickers: - caption += f"├ {chat_type} Stickers: {group_stickers}\n" + caption += f"├ {chat_type} Stickers: {group_stickers}\n" if not broadcast: if getattr(chat, "slowmode_enabled", None): - caption += f"├ Slow Mode: {full.slowmode_seconds}s\n" + caption += f"├ Slow Mode: {full.slowmode_seconds}s\n" else: - caption += f"├ Supergroup: {supergroup}\n" + caption += f"├ Supergroup: {supergroup}\n" if getattr(chat, "restricted", None): - caption += f"├ Restricted: {chat.restricted}\n" + caption += f"├ Restricted: {chat.restricted}\n" rist = chat.restriction_reason[0] - caption += f"┊ ├ Platform: {rist.platform}\n" - caption += f"┊ ├ Reason: {rist.reason}\n" - caption += f"┊ ├ Text: {rist.text}\n" + caption += f"┊ ├ Platform: {rist.platform}\n" + caption += f"┊ ├ Reason: {rist.reason}\n" + caption += f"┊ ├ Text: {rist.text}\n" if getattr(chat, "scam", None): - caption += "├ Scam: yes\n" + caption += "├ Scam: yes\n" if getattr(chat, "verified", None): - caption += "├ Verified By Telegram: yes\n" + caption += "├ Verified By Telegram: yes\n" about = escape(full.about or "") - caption += f"└ Description:\n
{about}
" + caption += f"└ Description:\n
{about}
" return chat_photo, caption diff --git a/getter/plugins/mutual.py b/getter/plugins/mutual.py index 3899fd1..9400fc4 100644 --- a/getter/plugins/mutual.py +++ b/getter/plugins/mutual.py @@ -55,7 +55,7 @@ async def _(kst): forwhat = await gvar(var) or "" if not val: forwhat = forwhat or "illvart_" if var == "ig" else forwhat or "kastaid" - return await kst.eor(f"**{var.upper()}:** `{forwhat}`") + return await kst.eor(f"**{var.upper()}**: `{forwhat}`") val = val.replace("@", "") if var == "ig": if val == forwhat: diff --git a/getter/plugins/pmpermit.py b/getter/plugins/pmpermit.py index 74d1309..ff001ff 100644 --- a/getter/plugins/pmpermit.py +++ b/getter/plugins/pmpermit.py @@ -253,7 +253,7 @@ async def _(kst): toggle = kst.pattern_match.group(1) pmguard = bool(await gvar("_pmguard")) if not toggle: - text = f"**PM-Guard Status:** `{humanbool(pmguard, toggle=True)}`" + text = f"**PM-Guard Status**: `{humanbool(pmguard, toggle=True)}`" return await yy.eod(text) if toggle in {"yes", "on", "true", "1"}: if pmguard: @@ -282,7 +282,7 @@ async def _(kst): toggle, opts = group(1), group(2).lower() pmlog = await gvar("_pmlog") if not toggle: - text = f"**PM-Logs Status:** `{humanbool(pmlog, toggle=True)}`" + text = f"**PM-Logs Status**: `{humanbool(pmlog, toggle=True)}`" if pmlog and pmlog == "media": text += "\n__Only media!__" return await yy.eod(text) @@ -331,8 +331,8 @@ async def _(kst): date = datetime.now(TZ).timestamp() await allow_user(user.id, date, reason) text = f"User {display_name(user)} allowed to PM!\n" - text += "Date: {}\n".format(datetime.fromtimestamp(date).strftime("%Y-%m-%d")) - text += "Reason: {}".format(f"
{reason}
" if reason else "None given.") + text += "Date: {}\n".format(datetime.fromtimestamp(date).strftime("%Y-%m-%d")) + text += "Reason: {}".format(f"
{reason}
" if reason else "None given.") done = await yy.eor(text, parse_mode="html") towarn, PMWARN = str(user.id), await jdata.pmwarns() if towarn in PMWARN: @@ -403,7 +403,7 @@ async def _(kst): toggle = kst.pattern_match.group(1) pmblock = bool(await gvar("_pmblock")) if not toggle: - text = f"**PM-Block Status:** `{humanbool(pmblock, toggle=True)}`" + text = f"**PM-Block Status**: `{humanbool(pmblock, toggle=True)}`" return await yy.eod(text) if toggle in {"yes", "on", "true", "1"}: if pmblock: @@ -432,7 +432,7 @@ async def _(kst): toggle, opts = group(1), group(2).lower() antipm = await gvar("_antipm") if not toggle: - text = f"**Anti-PM Status:** `{humanbool(antipm, toggle=True)}`" + text = f"**Anti-PM Status**: `{humanbool(antipm, toggle=True)}`" if antipm and antipm == "del": text += "\n__With delete chat!__" return await yy.eod(text) @@ -474,7 +474,7 @@ async def _(kst): mode = "pmbye" pmbye = await gvar("_pmbye") if not custom: - text = "PM-Bye:\n" + text = "PM-Bye:\n" text += f"
{escape(pmbye or pmbye_default)}
" return await yy.eor(text, parse_mode="html") if pmbye == custom: @@ -484,7 +484,7 @@ async def _(kst): mode = "pmmsg" pmmsg = await gvar("_pmmsg") if not custom: - text = "PM-Message:\n" + text = "PM-Message:\n" text += f"
{escape(pmmsg or pmmsg_default)}
" return await yy.eor(text, parse_mode="html") if pmmsg == custom: @@ -495,7 +495,7 @@ async def _(kst): pmtotal = await gvar("_pmtotal") custom = custom.strip() if not custom: - text = f"**PM-Total:** `{pmtotal or pmtotal_default}`" + text = f"**PM-Total**: `{pmtotal or pmtotal_default}`" return await yy.eod(text) if not custom.isdecimal(): return await yy.eor("`Provide a valid number!`", time=5) @@ -741,11 +741,11 @@ async def handle_pmpermit() -> None: "{i}unmove [reply]/[in_private]/[username/mention/id]": "Unarchive user but still muted.", "{i}delete": """Delete and revoke current PM also for bots but exclude myself. This action cannot be undone! -**Note:** +**Notes**: - The pmguard, allow, deny, denyall, pmblock, and antipm commands are automatically reboot after changes, this to apply changes! - The setpmbye, setpmmsg, and setpmtotal commands are not rebooted, but it's cached in 1 minutes. -**Format for pmbye and pmmsg:** +**Format for pmbye and pmmsg**: `{id}`: The user ID. `{name}`: The user first name. `{fullname}`: The user full name. diff --git a/getter/plugins/sudo.py b/getter/plugins/sudo.py index aa1c48a..747b649 100644 --- a/getter/plugins/sudo.py +++ b/getter/plugins/sudo.py @@ -37,7 +37,7 @@ async def _(kst): toggle = kst.pattern_match.group(1) sudo = bool(await gvar("_sudo")) if not toggle: - text = f"**Sudo Status:** `{humanbool(sudo, toggle=True)}`" + text = f"**Sudo Status**: `{humanbool(sudo, toggle=True)}`" return await yy.eod(text) if toggle in {"yes", "on", "true", "1"}: if sudo: @@ -60,7 +60,7 @@ async def _(kst): pattern="sudos$", ) async def _(kst): - cmds = "**Sudo Commands:**\n" + "\n".join(["- {}: {}".format(x, ", ".join(y)) for x, y in SUDO_CMDS.items()]) + cmds = "**Sudo Commands**:\n" + "\n".join(["- {}: {}".format(x, ", ".join(y)) for x, y in SUDO_CMDS.items()]) await kst.sod(cmds, parts=True) @@ -163,7 +163,7 @@ async def _(kst): "{i}listsudo": "List all sudo users.", "{i}delallsudos": """Delete all sudo users. -**Note:** +**Notes**: - Handler for sudo commands is [ , ] comma. E.g: `,test` - The sudo, addsudo, delsudo, and delsudos commands are automatically reboot after changes, this to apply changes! """, diff --git a/getter/plugins/text.py b/getter/plugins/text.py index 74d253e..8188834 100644 --- a/getter/plugins/text.py +++ b/getter/plugins/text.py @@ -91,7 +91,7 @@ async def _(kst): if not text: return await kst.try_delete() count = len(re.findall(r"(\S+)", text)) - text = f"**Count:** `{count}`" + text = f"**Count**: `{count}`" await kst.eor(text) diff --git a/getter/plugins/translate.py b/getter/plugins/translate.py index 602c3f2..5cbb52a 100644 --- a/getter/plugins/translate.py +++ b/getter/plugins/translate.py @@ -57,7 +57,7 @@ async def _(kst): text = strip_format(strip_emoji(words)) translator = Translator() translation = await translator(text, targetlang=lang) - tr = f"**Detected:** `{await translator.detect(translation.orig)}`\n**Translated:** `{await translator.detect(translation.text)}`\n\n```{translation.text}```" + tr = f"**Detected**: `{await translator.detect(translation.orig)}`\n**Translated**: `{await translator.detect(translation.text)}`\n\n```{translation.text}```" await yy.eor(tr, parts=True) except Exception as err: await yy.eor(formatx_send(err), parse_mode="html") @@ -167,7 +167,7 @@ async def _(kst): pattern="lang$", ) async def _(kst): - lang = f"**{len(LANG_CODES)} Language Code:**\n" + "\n".join( + lang = f"**{len(LANG_CODES)} Language Code**:\n" + "\n".join( [f"- {y}: {x}" for x, y in sort_dict(LANG_CODES).items()] ) await kst.sod(lang, parts=True) @@ -180,7 +180,7 @@ async def _(kst): "{i}ts [lang_code] [text]/[reply]": "Translate the message then text to speech.", "{i}lang": """List all language code. -**Examples:** +**Examples**: - Use default lang_code. -> `{i}tr ready` - With choosing lang_code. diff --git a/getter/plugins/updater.py b/getter/plugins/updater.py index e6951f9..8d8973f 100644 --- a/getter/plugins/updater.py +++ b/getter/plugins/updater.py @@ -49,23 +49,23 @@ Force temporarily update as locally. """ test_text = """ -├ User: {} -├ ID: {} -├ Getter Version: {} -├ Python Version: {} -├ Telethon Version: {} -├ Telegram Layer: {} -├ Handler: {} -├ Sudo: {} -├ PM-Guard: {} -├ PM-Logs: {} -├ PM-Block: {} -├ Anti-PM: {} -├ Heroku App: {} -├ Heroku Stack: {} -├ Uptime: {} -├ UTC Now: {} -└ Local Now: {} +├ User: {} +├ ID: {} +├ Getter Version: {} +├ Python Version: {} +├ Telethon Version: {} +├ Telegram Layer: {} +├ Handler: {} +├ Sudo: {} +├ PM-Guard: {} +├ PM-Logs: {} +├ PM-Block: {} +├ Anti-PM: {} +├ Heroku App: {} +├ Heroku Stack: {} +├ Uptime: {} +├ UTC Now: {} +└ Local Now: {} """ @@ -256,7 +256,7 @@ def verify(repo, diff) -> bool: def generate_changelog(repo, diff) -> str: chlog = "" rep = UPSTREAM_REPO.replace(".git", "") - ch = rf"\\#Getter// v{__version__} New UPDATE available for [{UPSTREAM_BRANCH}]:" + ch = rf"\\#Getter// v{__version__} New UPDATE available for [{UPSTREAM_BRANCH}]:" date = "%Y-%m-%d %H:%M:%S" for _ in repo.iter_commits(diff): chlog += f"\n\n#{_.count()} [{_.committed_datetime.strftime(date)}]\n{_.hexsha}\n[{_.summary}] ~ {_.author}" @@ -322,7 +322,7 @@ async def Pushing(kst, state, repo) -> None: msg = "HEROKU_API invalid or expired... Please re-check." else: msg = err - up = rf"""\\**#Getter**// **Heroku Error:** + up = rf"""\\**#Getter**// **Heroku Error**: `{msg}`""" return await kst.eor(up) await force_pull() diff --git a/getter/plugins/usage.py b/getter/plugins/usage.py index 79ed80a..24bea5b 100644 --- a/getter/plugins/usage.py +++ b/getter/plugins/usage.py @@ -25,38 +25,38 @@ dyno_text = """ 📦 Heroku App --> Name: {} --> Stack: {} --> Region: {} --> Created: {} --> Updated: {} --> Email: {} +-> Name: {} +-> Stack: {} +-> Region: {} +-> Created: {} +-> Updated: {} +-> Email: {} ⚙️ Heroku Dyno --> Dyno usage: +-> Dyno usage: • {}h {}m {}% --> Dyno hours quota remaining this month: +-> Dyno hours quota remaining this month: • {}h {}m {}% """ usage_text = """ 🖥️ Uptime -App: {} -System: {} +App: {} +System: {} 📊 Data Usage -Upload: {} -Download: {} +Upload: {} +Download: {} 💾 Disk Space -Total: {} -Used: {} -Free: {} +Total: {} +Used: {} +Free: {} 📈 Memory Usage -CPU: {} -RAM: {} -DISK: {} -SWAP: {} +CPU: {} +RAM: {} +DISK: {} +SWAP: {} """ @@ -89,17 +89,17 @@ async def _(kst): addons = dumps(to_dict(app.addons()), indent=1, default=str) buildpacks = dumps(to_dict(app.buildpacks()), indent=1, default=str) configs = dumps(app.config().to_dict(), indent=1, default=str) - await sendlog(f"Account:\n
{escape(account)}
", fallback=True, parse_mode="html") + await sendlog(f"Account:\n
{escape(account)}
", fallback=True, parse_mode="html") await asyncio.sleep(1) - await sendlog(f"App:\n
{escape(capp)}
", fallback=True, parse_mode="html") + await sendlog(f"App:\n
{escape(capp)}
", fallback=True, parse_mode="html") await asyncio.sleep(1) - await sendlog(f"Dyno:\n
{escape(dyno)}
", fallback=True, parse_mode="html") + await sendlog(f"Dyno:\n
{escape(dyno)}
", fallback=True, parse_mode="html") await asyncio.sleep(1) - await sendlog(f"Addons:\n
{escape(addons)}
", fallback=True, parse_mode="html") + await sendlog(f"Addons:\n
{escape(addons)}
", fallback=True, parse_mode="html") await asyncio.sleep(1) - await sendlog(f"Buildpacks:\n
{escape(buildpacks)}
", fallback=True, parse_mode="html") + await sendlog(f"Buildpacks:\n
{escape(buildpacks)}
", fallback=True, parse_mode="html") await asyncio.sleep(1) - await sendlog(f"Configs:\n
{escape(configs)}
", fallback=True, parse_mode="html") + await sendlog(f"Configs:\n
{escape(configs)}
", fallback=True, parse_mode="html") await yy.eor("`Heroku details sent at botlogs.`") @@ -166,7 +166,7 @@ async def heroku_usage() -> str: user = conn.account().id app = conn.app(hk.name) except Exception as err: - return f"ERROR:\n{err}" + return f"ERROR:\n{err}" headers = { "User-Agent": choice(USERAGENTS), "Authorization": f"Bearer {hk.api}", diff --git a/getter/plugins/utility.py b/getter/plugins/utility.py index 0d9bb4c..fbd004d 100644 --- a/getter/plugins/utility.py +++ b/getter/plugins/utility.py @@ -53,7 +53,7 @@ async def _(kst): correct = check.correct() except Exception as err: return await yy.eor(formatx_send(err), parse_mode="html") - text = f"• **Given Phrase:** `{sentence}`\n• **Corrected Phrase:** `{correct.strip()}`" + text = f"• **Given Phrase**: `{sentence}`\n• **Corrected Phrase**: `{correct.strip()}`" await yy.eor(text) @@ -77,8 +77,8 @@ async def _(kst): try: res = res["list"][0] except IndexError: - return await yy.eod(f"**No Results for:** `{word}`") - text = "• **Given Word:** `{}`\n• **Meaning:** `{}`\n• **Example:** `{}`".format( + return await yy.eod(f"**No Results for**: `{word}`") + text = "• **Given Word**: `{}`\n• **Meaning**: `{}`\n• **Example**: `{}`".format( res.get("word").strip(), res.get("definition").strip(), res.get("example").strip(), @@ -98,14 +98,14 @@ async def _(kst): url = f"https://api.dictionaryapi.dev/api/v2/entries/en/{word}" res = await Fetch(url, re_json=True) if not res: - return await yy.eod(f"**No Results for:** `{word}`") + return await yy.eod(f"**No Results for**: `{word}`") defi = res[0]["meanings"][0]["definitions"][0] exa = defi["example"] if defi.get("example") else "" - text = "• **Given Word:** `{}`\n• **Meaning:** `{}`\n• **Example:** `{}`".format(word, defi["definition"], exa) + text = "• **Given Word**: `{}`\n• **Meaning**: `{}`\n• **Example**: `{}`".format(word, defi["definition"], exa) if defi.get("synonyms"): - text += "\n• **Synonyms:**" + "".join(f" {x}," for x in defi["synonyms"])[:-1][:10] + text += "\n• **Synonyms**:" + "".join(f" {x}," for x in defi["synonyms"])[:-1][:10] if defi.get("antonyms"): - text += "\n**Antonyms:**" + "".join(f" {x}," for x in defi["antonyms"])[:-1][:10] + text += "\n**Antonyms**:" + "".join(f" {x}," for x in defi["antonyms"])[:-1][:10] await yy.eor(text) @@ -128,8 +128,8 @@ async def _(kst): try: mean = await aioify(KBBI, word) except BaseException: - return await yy.eod(f"**No Results for:** `{word}`") - text = f"• **Given Word:** `{word}`\n{mean}" + return await yy.eod(f"**No Results for**: `{word}`") + text = f"• **Given Word**: `{word}`\n{mean}" await yy.eor(text) @@ -364,9 +364,9 @@ async def _(kst): tg = await Telegraph() up = await tg.upload_file(res) link = "https://telegra.ph" + next((_ for _ in up), "") - push = f"**Telegraph:** [Telegraph Link]({link})" + push = f"**Telegraph**: [Telegraph Link]({link})" except Exception as err: - push = f"**ERROR:**\n`{err}`" + push = f"**ERROR**:\n`{err}`" (Root / res).unlink(missing_ok=True) if file: (Root / file).unlink(missing_ok=True) @@ -380,7 +380,7 @@ async def _(kst): res = push.get("url") if not res: return await yy.eod("`Try again now!`") - await yy.eor(f"**Telegraph:** [Telegraph Link]({res})") + await yy.eor(f"**Telegraph**: [Telegraph Link]({res})") @kasta_cmd( @@ -405,13 +405,13 @@ async def _(kst): lat = location.latitude lon = location.longitude addr = location.address - details = f"**Location:** `{locco}`\n**Address:** `{addr}`\n**Coordinates:** `{lat},{lon}`" + details = f"**Location**: `{locco}`\n**Address**: `{addr}`\n**Coordinates**: `{lat},{lon}`" return await yy.eor( details, file=typ.InputMediaGeoPoint(typ.InputGeoPoint(lat, lon)), force_document=True, ) - await yy.eod(f"**No Location found:** `{locco}`") + await yy.eod(f"**No Location found**: `{locco}`") @kasta_cmd( @@ -435,7 +435,7 @@ async def _(kst): chat, msg_id = get_msg_id(link) if not is_silent and not (chat and msg_id): return await yy.eor( - "Provide a valid message link!\n**E.g:** `https://t.me/tldevs/11` or `https://t.me/tldevs/19`" + "Provide a valid message link!\n**E.g**: `https://t.me/tldevs/11` or `https://t.me/tldevs/19`" ) try: from_msg = await ga.get_messages(chat, ids=msg_id) @@ -455,7 +455,7 @@ async def _(kst): file = "getmsg_" + str(msg_id) + guess_extension(mimetype) await ga.download_file(from_msg.media, file=file) msg = await yy.eor( - f"**Source:** `{link}`", + f"**Source**: `{link}`", file=file, force_document=True, ) @@ -491,7 +491,7 @@ async def _(kst): ): result += f"• [{msg.id}](https://t.me/c/{current}/{msg.id})\n" total += 1 - text = f"**Search Results for:** `{args}`\n{result}" if total > 0 else f"**No Results for:** `{args}`" + text = f"**Search Results for**: `{args}`\n{result}" if total > 0 else f"**No Results for**: `{args}`" await yy.eor(text) diff --git a/getter/plugins/vctools.py b/getter/plugins/vctools.py index dde83e5..9c40016 100644 --- a/getter/plugins/vctools.py +++ b/getter/plugins/vctools.py @@ -181,9 +181,9 @@ async def _(kst): except BaseException: return await yy.eor("`An error occurred. Try again now!`", time=5) text = "Video Chat Information\n" - text += f"Title: {res.call.title or ''}\n" - text += f"Join Muted: {humanbool(res.call.join_muted)}\n" - text += f"Participants Count: {res.call.participants_count}\n\n" + text += f"Title: {res.call.title or ''}\n" + text += f"Join Muted: {humanbool(res.call.join_muted)}\n" + text += f"Participants Count: {res.call.participants_count}\n\n" if res.call.participants_count > 0: text += "Participants\n" for x in res.users: diff --git a/getter/plugins/webtools.py b/getter/plugins/webtools.py index 3670c6d..1c7d69b 100644 --- a/getter/plugins/webtools.py +++ b/getter/plugins/webtools.py @@ -51,7 +51,7 @@ async def _(kst): url = "https://www.baidu.com/s?wd={}" result = url.format(keywords.replace("\n", " ").replace(" ", "+")).strip() keywords = keywords.replace("\n", " ").strip() - await yy.eor(f"**🔎 {search} Search Result:**\n\n[{keywords}]({result})") + await yy.eor(f"**🔎 {search} Search Result**:\n\n[{keywords}]({result})") @kasta_cmd( @@ -71,13 +71,13 @@ async def _(kst): ) if not res: return await yy.eod("`Try again now!`") - output = "• **Unshorted Link:** {}\n• **Original Link:** {}".format(res.headers.get("location"), text) + output = "• **Unshorted Link**: {}\n• **Original Link**: {}".format(res.headers.get("location"), text) else: url = f"https://da.gd/s?url={text}" res = await Fetch(url) if not res: return await yy.eod("`Try again now!`") - output = f"• **Shorted Link:** {res.strip()}\n• **Original Link:** {text}" + output = f"• **Shorted Link**: {res.strip()}\n• **Original Link**: {text}" await yy.eor(output) @@ -105,18 +105,18 @@ async def _(kst): if str(res.get("status")).lower() == "success": coordinates = str(res.get("lat") or "") + "," + str(res.get("lon") or "") text = """IP Address Information -├ IP: {} -├ City: {} -├ Region: {} -├ Country: {} -├ Country Code: {} -├ Currency: {} -├ Continent: {} -├ Coordinates: {} -├ Time Zone: {} -├ ISP: {} -├ Mobile: {} -└ Map: {}""".format( +├ IP: {} +├ City: {} +├ Region: {} +├ Country: {} +├ Country Code: {} +├ Currency: {} +├ Continent: {} +├ Coordinates: {} +├ Time Zone: {} +├ ISP: {} +├ Mobile: {} +└ Map: {}""".format( res.get("query"), res.get("city") or "?", res.get("regionName") or "?", @@ -132,9 +132,9 @@ async def _(kst): ) else: text = """IP Address Information -├ IP: {} -├ Status: {} -└ Message: {}""".format( +├ IP: {} +├ Status: {} +└ Message: {}""".format( res.get("query"), res.get("status"), res.get("message"), @@ -163,14 +163,14 @@ async def _(kst): resp = st.results.dict() client = resp.get("client") text = """SpeedTest completed in {:.3f}s -├ Download: {} -├ Upload: {} -├ Ping: {} -├ Internet Service Provider: {} -┊ ├ Rating: {} -┊ ├ IP: {} -┊ ├ Country: {} -└ Sponsor: {}""".format( +├ Download: {} +├ Upload: {} +├ Ping: {} +├ Internet Service Provider: {} +┊ ├ Rating: {} +┊ ├ IP: {} +┊ ├ Country: {} +└ Sponsor: {}""".format( monotonic() - start, humanbytes(resp.get("download")), humanbytes(resp.get("upload")), @@ -263,7 +263,7 @@ async def _(kst): return await kst.eor("`Provide a valid DNS or IP address!`", time=5) yy = await kst.eor("`Processing...`") duration = Pinger(dns) - await yy.eor(f"• **DNS:** `{dns}`\n• **Ping Speed:** `{duration}`") + await yy.eor(f"• **DNS**: `{dns}`\n• **Ping Speed**: `{duration}`") plugins_help["webtools"] = {