diff --git a/.env.sample b/.env.sample index 79d989c855..5100e50098 100644 --- a/.env.sample +++ b/.env.sample @@ -1,12 +1,15 @@ -# Don't use quotes( " and ' ) +# Don't use quotes( " or ' ) API_ID= API_HASH= SESSION= REDIS_URI= REDIS_PASSWORD= +LOG_CHANNEL= +BOT_TOKEN= # [OPTIONAL] -LOG_CHANNEL= -BOT_TOKEN= +MONGO_URI= +PMLOGGROUP= +GOOGLEAPI= diff --git a/.github/workflows/pylint.yaml b/.github/workflows/pylint.yaml index 8c71add5c5..73d091aed8 100644 --- a/.github/workflows/pylint.yaml +++ b/.github/workflows/pylint.yaml @@ -1,7 +1,9 @@ -name: PyLint +name: PyLint Ultroid on: push: - branches: [ dev ] + branches: + - patch-1 + - patch-2 paths: - "**.py" jobs: @@ -12,22 +14,26 @@ jobs: - name: Setup Python uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: 3.9 cache: "pip" - name: Install Python lint libraries run: pip install autopep8 autoflake isort black - name: Check for showstoppers run: | + autopep8 --verbose --in-place --recursive --aggressive --aggressive pyUltroid/*.py autopep8 --verbose --in-place --recursive --aggressive --aggressive assistant/*.py autopep8 --verbose --in-place --recursive --aggressive --aggressive assistant/manager/*.py autopep8 --verbose --in-place --recursive --aggressive --aggressive plugins/*.py - name: Remove unused imports and variables run: | + autoflake --in-place --recursive --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports pyUltroid/*.py autoflake --in-place --recursive --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports assistant/*.py autoflake --in-place --recursive --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports assistant/manager/*.py autoflake --in-place --recursive --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports plugins/*.py - name: lint with isort and black run: | + isort --profile black pyUltroid/*.py + black --fast pyUltroid/*.py isort assistant/*.py isort assistant/manager/*.py black --fast assistant/*.py @@ -37,9 +43,8 @@ jobs: - uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: 'pylint: auto fixes' - commit_options: '--no-verify' + commit_options: '--verify' repository: . - commit_user_name: buddhhu - commit_user_email: 48654350+buddhhu@users.noreply.github.com - commit_author: Amit Sharma <48654350+buddhhu@users.noreply.github.com> - + commit_user_name: ufoptg + commit_user_email: ufperth@protonmail.com + commit_author: ufoptg diff --git a/Dockerfile b/Dockerfile index ada30cbf09..71f27584af 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in . diff --git a/assistant/__init__.py b/assistant/__init__.py index cba67e1dc9..47988c15f9 100644 --- a/assistant/__init__.py +++ b/assistant/__init__.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/assistant/callbackstuffs.py b/assistant/callbackstuffs.py index 3cdd332044..2eeb8d8e2e 100644 --- a/assistant/callbackstuffs.py +++ b/assistant/callbackstuffs.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in @@ -174,14 +174,21 @@ def text_to_url(event): "apiset": { "text": get_string("ast_1"), "buttons": [ - [Button.inline("Remove.bg API", data="abs_rmbg")], - [Button.inline("DEEP API", data="abs_dapi")], - [Button.inline("OCR API", data="abs_oapi")], + [ + Button.inline("RMBG API", data="abs_rmbg"), + Button.inline("DEEP API", data="abs_dapi"), + Button.inline("OCR API", data="abs_oapi"), + ], + [ + Button.inline("OᴘᴇɴAI API", data="abs_openapi"), + Button.inline("🌀ʊʄ⊕ք🌀", data="abs_uapi"), + Button.inline("Google API", data="abs_gapi"), + ], + [Button.inline("OpenWeather API", data="abs_openwapi")], [Button.inline("« Back", data="setter")], ], }, } - _convo = { "rmbg": { "var": "RMBG_API", @@ -192,13 +199,31 @@ def text_to_url(event): "dapi": { "var": "DEEP_AI", "name": "Deep AI Api Key", - "text": "Get Your Deep Api from deepai.org and send here.", + "text": "Get Your Deep Api from deepai.org and send here.\n\n /cancel to cancel", "back": "cbs_apiset", }, "oapi": { "var": "OCR_API", "name": "Ocr Api Key", - "text": "Get Your OCR api from ocr.space and send that Here.", + "text": "Get Your OCR api from ocr.space and send that Here.\n\n /cancel to cancel", + "back": "cbs_apiset", + }, + "openapi": { + "var": "OPENAI_API", + "name": "OPENAI API Key", + "text": "Visit openai.com for an OPENAI Api key!\n\n /cancel to cancel", + "back": "cbs_apiset", + }, + "uapi": { + "var": "UFOPAPI", + "name": "UFoP API Key", + "text": "Contact 🌀ʊʄ⊕ք🌀 or Visit @PerthUnity_Bot/@UFoPInfo Support Group\n\n /cancel to cancel", + "back": "cbs_apiset", + }, + "gapi": { + "var": "GOOGLEAPI", + "name": "Google Api Key", + "text": "Get Your GOOGLE API from https://makersuite.google.com/app/apikey \n\n /cancel to cancel", "back": "cbs_apiset", }, "pmlgg": { @@ -556,7 +581,9 @@ async def emoji(event): var = "EMOJI_IN_HELP" name = f"Emoji in `{HNDLR}help` menu" async with event.client.conversation(pru) as conv: - await conv.send_message("Send emoji u want to set 🙃.\n\nUse /cancel to cancel.") + await conv.send_message( + "Send emoji u want to set 🙃.\n\nUse /cancel to cancel." + ) response = conv.wait_event(events.NewMessage(chats=pru)) response = await response themssg = response.message.message diff --git a/assistant/games.py b/assistant/games.py index 59c707ad3b..daeacad1d6 100644 --- a/assistant/games.py +++ b/assistant/games.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/assistant/initial.py b/assistant/initial.py index eb57a0308c..daf53ff2bd 100644 --- a/assistant/initial.py +++ b/assistant/initial.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/assistant/inlinestuff.py b/assistant/inlinestuff.py index 16a45f522b..2ebe7a480c 100644 --- a/assistant/inlinestuff.py +++ b/assistant/inlinestuff.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/assistant/localization.py b/assistant/localization.py index 0fc8538cdb..2f92d343ba 100644 --- a/assistant/localization.py +++ b/assistant/localization.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/assistant/manager/__init__.py b/assistant/manager/__init__.py index 69b49061e9..c401be8d96 100644 --- a/assistant/manager/__init__.py +++ b/assistant/manager/__init__.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/assistant/manager/_help.py b/assistant/manager/_help.py index f071301e91..5feba6c478 100644 --- a/assistant/manager/_help.py +++ b/assistant/manager/_help.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/assistant/manager/_on_adds.py b/assistant/manager/_on_adds.py index c54cf14442..d66d6531fa 100644 --- a/assistant/manager/_on_adds.py +++ b/assistant/manager/_on_adds.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/assistant/manager/admins.py b/assistant/manager/admins.py index 168e14e680..9e6ad1bcb2 100644 --- a/assistant/manager/admins.py +++ b/assistant/manager/admins.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/assistant/manager/afk.py b/assistant/manager/afk.py index ceb45a3fd2..99c93311a7 100644 --- a/assistant/manager/afk.py +++ b/assistant/manager/afk.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/assistant/manager/misc.py b/assistant/manager/misc.py index 093c9c7438..9419b92fa2 100644 --- a/assistant/manager/misc.py +++ b/assistant/manager/misc.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/assistant/manager/stickermanager.py b/assistant/manager/stickermanager.py index 18529bb34d..01f9ff7715 100644 --- a/assistant/manager/stickermanager.py +++ b/assistant/manager/stickermanager.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/assistant/pmbot.py b/assistant/pmbot.py index 316f8eae6d..a7f1618759 100644 --- a/assistant/pmbot.py +++ b/assistant/pmbot.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in @@ -9,6 +9,8 @@ # --------------------------------------- Imports -------------------------------------------- # +import asyncio +import logging import os from telethon.errors.rpcerrorlist import UserNotParticipantError @@ -26,7 +28,58 @@ botb = KeyManager("BOTBLS", cast=list) FSUB = udB.get_key("PMBOT_FSUB") +PMBOTGROUP = Keys.LOG_CHANNEL CACHE = {} +SUDOS = udB.get_key("SUDOS") +PMUSERS = [OWNER_ID, SUDOS] +logging.basicConfig( + format="%(asctime)s | %(name)s [%(levelname)s] : %(message)s", + level=logging.INFO, + datefmt="%m/%d/%Y, %H:%M:%S", +) +logger = logging.getLogger("DEBUGGING") + +# --------------------------------------- Functions -------------------------------------------- # + + +async def forward_to_multiple(event, *user_ids): + results = [] + tasks = [] + + for user_id in user_ids: + task = asyncio.create_task(event.forward_to(user_id)) + tasks.append(task) + + for task in tasks: + try: + result = await task + results.append(result) + except Exception as e: + results.append(str(e)) + + return results + + +async def check_reply_from_bot(event): + if (event.is_private and event.is_reply) or ( + event.chat_id == PMBOTGROUP and event.is_reply and event.reply_to_msg_id + ): + if event.chat_id == PMBOTGROUP: + replied_message = await event.client.get_messages( + event.chat_id, ids=event.reply_to_msg_id + ) + if replied_message.from_id: + entity = replied_message.from_id.user_id + else: + return False + return entity == 6176247391 + else: + # For private messages, no need to check the entity, as it's + # already a reply + return True + return False + + # --------------------------------------- Incoming -------------------------------------------- # @@ -37,7 +90,6 @@ ) async def on_new_mssg(event): who = event.sender_id - # doesn't reply to that user anymore if event.text.startswith("/") or who == OWNER_ID: return if FSUB: @@ -72,9 +124,12 @@ async def on_new_mssg(event): if MSG and BTTS: return await event.reply(MSG, buttons=BTTS) xx = await event.forward_to(OWNER_ID) + zz = await event.forward_to(PMBOTGROUP) if event.fwd_from: await xx.reply(f"From {inline_mention(event.sender)} [`{event.sender_id}`]") + await zz.reply(f"From {inline_mention(event.sender)} [`{event.sender_id}`]") add_stuff(xx.id, who) + add_stuff(zz.id, who) # --------------------------------------- Outgoing -------------------------------------------- # @@ -82,30 +137,74 @@ async def on_new_mssg(event): @asst_cmd( load=AST_PLUGINS, - from_users=[OWNER_ID], + from_users=PMUSERS, incoming=True, - func=lambda e: e.is_private and e.is_reply, + func=check_reply_from_bot, ) async def on_out_mssg(event): x = event.reply_to_msg_id - to_user = get_who(x) + logger.info(f"msg_id: {x}") + if event.chat_id == PMBOTGROUP: + group_to_user = get_who(x) + else: + to_user = get_who(x) + + if event.reply_to_msg_id: + replied_message = await event.client.get_messages( + event.chat_id, ids=event.reply_to_msg_id + ) + if ( + replied_message + and replied_message.fwd_from + and replied_message.fwd_from.from_id + and replied_message.fwd_from.from_id.user_id != asst.me.id + ): + return if event.text.startswith("/who"): try: - k = await asst.get_entity(to_user) - photu = await event.client.download_profile_photo(k.id) - await event.reply( - f"• **Name :** {get_display_name(k)}\n• **ID :** `{k.id}`\n• **Link :** {inline_mention(k)}", - file=photu, - ) - if photu: - os.remove(photu) - return + if event.is_private and to_user: + k = await asst.get_entity(to_user) + photu = await event.client.download_profile_photo(k.id) + await event.reply( + f"• **Name :** {get_display_name(k)}\n• **ID :** `{k.id}`\n• **Link :** {inline_mention(k)}", + file=photu, + ) + if photu: + os.remove(photu) + return + elif event.chat_id == PMBOTGROUP and group_to_user: + k = await asst.get_entity(group_to_user) + photu = await event.client.download_profile_photo(k.id) + await event.reply( + f"• **Name :** {get_display_name(k)}\n• **ID :** `{k.id}`\n• **Link :** {inline_mention(k)}", + file=photu, + ) + if photu: + os.remove(photu) + return + else: + return await event.reply( + "Unable to determine the user. Please reply to a specific message." + ) except BaseException as er: return await event.reply(f"**ERROR : **{str(er)}") elif event.text.startswith("/"): return - if to_user: - await asst.send_message(to_user, event.message) + + if event.chat_id == PMBOTGROUP: + if group_to_user: + await asst.send_message(group_to_user, event.message) + else: + return await event.reply( + "Unable to determine the user. Please reply to a specific message." + ) + elif event.sender_id in PMUSERS: + if to_user: + await asst.send_message(to_user, event.message) + else: + return await event.reply( + "Unable to determine the user. Please reply to a specific message." + ) # --------------------------------------- Ban/Unban -------------------------------------------- # diff --git a/assistant/start.py b/assistant/start.py index c8dcb3c700..ff093d7403 100644 --- a/assistant/start.py +++ b/assistant/start.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in @@ -115,17 +115,21 @@ async def ultroid(event): await event.reply( f"Hey there {mention}, this is Ultroid Assistant of {me}!\n\n{ok}", file=udB.get_key("STARTMEDIA"), - buttons=[Button.inline("Info.", data="ownerinfo")] - if Owner_info_msg - else None, + buttons=( + [Button.inline("Info.", data="ownerinfo")] + if Owner_info_msg + else None + ), ) else: await event.reply( udB.get_key("STARTMSG").format(me=me, mention=mention), file=udB.get_key("STARTMEDIA"), - buttons=[Button.inline("Info.", data="ownerinfo")] - if Owner_info_msg - else None, + buttons=( + [Button.inline("Info.", data="ownerinfo")] + if Owner_info_msg + else None + ), ) else: name = get_display_name(event.sender) diff --git a/assistant/ytdl.py b/assistant/ytdl.py index 9a65b37679..0373912d20 100644 --- a/assistant/ytdl.py +++ b/assistant/ytdl.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/install-termux b/install-termux index 7817ddc69e..11eaeaf6d5 100644 --- a/install-termux +++ b/install-termux @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in . diff --git a/plugins/__init__.py b/plugins/__init__.py index 9b98484c1e..6dec5d78c3 100644 --- a/plugins/__init__.py +++ b/plugins/__init__.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in @@ -22,6 +22,7 @@ from pyUltroid.fns.helper import * from pyUltroid.fns.misc import * from pyUltroid.fns.tools import * +from pyUltroid.fns.custom_markdown import * from pyUltroid.startup._database import _BaseDatabase as Database from pyUltroid.version import __version__, ultroid_version from strings import get_help, get_string @@ -39,6 +40,7 @@ LOG_CHANNEL = udB.get_key("LOG_CHANNEL") +ultroid_bot.parse_mode = CustomMarkdown() def inline_pic(): INLINE_PIC = udB.get_key("INLINE_PIC") diff --git a/plugins/_chatactions.py b/plugins/_chatactions.py index 8f1a9d3baa..1026f636b9 100644 --- a/plugins/_chatactions.py +++ b/plugins/_chatactions.py @@ -1,13 +1,17 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in # . import asyncio +import os +import tempfile +from typing import Union -from telethon import events +import requests +from telethon import events, types from telethon.errors.rpcerrorlist import UserNotParticipantError from telethon.tl.functions.channels import GetParticipantRequest from telethon.utils import get_display_name @@ -18,8 +22,13 @@ from pyUltroid.dB.gban_mute_db import is_gbanned from pyUltroid.dB.greetings_db import get_goodbye, get_welcome, must_thank from pyUltroid.dB.nsfw_db import is_profan -from pyUltroid.fns.helper import inline_mention -from pyUltroid.fns.tools import async_searcher, create_tl_btn, get_chatbot_reply +from pyUltroid.fns.helper import check_reply_to, inline_mention +from pyUltroid.fns.tools import ( + async_searcher, + create_tl_btn, + get_chatbot_reply, + get_oracle_reply, +) try: from ProfanityDetector import detector @@ -28,6 +37,43 @@ from . import LOG_CHANNEL, LOGS, asst, get_string, types, udB, ultroid_bot from ._inline import something +if not udB.get_key("ORACLE_USERS"): + udB.set_key("ORACLE_USERS", {}) +if not udB.get_key("CHATBOT_USERS"): + udB.set_key("CHATBOT_USERS", {}) + +# ------------------------- UFoP Bans -------------------------# + + +class UFoPBan: + def __init__(self, api_key: str = None): + self.api_key = api_key + + def _make_request( + self, method: str, url: str, params: dict = None, json_data: dict = None + ): + headers = {"accept": "application/json", "api-key": self.api_key} + try: + response = requests.request( + method, url, headers=headers, params=params, json=json_data + ) + return response.json() + except requests.RequestException: + pass + + def get_ufop_ban( + self, user_id: int = None, banlist: bool = False + ) -> Union[dict, str]: + if banlist: + url = "https://ufoptg-ufop-api.hf.space/UFoP/bans" + payload = {"user_id": user_id} + return self._make_request("GET", url, params=payload) + else: + raise ValueError("Error: banlist must be True") + + +# ------------------------- Huge Thanks to @xtdevs -------------------------# + @ultroid_bot.on(events.ChatAction()) async def Function(event): @@ -97,6 +143,30 @@ async def DummyHandler(ult): except BaseException: pass + + if udB.get_key("UFoP_BANS"): + ufop_api_key = udB.get_key("UFOPAPI") + clients = UFoPBan(ufop_api_key) + try: + UFoP_banned = clients.get_ufop_ban(user_id=user.id, banlist=True) + + if UFoP_banned and UFoP_banned.get("sukuna", {}).get( + "is_banned", False + ): + await ult.client.edit_permissions( + chat.id, + user.id, + view_messages=False, + ) + await ult.respond( + f"**🌀ʊʄ⊕ք🌀:** Banned user detected and banned!\n" + f'Sibyl User ID: {UFoP_banned["sukuna"]["sibyl_user_id"]}\n' + f'Ban Reason: {UFoP_banned["sukuna"]["reason"]}', + ) + + except Exception as e: + LOGS.exception(f"Error checking UFoP: {e}") + reason = is_gbanned(user.id) if reason and chat.admin_rights: try: @@ -195,30 +265,118 @@ async def DummyHandler(ult): @ultroid_bot.on(events.NewMessage(incoming=True)) async def chatBot_replies(e): - sender = await e.get_sender() - if not isinstance(sender, types.User) or sender.bot: + if e.sender_id in udB.get_key("CHATBOT_USERS"): + xxrep = await check_reply_to(e) + else: return - if check_echo(e.chat_id, e.sender_id): - try: - await e.respond(e.message) - except Exception as er: - LOGS.exception(er) - key = udB.get_key("CHATBOT_USERS") or {} - if e.text and key.get(e.chat_id) and sender.id in key[e.chat_id]: - msg = await get_chatbot_reply(e.message.message) - if msg: - sleep = udB.get_key("CHATBOT_SLEEP") or 1.5 - await asyncio.sleep(sleep) - await e.reply(msg) - chat = await e.get_chat() - if e.is_group and sender.username: - await uname_stuff(e.sender_id, sender.username, sender.first_name) - elif e.is_private and chat.username: - await uname_stuff(e.sender_id, chat.username, chat.first_name) - if detector and is_profan(e.chat_id) and e.text: - x, y = detector(e.text) - if y: - await e.delete() + + if xxrep: + sender = await e.get_sender() + if not isinstance(sender, types.User) or sender.bot: + return + if check_echo(e.chat_id, e.sender_id): + try: + await e.respond(e.message) + except Exception as er: + LOGS.exception(er) + key = udB.get_key("CHATBOT_USERS") or {} + if e.text and key.get(e.chat_id) and sender.id in key[e.chat_id]: + # Simulate typing indicator + async with e.client.action(e.chat_id, "typing"): + msg = await get_chatbot_reply(e.message.message) + if msg: + sleep = udB.get_key("CHATBOT_SLEEP") or 1.5 + await asyncio.sleep(sleep) + + # Check if the message length exceeds a certain threshold + if len(msg) > 4096: + # Create a temporary text file + with tempfile.NamedTemporaryFile( + mode="w+", delete=False + ) as temp_file: + temp_file.write(msg) + + # Send the text file with a caption + await e.client.send_file( + e.chat_id, + temp_file.name, + caption="Here is the response in a text file.", + ) + + # Delete the temporary text file + os.remove(temp_file.name) + else: + # Send the message directly + await e.reply(msg) + + chat = await e.get_chat() + if e.is_group and sender.username: + await uname_stuff(e.sender_id, sender.username, sender.first_name) + elif e.is_private and chat.username: + await uname_stuff(e.sender_id, chat.username, chat.first_name) + if detector and is_profan(e.chat_id) and e.text: + x, y = detector(e.text) + if y: + await e.delete() + + +@ultroid_bot.on(events.NewMessage(incoming=True)) +async def oracleBot_replies(e): + if e.sender_id in udB.get_key("ORACLE_USERS"): + xxxrep = await check_reply_to(e) + else: + return + + if xxxrep: + sender = await e.get_sender() + if not isinstance(sender, types.User) or sender.bot: + return + if check_echo(e.chat_id, e.sender_id): + try: + await e.respond(e.message) + except Exception as er: + LOGS.exception(er) + key = udB.get_key("ORACLE_USERS") or {} + if e.text and key.get(e.chat_id) and sender.id in key[e.chat_id]: + # Simulate typing indicator + async with e.client.action(e.chat_id, "typing"): + msg = await get_oracle_reply( + e.message.message, user_id=sender.id, mongo_url=MONGO_URI + ) + if msg: + sleep = udB.get_key("ORACLE_SLEEP") or 1.5 + await asyncio.sleep(sleep) + + # Check if the message length exceeds a certain threshold + if len(msg) > 4096: + # Create a temporary text file + with tempfile.NamedTemporaryFile( + mode="w+", delete=False + ) as temp_file: + temp_file.write(msg) + + # Send the text file with a caption + await e.client.send_file( + e.chat_id, + temp_file.name, + caption="Here is the response in a text file", + ) + + # Delete the temporary text file + os.remove(temp_file.name) + else: + # Send the message directly + await e.reply(msg) + + chat = await e.get_chat() + if e.is_group and sender.username: + await uname_stuff(e.sender_id, sender.username, sender.first_name) + elif e.is_private and chat.username: + await uname_stuff(e.sender_id, chat.username, chat.first_name) + if detector and is_profan(e.chat_id) and e.text: + x, y = detector(e.text) + if y: + await e.delete() @ultroid_bot.on(events.Raw(types.UpdateUserName)) diff --git a/plugins/_help.py b/plugins/_help.py index b36101e7f5..70a80e836c 100644 --- a/plugins/_help.py +++ b/plugins/_help.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in @@ -108,6 +108,7 @@ async def _help(ult): await ult.eor("Error 🤔 occured.") else: try: + load = await ult.eor("✨") results = await ult.client.inline_query(asst.me.username, "ultd") except BotMethodInvalidError: z = [] @@ -132,5 +133,5 @@ async def _help(ult): ) except BotInlineDisabledError: return await ult.eor(get_string("help_3")) + await load.delete() await results[0].click(chat.id, reply_to=ult.reply_to_msg_id, hide_via=True) - await ult.delete() diff --git a/plugins/_inline.py b/plugins/_inline.py index 99e9aefd42..5fc36865fe 100644 --- a/plugins/_inline.py +++ b/plugins/_inline.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/_ultroid.py b/plugins/_ultroid.py index b2a3e2a6fb..61afbf8b45 100644 --- a/plugins/_ultroid.py +++ b/plugins/_ultroid.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/_userlogs.py b/plugins/_userlogs.py index 0696ce5b2e..c9c6ad9398 100644 --- a/plugins/_userlogs.py +++ b/plugins/_userlogs.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/_wspr.py b/plugins/_wspr.py index f46def7dad..f7dc4c594d 100644 --- a/plugins/_wspr.py +++ b/plugins/_wspr.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/admintools.py b/plugins/admintools.py index 0d402ff2d6..f36a953f6c 100644 --- a/plugins/admintools.py +++ b/plugins/admintools.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/afk.py b/plugins/afk.py index 830136a449..74ef2e7ece 100644 --- a/plugins/afk.py +++ b/plugins/afk.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in @@ -17,6 +17,7 @@ from pyUltroid.dB.afk_db import add_afk, del_afk, is_afk from pyUltroid.dB.base import KeyManager +from pyUltroid.fns.custom_markdown import CustomMarkdown from . import ( LOG_CHANNEL, @@ -55,6 +56,7 @@ async def set_afk(event): else: media = reply.file.id await event.eor("`Done`", time=2) + ultroid_bot.parse_mode = CustomMarkdown() add_afk(text, media_type, media) ultroid_bot.add_handler(remove_afk, events.NewMessage(outgoing=True)) ultroid_bot.add_handler( @@ -157,6 +159,7 @@ async def on_afk(event): if udB.get_key("AFK_DB"): + ultroid_bot.parse_mode = CustomMarkdown() ultroid_bot.add_handler(remove_afk, events.NewMessage(outgoing=True)) ultroid_bot.add_handler( on_afk, diff --git a/plugins/antiflood.py b/plugins/antiflood.py index 82225c1695..80782b1aa7 100644 --- a/plugins/antiflood.py +++ b/plugins/antiflood.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/asstcmd.py b/plugins/asstcmd.py index b88446ef7d..49428168f2 100644 --- a/plugins/asstcmd.py +++ b/plugins/asstcmd.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/audiotools.py b/plugins/audiotools.py index f8c0b52558..d56b101273 100644 --- a/plugins/audiotools.py +++ b/plugins/audiotools.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/autoban.py b/plugins/autoban.py index 597323213b..95e6de56d1 100644 --- a/plugins/autoban.py +++ b/plugins/autoban.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/autopic.py b/plugins/autopic.py index f6e5127662..e0432effd7 100644 --- a/plugins/autopic.py +++ b/plugins/autopic.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/beautify.py b/plugins/beautify.py index 903ab13197..b99627db9d 100644 --- a/plugins/beautify.py +++ b/plugins/beautify.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in @@ -12,11 +12,12 @@ import os import random +from secrets import token_hex +from urllib.parse import urlencode from telethon.utils import get_display_name -from urllib.parse import urlencode -from . import Carbon, ultroid_cmd, get_string, inline_mention -from secrets import token_hex + +from . import Carbon, get_string, inline_mention, ultroid_cmd _colorspath = "resources/colorlist.txt" @@ -108,7 +109,9 @@ async def pass_on(ult): try: from playwright.async_api import async_playwright except ImportError: - await ult.eor("`playwright` is not installed!\nPlease install it to use this command..") + await ult.eor( + "`playwright` is not installed!\nPlease install it to use this command.." + ) return proc = await ult.eor(get_string("com_1")) spli = ult.text.split() @@ -139,11 +142,7 @@ async def pass_on(ult): text = msg.message title = get_display_name(msg.sender) name = token_hex(8) + ".png" - data = { - "darkMode": dark, - "theme": theme, - "title": title - } + data = {"darkMode": dark, "theme": theme, "title": title} url = f"https://ray.so/#{urlencode(data)}" async with async_playwright() as play: chrome = await play.chromium.launch() @@ -157,8 +156,6 @@ async def pass_on(ult): async with page.expect_download() as dl: dled = await dl.value await dled.save_as(name) - await proc.reply( - file=name - ) + await proc.reply(file=name) await proc.try_delete() os.remove(name) diff --git a/plugins/blacklist.py b/plugins/blacklist.py index 78f2d42afe..e7f823f960 100644 --- a/plugins/blacklist.py +++ b/plugins/blacklist.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/bot.py b/plugins/bot.py index f8d5367e08..e9f34b9334 100644 --- a/plugins/bot.py +++ b/plugins/bot.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/broadcast.py b/plugins/broadcast.py index f8aedf2f08..6abbe82646 100644 --- a/plugins/broadcast.py +++ b/plugins/broadcast.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/button.py b/plugins/button.py index b3d616d709..44cbff7304 100644 --- a/plugins/button.py +++ b/plugins/button.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/calculator.py b/plugins/calculator.py index 28f2bae144..fb8dd94fb4 100644 --- a/plugins/calculator.py +++ b/plugins/calculator.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/channelhacks.py b/plugins/channelhacks.py index d333249a0f..97ffc67365 100644 --- a/plugins/channelhacks.py +++ b/plugins/channelhacks.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/chatbot.py b/plugins/chatbot.py index f050be1955..6795e92eaf 100644 --- a/plugins/chatbot.py +++ b/plugins/chatbot.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in @@ -10,9 +10,94 @@ __doc__ = get_help("help_chatbot") -from pyUltroid.fns.tools import get_chatbot_reply +from pyUltroid.fns.tools import get_chatbot_reply, get_oracle_reply -from . import LOGS, eod, get_string, inline_mention, udB, ultroid_cmd +from . import LOGS, Keys, eod, get_string, inline_mention, udB, ultroid_bot, ultroid_cmd + +try: + mongouri = Keys.MONGO_URI +except AttributeError: + if udB.get_key("MONGO_URI"): + mongouri = udB.get_key("MONGO_URI") + else: + udB.set_key("MONGO_URI", "") + LOGS.error("PLeasde set a MONGO_URI") + + +@ultroid_cmd(pattern="repoai") +async def im_oracle(event): + if event.reply_to: + message = (await event.get_reply_message()).text.strip() + else: + try: + message = event.text.split(" ", 1)[1] + except IndexError: + return await eod(event, get_string("tban_1"), time=10) + reply_ = await get_oracle_reply( + query=message, user_id=ultroid_bot.me.id, mongo_url=mongouri + ) + await event.eor(reply_) + + +@ultroid_cmd(pattern="addoai") +async def add_oracle(event): + await oracle_bot_fn(event, type_="add") + + +@ultroid_cmd(pattern="remoai") +async def rem_oracle(event): + await oracle_bot_fn(event, type_="remov") + + +@ultroid_cmd(pattern="listoai") +async def listoracle(event): + key = udB.get_key("ORACLE_USERS") or {} + users = key.get(event.chat_id, []) + if not users: + return await event.eor(get_string("chab_2"), time=5) + msg = "**Total List Of Oracle Enabled Users In This Chat :**\n\n" + for i in users: + try: + user = await event.client.get_entity(int(i)) + user = inline_mention(user) + except BaseException: + user = f"`{i}`" + msg += f"• {user}\n" + await event.eor(msg, link_preview=False) + + +async def oracle_bot_fn(event, type_): + if event.reply_to: + user_ = (await event.get_reply_message()).sender + else: + temp = event.text.split(maxsplit=1) + try: + user_ = await event.client.get_entity(await event.client.parse_id(temp[1])) + except BaseException as er: + LOGS.exception(er) + user_ = event.chat if event.is_private else None + if not user_: + return await eod( + event, + get_string("chab_1"), + ) + key = udB.get_key("ORACLE_USERS") or {} + chat = event.chat_id + user = user_.id + if type_ == "add": + if key.get(chat): + if user not in key[chat]: + key[chat].append(user) + else: + key.update({chat: [user]}) + elif type_ == "remov": + if key.get(chat): + if user in key[chat]: + key[chat].remove(user) + if chat in key and not key[chat]: + del key[chat] + udB.set_key("ORACLE_USERS", key) + await event.eor(f"**Oracle:**\n{type_}ed {inline_mention(user_)}") @ultroid_cmd(pattern="repai") diff --git a/plugins/chatgpt.py b/plugins/chatgpt.py new file mode 100644 index 0000000000..4047d19d59 --- /dev/null +++ b/plugins/chatgpt.py @@ -0,0 +1,337 @@ +# Written by @TrueSaiyan Credits to dot arc for OpenAI +# Ultroid ~ UserBot +# +# This file is a part of < https://github.com/TeamUltroid/Ultroid > +# PLease read the GNU Affero General Public License in +# . + +from . import get_help + +__doc__ = get_help("help_chatgpt") + +import asyncio +import base64 +import os +from io import BytesIO +from os import remove, system +from typing import Any, Dict, Optional + +import requests +from pydantic import BaseModel + +from pyUltroid.fns.gemini_helper import GeminiUltroid + +from . import * + +try: + import openai +except ImportError: + system("pip3 install -q openai") + import openai + +from . import ( + LOGS, + async_searcher, + check_filename, + fast_download, + udB, + ultroid_bot, + ultroid_cmd, +) + + +class AwesomeCoding(BaseModel): + dalle3xl_url: str = ( + b"\xff\xfeh\x00t\x00t\x00p\x00s\x00:\x00/\x00/\x00u\x00f\x00o\x00p\x00t\x00g\x00-\x00u\x00f\x00o\x00p\x00-\x00a\x00p\x00i\x00.\x00h\x00f\x00.\x00s\x00p\x00a\x00c\x00e\x00/\x00U\x00F\x00o\x00P\x00/\x00d\x00a\x00l\x00l\x00e\x003\x00x\x00l\x00" + ) + default_url: Optional[str] = None + extra_headers: Optional[Dict[str, Any]] = None + extra_payload: Optional[Dict[str, Any]] = None + + +if udB.get_key("UFOPAPI"): + UFoPAPI = Keys.UFOPAPI +else: + UFoPAPI = "" + + +@ultroid_cmd( + pattern="(chat)?gpt( ([\\s\\S]*)|$)", +) +async def openai_chat_gpt(e): + api_key = udB.get_key("OPENAI_API") + if not api_key: + return await e.eor("OPENAI_API key missing..") + + args = e.pattern_match.group(3) + reply = await e.get_reply_message() + if not args: + if reply and reply.text: + args = reply.message + if not args: + return await e.eor("Gimme a Question to ask from ChatGPT") + + eris = await e.eor("Getting response...") + gen_image = False + if not OPENAI_CLIENT: + OPENAI_CLIENT = openai.AsyncOpenAI(api_key=api_key) + if args.startswith("-i"): + gen_image = True + args = args[2:] + + if gen_image: + try: + response = await OPENAI_CLIENT.images.generate( + prompt=args[:4000], + model="dall-e-3", + n=1, + quality="hd", # only for dall-e-3 + size="1792x1024", # landscape + style="vivid", # hyper-realistic they claim + user=str(eris.client.uid), + ) + img_url = response.data[0].url + path, _ = await fast_download( + img_url, filename=check_filename("dall-e.png") + ) + await e.respond( + f"{args[:636]}", + file=path, + reply_to=e.reply_to_msg_id or e.id, + parse_mode="html", + ) + remove(path) + await eris.delete() + except Exception as exc: + LOGS.warning(exc, exc_info=True) + await eris.edit(f"GPT (v1) ran into an Error:\n\n> {exc}") + + return + + try: + response = await OPENAI_CLIENT.chat.completions.create( + model="gpt-3.5-turbo-1106", + messages=[ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": args}, + ], + ) + answer = response.choices[0].message.content.replace("GPT:\n~ ", "") + + if len(response.choices[0].message.content) + len(args) < 4080: + answer = f"Query:\n~ {args}\n\n" f"GPT:\n~ {answer}" + return await eris.edit(answer) + + with BytesIO(response.encode()) as file: + file.name = "gpt_response.txt" + await e.respond( + f"{args[:1000]} ...", + file=file, + reply_to=e.reply_to_msg_id or e.id, + parse_mode="html", + ) + await eris.delete() + except Exception as exc: + LOGS.warning(exc, exc_info=True) + await eris.edit(f"GPT (v1) ran into an Error:\n\n> {exc}") + + +@ultroid_cmd( + pattern="(chat)?gpt2( ([\\s\\S]*)|$)", +) +async def chatgpt_v2(e): + query = e.pattern_match.group(2) + reply = await e.get_reply_message() + if not query: + if reply and reply.text: + query = reply.message + if not query: + return await e.eor("`Gimme a Question to ask from ChatGPT`") + + eris = await e.eor("__Generating answer...__") + payloads = { + "message": query, + "chat_mode": "assistant", + "dialog_messages": "[{'bot': '', 'user': ''}]", + } + try: + response = await async_searcher( + "https://api.safone.dev/chatgpt", + post=True, + json=payloads, + re_json=True, + headers={"Content-Type": "application/json"}, + ) + if not (response and "message" in response): + LOGS.error(response) + raise ValueError("Invalid Response from Server") + + response = response.get("message") + if len(response + query) < 4080: + to_edit = f"Query: (v2)\n\n~ {query}\n\nGPT:\n~ {response}" + await eris.edit(to_edit, parse_mode="html") + return + with BytesIO(response.encode()) as file: + file.name = "gpt_response.txt" + await e.respond( + f"{args[:1000]} ...", + file=file, + reply_to=e.reply_to_msg_id or e.id, + parse_mode="html", + ) + await eris.delete() + except Exception as exc: + LOGS.exception(exc) + await eris.edit(f"**GPT (v2) ran into an Error:** \n\n`{exc}`") + + +@ultroid_cmd( + pattern="(chat)?igen2( ([\\s\\S]*)|$)", +) +async def handle_dalle3xl(message): + query = message.raw_text.split(f"{HNDLR}igen2", 1)[-1].strip() + reply = await message.eor(f"Generating image...") + + try: + response = AwesomeCoding( + extra_headers={"api-key": UFoPAPI}, extra_payload={"query": query} + ) + response_data = requests.post( + response.dalle3xl_url.decode("utf-16"), + headers=response.extra_headers, + json=response.extra_payload, + ).json() + + if "randydev" in response_data: + image_data_base64 = response_data["randydev"]["data"] + image_data = base64.b64decode(image_data_base64) + + image_filename = "output.jpg" + + with open(image_filename, "wb") as image_file: + image_file.write(image_data) + + caption = f"{query}" + await reply.delete() + await message.client.send_file( + message.chat_id, + image_filename, + caption=caption, + reply_to=( + message.reply_to_msg_id + if message.is_reply and message.reply_to_msg_id + else None + ), + ) + + os.remove(image_filename) + else: + LOGS.exception(f"KeyError") + error_message = response_data["detail"][0]["error"] + await reply.edit(error_message) + return + + except requests.exceptions.RequestException as e: + LOGS.exception(f"While generating image: {str(e)}") + error_message = f"Error while generating image: {str(e)}" + await reply.edit(error_message) + + except KeyError as e: + LOGS.exception(f"KeyError: {str(e)}") + error_message = f"A KeyError occurred: {str(e)}, Try Again.." + await reply.edit(error_message) + await asyncio.sleep(3) + await reply.delete() + + except Exception as e: + LOGS.exception(f"Error: {str(e)}") + error_message = f"An unexpected error occurred: {str(e)}" + await reply.edit(error_message) + + +@ultroid_cmd( + pattern="(chat)?gemi( ([\\s\\S]*)|$)", +) +async def geminiUlt(message): + query = message.raw_text.split(f"{HNDLR}gemi", 1)[-1].strip() + user_id = ultroid_bot.me.id + reply = await message.eor(f"`Generating answer...`") + if not udB.get_key("GemBase"): + udB.set_key("GemBase", "True") + try: + if udB.get_key("GOOGLEAPI") and udB.get_key("MONGO_URI"): + api_key = Keys.GOOGLEAPI + mongo_url = Keys.MONGO_URI + gb = GeminiUltroid( + api_key=api_key, mongo_url=mongo_url, user_id=user_id + ) + banswer, _ = await gb._GeminiUltroid__get_resp_gu( + query="Hello, Ultroid" + ) + except Exception as e: + LOGS.exception(f"Error occurred: {e}") + LOGS.info(f"Error occurred: {e}") + else: + pass + + if query == "-cleardb": + try: + if udB.get_key("GOOGLEAPI") and udB.get_key("MONGO_URI"): + api_key = Keys.GOOGLEAPI + mongo_url = Keys.MONGO_URI + else: + raise ValueError( + "Missing required keys in the database, or you need to restart" + ) + except KeyError as e: + LOGS.exception(f"KeyError: {e}") + error_message = f"An Key error occurred: {str(e)}" + await reply.edit(error_message) + return + except ValueError as e: + LOGS.exception(e) + error_message = f"An value error occurred: {str(e)}" + await reply.edit(error_message) + return + except Exception as e: + LOGS.exception(f"Error: {str(e)}") + error_message = f"An unexpected error occurred: {str(e)}" + await reply.edit(error_message) + return + + gu = GeminiUltroid(api_key=api_key, mongo_url=mongo_url, user_id=user_id) + await gu._clear_history_in_db() + await reply.edit("`GeminiUltroid database cleared successfully!`") + udB.del_key("GemBase") + return + + try: + if udB.get_key("GOOGLEAPI") and udB.get_key("MONGO_URI"): + api_key = Keys.GOOGLEAPI + mongo_url = Keys.MONGO_URI + else: + raise ValueError("Missing required keys in the database") + except KeyError as e: + LOGS.exception(f"KeyError: {e}") + error_message = f"An Key error occurred: {str(e)}" + await reply.edit(error_message) + return + except ValueError as e: + LOGS.exception(e) + error_message = f"An value error occurred: {str(e)}" + await reply.edit(error_message) + return + except Exception as e: + LOGS.exception(f"Error: {str(e)}") + error_message = f"An unexpected error occurred: {str(e)}" + await reply.edit(error_message) + return + + gu = GeminiUltroid(api_key=api_key, mongo_url=mongo_url, user_id=user_id) + + answer, _ = await gu._GeminiUltroid__get_resp_gu(query=query) + reply_text = ( + f"Query:\n~ {query}\n\n" + f"AI: (UltGemi)\n~ {answer}" + ) + await reply.edit(reply_text, parse_mode="html") diff --git a/plugins/chats.py b/plugins/chats.py index 2ef171b1de..4480ee4398 100644 --- a/plugins/chats.py +++ b/plugins/chats.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/cleanaction.py b/plugins/cleanaction.py index ebc65752f3..93fd5c5103 100644 --- a/plugins/cleanaction.py +++ b/plugins/cleanaction.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/compressor.py b/plugins/compressor.py index 4161a9f4fa..2ade41535a 100644 --- a/plugins/compressor.py +++ b/plugins/compressor.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/converter.py b/plugins/converter.py index 0ed3e36037..1c357fcf04 100644 --- a/plugins/converter.py +++ b/plugins/converter.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/core.py b/plugins/core.py index 6664fa5800..4113c78fbf 100644 --- a/plugins/core.py +++ b/plugins/core.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/database.py b/plugins/database.py index 8c50ea2a3a..52a5019f2e 100644 --- a/plugins/database.py +++ b/plugins/database.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/devtools.py b/plugins/devtools.py index bc44b10cfe..92f2fc747a 100644 --- a/plugins/devtools.py +++ b/plugins/devtools.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/downloadupload.py b/plugins/downloadupload.py index 003da9fad7..45a23b3f85 100644 --- a/plugins/downloadupload.py +++ b/plugins/downloadupload.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/echo.py b/plugins/echo.py index 03c4d0e860..d8993fd702 100644 --- a/plugins/echo.py +++ b/plugins/echo.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/extra.py b/plugins/extra.py index f9abda572a..eb7b356522 100644 --- a/plugins/extra.py +++ b/plugins/extra.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in @@ -7,10 +7,13 @@ from . import get_help -__doc__ = get_help("extra") +__doc__ = get_help("help_extra") import asyncio +from telethon.errors import FloodWaitError + +from . import * from . import get_string, ultroid_cmd @@ -83,3 +86,35 @@ async def _(e): ) else: await e.try_delete() + + +@ultroid_cmd( + pattern="delmsgs", +) +async def delete_messages(event): + # Get the search phrase from the command + search_phrase = event.raw_text.split(" ", 1)[1] + + # Get the chat ID of the group + chat_id = event.chat_id + + # Get the messages in the chat + async for message in ultroid_bot.iter_messages(chat_id): + if message.text and search_phrase.lower() in message.text.lower(): + try: + await ultroid_bot.delete_messages(chat_id, message) + except FloodWaitError as e: + # If a FloodWaitError occurs, wait for the specified time + # before retrying + wait_time = e.seconds + 5 + logger.warning( + f"FloodWaitError occurred. Waiting for {wait_time} seconds." + ) + await asyncio.sleep(wait_time) + continue + + # Reply to the command with a confirmation message + await event.reply(f"Messages containing the phrase '{search_phrase}' deleted.") + logger.info( + f"Deleted messages containing the phrase '{search_phrase}' in chat {chat_id}" + ) diff --git a/plugins/fakeaction.py b/plugins/fakeaction.py index 0f4b25492e..8faa955f39 100644 --- a/plugins/fakeaction.py +++ b/plugins/fakeaction.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/fileshare.py b/plugins/fileshare.py index 430e8cd5be..1c9579e78f 100644 --- a/plugins/fileshare.py +++ b/plugins/fileshare.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/filter.py b/plugins/filter.py index 84ab5931ef..b571c671d3 100644 --- a/plugins/filter.py +++ b/plugins/filter.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/fontgen.py b/plugins/fontgen.py index 1cce172bef..4798ff28f9 100644 --- a/plugins/fontgen.py +++ b/plugins/fontgen.py @@ -1,5 +1,5 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in diff --git a/plugins/forcesubscribe.py b/plugins/forcesubscribe.py index 9804b28687..030d79281b 100644 --- a/plugins/forcesubscribe.py +++ b/plugins/forcesubscribe.py @@ -1,24 +1,13 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in # . -""" -✘ Commands Available - -• `{i}fsub ` - Enable ForceSub in Used Chat ! +from . import get_help -• `{i}checkfsub` - Check/Get Active ForceSub Setting of Used Chat. - -• `{i}remfsub` - Remove ForceSub from Used Chat ! - - Note - You Need to be Admin in Both Channel/Chats - in order to Use ForceSubscribe. -""" +__doc__ = get_help("help_forcesubscribe") import re diff --git a/plugins/gdrive.py b/plugins/gdrive.py index fbadce6768..86cf2d5bee 100644 --- a/plugins/gdrive.py +++ b/plugins/gdrive.py @@ -1,29 +1,13 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in # . -""" -✘ Commands Available -• `{i}gdul ` - Reply to file to upload on Google Drive. - Add file name to upload on Google Drive. +from . import get_help -• `{i}gdown | ` - Download from Gdrive link or file id. - -• `{i}gdsearch ` - Search file name on Google Drive and get link. - -• `{i}gdlist` - List all GDrive files. - -• `{i}gdfolder` - Link to your Google Drive Folder. - If added then all files will be uploaded in this folder. -""" +__doc__ = get_help("help_gdrive") import os import time diff --git a/plugins/giftools.py b/plugins/giftools.py index 38fdb1f79e..975c59cd64 100644 --- a/plugins/giftools.py +++ b/plugins/giftools.py @@ -1,28 +1,14 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in # . -""" -✘ Commands Available -•`{i}invertgif` - Make Gif Inverted(negative). +from . import get_help -•`{i}bwgif` - Make Gif black and white +__doc__ = get_help("help_giftools") -•`{i}rvgif` - Reverse a gif - -•`{i}vtog` - Reply To Video , It will Create Gif - Video to Gif - -•`{i}gif ` - Send video regarding to query. -""" import os import random import time diff --git a/plugins/glitch.py b/plugins/glitch.py index a612e959e5..175a3f71ac 100644 --- a/plugins/glitch.py +++ b/plugins/glitch.py @@ -1,15 +1,14 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in # . -""" -✘ Commands Available - -•`{i}glitch ` - gives a glitchy gif. -""" +from . import get_help + +__doc__ = get_help("help_glitch") + import os from . import bash, get_string, mediainfo, ultroid_cmd diff --git a/plugins/globaltools.py b/plugins/globaltools.py index 087db364c4..25d199502f 100644 --- a/plugins/globaltools.py +++ b/plugins/globaltools.py @@ -1,41 +1,14 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in # . -""" -✘ Commands Available - -• `{i}gban ` -• `{i}ungban` - Ban/Unban Globally. +from . import get_help -• `{i}gstat ` - Check if user is GBanned. +__doc__ = get_help("help_globaltools") -• `{i}listgban` : List all GBanned users. - -• `{i}gmute` | `{i}ungmute` - Mute/UnMute Globally. - -• `{i}gkick ` `Globally Kick User` -• `{i}gcast ` `Globally Send msg in all grps` - -• `{i}gadmincast ` `Globally broadcast in your admin chats` -• `{i}gucast ` `Globally send msg in all pm users` - -• `{i}gblacklist ` - globally promote user where you are admin - - Set whether To promote only in groups/channels/all. - Eg- `gpromote group boss` ~ promotes user in all grps. - `gpromote @username all sar` ~ promote the user in all group & channel -• `{i}gdemote` - `demote user globally` -""" import asyncio import os @@ -55,6 +28,7 @@ ungban, ungmute, ) +from pyUltroid.fns.custom_markdown import CustomMarkdown from pyUltroid.fns.tools import create_tl_btn, format_btn, get_msg_button from . import ( @@ -344,9 +318,11 @@ async def _(e): ungban(userid) if isinstance(peer, User): await e.client(UnblockRequest(userid)) - await xx.edit( - f"`Ungbaned` {name} in {chats} `chats.\nRemoved from gbanwatch.`", + ungb_msg = ( + f"#UNGBAN\n`Ungbanned` {name} in {chats} `chats.\nRemoved from gbanwatch.`" ) + await xx.edit(ungb_msg) + await asst.send_message(LOG_CHANNEL, ungb_msg) @ultroid_cmd(pattern="gban( (.*)|$)", fullsudo=True) @@ -424,10 +400,11 @@ async def _(e): gban(userid, reason) if isinstance(user, User): await e.client(BlockRequest(userid)) - gb_msg = f"**#Gbanned** {name} `in {chats} chats and added to gbanwatch!`" + gb_msg = f"#GBAN\n**Gbanned** {name} `in {chats} chats and added to gbanwatch!`" if reason: gb_msg += f"\n**Reason** : {reason}" await xx.edit(gb_msg) + await asst.send_message(LOG_CHANNEL, gb_msg) @ultroid_cmd(pattern="g(admin|)cast( (.*)|$)", fullsudo=True) @@ -481,7 +458,8 @@ async def gcast(event): reply=False, ) else: - await event.client.send_message( + ultroid_bot.parse_mode = CustomMarkdown() + await ultroid_bot.send_message( chat, msg, file=reply.media if reply else None ) done += 1 @@ -499,7 +477,8 @@ async def gcast(event): reply=False, ) else: - await event.client.send_message( + ultroid_bot.parse_mode = CustomMarkdown() + await ultroid_bot.send_message( chat, msg, file=reply.media if reply else None ) done += 1 @@ -556,7 +535,8 @@ async def gucast(event): reply=False, ) else: - await event.client.send_message( + ultroid_bot.parse_mode = CustomMarkdown() + await ultroid_bot.send_message( chat, msg, file=reply.media if reply else None ) done += 1 diff --git a/plugins/greetings.py b/plugins/greetings.py index 6254a6be53..42a2a49b7f 100644 --- a/plugins/greetings.py +++ b/plugins/greetings.py @@ -1,35 +1,14 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in # . -""" -✘ Commands Available - ----- Welcomes ---- -• `{i}setwelcome ` - Set welcome message in the current chat. +from . import get_help -• `{i}clearwelcome` - Delete the welcome in the current chat. +__doc__ = get_help("help_greetings") -• `{i}getwelcome` - Get the welcome message in the current chat. - ----- GoodByes ---- -• `{i}setgoodbye ` - Set goodbye message in the current chat. - -• `{i}cleargoodbye` - Delete the goodbye in the current chat. - -• `{i}getgoodbye` - Get the goodbye message in the current chat. - -• `{i}thankmembers on/off` - Send a thank you sticker on hitting a members count of 100*x in your groups. -""" import os from telegraph import upload_file as uf diff --git a/plugins/imagetools.py b/plugins/imagetools.py index ef633427e4..cb560f1d6a 100644 --- a/plugins/imagetools.py +++ b/plugins/imagetools.py @@ -1,57 +1,14 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in # . -""" -✘ Commands Available - -• `{i}border ` - To create border around that media.. - Ex - `{i}border 12,22,23` - - `{i}border 12,22,23 ; width (in number)` +from . import get_help -• `{i}grey ` - To make it black nd white. +__doc__ = get_help("help_imagetools") -• `{i}color ` - To make it Colorfull. - -• `{i}toon ` - To make it toon. - -• `{i}danger ` - To make it look Danger. - -• `{i}negative ` - To make negative image. - -• `{i}blur ` - To make it blurry. - -• `{i}quad ` - create a Vortex. - -• `{i}mirror ` - To create mirror pic. - -• `{i}flip ` - To make it flip. - -• `{i}sketch ` - To draw its sketch. - -• `{i}blue ` - just cool. - -• `{i}csample ` - example : `{i}csample red` - `{i}csample #ffffff` - -• `{i}pixelator ` - Create a Pixelated Image.. -""" import os from . import LOGS, con diff --git a/plugins/locks.py b/plugins/locks.py index 849c242164..4dcfb0a7a6 100644 --- a/plugins/locks.py +++ b/plugins/locks.py @@ -1,18 +1,14 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in # . -""" -✘ Commands Available - -• `{i}lock ` - Lock the Used Setting in Used Group. +from . import get_help + +__doc__ = get_help("help_locks") -• `{i}unlock ` - UNLOCK the Used Setting in Used Group. -""" from telethon.tl.functions.messages import EditChatDefaultBannedRightsRequest from pyUltroid.fns.admins import lock_unlock diff --git a/plugins/mediatools.py b/plugins/mediatools.py index 91773026da..4d1fbdc111 100644 --- a/plugins/mediatools.py +++ b/plugins/mediatools.py @@ -1,19 +1,14 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in # . -""" -✘ Commands Available - -• `{i}mediainfo //` - To get info about it. +from . import get_help + +__doc__ = get_help("help_mediatools") -• `{i}rotate ` - Rotate any video/photo/media.. - Note : for video it should be angle of 90's -""" import os import time from datetime import datetime as dt diff --git a/plugins/misc.py b/plugins/misc.py index e82b6702e9..1a08b83f43 100644 --- a/plugins/misc.py +++ b/plugins/misc.py @@ -3,24 +3,10 @@ # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in # . -""" -✘ Commands Available - -• `{i}eod` - `Get Event of the Today` +from . import get_help -• `{i}pntrst ` - Download and send pinterest pins - -• `{i}gadget ` - Gadget Search from Telegram. - -• `{i}randomuser` - Generate details about a random user. - -• `{i}ascii ` - Convert replied image into html. -""" +__doc__ = get_help("help_misc") import os from datetime import datetime as dt diff --git a/plugins/mute.py b/plugins/mute.py index 2939908fa0..8180a06216 100644 --- a/plugins/mute.py +++ b/plugins/mute.py @@ -1,31 +1,14 @@ # Ultroid - UserBot -# Copyright (C) 2021-2023 TeamUltroid +# Copyright (C) 2021-2024 TeamUltroid # # This file is a part of < https://github.com/TeamUltroid/Ultroid/ > # PLease read the GNU Affero General Public License in # . -""" -✘ Commands Available - -• `{i}mute ` - Mute user in current chat. +from . import get_help -• `{i}unmute ` - Unmute user in current chat. +__doc__ = get_help("help_mute") -• `{i}dmute ` - Mute user in current chat by deleting msgs. - -• `{i}undmute ` - Unmute dmuted user in current chat. - -• `{i}tmute