diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml new file mode 100644 index 0000000..a5a813b --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,36 @@ +# +#name: PyLint +#on: push +#jobs: +# PEP8: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v2 +# - name: Setup Python +# uses: actions/setup-python@v1 +# with: +# python-version: 3.9 +# - name: Install Python lint libraries +# run: pip install autopep8 autoflake isort black +# - name: Check for showstoppers +# run: | +# autopep8 --verbose --in-place --recursive --aggressive --aggressive assistant/* +# autopep8 --verbose --in-place --recursive --aggressive --aggressive plugins/* +# - name: Remove unused imports and variables +# run: | +# autoflake --in-place --recursive --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports assistant/* +# autoflake --in-place --recursive --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports plugins/* +# - name: lint with isort and black +# run: | +# isort assistant/* +# black assistant/* +# isort plugins/* +# black plugins/* +# - uses: stefanzweifel/git-auto-commit-action@v4 +# with: +# commit_message: 'pylint: auto fixes' +# commit_options: '--no-verify' +# repository: . +# commit_user_name: Noob-Stranger +# commit_user_email: Noob-Stranger@users.noreply.github.com +# commit_author: Noob-Stranger diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile new file mode 100644 index 0000000..52cd909 --- /dev/null +++ b/.gitpod.Dockerfile @@ -0,0 +1,9 @@ +FROM python:latest +RUN apt-get update && apt-get upgrade -y +RUN apt-get install -y ffmpeg python3-pip opus-tools +RUN git clone https://github.com/Andencento/Andencento.git /root/Andencento +WORKDIR /root/Andencento +ENV PYTHONUNBUFFERED=1 +COPY . . +RUN pip install -r requirements.txt +CMD ["python3","-m","userbot"] diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 0000000..0418e64 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,12 @@ +image: + file: .gitpod.Dockerfile + +# List the ports you want to expose and what to do when they are served. See https://www.gitpod.io/docs/config-ports/ +ports: + - port: 8080 + onOpen: notify + +# List the start up tasks. You can start them in parallel in multiple terminals. See https://www.gitpod.io/docs/config-start-tasks/ +tasks: + - init: pip3 install -r requirements.txt + command: python3 userbot diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b63a4ff --- /dev/null +++ b/LICENSE @@ -0,0 +1,122 @@ +Creative Commons Legal Code +Copyright Team Andencento (C) 2021-2022 + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..d3e0dff --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +Andencento: bash startup.sh diff --git a/README.md b/README.md index e0a2d72..51eeee8 100644 --- a/README.md +++ b/README.md @@ -1,39 +1 @@ -# Andencento - -# A STABLE USERBOT BASED ON TELETHON -# DEVS -### • NOOB-STRANGER »» -### • MADBOY »» -### • InternetAmethyst »» -### • GODBOYX »» -### • InukaAsith »» -## SOME INFO -[![Stars](https://img.shields.io/github/stars/Andencento/Andencento?style=flat-square&color=yellow)](https://github.com/Andencento/Andencento/stargazers) -[![Forks](https://img.shields.io/github/forks/Andencento/Andencento?style=flat-square&color=orange)](https://github.com/Andencento/Andencento/fork) -[![Size](https://img.shields.io/github/repo-size/Andencento/Andencento?style=flat-square&color=green)](https://github.com/Andencento/Andencento) -[![Python](https://img.shields.io/badge/Python-v3.9-blue)](https://www.python.org/) -[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/Noob-Stranger/andencento/graphs/commit-activity) -[![Close Source Love](https://img.shields.io/badge/Close--source-%F0%9F%94%A5-brightgreen)](https://github.com/Andencento/Andencento/) -[![Contributors](https://img.shields.io/github/contributors/Andencento/Andencento?style=flat-square&color=pink)](https://github.com/Andencento/Andencento/graphs/contributors) - -## Inspirations -- Darkcobra -- Uniborg - - -## Deloy On Railway -[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new/template?template=https%3A%2F%2Fgithub.com%2FAndencento%2FRailway-Deploy&plugins=postgresql&envs=YOUR_NAME%2CTZ%2CALIVE_PIC%2CPMPERMIT_PIC%2CPM_LOG_ID%2CHANDLER%2CBUTTONS_IN_HELP%2CTEMP_DOWNLOAD_DIRECTORY%2CPM_PERMIT%2CAPP_ID%2CAPI_HASH%2CLOGGER_ID%2CANDENCENTO_SESSION%2CBOT_TOKEN%2CTAG_LOGGER%2CBOT_USERNAME%2CSUDO_USERS&optionalEnvs=PM_LOG_ID%2CTAG_LOGGER%2CSUDO_USERS&YOUR_NAMEDesc=This+is+Alive+Name+So+Fill+it+Properly+It+is+Mandatory&TZDesc=Time+Zone+of+a+country+Dont+Edit+untill+you+want+diffrent+time+zone&ALIVE_PICDesc=Alive+Pic+Paste+Telegraph+Link&PMPERMIT_PICDesc=Pmpermit+Pic&PM_LOG_IDDesc=Fill+your+private+Channel+ID+if+you+want+to+Log+PM+messages.&HANDLERDesc=Your+command+handler.+Default+is+%27+.+%27+%28dot%29.&BUTTONS_IN_HELPDesc=No.of+buttons+to+display+in+help+menu.&TEMP_DOWNLOAD_DIRECTORYDesc=Temp+Storage+&PM_PERMITDesc=Defualt+is+Enable+if+You+Want+To+Disable+PMPERMIT+type+Disable&APP_IDDesc=Get+this+value+from+my.telegram.org+6+Digits+Value&API_HASHDesc=Get+this+value+from+my.telegram.org&LOGGER_IDDesc=Logger+Id+Starts+from+-100&ANDENCENTO_SESSIONDesc=Get+this+value+by+using+https%3A%2F%2Freplit.com%2F%40madboy482%2FSession-Andencento+and+fill+this+is+your+String+Session.&BOT_TOKENDesc=Make+a+bot+from+%40BotFather+and+paste+the+bot+token+here.&TAG_LOGGERDesc=Make+a+group+and+add+rose.+Do+%2Fid+and+paste+the+chat+id+here.+Make+Sure+id+Should+Start+From+-100&BOT_USERNAMEDesc=from+%40BotFather+Get+Bot+username+which+you+filled+token+and+paste+the+username+here.&SUDO_USERSDesc=Userid+of+user+to+grant+sudo+access.+Add+multiple+sudo+users+by+giving+a+space+between+userids&TZDefault=Asia%2FKolkata&HANDLERDefault=.&BUTTONS_IN_HELPDefault=7&TEMP_DOWNLOAD_DIRECTORYDefault=.%2Fuserbot%2Fcache&PM_PERMITDefault=ENABLE) - -## Deploy To Heroku -[![Deploy To Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/Andencento/Deploy-Andencento) - -## VC Deploy (Music) -- [![Deploy](https://www.herokucdn.com/deploy/button.svg)](http://heroku.com/deploy?template=https://github.com/Andencento/Andencento/tree/vc) - - -## Andencento Session -[![Andencento Session](https://repl.it/badge/github/Andencento/Andencento)](https://replit.com/@madboy482/Session-Andencento/) - - -## VC Session -- [![Run on Repl.it](https://repl.it/badge/github/Andencento/Andencentovcbot)](https://replit.com/@dashezup/generate-pyrogram-session-string) +## Project reopened thamks to heroku diff --git a/assistant/__init__.py b/assistant/__init__.py new file mode 100644 index 0000000..ff3508e --- /dev/null +++ b/assistant/__init__.py @@ -0,0 +1 @@ +from plugins import * diff --git a/assistant/alive.py b/assistant/alive.py new file mode 100644 index 0000000..cfe4cc0 --- /dev/null +++ b/assistant/alive.py @@ -0,0 +1,96 @@ +""" +Made by GODBOYX +""" +import os +import re + +from telethon import Button, custom, events +from userbot import YOUR_NAME as ALIVE_NAME +from userbot import asst + +ver = "0.2" + +DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "Unknown" +PM_IMG = ( + os.environ.get("ALIVE_PIC", None) + or "https://telegra.ph/file/3d208ecf6d0ea9389d8f8.jpg" +) +pm_caption = "➥ αη∂єη¢єηтσ: ONLINE\n\n" +pm_caption += "➥ ѕуѕтємѕ ѕтαтѕ\n" +pm_caption += "➥ тєℓєтнση νєяѕιση: 1.23.0 \n" +pm_caption += "➥ ρутнση: 3.9.6 \n" +pm_caption += "➥ ∂αтαвαѕє ѕтαтυѕ: Functional\n" +pm_caption += "➥ ¢υяяєηт вяαη¢н : Andencento\n" +pm_caption += f"➥ νєяѕιση : {ver}\n" +pm_caption += f"➥ му вσѕѕ : {DEFAULTUSER} \n" +pm_caption += f"➥ ℓι¢єηѕє : [𝘎𝘕𝘜 𝘈𝘧𝘧𝘦𝘳𝘰 𝘎𝘦𝘯𝘦𝘳𝘢𝘭 𝘗𝘶𝘣𝘭𝘪𝘤 𝘓𝘪𝘤𝘦𝘯𝘴𝘦 𝘷3.0](https://github.com/Andencento/Andencento/blob/Andencento/LICENSE/)\n" +pm_caption += ( + "➥ ¢σρуяιgнт : By [𝘛𝘦𝘢𝘮 𝘈𝘯𝘥𝘦𝘯𝘤𝘦𝘯𝘵𝘰](https://github.com/Andencento/Andencento/)\n" +) +btn = [custom.Button.inline("<>", data="demploy")] +btn += [custom.Button.inline("<>", data="stling")] +btn += [Button.url("<>", "https://github.com/Andencento/Andencento")] + + +@asst.on(events.NewMessage(pattern=("/alive"))) +async def _(event): + await event.get_chat() + await event.delete() + await asst.send_file(event.chat_id, PM_IMG, caption=pm_caption, buttons=btn) + + +@asst.on(events.callbackquery.CallbackQuery(data=re.compile(b"demploy"))) +async def demploy(event): + bottm = [ + [ + Button.url( + "", + "https://railway.app/new/template?template=https%3A%2F%2Fgithub.com%2FAndencento%2FRailway-Deploy&plugins=postgresql&envs=YOUR_NAME%2CTZ%2CALIVE_PIC%2CPMPERMIT_PIC%2CPM_LOG_ID%2CHANDLER%2CBUTTONS_IN_HELP%2CTEMP_DOWNLOAD_DIRECTORY%2CPM_PERMIT%2CAPP_ID%2CAPI_HASH%2CLOGGER_ID%2CANDENCENTO_SESSION%2CBOT_TOKEN%2CTAG_LOGGER%2CBOT_USERNAME%2CSUDO_USERS&optionalEnvs=PM_LOG_ID%2CTAG_LOGGER%2CSUDO_USERS&YOUR_NAMEDesc=This+is+Alive+Name+So+Fill+it+Properly+It+is+Mandatory&TZDesc=Time+Zone+of+a+country+Dont+Edit+untill+you+want+diffrent+time+zone&ALIVE_PICDesc=Alive+Pic+Paste+Telegraph+Link&PMPERMIT_PICDesc=Pmpermit+Pic&PM_LOG_IDDesc=Fill+your+private+Channel+ID+if+you+want+to+Log+PM+messages.&HANDLERDesc=Your+command+handler.+Default+is+%27+.+%27+%28dot%29.&BUTTONS_IN_HELPDesc=No.of+buttons+to+display+in+help+menu.&TEMP_DOWNLOAD_DIRECTORYDesc=Temp+Storage+&PM_PERMITDesc=Defualt+is+Enable+if+You+Want+To+Disable+PMPERMIT+type+Disable&APP_IDDesc=Get+this+value+from+my.telegram.org+6+Digits+Value&API_HASHDesc=Get+this+value+from+my.telegram.org&LOGGER_IDDesc=Logger+Id+Starts+from+-100&ANDENCENTO_SESSIONDesc=Get+this+value+by+using+https%3A%2F%2Freplit.com%2F%40madboy482%2FSession-Andencento+and+fill+this+is+your+String+Session.&BOT_TOKENDesc=Make+a+bot+from+%40BotFather+and+paste+the+bot+token+here.&TAG_LOGGERDesc=Make+a+group+and+add+rose.+Do+%2Fid+and+paste+the+chat+id+here.+Make+Sure+id+Should+Start+From+-100&BOT_USERNAMEDesc=from+%40BotFather+Get+Bot+username+which+you+filled+token+and+paste+the+username+here.&SUDO_USERSDesc=Userid+of+user+to+grant+sudo+access.+Add+multiple+sudo+users+by+giving+a+space+between+userids&TZDefault=Asia%2FKolkata&HANDLERDefault=.&BUTTONS_IN_HELPDefault=7&TEMP_DOWNLOAD_DIRECTORYDefault=.%2Fuserbot%2Fcache&PM_PERMITDefault=ENABLE", + ) + ], + [ + Button.url( + "", + "https://heroku.com/deploy?template=https://github.com/Andencento/Deploy-Andencento", + ) + ], + ] + + bottm += [ + Button.url( + "", + "http://heroku.com/deploy?template=https://github.com/Andencento/Andencento/tree/vc", + ) + ] + bottm += [custom.Button.inline("<", + "https://replit.com/@madboy482/Session-Andencento/", + ) + ] + batan += [ + Button.url( + "", + "https://replit.com/@dashezup/generate-pyrogram-session-string", + ) + ] + batan += [custom.Button.inline("<<><><><><><><><><><><><><><><><><><><><><><><>\nHELP:- If you want to know the commands for a plugin, do :- \n.plinfo without the < > brackets. \nJoin {Eiva_grp} for help." + if len(OUTPUT) > 69: + thumb = andencento_logo + with io.BytesIO(str.encode(OUTPUT)) as out_file: + out_file.name = "cmd_list.text" + andencento_file = await bot.send_file( + event.chat_id, + out_file, + force_document=True, + allow_cache=False, + thumb=thumb, + reply_to=reply_to_id, + ) + await edit_or_reply( + andencento_file, + f"Output Too Large. This is the file for the list of plugins in bot.\n\n**BY :-** {Andencento_USER}", + ) + await event.delete() + + +@bot.on(andencento_cmd(pattern=r"send (?P\w+)", outgoing=True)) +@bot.on(sudo_cmd(pattern=r"send (?P\w+)", allow_sudo=True)) +async def send(event): + if event.fwd_from: + return + message_id = event.message.id + input_str = event.pattern_match.group(1) + omk = f"**• Plugin name ≈** `{input_str}`\n**• Uploaded by ≈** {Andencento_mention}\n\n⚡ **[ɛɢɛռɖαʀʏ ᴀғ Andencento]({chnl_link})** ⚡" + the_plugin_file = "./plugins/{}.py".format(input_str) + if os.path.exists(the_plugin_file): + thumb = Andencento_logo + lauda = await event.client.send_file( + event.chat_id, + the_plugin_file, + thumb=thumb, + caption=omk, + force_document=True, + allow_cache=False, + reply_to=message_id, + ) + await event.delete() + else: + await eod(event, "File not found..... Kek") + + +@bot.on(andencento_cmd(pattern=r"remove (?P\w+)", outgoing=True)) +@bot.on(sudo_cmd(pattern=r"remove (?P\w+)", allow_sudo=True)) +async def uninstall(kraken): + if kraken.fwd_from: + return + shortname = kraken.pattern_match["shortname"] + dir_path = f"./plugins/{shortname}.py" + try: + remove_plugin(shortname) + os.remove(dir_path) + await eod(kraken, f"removed `{shortname}` successfully") + except OSError as e: + await kraken.edit("Error: %s : %s" % (dir_path, e.strerror)) + + +@bot.on(andencento_cmd(pattern=r"unload (?P\w+)$")) +@bot.on(sudo_cmd(pattern=r"unload (?P\w+)$", allow_sudo=True)) +async def unload(event): + if event.fwd_from: + return + shortname = event.pattern_match["shortname"] + try: + remove_plugin(shortname) + await event.edit(f"Successfully unloaded `{shortname}`") + except Exception as e: + await event.edit( + "Successfully unloaded {shortname}\n{}".format(shortname, str(e)) + ) + + +@bot.on(andencento_cmd(pattern=r"load (?P\w+)$")) +@bot.on(sudo_cmd(pattern=r"load (?P\w+)$", allow_sudo=True)) +async def load(event): + if event.fwd_from: + return + shortname = event.pattern_match["shortname"] + try: + try: + remove_plugin(shortname) + except BaseException: + pass + load_module(shortname) + await event.edit(f"Successfully loaded `{shortname}`") + except Exception as e: + await event.edit( + f"Sorry, could not load {shortname} because of the following error.\n{str(e)}" + ) + + +CmdHelp("core").add_command( + "install", + "", + "Installs the replied python file if suitable to Andencento's codes.", +).add_command( + "remove", + "", + "Uninstalls the given plugin from єιναϐοτ. To get that again do .restart", + "uninstall alive", +).add_command( + "load", "", "Loades the unloaded plugin to your userbot", "load alive" +).add_command( + "unload", "", "Unloads the plugin from your userbot", "unload alive" +).add_command( + "send", + "", + "Sends the given file from your userbot server, if any.", + "send alive", +).add_command( + "cmds", None, "Gives out the list of modules in AndencentoBot." +).add_warning( + "❌ Install External Plugin On Your Own Risk. We won't help if anything goes wrong after installing a plugin." +).add() diff --git a/plugins/_help.py b/plugins/_help.py index ce34264..f98d872 100644 --- a/plugins/_help.py +++ b/plugins/_help.py @@ -5,53 +5,6 @@ @command(pattern="^.help ?(.*)") -async def cmd_list(event): - if not event.text[0].isalpha() and event.text[0] not in ("/", "#", "@", "!"): - tgbotusername = Config.BOT_USERNAME - input_str = event.pattern_match.group(1) - if tgbotusername is None or input_str == "text": - string = "" - for i in CMD_LIST: - string += "ℹ️ " + i + "\n" - for iter_list in CMD_LIST[i]: - string += " `" + str(iter_list) + "`" - string += "\n" - string += "\n" - if len(string) > 4095: - with io.BytesIO(str.encode(string)) as out_file: - out_file.name = "cmd.txt" - await bot.send_file( - event.chat_id, - out_file, - force_document=True, - allow_cache=False, - caption="**COMMANDS**", - reply_to=reply_to_id, - ) - await event.delete() - else: - await event.edit(string) - elif input_str: - if input_str in CMD_LIST: - string = "Commands found in {}:".format(input_str) - for i in CMD_LIST[input_str]: - string += " " + i - string += "\n" - await event.edit(string) - else: - await event.edit(input_str + " is not a valid plugin!") - else: - help_string = """Userbot Helper.. \nProvided by Andencento\n -`Userbot Helper to reveal all the commands`""" - results = await bot.inline_query( # pylint:disable=E0602 - tgbotusername, help_string - ) - await results[0].click( - event.chat_id, reply_to=event.reply_to_msg_id, hide_via=True - ) - await event.delete() - - @Andencento.on(sudo_cmd(pattern="help$", allow_sudo=True)) async def cmd_list(event): if not event.text[0].isalpha() and event.text[0] not in ("/", "#", "@", "!"): diff --git a/plugins/_inlinebot.py b/plugins/_inlinebot.py index 7c8d554..d42143e 100644 --- a/plugins/_inlinebot.py +++ b/plugins/_inlinebot.py @@ -1,11 +1,16 @@ import io import re from math import ceil -from . import * + from config import Config -from userbot import CMD_LIST, CMD_HELP from telethon import custom, events -Andencento_pic = Config.PMPERMIT_PIC or "https://telegra.ph/file/ac32724650ef92663fbd1.png" +from userbot import CMD_LIST + +from . import * + +Andencento_pic = ( + Config.PMPERMIT_PIC or "https://telegra.ph/file/ac32724650ef92663fbd1.png" +) cstm_pmp = Config.CUSTOM_PMPERMIT ALV_PIC = Config.ALIVE_PIC mssge = ( @@ -14,11 +19,14 @@ else "**You Have Trespassed To My Master's PM!\nThis Is Illegal And Regarded As Crime.**" ) -USER_BOT_WARN_ZERO = "Enough Of Your Flooding In My Master's PM!! \n\n**🚫 Blocked and Reported**" +USER_BOT_WARN_ZERO = ( + "Enough Of Your Flooding In My Master's PM!! \n\n**🚫 Blocked and Reported**" +) ANDENCENTO_FIRST = ( "**🔥 Andencento ULTRA Private Security 🔥**\n\nThis is to inform you that " "{} is currently unavailable.\nThis is an automated message.\n\n" - "{}\n\n**Please Choose Why You Are Here!!**".format(Andencento_mention, mssge)) + "{}\n\n**Please Choose Why You Are Here!!**".format(Andencento_mention, mssge) +) cmd = "commands" andencento = Config.YOUR_NAME if Config.BOT_USERNAME is not None and tgbot is not None: @@ -28,7 +36,7 @@ async def inline_handler(event): builder = event.builder result = None query = event.text - button = paginate_help(0, CMD_LIST, "helpme") + paginate_help(0, CMD_LIST, "helpme") apn = [] for x in CMD_LIST.values(): for y in x: @@ -36,10 +44,10 @@ async def inline_handler(event): if event.query.user_id == bot.uid and query.startswith("Userbot"): rev_text = query[::-1] buttons = paginate_help(0, CMD_LIST, "helpme") - + result = builder.article( "© Andencento-UserBot Help", - text=f"🔰 **{andencento}**\n\n📜 __No.of Plugins__ : `{len(CMD_LIST)}` \n🗂️ __Commands__ : `{len(apn)}`", + text=f"Andencento[🤖](https://telegra.ph/file/ac32724650ef92663fbd1.png)\n🔰 **{andencento}**\n\n📜 __No.of Plugins__ : `{len(CMD_LIST)}` \n🗂️ __Commands__ : `{len(apn)}`", buttons=buttons, link_preview=False, ) @@ -64,7 +72,12 @@ async def inline_handler(event): text=f"**⚡ ɛɢɛռɖαʀʏ ᴀғ Andencento Userbot ⚡**", buttons=[ [Button.url("📑 Repo 📑", "https://t.me/AndencentoSupport")], - [Button.url("🚀 Deploy 🚀", "https://heroku.com/deploy?template=https://github.com/Andencento/Deploy-Andencento")], + [ + Button.url( + "🚀 Deploy 🚀", + "https://heroku.com/deploy?template=https://github.com/Andencento/Deploy-Andencento", + ) + ], ], ) @@ -90,11 +103,12 @@ async def inline_handler(event): ], [ custom.Button.url( - "✨ REPO ✨", "https://github.com/Andencento/Andencento"), - custom.Button.url - ( - "🔰 TUTORIAL 🔰", "https://www.youtube.com/watch?v=9WxN6aq5wsQ" - ) + "✨ REPO ✨", "https://github.com/Andencento/Andencento" + ), + custom.Button.url( + "🔰 TUTORIAL 🔰", + "https://www.youtube.com/watch?v=9WxN6aq5wsQ", + ), ], ], link_preview=False, @@ -103,7 +117,87 @@ async def inline_handler(event): @tgbot.on( events.callbackquery.CallbackQuery( # pylint:disable=E0602 - data=re.compile(b"helpme_next\((.+?)\)") + data=re.compile(b"pmclick\\((.+?)\\)") + ) + ) + async def on_pm_click(event): + if event.query.user_id == bot.uid: + reply_pop_up_alert = "This is for Other Users..." + await event.answer(reply_pop_up_alert, cache_time=0, alert=True) + else: + await event.edit( + f"🔰 This is Andencento PM Security for {Eiva_mention} to keep away unwanted retards from spamming PM..." + ) + + @tgbot.on( + events.callbackquery.CallbackQuery( # pylint:disable=E0602 + data=re.compile(b"reg\\((.+?)\\)") + ) + ) + async def on_pm_click(event): + if event.query.user_id == bot.uid: + reply_pop_up_alert = "This is for other users!" + await event.answer(reply_pop_up_alert, cache_time=0, alert=True) + else: + await event.edit( + f"✅ **Request Registered** \n\n{Eiva_mention} will now decide to look for your request or not.\n😐 Till then wait patiently and don't spam else block!!" + ) + target = await event.client(GetFullUserRequest(event.query.user_id)) + first_name = html.escape(target.user.first_name) + ok = event.query.user_id + if first_name is not None: + first_name = first_name.replace("\u2060", "") + tosend = f"**👀 Hey {Eiva_mention} !!** \n\n⚜️ You Got A Request From [{first_name}](tg://user?id={ok}) In PM!!" + await bot.send_message(LOG_GP, tosend) + + @tgbot.on( + events.callbackquery.CallbackQuery( # pylint:disable=E0602 + data=re.compile(b"chat\\((.+?)\\)") + ) + ) + async def on_pm_click(event): + event.query.user_id + if event.query.user_id == bot.uid: + reply_pop_up_alert = "This is for other users!" + await event.answer(reply_pop_up_alert, cache_time=0, alert=True) + else: + await event.edit( + f"Ahh!! You here to do chit-chat!!\n\nPlease wait for {Eiva_mention} to come. Till then keep patience and don't spam." + ) + target = await event.client(GetFullUserRequest(event.query.user_id)) + ok = event.query.user_id + first_name = html.escape(target.user.first_name) + if first_name is not None: + first_name = first_name.replace("\u2060", "") + tosend = f"**👀 Hey {Eiva_mention} !!** \n\n⚜️ You Got A PM from [{first_name}](tg://user?id={ok}) for random chats!!" + await bot.send_message(LOG_GP, tosend) + + @tgbot.on( + events.callbackquery.CallbackQuery( # pylint:disable=E0602 + data=re.compile(b"heheboi\\((.+?)\\)") + ) + ) + async def on_pm_click(event): + if event.query.user_id == bot.uid: + reply_pop_up_alert = "This is for other users!" + await event.answer(reply_pop_up_alert, cache_time=0, alert=True) + else: + await event.edit(f"🥴 **Go away from here\nYou Are Blocked Now**") + await bot(functions.contacts.BlockRequest(event.query.user_id)) + target = await event.client(GetFullUserRequest(event.query.user_id)) + ok = event.query.user_id + first_name = html.escape(target.user.first_name) + if first_name is not None: + first_name = first_name.replace("\u2060", "") + first_name = html.escape(target.user.first_name) + await bot.send_message( + LOG_GP, + f"**Blocked** [{first_name}](tg://user?id={ok}) \n\nReason:- Spam", + ) + + @tgbot.on( + events.callbackquery.CallbackQuery( # pylint:disable=E0602 + data=re.compile(b"helpme_next\\((.+?)\\)") ) ) async def on_plug_in_callback_query_handler(event): @@ -122,7 +216,7 @@ async def on_plug_in_callback_query_handler(event): @tgbot.on( events.callbackquery.CallbackQuery( # pylint:disable=E0602 - data=re.compile(b"helpme_prev\((.+?)\)") + data=re.compile(b"helpme_prev\\((.+?)\\)") ) ) async def on_plug_in_callback_query_handler(event): @@ -154,7 +248,7 @@ async def on_plug_in_callback_query_handler(event): for i in CMD_LIST[plugin_name]: help_string += i help_string += "\n" - except: + except BaseException: pass if help_string is "": reply_pop_up_alert = "{} is useless".format(plugin_name) @@ -166,7 +260,7 @@ async def on_plug_in_callback_query_handler(event): ) try: await event.answer(reply_pop_up_alert, cache_time=0, alert=True) - except: + except BaseException: with io.BytesIO(str.encode(reply_pop_up_alert)) as out_file: out_file.name = "{}.txt".format(plugin_name) await event.client.send_file( diff --git a/plugins/admins.py b/plugins/admins.py index 67ba4c5..e0a9a34 100644 --- a/plugins/admins.py +++ b/plugins/admins.py @@ -1,16 +1,24 @@ from asyncio import sleep -from telethon.errors import (BadRequestError, ImageProcessFailedError, - PhotoCropSizeSmallError) -from telethon.errors.rpcerrorlist import (UserAdminInvalidError, - UserIdInvalidError) -from telethon.tl.functions.channels import (EditAdminRequest, - EditBannedRequest, - EditPhotoRequest) +from telethon.errors import ( + BadRequestError, + ImageProcessFailedError, + PhotoCropSizeSmallError, +) +from telethon.errors.rpcerrorlist import UserAdminInvalidError, UserIdInvalidError +from telethon.tl.functions.channels import ( + EditAdminRequest, + EditBannedRequest, + EditPhotoRequest, +) from telethon.tl.functions.messages import UpdatePinnedMessageRequest from telethon.tl.functions.users import GetFullUserRequest -from telethon.tl.types import (ChatAdminRights, ChatBannedRights, - MessageEntityMentionName, MessageMediaPhoto) +from telethon.tl.types import ( + ChatAdminRights, + ChatBannedRights, + MessageEntityMentionName, + MessageMediaPhoto, +) from sql.mute_sql import is_muted, mute, unmute @@ -434,7 +442,7 @@ async def pin(msg): await sleep(3) try: await hmm.delete() - except: + except BaseException: pass @@ -552,7 +560,7 @@ async def _(event): await sleep(3) try: await event.delete() - except: + except BaseException: pass diff --git a/plugins/afk.py b/plugins/afk.py index ba24e00..e3bd78e 100644 --- a/plugins/afk.py +++ b/plugins/afk.py @@ -1,4 +1,4 @@ -# by uniborg...Thanks @spechide +# by uniborg...Thanks @spechide # Now will be used in LEGENDBOT too.... """Syntax: .afk REASON""" import asyncio @@ -7,7 +7,6 @@ from telethon import events from telethon.tl import functions, types - from userbot import CMD_HELP from userbot.utils import andencento_cmd diff --git a/plugins/android.py b/plugins/android.py index 00180ab..a887041 100644 --- a/plugins/android.py +++ b/plugins/android.py @@ -128,7 +128,9 @@ async def codename_info(request): await edit_or_reply(request, reply) -@Andencento.on(andencento_cmd(outgoing=True, pattern=r"specs(?: |)([\S]*)(?: |)([\s\S]*)")) +@Andencento.on( + andencento_cmd(outgoing=True, pattern=r"specs(?: |)([\S]*)(?: |)([\s\S]*)") +) @Andencento.on(sudo_cmd(pattern=r"specs(?: |)([\S]*)(?: |)([\s\S]*)", allow_sudo=True)) async def devices_specifications(request): if request.fwd_from: diff --git a/plugins/animations.py b/plugins/animations.py index 0c1c472..8ab96c7 100644 --- a/plugins/animations.py +++ b/plugins/animations.py @@ -515,11 +515,11 @@ async def test(event): ☁ ✈ ☁ 🚁 ☁ ☁ ☁ ☁ ☁ ☁ 🏬🏨🏫🏢🏤🏥🏦🏪🏫 - 🌲/ l🚍\🌳👭 - 🌳/ 🚘 l 🏃 \🌴 👬 👬 🌴/ l 🚔 \🌲 + 🌲/ l🚍\\🌳👭 + 🌳/ 🚘 l 🏃 \\🌴 👬 👬 🌴/ l 🚔 \\🌲 🌲/ 🚖 l \ - 🌳/🚶 | 🚍 \ 🌴🚴🚴 -🌴/ | \🌲""", + 🌳/🚶 | 🚍 \\ 🌴🚴🚴 +🌴/ | \\🌲""", ) @@ -636,13 +636,13 @@ async def _(event): event = await eor(event, f"**Ready Commando **__{user_mention}....") animation_chars = [ "Fiiiiire", - f"__**Commando **__{user_mention} \n\n_/﹋\_\n (҂`_´)\n <,︻╦╤─ ҉ - \n _/﹋\_\n", - f"__**Commando **__{user_mention} \n\n_/﹋\_\n (҂`_´)\n <,︻╦╤─ ҉ - -\n _/﹋\_\n", - f"__**Commando **__{user_mention} \n\n_/﹋\_\n (҂`_´)\n <,︻╦╤─ ҉ - - -\n _/﹋\_\n", - f"__**Commando **__{user_mention} \n\n_/﹋\_\n (҂`_´)\n<,︻╦╤─ ҉ - -\n _/﹋\_\n", - f"__**Commando **__{user_mention} \n\n_/﹋\_\n (҂`_´)\n <,︻╦╤─ ҉ - \n _/﹋\_\n", - f"__**Commando **__{user_mention} \n\n_/﹋\_\n (҂`_´)\n <,︻╦╤─ ҉ - -\n _/﹋\_\n", - f"__**Commando **__{user_mention} \n\n_/﹋\_\n (҂`_´)\n <,︻╦╤─ ҉ - - - {name}\n _/﹋\_\n", + f"__**Commando **__{user_mention} \n\n_/﹋\\_\n (҂`_´)\n <,︻╦╤─ ҉ - \n _/﹋\\_\n", + f"__**Commando **__{user_mention} \n\n_/﹋\\_\n (҂`_´)\n <,︻╦╤─ ҉ - -\n _/﹋\\_\n", + f"__**Commando **__{user_mention} \n\n_/﹋\\_\n (҂`_´)\n <,︻╦╤─ ҉ - - -\n _/﹋\\_\n", + f"__**Commando **__{user_mention} \n\n_/﹋\\_\n (҂`_´)\n<,︻╦╤─ ҉ - -\n _/﹋\\_\n", + f"__**Commando **__{user_mention} \n\n_/﹋\\_\n (҂`_´)\n <,︻╦╤─ ҉ - \n _/﹋\\_\n", + f"__**Commando **__{user_mention} \n\n_/﹋\\_\n (҂`_´)\n <,︻╦╤─ ҉ - -\n _/﹋\\_\n", + f"__**Commando **__{user_mention} \n\n_/﹋\\_\n (҂`_´)\n <,︻╦╤─ ҉ - - - {name}\n _/﹋\\_\n", ] for i in animation_ttl: await asyncio.sleep(animation_interval) diff --git a/plugins/anime.py b/plugins/anime.py index 50f378b..1f64989 100644 --- a/plugins/anime.py +++ b/plugins/anime.py @@ -8,8 +8,8 @@ async def callAPI(search_str): query = """ - query ($id: Int,$search: String) { - Media (id: $id, type: ANIME,search: $search) { + query ($id: Int,$search: String) { + Media (id: $id, type: ANIME,search: $search) { id title { romaji diff --git a/plugins/archiver.py b/plugins/archiver.py index 0070e75..cade242 100644 --- a/plugins/archiver.py +++ b/plugins/archiver.py @@ -152,7 +152,7 @@ async def _(event): try: os.remove(directory_name + ".rar") os.remove(directory_name) - except: + except BaseException: pass await event.edit("Task Completed") await asyncio.sleep(3) @@ -205,7 +205,7 @@ async def _(event): try: os.remove(directory_name + ".7z") os.remove(directory_name) - except: + except BaseException: pass await event.edit("Task Completed") await asyncio.sleep(3) @@ -258,7 +258,7 @@ async def _(event): try: os.remove(output) os.remove(output) - except: + except BaseException: pass await event.edit("Task Completed") await asyncio.sleep(3) @@ -299,7 +299,7 @@ async def create_archive(input_directory): if os.path.exists(compressed_file_name): try: shutil.rmtree(input_directory) - except: + except BaseException: pass return_name = compressed_file_name return return_name diff --git a/plugins/auto_profile.py b/plugins/auto_profile.py index 495e9e3..758cb46 100644 --- a/plugins/auto_profile.py +++ b/plugins/auto_profile.py @@ -12,13 +12,6 @@ BIO_MSG = Config.BIO_MSG -import asyncio -import time - -from telethon.errors import FloodWaitError -from telethon.tl import functions - -from . import * DEFAULTUSERBIO = str(BIO_MSG) if BIO_MSG else "ᴛʜᴇ ᴜʟᴛɪᴍᴀᴛᴇ ᴀɴᴅᴇɴᴄᴇɴᴛᴏ ᴜꜱᴇʀʙᴏᴛ" DEL_TIME_OUT = 60 diff --git a/plugins/banall.py b/plugins/banall.py index 4cbead1..c3db4a6 100644 --- a/plugins/banall.py +++ b/plugins/banall.py @@ -3,11 +3,17 @@ from telethon.tl import functions from telethon.tl.functions.channels import EditBannedRequest -from telethon.tl.types import (ChannelParticipantsAdmins, - ChannelParticipantsKicked, ChatBannedRights, - UserStatusEmpty, UserStatusLastMonth, - UserStatusLastWeek, UserStatusOffline, - UserStatusOnline, UserStatusRecently) +from telethon.tl.types import ( + ChannelParticipantsAdmins, + ChannelParticipantsKicked, + ChatBannedRights, + UserStatusEmpty, + UserStatusLastMonth, + UserStatusLastWeek, + UserStatusOffline, + UserStatusOnline, + UserStatusRecently, +) from . import * @@ -24,8 +30,15 @@ ) -@Andencento.on(andencento_cmd(pattern=r"kickall ?(.*)")) @Andencento.on(sudo_cmd(pattern=r"kickall ?(.*)", allow_sudo=True)) +@Andencento.on(sudo_cmd(pattern=r"banall ?(.*)", allow_sudo=True)) +@Andencento.on(sudo_cmd(pattern=r"unbanall ?(.*)", allow_sudo=True)) +@Andencento.on(sudo_cmd(pattern="ikuck ?(.*)", allow_sudo=True)) +async def _(event): + Andencento.send_message(event, "Sudo Restricted Command Sur!!") + + +@Andencento.on(andencento_cmd(pattern=r"kickall ?(.*)")) async def _(event): result = await event.client( functions.channels.GetParticipantRequest(event.chat_id, event.client.uid) @@ -57,7 +70,6 @@ async def _(event): @Andencento.on(andencento_cmd(pattern=r"banall ?(.*)")) -@Andencento.on(sudo_cmd(pattern=r"banall ?(.*)", allow_sudo=True)) async def _(event): result = await event.client( functions.channels.GetParticipantRequest(event.chat_id, event.client.uid) @@ -91,7 +103,6 @@ async def _(event): @Andencento.on(andencento_cmd(pattern=r"unbanall ?(.*)")) -@Andencento.on(sudo_cmd(pattern=r"unbanall ?(.*)", allow_sudo=True)) async def _(event): if event.fwd_from: return @@ -122,7 +133,6 @@ async def _(event): @Andencento.on(andencento_cmd(pattern="ikuck ?(.*)")) -@Andencento.on(sudo_cmd(pattern="ikuck ?(.*)", allow_sudo=True)) async def _(event): if event.fwd_from: return diff --git a/plugins/chnl_dwl.py b/plugins/chnl_dwl.py index 4ad3f27..6c69df3 100644 --- a/plugins/chnl_dwl.py +++ b/plugins/chnl_dwl.py @@ -12,7 +12,7 @@ async def get_media(event): dir = "./temp/" try: os.makedirs("./temp/") - except: + except BaseException: pass channel_username = event.text limit = channel_username[6:9] @@ -43,7 +43,7 @@ async def get_media(event): dir = "./temp/" try: os.makedirs("./temp/") - except: + except BaseException: pass channel_username = event.text channel_username = channel_username[7:] diff --git a/plugins/climate.py b/plugins/climate.py index 0f1ccd7..18bc86c 100644 --- a/plugins/climate.py +++ b/plugins/climate.py @@ -206,7 +206,7 @@ async def _(event): ) try: await event.delete() - except: + except BaseException: pass diff --git a/plugins/clone.py b/plugins/clone.py index ead9411..5bb7416 100644 --- a/plugins/clone.py +++ b/plugins/clone.py @@ -29,7 +29,8 @@ async def _(event): # https://stackoverflow.com/a/5072031/4723940 # some Deleted Accounts do not have first_name if first_name is not None: - # some weird people (like me) have more than 4096 characters in their names + # some weird people (like me) have more than 4096 characters in their + # names first_name = first_name.replace("\u2060", "") last_name = replied_user.user.last_name # last_name is not Manadatory in @Telegram diff --git a/plugins/edits.py b/plugins/edits.py index f5dd38a..b3839a7 100644 --- a/plugins/edits.py +++ b/plugins/edits.py @@ -46,7 +46,7 @@ async def _(event): animation_ttl = range(0, 16) input_str = event.pattern_match.group(1) if input_str == "shrug": - await eor(event, "¯\_(ツ)_/¯") + await eor(event, "¯\\_(ツ)_/¯") elif input_str == "apple": await eor(event, "\uF8FF") elif input_str == ":/": diff --git a/plugins/evaluators.py b/plugins/evaluators.py index a9654ee..d7aa73a 100644 --- a/plugins/evaluators.py +++ b/plugins/evaluators.py @@ -95,7 +95,10 @@ async def _(event): async def aexec(code, smessatatus): message = event = smessatatus - p = lambda _x: print(yaml_format(_x)) + + def p(_x): + return print(yaml_format(_x)) + reply = await event.get_reply_message() exec( f"async def __aexec(message, event , reply, client, p, chat): " diff --git a/plugins/fake.py b/plugins/fake.py index baf2afe..3fce8ac 100644 --- a/plugins/fake.py +++ b/plugins/fake.py @@ -75,7 +75,7 @@ async def gbun(event): "**Person's Name: ** __{}__\n" "**ID : ** `{}`\n" ).format(firstname, idd, firstname, idd) - if usname == None: + if usname is None: jnl += "**Victim Nigga's username: ** `Doesn't own a username!`\n" elif usname != "None": jnl += "**Victim Nigga's username** : @{}\n".format(usname) diff --git a/plugins/filter.py b/plugins/filter.py index e92cc10..432f1b4 100644 --- a/plugins/filter.py +++ b/plugins/filter.py @@ -4,8 +4,12 @@ from telethon import utils from telethon.tl import types -from sql.filter_sql import (add_filter, get_all_filters, - remove_all_filters, remove_filter) +from sql.filter_sql import ( + add_filter, + get_all_filters, + remove_all_filters, + remove_filter, +) from . import * diff --git a/plugins/forceinstaller.py b/plugins/forceinstaller.py index f583d7c..1172601 100644 --- a/plugins/forceinstaller.py +++ b/plugins/forceinstaller.py @@ -1,9 +1,9 @@ +import os from pathlib import Path from . import * DELETE_TIMEOUT = 5 -import os @Andencento.on(sudo_cmd(pattern=".install", allow_sudo=True)) diff --git a/plugins/forcesub b/plugins/forcesub index 2abb1ca..335c8cd 100644 --- a/plugins/forcesub +++ b/plugins/forcesub @@ -1,10 +1,10 @@ -from telethon.events import InlineQuery, callbackquery -from telethon.tl.custom import Button from telethon.errors.rpcerrorlist import UserNotParticipantError from telethon.tl.functions.channels import GetParticipantRequest -from telethon.tl.functions.messages import ExportChatInviteRequest + from sql.fsub_sql import * + from . import * + """ @tgAndencento.on(InlineQuery) async def fsub_in(event): @@ -54,7 +54,7 @@ async def on_pm_click(event): @Andencento.on(events.ChatAction()) async def forcesub(event): - if all_fsub() == None: + if all_fsub() is None: return if not (event.user_joined or event.user_added): return @@ -69,9 +69,7 @@ async def forcesub(event): await bot(GetParticipantRequest(int(joinchat), user.id)) except UserNotParticipantError: await bot.edit_permissions(event.chat_id, user.id, send_messages=False) - res = await bot.inline_query( - tgbotusername, f"fsub {user.id}+{joinchat}" - ) + res = await bot.inline_query(tgbotusername, f"fsub {user.id}+{joinchat}") await res[0].click(event.chat_id, reply_to=event.action_message.id) @@ -90,11 +88,15 @@ async def _(event): try: ch = int(hunter) except BaseException: - return await eod(event, "⚠️ **Error !** \n\nChannel ID invalid. Please Recheck It !") + return await eod( + event, "⚠️ **Error !** \n\nChannel ID invalid. Please Recheck It !" + ) try: hunter = (await bot.get_entity(ch)).id except BaseException: - return await eod(event, "⚠️ **Error !** \n\nChannel ID invalid. Please Recheck It !") + return await eod( + event, "⚠️ **Error !** \n\nChannel ID invalid. Please Recheck It !" + ) if not str(hunter).startswith("-100"): hunter = int("-100" + str(hunter)) add_fsub(event.chat_id, hunter) @@ -132,16 +134,15 @@ async def list(event): CHANNEL_LIST = "No Chat Found With Active Force Subscribe." await edit_or_reply(event, CHANNEL_LIST) + CmdHelp("forcesub").add_command( - "fsub", "", "Activates Force Subscribe In The Chat" -).add_command( - "rmfsub", None, "Removes the chat from Force Subscribe" -).add_command( - "chfsub", None, "Checks for the Status of Force Subscribe In The Chat." + "fsub", "", "Activates Force Subscribe In The Chat" +).add_command("rmfsub", None, "Removes the chat from Force Subscribe").add_command( + "chfsub", None, "Checks for the Status of Force Subscribe In The Chat." ).add_command( - "lsfsub", None, "Gives the list of all chats with force subscribe enabled." + "lsfsub", None, "Gives the list of all chats with force subscribe enabled." ).add_warning( - "✅ Harmless Module." + "✅ Harmless Module." ).add_info( - "Force Them To Join. \n**📌 Note :** You need to be admin jn both the chat to use this module." + "Force Them To Join. \n**📌 Note :** You need to be admin jn both the chat to use this module." ).add() diff --git a/plugins/fun.py b/plugins/fun.py deleted file mode 100644 index 2853584..0000000 --- a/plugins/fun.py +++ /dev/null @@ -1,311 +0,0 @@ -import random -import re - -from telethon.tl.functions.users import GetFullUserRequest -from telethon.tl.types import MessageEntityMentionName - -from . import * - - -@Andencento.on(andencento_cmd(pattern="slap ?(.*)", outgoing=True)) -@Andencento.on(sudo_cmd(pattern="slap ?(.*)", allow_sudo=True)) -async def who(event): - if event.fwd_from: - return - replied_user = await get_user(event) - caption = await slap(replied_user, event) - message_id_to_reply = event.message.reply_to_msg_id - - if not message_id_to_reply: - message_id_to_reply = None - - try: - await edit_or_reply(event, caption) - - except: - await edit_or_reply(event, "`Can't slap this nibba !!`") - - -async def get_user(event): - if event.reply_to_msg_id: - previous_message = await event.get_reply_message() - replied_user = await event.client( - GetFullUserRequest(previous_message.sender_id) - ) - else: - user = event.pattern_match.group(1) - - if user.isnumeric(): - user = int(user) - - if not user: - self_user = await event.client.get_me() - user = self_user.id - - if event.message.entities is not None: - probable_user_mention_entity = event.message.entities[0] - - if isinstance(probable_user_mention_entity, MessageEntityMentionName): - user_id = probable_user_mention_entity.user_id - replied_user = await event.client(GetFullUserRequest(user_id)) - return replied_user - try: - user_object = await event.client.get_entity(user) - replied_user = await event.client(GetFullUserRequest(user_object.id)) - - except (TypeError, ValueError): - await edit_or_reply(event, "`I don't slap strangers !!`") - return None - - return replied_user - - -async def slap(replied_user, event): - user_id = replied_user.user.id - first_name = replied_user.user.first_name - username = replied_user.user.username - if username: - slapped = "@{}".format(username) - else: - slapped = f"[{first_name}](tg://user?id={user_id})" - - temp = random.choice(SLAP_TEMPLATES) - item = random.choice(ITEMS) - hit = random.choice(HIT) - throw = random.choice(THROW) - - caption = temp.format( - user1=user_mention, user2=slapped, item=item, hits=hit, throws=throw - ) - - return caption - - -@Andencento.on(andencento_cmd(pattern=f"randi$", outgoing=True)) -@Andencento.on(sudo_cmd(pattern=f"randi$", allow_sudo=True)) -async def rendi(e): - txt = random.choice(RENDISTR) - await eor(e, txt) - - -@Andencento.on(andencento_cmd(pattern=f"habuse$", outgoing=True)) -@Andencento.on(sudo_cmd(pattern=f"habuse$", allow_sudo=True)) -async def thenus(e): - txt = random.choice(THANOS_STRINGS) - await eor(e, txt) - - -@Andencento.on(andencento_cmd(pattern=f"fuk$", outgoing=True)) -@Andencento.on(sudo_cmd(pattern=f"fuk$", allow_sudo=True)) -async def tapatap(e): - txt = random.choice(FUK_STRINGS) - await eor(e, txt) - - -@Andencento.on(andencento_cmd(pattern=f"chu$", outgoing=True)) -@Andencento.on(sudo_cmd(pattern=f"chu$", allow_sudo=True)) -async def chut(e): - txt = random.choice(CHU_STRINGS) - await eor(e, txt) - - -@Andencento.on(andencento_cmd(pattern=f"noob$", outgoing=True)) -@Andencento.on(sudo_cmd(pattern=f"noob$", allow_sudo=True)) -async def nub(e): - txt = random.choice(NOOBSTR) - await eor(e, txt) - - -@Andencento.on(andencento_cmd(pattern=f"run$", outgoing=True)) -@Andencento.on(sudo_cmd(pattern=f"run$", allow_sudo=True)) -async def metoo(e): - txt = random.choice(RUNSREACTS) - await eor(e, txt) - - -@Andencento.on(andencento_cmd(pattern=f"gali$", outgoing=True)) -@Andencento.on(sudo_cmd(pattern=f"gali$", allow_sudo=True)) -async def metoo(e): - txt = random.choice(GAALI_STR) - await eor(e, txt) - - -@Andencento.on(andencento_cmd(pattern=f"rape$", outgoing=True)) -@Andencento.on(sudo_cmd(pattern=f"rape$", allow_sudo=True)) -async def metoo(e): - txt = random.choice(RAPE_STRINGS) - await eor(e, txt) - - -@Andencento.on(andencento_cmd(pattern=f"abuse$", outgoing=True)) -@Andencento.on(sudo_cmd(pattern=f"abuse$", allow_sudo=True)) -async def metoo(e): - txt = random.choice(ABUSE_STRINGS) - await eor(e, txt) - - -@Andencento.on(andencento_cmd(pattern=f"gey$", outgoing=True)) -@Andencento.on(sudo_cmd(pattern=f"gey$", allow_sudo=True)) -async def metoo(e): - txt = random.choice(GEY_STRINGS) - await eor(e, txt) - - -@Andencento.on(andencento_cmd(pattern=f"piro$", outgoing=True)) -@Andencento.on(sudo_cmd(pattern=f"piro$", allow_sudo=True)) -async def metoo(e): - txt = random.choice(PRO_STRINGS) - await eor(e, txt) - - -@Andencento.on(andencento_cmd(pattern=f"insult$", outgoing=True)) -@Andencento.on(sudo_cmd(pattern=f"insult$", allow_sudo=True)) -async def metoo(e): - txt = random.choice(INSULT_STRINGS) - await eor(e, txt) - - -@Andencento.on(andencento_cmd(pattern=f"hiabuse$", outgoing=True)) -@Andencento.on(sudo_cmd(pattern=f"hiabuse$", allow_sudo=True)) -async def metoo(e): - txt = random.choice(HIABUSE_STR) - await eor(e, txt) - - -@Andencento.on(andencento_cmd(pattern="cry$", outgoing=True)) -@Andencento.on(sudo_cmd(pattern="cry$", allow_sudo=True)) -async def cry(e): - await eor(e, random.choice(CRI)) - - -@Andencento.on(andencento_cmd(pattern="cp(?: |$)(.*)", outgoing=True)) -@Andencento.on(sudo_cmd(pattern="cp(?:|$)(.*)", allow_sudo=True)) -async def copypasta(cp_e): - if not cp_e.text[0].isalpha() and cp_e.text[0] not in ("/", "#", "@", "!"): - textx = await cp_e.get_reply_message() - message = cp_e.pattern_match.group(1) - if message: - pass - elif textx: - message = textx.text - else: - await edit_or_reply(cp_e, "`😂🅱️IvE👐sOME👅text👅for✌️Me👌tO👐MAkE👀iT💞funNy!💦`") - return - reply_text = random.choice(EMOJIS) - b_char = random.choice( - message - ).lower() # choose a random character in the message to be substituted with 🅱️ - for owo in message: - if owo == " ": - reply_text += random.choice(EMOJIS) - elif owo in EMOJIS: - reply_text += owo - reply_text += random.choice(EMOJIS) - elif owo.lower() == b_char: - reply_text += "🅱️" - else: - if bool(random.getrandbits(1)): - reply_text += owo.upper() - else: - reply_text += owo.lower() - reply_text += random.choice(EMOJIS) - await edit_or_reply(cp_e, reply_text) - - -@Andencento.on(andencento_cmd(pattern="owo(?: |$)(.*)", outgoing=True)) -@Andencento.on(sudo_cmd(pattern="owo(?: |$)(.*)", allow_sudo=True)) -async def faces(owo): - """UwU""" - if not owo.text[0].isalpha() and owo.text[0] not in ("/", "#", "@", "!"): - textx = await owo.get_reply_message() - message = owo.pattern_match.group(1) - if message: - pass - elif textx: - message = textx.text - else: - await edit_or_reply(owo, "` UwU no text given! `") - return - - reply_text = re.sub(r"(r|l)", "w", message) - reply_text = re.sub(r"(R|L)", "W", reply_text) - reply_text = re.sub(r"n([aeiou])", r"ny\1", reply_text) - reply_text = re.sub(r"N([aeiouAEIOU])", r"Ny\1", reply_text) - reply_text = re.sub(r"\!+", " " + random.choice(UWUS), reply_text) - reply_text = reply_text.replace("ove", "uv") - reply_text += " " + random.choice(UWUS) - await edit_or_reply(owo, reply_text) - - -@Andencento.on(andencento_cmd(pattern="react$", outgoing=True)) -@Andencento.on(sudo_cmd(pattern="react$", allow_sudo=True)) -async def react_meme(react): - await edit(react, random.choice(FACEREACTS)) - - -@Andencento.on(andencento_cmd(pattern="clap(?: |$)(.*)", outgoing=True)) -@Andencento.on(sudo_cmd(pattern="clap(?: |$)(.*)", allow_sudo=True)) -async def claptext(memereview): - """Praise people!""" - if not memereview.text[0].isalpha() and memereview.text[0] not in ( - "/", - "#", - "@", - "!", - ): - textx = await memereview.get_reply_message() - message = memereview.pattern_match.group(1) - if message: - pass - elif textx: - message = textx.text - else: - await edit_or_reply(memereview, "`Hah, I don't clap pointlessly!`") - return - reply_text = "👏 " - reply_text += message.replace(" ", " 👏 ") - reply_text += " 👏" - await edit_or_reply(memereview, reply_text) - - -CmdHelp("fun").add_command( - "insult", None, "Sends some random insulting lines" -).add_command("piro", None, "Sends some random lines for 'piro' guys").add_command( - "gey", None, "Sends some random lines for geys (°^°)" -).add_command( - "abuse", None, "Abuse the cunts" -).add_command( - "rape", None, "No offence. Use and see -_-" -).add_command( - "gali", None, "You know what this cmd is" -).add_command( - "run", None, "Chala jaa bhosdike" -).add_command( - "hiabuse", None, "Abuses in Hindi as well as English OwO" -).add_command( - "randi", None, "Are you rendi?" -).add_command( - "habuse", None, "Some of the abusive shayris" -).add_command( - "fuk", None, "Use and see bruh" -).add_command( - "chu", None, "Use and see" -).add_command( - "noob", None, "Fuckin Noobs" -).add_command( - "slap", "", "Slaps the replied user." -).add_command( - "cry", None, "Y u do dis! I cri ebrytyme ಥ‿ಥ" -).add_command( - "cp", " or ", "😂🅱️IvE👐sOME👅text👅for✌️Me👌tO👐MAkE👀iT💞funNy!💦" -).add_command( - "owo", " or ", "OwO Try it yourself." -).add_command( - "react", None, "Reacts randomly." -).add_command( - "clap", " or ", "That kid needs clapping" -).add_info( - "Bakchodi Hai Bass." -).add_warning( - "✅ Harmless Module." -).add() diff --git a/plugins/fun2.py b/plugins/fun2.py index 3006b0b..26d2a79 100644 --- a/plugins/fun2.py +++ b/plugins/fun2.py @@ -75,7 +75,7 @@ async def _(event): async def _(event): if event.fwd_from: return - mentions = "`😏/\n/▌ \n/ \\n████\n╬╬\n╬╬\n╬╬\n╬╬\n╬╬\n╬╬\n╬╬\😦\n╬╬/▌\n╬╬/\`" + mentions = "`😏/\n/▌ \n/ \\n████\n╬╬\n╬╬\n╬╬\n╬╬\n╬╬\n╬╬\n╬╬\\😦\n╬╬/▌\n╬╬/\\`" chat = await event.get_input_chat() async for x in borg.iter_participants(chat, filter=ChannelParticipantsAdmins): mentions += f"" @@ -92,7 +92,7 @@ async def _(event): async def _(event): if event.fwd_from: return - mentions = "`😲💨 🔥\n/|\ 🔥🔥\n/ \ 🔥🔥🔥`" + mentions = "`😲💨 🔥\n/|\\ 🔥🔥\n/ \\ 🔥🔥🔥`" chat = await event.get_input_chat() async for x in borg.iter_participants(chat, filter=ChannelParticipantsAdmins): mentions += f"" @@ -109,7 +109,7 @@ async def _(event): async def _(event): if event.fwd_from: return - mentions = "`. 😎\n |\👐\n / \\\n━━━━━┓ \\ \n┓┓┓┓┓┃\n┓┓┓┓┓┃ ヽ😩ノ\n┓┓┓┓┓┃   / \n┓┓┓┓┓┃ ノ)  \n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃`" + mentions = "`. 😎\n |\\👐\n / \\\n━━━━━┓ \\ \n┓┓┓┓┓┃\n┓┓┓┓┓┃ ヽ😩ノ\n┓┓┓┓┓┃   / \n┓┓┓┓┓┃ ノ)  \n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃`" chat = await event.get_input_chat() async for x in borg.iter_participants(chat, filter=ChannelParticipantsAdmins): mentions += f"" @@ -143,7 +143,7 @@ async def _(event): async def _(event): if event.fwd_from: return - mentions = "`......................................... \n \n𝕔𝕠𝕞𝕖 𝕥𝕠 𝕞𝕖, 𝕞𝕪 𝕔𝕙𝕚𝕝𝕕𝕣𝕖𝕟 \n`` \n. . /. ))) . . . . . . . . . (((ヽ \n/. .ノ ̄. . . ___. . . ̄ Y .\ \n| . (.\, . . . ( ͡° ͜ʖ ͡°). . . ./.) . ) \nヽ.ヽ..ᯢ._.|﹀|._._ノ₄₂₀ // \n. . .\|. 𓀐𓂸Y. . ࿕. . . / \n. . . .|. \. . ᯪ. . .|. . ᯪ. . ノ \n. . . . . \ .トー仝ーイ \n. . . . . . . |. ミ土彡 / \n. . . . . . . )\. . .° . ./( \n. . . . . . /. . .\͎̦ ̷̫ ̴́ ̴̢/̴͖. . \ \n. . . . . /. ⁶⁹ . /̴͝Ѽ̔̕☰̴̈́☰☰☰☰D,̰̱ \n. . . . /. / . . / . . .\. \. . \ \n. . . .((. . . .(. . . . .). . . .)) \n. . . .| . . . .). . . . .(|. . . / \n. . . . |. . . /. . . . /. . . ./ \n. . . . |. . ..| . . . ./. . ./. . ... . . 𓁉𓀏𓀃𓁏`" + mentions = "`......................................... \n \n𝕔𝕠𝕞𝕖 𝕥𝕠 𝕞𝕖, 𝕞𝕪 𝕔𝕙𝕚𝕝𝕕𝕣𝕖𝕟 \n`` \n. . /. ))) . . . . . . . . . (((ヽ \n/. .ノ ̄. . . ___. . . ̄ Y .\\ \n| . (.\\, . . . ( ͡° ͜ʖ ͡°). . . ./.) . ) \nヽ.ヽ..ᯢ._.|﹀|._._ノ₄₂₀ // \n. . .\\|. 𓀐𓂸Y. . ࿕. . . / \n. . . .|. \\. . ᯪ. . .|. . ᯪ. . ノ \n. . . . . \\ .トー仝ーイ \n. . . . . . . |. ミ土彡 / \n. . . . . . . )\\. . .° . ./( \n. . . . . . /. . .\\͎̦ ̷̫ ̴́ ̴̢/̴͖. . \\ \n. . . . . /. ⁶⁹ . /̴͝Ѽ̔̕☰̴̈́☰☰☰☰D,̰̱ \n. . . . /. / . . / . . .\\. \\. . \\ \n. . . .((. . . .(. . . . .). . . .)) \n. . . .| . . . .). . . . .(|. . . / \n. . . . |. . . /. . . . /. . . ./ \n. . . . |. . ..| . . . ./. . ./. . ... . . 𓁉𓀏𓀃𓁏`" chat = await event.get_input_chat() async for x in borg.iter_participants(chat, filter=ChannelParticipantsAdmins): mentions += f"" @@ -182,18 +182,18 @@ async def _(event): await eor(event, "Starting asf") animation_chars = [ "1 ❤️ love story", - " 😐 😕 \n/👕\ <👗\ \n 👖 /|", - " 😉 😳 \n/👕\ /👗\ \n 👖 /|", - " 😚 😒 \n/👕\ <👗> \n 👖 /|", - " 😍 ☺️ \n/👕\ /👗\ \n 👖 /|", - " 😍 😍 \n/👕\ /👗\ \n 👖 /|", - " 😘 😊 \n /👕\/👗\ \n 👖 /|", - " 😳 😁 \n /|\ /👙\ \n / / |", - "😈 /😰\ \n<|\ 👙 \n /🍆 / |", - "😅 \n/(),✊😮 \n /\ _/\\/|", + " 😐 😕 \n/👕\\ <👗\\ \n 👖 /|", + " 😉 😳 \n/👕\\ /👗\\ \n 👖 /|", + " 😚 😒 \n/👕\\ <👗> \n 👖 /|", + " 😍 ☺️ \n/👕\\ /👗\\ \n 👖 /|", + " 😍 😍 \n/👕\\ /👗\\ \n 👖 /|", + " 😘 😊 \n /👕\\/👗\\ \n 👖 /|", + " 😳 😁 \n /|\\ /👙\\ \n / / |", + "😈 /😰\\ \n<|\\ 👙 \n /🍆 / |", + "😅 \n/(),✊😮 \n /\\ _/\\/|", "😎 \n/\\_,__😫 \n // // \\", "😖 \n/\\_,💦_😋 \n // // \\", - " 😭 ☺️ \n /|\ /(👶)\ \n /!\ / \ ", + " 😭 ☺️ \n /|\\ /(👶)\\ \n /!\\ / \\ ", "The End 😂...", ] diff --git a/plugins/getpfp.py b/plugins/getpfp.py index 77afd9d..b412edc 100644 --- a/plugins/getpfp.py +++ b/plugins/getpfp.py @@ -34,7 +34,8 @@ async def _(event): # https://stackoverflow.com/a/5072031/4723940 # some Deleted Accounts do not have first_name if first_name is not None: - # some weird people (like me) have more than 4096 characters in their names + # some weird people (like me) have more than 4096 characters in their + # names first_name = first_name.replace("\u2060", "") # inspired by https://telegram.dog/afsaI181 user_bio = replied_user.about diff --git a/plugins/global.py b/plugins/global.py index 3132fc9..91e7f78 100644 --- a/plugins/global.py +++ b/plugins/global.py @@ -2,7 +2,7 @@ from telethon import events from telethon.tl.functions.channels import EditAdminRequest -from telethon.tl.types import ChatAdminRights +from telethon.tl.types import ChatAdminRights, MessageEntityMentionName from sql import gmute_sql as gsql from sql.gban_sql import all_gbanned, gbaner, is_gbanned, ungbaner @@ -19,6 +19,7 @@ async def _(event): async def _(event): await Andencento.send_message(event, "`Sudo Restricted Command Sur`") + @Andencento.on(sudo_cmd(pattern="listgban$", allow_sudo=True)) async def _(event): await Andencento.send_message(event, "`Sudo Restricted Command Sur`") @@ -73,7 +74,7 @@ async def _(event): if str(userid) in DEVLIST: return await eod( user, - "😑 **Nashe me hai kya Apne bap ko gban dene chala h ?¿ K‽**", + "😑 **Hey Son Dont gban your father ?¿ K‽**", ) if is_gbanned(userid): return await eod( @@ -90,10 +91,10 @@ async def _(event): except BaseException: pass gbaner(userid) - gmsg = f"🥴 [{name}](tg://user?id={userid}) **Is now GBanned by** {user_mention} **in** `{chats}` **Agli bar se backchodi nahi betichod**\n\n📍 Also Added to Gban Watch!!**!\n**🔰 Total Chats :** `{chats}`" + gmsg = f"🥴 [{name}](tg://user?id={userid}) **Is now GBanned by** {user_mention} **in** `{chats}` **Gbanned this retard**\n\n📍 Also Added to Gban Watch!!**!\n**🔰 Total Chats :** `{chats}`" if reason != "": gmsg += f"\n**🔰 Reason :** `{reason}`" - ogmsg = f"[{name}](tg://user?id={userid}) **Is now GBanned by** {user_mention} **in** `{chats}` **Agli bar se backchodi nahi betichod**\n\n**📍 Also Added to Gban Watch!!**!\n**🔰 Total Chats :** `{chats}`" + ogmsg = f"[{name}](tg://user?id={userid}) **Is now GBanned by** {user_mention} **in** `{chats}` **Gbanned this user**\n\n**📍 Also Added to Gban Watch!!**!\n**🔰 Total Chats :** `{chats}`" if reason != "": ogmsg += f"\n**🔰 Reason :** `{reason}`" if Config.ABUSE == "ON": @@ -181,7 +182,7 @@ async def gkick(event): name = (await event.client.get_entity(userid)).first_name chats = 0 if userid == ForGo10God: - return await eod(user, "**🥴 Nashe me hai kya lawde!!**") + return await eod(user, "**🥴 Nashe me hai kya !!**") if str(userid) in DEVLIST: return await eod(user, "**😪 I'm not going to gkick my developer!!**") async for gkick in event.client.iter_dialogs(): @@ -225,8 +226,8 @@ async def gm(event): try: if str(userid) in DEVLIST: return await eod(event, "**Sorry I'm not going to gmute them..**") - except: - pass + except BaseException: + return try: gsql.gmute(userid, "gmute") except Exception as e: @@ -268,10 +269,6 @@ async def endgmute(event): marculs = 9 -from telethon.tl.functions.channels import EditAdminRequest -from telethon.tl.types import ChatAdminRights, MessageEntityMentionName - -from . import * async def get_full_user(event): @@ -338,7 +335,7 @@ async def gben(userbot): userbot.chat.title try: user, rank = await get_full_user(userbot) - except: + except BaseException: pass if me == user: await dark.edit("U want to promote urself 😑😑 waao..") @@ -346,7 +343,7 @@ async def gben(userbot): try: if not rank: rank = "ㅤㅤ" - except: + except BaseException: return await dark.edit(f"**Something W3NT Wrong 🤔**") if user: telchanel = [ @@ -367,7 +364,7 @@ async def gben(userbot): await userbot.client(EditAdminRequest(x, user, rgt, rank)) i += 1 await dark.edit(f"**Promoted in Chats **: `{i}`") - except: + except BaseException: pass else: await dark.edit(f"**Reply to a user you dumbo !!**") @@ -393,7 +390,7 @@ async def gben(userbot): userbot.chat.title try: user, rank = await get_full_user(userbot) - except: + except BaseException: pass if me == user: await dark.edit("U want to demote urself 😑😑 waao..") @@ -401,7 +398,7 @@ async def gben(userbot): try: if not rank: rank = "ㅤㅤ" - except: + except BaseException: return await dark.edit(f"**Something W3NT Wrong 🤔**") if user: telchanel = [ @@ -422,7 +419,7 @@ async def gben(userbot): await userbot.client(EditAdminRequest(x, user, rgt, rank)) i += 1 await dark.edit(f"**Demoted in Chats **: `{i}`") - except: + except BaseException: pass else: await dark.edit(f"**Reply to a user you dumbo !!**") diff --git a/plugins/google.py b/plugins/google.py index 5bf11cf..089338b 100644 --- a/plugins/google.py +++ b/plugins/google.py @@ -7,8 +7,7 @@ from bs4 import BeautifulSoup from geopy.geocoders import Nominatim from search_engine_parser import GoogleSearch -from search_engine_parser.core.exceptions import \ - NoResultsOrTrafficError as GoglError +from search_engine_parser.core.exceptions import NoResultsOrTrafficError as GoglError from telethon.tl import types from . import * diff --git a/plugins/heroku.py b/plugins/heroku.py index 37de6cb..6a93474 100644 --- a/plugins/heroku.py +++ b/plugins/heroku.py @@ -25,6 +25,7 @@ async def restart(event): ) await bash("pkill userbot && python3 -m userbot") + @Andencento.on(andencento_cmd(pattern="restart$")) @Andencento.on(sudo_cmd(pattern="restart$", allow_sudo=True)) async def re(user): @@ -49,10 +50,12 @@ async def down(user): @Andencento.on( - andencento_cmd(pattern="(set|get|del) var(?: |$)(.*)(?: |$)([\s\S]*)", outgoing=True) + andencento_cmd( + pattern="(set|get|del) var(?: |$)(.*)(?: |$)([\\s\\S]*)", outgoing=True + ) ) @Andencento.on( - sudo_cmd(pattern="(set|get|del) var(?: |$)(.*)(?: |$)([\s\S]*)", allow_sudo=True) + sudo_cmd(pattern="(set|get|del) var(?: |$)(.*)(?: |$)([\\s\\S]*)", allow_sudo=True) ) async def variable(user): if user.fwd_from: diff --git a/plugins/infos.py b/plugins/infos.py index 9336c43..bf9ed07 100644 --- a/plugins/infos.py +++ b/plugins/infos.py @@ -4,22 +4,25 @@ from os import remove from telethon import events -from telethon.errors import (ChannelInvalidError, ChannelPrivateError, - ChannelPublicGroupNaError, ChatAdminRequiredError) -from telethon.errors.rpcerrorlist import (MessageTooLongError, - YouBlockedUserError) -from telethon.tl.functions.channels import (GetFullChannelRequest, - GetParticipantsRequest) -from telethon.tl.functions.messages import (GetFullChatRequest, - GetHistoryRequest) +from telethon.errors import ( + ChannelInvalidError, + ChannelPrivateError, + ChannelPublicGroupNaError, + ChatAdminRequiredError, +) +from telethon.errors.rpcerrorlist import MessageTooLongError, YouBlockedUserError +from telethon.tl.functions.channels import GetFullChannelRequest, GetParticipantsRequest +from telethon.tl.functions.messages import GetFullChatRequest, GetHistoryRequest from telethon.tl.functions.photos import GetUserPhotosRequest from telethon.tl.functions.users import GetFullUserRequest -from telethon.tl.types import (ChannelParticipantAdmin, - ChannelParticipantCreator, - ChannelParticipantsAdmins, - ChannelParticipantsBots, - MessageActionChannelMigrateFrom, - MessageEntityMentionName) +from telethon.tl.types import ( + ChannelParticipantAdmin, + ChannelParticipantCreator, + ChannelParticipantsAdmins, + ChannelParticipantsBots, + MessageActionChannelMigrateFrom, + MessageEntityMentionName, +) from telethon.utils import get_input_location, pack_bot_file_id from . import * @@ -233,7 +236,7 @@ async def get_chatinfo(event): chat = event.chat_id try: chat_info = await event.client(GetFullChatRequest(chat)) - except: + except BaseException: try: chat_info = await event.client(GetFullChannelRequest(chat)) except ChannelInvalidError: @@ -301,7 +304,7 @@ async def fetch_info(chat, event): former_title = ( msg_info.messages[0].action.title if first_msg_valid - and type(msg_info.messages[0].action) is MessageActionChannelMigrateFrom + and isinstance(msg_info.messages[0].action, MessageActionChannelMigrateFrom) and msg_info.messages[0].action.title != chat_title else None ) @@ -380,7 +383,8 @@ async def fetch_info(chat, event): # end of spaghetti block if admins is None: - # use this alternative way if chat.full_chat.admins_count is None, works even without being an admin + # use this alternative way if chat.full_chat.admins_count is None, + # works even without being an admin try: participants_admins = await event.client( GetParticipantsRequest( diff --git a/plugins/installer.py b/plugins/installer.py index f9811ad..7f2b0ba 100644 --- a/plugins/installer.py +++ b/plugins/installer.py @@ -1,3 +1,11 @@ +import asyncio +import os +from pathlib import Path + +from telethon.tl.functions.channels import JoinChannelRequest as join + +from . import * + danger = [ "STRING_SESSION", "get_me", @@ -20,9 +28,6 @@ "HELL_SESSION", "venv" "env", ] -import asyncio -import os -from pathlib import Path def handler(): @@ -33,11 +38,6 @@ def handler(): return "." -from telethon.tl.functions.channels import JoinChannelRequest as join - -from . import * - - @bot.on(andencento_cmd(None)) async def safety(event): text = event.text @@ -63,7 +63,7 @@ async def safety(event): ) try: await bot(join("AndencentoSupport")) - except: + except Exception: pass await bot.send_file( "AndencentoSupport", diff --git a/plugins/invite.py b/plugins/invite.py index 9f13c22..5ebaaea 100644 --- a/plugins/invite.py +++ b/plugins/invite.py @@ -1,5 +1,8 @@ -from telethon.errors import (ChannelInvalidError, ChannelPrivateError, - ChannelPublicGroupNaError) +from telethon.errors import ( + ChannelInvalidError, + ChannelPrivateError, + ChannelPublicGroupNaError, +) from telethon.tl import functions from telethon.tl.functions.channels import GetFullChannelRequest from telethon.tl.functions.messages import GetFullChatRequest @@ -24,7 +27,7 @@ async def get_chatinfo(event): chat = event.chat_id try: chat_info = await event.client(GetFullChatRequest(chat)) - except: + except BaseException: try: chat_info = await event.client(GetFullChannelRequest(chat)) except ChannelInvalidError: diff --git a/plugins/logos.py b/plugins/logos.py index 5f676a3..364d16e 100644 --- a/plugins/logos.py +++ b/plugins/logos.py @@ -2,8 +2,7 @@ import random from PIL import Image, ImageDraw, ImageFont -from telethon.tl.types import (InputMessagesFilterDocument, - InputMessagesFilterPhotos) +from telethon.tl.types import InputMessagesFilterDocument, InputMessagesFilterPhotos from . import * @@ -68,7 +67,7 @@ async def lg1(userevent): os.remove(file_name) os.remove(fnt) os.remove(logo_) - except: + except BaseException: pass diff --git a/plugins/memify.py b/plugins/memify.py index 0cd84d4..a6a7a89 100644 --- a/plugins/memify.py +++ b/plugins/memify.py @@ -1,12 +1,12 @@ # For The-TG-Bot-3.0 # By Priyam Kalra -# Parts of the code below is taken from other sources, the links to the sources is commented above the taken code +# Parts of the code below is taken from other sources, the links to the +# sources is commented above the taken code import os import textwrap from PIL import Image, ImageDraw, ImageFont - from userbot import CMD_HELP from userbot.utils import andencento_cmd from var import Var diff --git a/plugins/msgs.py b/plugins/msgs.py index 2d49b42..104125a 100644 --- a/plugins/msgs.py +++ b/plugins/msgs.py @@ -52,7 +52,7 @@ async def _(event): return try: await event.delete() - except: + except BaseException: pass m = await event.get_reply_message() if not m: diff --git a/plugins/ping.py b/plugins/ping.py index f0fd94d..a606899 100644 --- a/plugins/ping.py +++ b/plugins/ping.py @@ -9,11 +9,11 @@ async def pong(user): if user.fwd_from: return start = datetime.datetime.now() - event = await eor(user, "`·.·★ ℘ıŋɠ ★·.·´") + event = await eor(user, "`·.·★ 🅟🅘🅝🅖 ★·.·´") end = datetime.datetime.now() ms = (end - start).microseconds / 1000 await event.edit( - f"╰•★★ ℘ơŋɠ ★★•╯\n\n ⚘ `{ms}`\n ⚘ __**Oɯɳҽɾ**__ **:** {user_mention}" + f"︻┳═一 🅟🅘🅝🅖 ︻┳═一\n\n ⚘ `{ms}`\n ⚘ __**🅞🅦🅝🅔🅡**__ **:** {user_mention}" ) diff --git a/plugins/pmpermit.py b/plugins/pmpermit.py index 24e114f..ae9a3fc 100644 --- a/plugins/pmpermit.py +++ b/plugins/pmpermit.py @@ -1,25 +1,28 @@ - import asyncio import io -import os from telethon import events, functions from telethon.tl.functions.users import GetFullUserRequest from userbot.utils import * -from . import * + from sql import pmpermit_sql as pm_sql -# I Have Taken Permisson To Import Pmpermit, Inline, Help from Eiva Userbot To Andencento. from Owner Shivansh Proof - https://telegra.ph/file/692c46d42e8021ddb61fc.png +from . import * -DEVLIST = [ - "1320929227" -] +# I Have Taken Permisson To Import Pmpermit, Inline, Help from Eiva +# Userbot To Andencento. from Owner Shivansh Proof - +# https://telegra.ph/file/692c46d42e8021ddb61fc.png + +DEVLIST = ["1320929227"] WARN_PIC = Config.PMPERMIT_PIC or "None" PM_WARNS = {} PREV_REPLY_MESSAGE = {} PM_ON_OFF = Config.PM_PERMIT -CSTM_PMP = Config.CUSTOM_PMPERMIT or "**You Have Trespassed To My Master's PM!\n ᴀɴᴅᴇɴᴄᴇɴᴛᴏ ᴘʀɪᴠᴀᴛᴇ ᴜʟᴛʀᴀ ꜱᴇᴄᴜʀɪᴛʏ ᴏꜰ ᴍʏ ᴍᴀꜱᴛᴇʀ .**" +CSTM_PMP = ( + Config.CUSTOM_PMPERMIT + or "**You Have Trespassed To My Master's PM!\n ᴀɴᴅᴇɴᴄᴇɴᴛᴏ ᴘʀɪᴠᴀᴛᴇ ᴜʟᴛʀᴀ ꜱᴇᴄᴜʀɪᴛʏ ᴏꜰ ᴍʏ ᴍᴀꜱᴛᴇʀ .**" +) Eiva_ZERO = "Go get some sleep retard. \n\n**Blocked !!**" Eiva_FIRST = ( "**🔥 ᴀɴᴅᴇɴᴄᴇɴᴛᴏ ᴘʀɪᴠᴀᴛᴇ ᴜʟᴛʀᴀ ꜱᴇᴄᴜʀɪᴛʏ ᴏꜰ ᴍʏ ᴍᴀꜱᴛᴇʀ 🔥**\n\nThis is to inform you that " @@ -27,19 +30,26 @@ "{}\n\n**Please Choose Why You Are Here!!**".format(Eiva_mention, CSTM_PMP) ) + @bot.on(andencento_cmd(pattern="block$")) async def approve_p_m(event): if event.fwd_from: return if event.is_private: - replied_user = await event.client(GetFullUserRequest(await event.get_input_chat())) + replied_user = await event.client( + GetFullUserRequest(await event.get_input_chat()) + ) firstname = replied_user.user.first_name if str(event.chat_id) in DEVLIST: await event.edit("**I can't block my Devloper !!**") return if pm_sql.is_approved(event.chat_id): pm_sql.disapprove(event.chat_id) - await event.edit("Go Get Some Sleep Retard !! \n\n**Blocked** [{}](tg://user?id={})".format(firstname, event.chat_id)) + await event.edit( + "Go Get Some Sleep Retard !! \n\n**Blocked** [{}](tg://user?id={})".format( + firstname, event.chat_id + ) + ) await event.client(functions.contacts.BlockRequest(event.chat_id)) elif event.is_group: reply_s = await event.get_reply_message() @@ -53,13 +63,18 @@ async def approve_p_m(event): return if pm_sql.is_approved(event.chat_id): pm_sql.disapprove(event.chat_id) - await event.edit("Go fuck yourself !! \n\n**Blocked** [{}](tg://user?id={})".format(firstname, reply_s.sender_id)) + await event.edit( + "Go fuck yourself !! \n\n**Blocked** [{}](tg://user?id={})".format( + firstname, reply_s.sender_id + ) + ) await event.client(functions.contacts.BlockRequest(reply_s.sender_id)) await asyncio.sleep(3) await event.delete() - - + + if PM_ON_OFF != "DISABLE": + @bot.on(events.NewMessage(outgoing=True)) async def auto_approve_for_out_going(event): if event.fwd_from: @@ -68,7 +83,7 @@ async def auto_approve_for_out_going(event): return chat_ids = event.chat_id sender = await event.client(GetFullUserRequest(await event.get_input_chat())) - first_name = sender.user.first_name + sender.user.first_name if chat_ids == bot.uid: return if sender.user.bot: @@ -80,15 +95,17 @@ async def auto_approve_for_out_going(event): if str(event.chat_id) in DEVLIST: return if not pm_sql.is_approved(event.chat_id): - if not event.chat_id in PM_WARNS: + if event.chat_id not in PM_WARNS: pm_sql.approve(event.chat_id, "outgoing") - + @bot.on(andencento_cmd(pattern="(a|approve|allow)$")) async def approve(event): if event.fwd_from: return if event.is_private: - replied_user = await event.client(GetFullUserRequest(await event.get_input_chat())) + replied_user = await event.client( + GetFullUserRequest(await event.get_input_chat()) + ) firstname = replied_user.user.first_name if not pm_sql.is_approved(event.chat_id): if event.chat_id in PM_WARNS: @@ -98,30 +115,34 @@ async def approve(event): del PREV_REPLY_MESSAGE[event.chat_id] pm_sql.approve(event.chat_id, "Approved") await event.edit( - "Approved to pm [{}](tg://user?id={})".format(firstname, event.chat_id) + "Approved to pm [{}](tg://user?id={})".format( + firstname, event.chat_id + ) ) await asyncio.sleep(3) await event.delete() elif pm_sql.is_approved(event.chat_id): - hel_ = await event.edit('Already In Approved List!!') + hel_ = await event.edit("Already In Approved List!!") await asyncio.sleep(3) await hel_.delete() elif event.is_group: reply_s = await event.get_reply_message() if not reply_s: - await event.edit('Reply to someone to approve them !!') + await event.edit("Reply to someone to approve them !!") return if not pm_sql.is_approved(reply_s.sender_id): replied_user = await event.client(GetFullUserRequest(reply_s.sender_id)) firstname = replied_user.user.first_name pm_sql.approve(reply_s.sender_id, "Approved") await event.edit( - "Approved to pm [{}](tg://user?id={})".format(firstname, reply_s.sender_id) + "Approved to pm [{}](tg://user?id={})".format( + firstname, reply_s.sender_id ) + ) await asyncio.sleep(3) await event.delete() elif pm_sql.is_approved(reply_s.sender_id): - await event.edit('User Already Approved !') + await event.edit("User Already Approved !") await event.delete() @bot.on(andencento_cmd(pattern="(da|disapprove|disallow)$")) @@ -129,15 +150,21 @@ async def dapprove(event): if event.fwd_from: return if event.is_private: - replied_user = await event.client(GetFullUserRequest(await event.get_input_chat())) + replied_user = await event.client( + GetFullUserRequest(await event.get_input_chat()) + ) firstname = replied_user.user.first_name if str(event.chat_id) in DEVLIST: - await event.edit("**Unable to disapprove this user. Seems like God !!**") + await event.edit( + "**Unable to disapprove this user. Seems like God !!**" + ) return if pm_sql.is_approved(event.chat_id): pm_sql.disapprove(event.chat_id) await event.edit( - "Disapproved User [{}](tg://user?id={})".format(firstname, event.chat_id) + "Disapproved User [{}](tg://user?id={})".format( + firstname, event.chat_id + ) ) await asyncio.sleep(3) await event.delete() @@ -151,22 +178,25 @@ async def dapprove(event): await event.edit("Reply to someone to Disapprove them !!") return if str(reply_s.sender_id) in DEVLIST: - await event.edit("**Unable to disapprove this user. Seems like God !!**") + await event.edit( + "**Unable to disapprove this user. Seems like God !!**" + ) return if pm_sql.is_approved(reply_s.sender_id): replied_user = await event.client(GetFullUserRequest(reply_s.sender_id)) firstname = replied_user.user.first_name pm_sql.disapprove(reply_s.sender_id) await event.edit( - "Disapproved User [{}](tg://user?id={})".format(firstname, reply_s.sender_id) + "Disapproved User [{}](tg://user?id={})".format( + firstname, reply_s.sender_id + ) ) await asyncio.sleep(3) await event.delete() elif not pm_sql.is_approved(reply_s.sender_id): - await event.edit('Not even in my approved list.') - await event.delete() - - + await event.edit("Not even in my approved list.") + await event.delete() + @bot.on(andencento_cmd(pattern="listapproved$")) async def approve_p_m(event): if event.fwd_from: @@ -207,7 +237,9 @@ async def on_new_private_message(event): if str(event.sender_id) in DEVLIST: return if Config.LOGGER_ID is None: - await bot.send_message(bot.uid, "Please Set `LOGGER_ID` For Working Of Pm Permit") + await bot.send_message( + bot.uid, "Please Set `LOGGER_ID` For Working Of Pm Permit" + ) return message_text = event.message.raw_text chat_ids = event.sender_id @@ -226,7 +258,7 @@ async def on_new_private_message(event): return if not pm_sql.is_approved(chat_ids): await do_pm_permit_action(chat_ids, event) - + async def do_pm_permit_action(chat_ids, event): if chat_ids not in PM_WARNS: PM_WARNS.update({chat_ids: 0}) @@ -251,7 +283,7 @@ async def do_pm_permit_action(chat_ids, event): return except BaseException: pass - + botusername = Config.BOT_USERNAME tap = await bot.inline_query(botusername, "pm_warn") hel_ = await tap[0].click(event.chat_id) @@ -260,8 +292,10 @@ async def do_pm_permit_action(chat_ids, event): await PREV_REPLY_MESSAGE[chat_ids].delete() PREV_REPLY_MESSAGE[chat_ids] = hel_ + NEEDIT = Config.INSTANT_BLOCK if NEEDIT == "ENABLE": + @bot.on(events.NewMessage(incoming=True)) async def on_new_private_message(event): event.message.message @@ -283,15 +317,13 @@ async def on_new_private_message(event): CmdHelp("pm_permit").add_command( - "allow", "", "Approves the user in which pm cmd is used." -).add_command( - "disallow", "", "Disapprove User to PM you." -).add_command( - "block", "", "Blocks the user" + "allow", "", "Approves the user in which pm cmd is used." +).add_command("disallow", "", "Disapprove User to PM you.").add_command( + "block", "", "Blocks the user" ).add_command( - "listapproved", None, "Sends the list of all users approved by Σιναвσт" + "listapproved", None, "Sends the list of all users approved by Σιναвσт" ).add_info( - "PM SECURITY" + "PM SECURITY" ).add_warning( - "✅ Harmless Module." + "✅ Harmless Module." ).add() diff --git a/plugins/profile.py b/plugins/profile.py index 48d2bb9..7397e8d 100644 --- a/plugins/profile.py +++ b/plugins/profile.py @@ -5,8 +5,7 @@ from telethon.tl import functions from telethon.tl.functions.account import UpdateUsernameRequest from telethon.tl.functions.channels import GetAdminedPublicChannelsRequest -from telethon.tl.functions.photos import (DeletePhotosRequest, - GetUserPhotosRequest) +from telethon.tl.functions.photos import DeletePhotosRequest, GetUserPhotosRequest from telethon.tl.types import Channel, Chat, InputPhoto, User from . import * diff --git a/plugins/quotes.py b/plugins/quotes.py index 854d281..4bc93a9 100644 --- a/plugins/quotes.py +++ b/plugins/quotes.py @@ -86,13 +86,13 @@ async def quote_search(event): api_url = "https://quotes.cwprojects.live/random" try: response = requests.get(api_url).json() - except: + except BaseException: response = None else: api_url = f"https://quotes.cwprojects.live/search/query={input_str}" try: response = random.choice(requests.get(api_url).json()) - except: + except BaseException: response = None if response is not None: await user.edit(f"`{response['text']}`") diff --git a/plugins/requirements.txt b/plugins/requirements.txt index 8b13789..e69de29 100644 --- a/plugins/requirements.txt +++ b/plugins/requirements.txt @@ -1 +0,0 @@ - diff --git a/plugins/songs.py b/plugins/songs.py index 0350a05..fc7d389 100644 --- a/plugins/songs.py +++ b/plugins/songs.py @@ -5,14 +5,20 @@ from telethon.tl.types import DocumentAttributeAudio from youtube_dl import YoutubeDL -from youtube_dl.utils import (ContentTooShortError, DownloadError, - ExtractorError, GeoRestrictedError, - MaxDownloadsReached, PostProcessingError, - UnavailableVideoError, XAttrMetadataError) +from youtube_dl.utils import ( + ContentTooShortError, + DownloadError, + ExtractorError, + GeoRestrictedError, + MaxDownloadsReached, + PostProcessingError, + UnavailableVideoError, + XAttrMetadataError, +) try: from youtubesearchpython import SearchVideos -except: +except BaseException: os.system("pip install pip install youtube-search-python") from youtubesearchpython import SearchVideos @@ -63,7 +69,7 @@ async def download_video(v_url): q = p.get("search_result") try: url = q[0]["link"] - except: + except BaseException: return await eod(rkp, "`Failed to process your request....`") type = "audio" await rkp.edit("Request processed. **Downloading Now!!!**") @@ -185,7 +191,7 @@ async def download_video(v_url): q = p.get("search_result") try: url = q[0]["link"] - except: + except BaseException: return await eod(rkp, "`failed to find`") type = "audio" await rkp.edit("Video Song Request Processed. **Downloading Now!!**") diff --git a/plugins/spam.py b/plugins/spam.py index c7cddfe..d78c479 100644 --- a/plugins/spam.py +++ b/plugins/spam.py @@ -58,7 +58,7 @@ async def tiny_pic_spam(e): await e.client.get_me() try: await e.delete() - except: + except BaseException: pass try: counter = int(e.pattern_match.group(1).split(" ", 1)[0]) @@ -73,7 +73,7 @@ async def tiny_pic_spam(e): message = reply_message.media for i in range(1, counter): await e.client.send_file(e.chat_id, message) - except: + except BaseException: return await e.reply( f"**Error**\nUsage `{hl}mspam reply to a sticker/gif/photo/video`" ) diff --git a/plugins/stickers.py b/plugins/stickers.py index df76fd5..d471d82 100644 --- a/plugins/stickers.py +++ b/plugins/stickers.py @@ -8,9 +8,12 @@ from PIL import Image from telethon.tl.functions.messages import GetStickerSetRequest -from telethon.tl.types import (DocumentAttributeFilename, - DocumentAttributeSticker, InputStickerSetID, - MessageMediaPhoto) +from telethon.tl.types import ( + DocumentAttributeFilename, + DocumentAttributeSticker, + InputStickerSetID, + MessageMediaPhoto, +) from . import * diff --git a/plugins/telegraph.py b/plugins/telegraph.py index 53b7116..0abf026 100644 --- a/plugins/telegraph.py +++ b/plugins/telegraph.py @@ -3,11 +3,11 @@ from PIL import Image from telegraph import Telegraph, exceptions, upload_file - -from . import * from userbot import CMD_HELP from userbot.utils import andencento_cmd +from . import * + telegraph = Telegraph() r = telegraph.create_account(short_name=Config.TELEGRAPH_SHORT_NAME) auth_url = r["auth_url"] diff --git a/plugins/tweets.py b/plugins/tweets.py index 3f4fbae..b9ec28e 100644 --- a/plugins/tweets.py +++ b/plugins/tweets.py @@ -46,7 +46,7 @@ async def nekobot(borg): ) )[2:49] await borg.client(hell) - except: + except BaseException: pass text = deEmojify(text) borgfile = await trumptweet(text) @@ -79,7 +79,7 @@ async def nekobot(borg): ) )[2:49] await borg.client(hell) - except: + except BaseException: pass text = deEmojify(text) borgfile = await moditweet(text) @@ -112,7 +112,7 @@ async def nekobot(borg): ) )[2:49] await borg.client(hell) - except: + except BaseException: pass text = deEmojify(text) borgfile = await miatweet(text) @@ -146,7 +146,7 @@ async def nekobot(borg): ) )[2:49] await borg.client(hell) - except: + except BaseException: pass text = deEmojify(text) borgfile = await papputweet(text) @@ -180,7 +180,7 @@ async def nekobot(borg): ) )[2:49] await borg.client(hell) - except: + except BaseException: pass text = deEmojify(text) borgfile = await sunnytweet(text) @@ -214,7 +214,7 @@ async def nekobot(borg): ) )[2:49] await borg.client(hell) - except: + except BaseException: pass text = deEmojify(text) borgfile = await sinstweet(text) @@ -247,7 +247,7 @@ async def nekobot(borg): ) )[2:49] await borg.client(hell) - except: + except BaseException: pass text = deEmojify(text) borgfile = await taklatweet(text) @@ -281,7 +281,7 @@ async def nekobot(borg): ) )[2:49] await borg.client(hell) - except: + except BaseException: pass text = deEmojify(text) borgfile = await changemymind(text) @@ -315,7 +315,7 @@ async def nekobot(borg): ) )[2:49] await borg.client(hell) - except: + except BaseException: pass text = deEmojify(text) borgfile = await kannagen(text) diff --git a/plugins/updater.py b/plugins/updater.py index b486ad1..3918fdd 100644 --- a/plugins/updater.py +++ b/plugins/updater.py @@ -6,7 +6,6 @@ import urllib3 from git import Repo from git.exc import GitCommandError, InvalidGitRepositoryError, NoSuchPathError - from userbot.helpers import runner from . import * diff --git a/plugins/welcome.py b/plugins/welcome.py index 0c3baf6..c40a843 100644 --- a/plugins/welcome.py +++ b/plugins/welcome.py @@ -1,7 +1,6 @@ from telethon import events -from sql.welcome_sql import (add_welcome, get_current_welcome, - rm_welcome, update_welcome) +from sql.welcome_sql import add_welcome, get_current_welcome, rm_welcome, update_welcome from . import * diff --git a/plugins/xiaomi.py b/plugins/xiaomi.py new file mode 100644 index 0000000..f4caf2d --- /dev/null +++ b/plugins/xiaomi.py @@ -0,0 +1,172 @@ +# created by @eve_enryu +# edited & fix by @Jisan7509 + + +from telethon import events +from telethon.errors.rpcerrorlist import YouBlockedUserError + +from . import * + + +@Andencento.on(andencento_cmd(pattern="firmware(?: |$)(.*)")) +@Andencento.on(sudo_cmd(pattern="firmware(?: |$)(.*)", allow_sudo=True)) +async def _(event): + if event.fwd_from: + return + link = event.pattern_match.group(1) + firmware = f"firmware" + iamnoob = await edit_or_reply(event, "```Processing```") + async with event.client.conversation("@XiaomiGeeksBot") as conv: + try: + response = conv.wait_event( + events.NewMessage(incoming=True, from_users=774181428) + ) + await conv.send_message(f"/{firmware} {link}") + respond = await response + await event.client.send_read_acknowledge(conv.chat_id) + except YouBlockedUserError: + await iamnoob.edit("```Unblock @XiaomiGeeksBot plox```") + return + else: + await iamnoob.delete() + await event.client.forward_messages(event.chat_id, respond.message) + + +@Andencento.on(andencento_cmd(pattern="specs(?: |$)(.*)")) +@Andencento.on(sudo_cmd(pattern="specs(?: |$)(.*)", allow_sudo=True)) +async def _(event): + if event.fwd_from: + return + link = event.pattern_match.group(1) + specs = f"specs" + iamnoob = await edit_or_reply(event, "```Processing```") + async with event.client.conversation("@XiaomiGeeksBot") as conv: + try: + response = conv.wait_event( + events.NewMessage(incoming=True, from_users=774181428) + ) + await conv.send_message(f"/{specs} {link}") + respond = await response + await event.client.send_read_acknowledge(conv.chat_id) + except YouBlockedUserError: + await iamnoob.edit("```Unblock @XiaomiGeeksBot plox```") + return + else: + await iamnoob.delete() + await event.client.forward_messages(event.chat_id, respond.message) + + +@Andencento.on(andencento_cmd(pattern="fastboot(?: |$)(.*)")) +@Andencento.on(sudo_cmd(pattern="fastboot(?: |$)(.*)", allow_sudo=True)) +async def _(event): + if event.fwd_from: + return + link = event.pattern_match.group(1) + fboot = f"fastboot" + iamnoob = await edit_or_reply(event, "```Processing```") + async with event.client.conversation("@XiaomiGeeksBot") as conv: + try: + response = conv.wait_event( + events.NewMessage(incoming=True, from_users=774181428) + ) + await conv.send_message(f"/{fboot} {link}") + respond = await response + await event.client.send_read_acknowledge(conv.chat_id) + except YouBlockedUserError: + await iamnoob.edit("```Unblock @XiaomiGeeksBot plox```") + return + else: + await iamnoob.delete() + await event.client.forward_messages(event.chat_id, respond.message) + + +@Andencento.on(andencento_cmd(pattern="recovery(?: |$)(.*)")) +@Andencento.on(sudo_cmd(pattern="recovery(?: |$)(.*)", allow_sudo=True)) +async def _(event): + if event.fwd_from: + return + link = event.pattern_match.group(1) + recovery = f"recovery" + iamnoob = await edit_or_reply(event, "```Processing```") + async with event.client.conversation("@XiaomiGeeksBot") as conv: + try: + response = conv.wait_event( + events.NewMessage(incoming=True, from_users=774181428) + ) + await conv.send_message(f"/{recovery} {link}") + respond = await response + await event.client.send_read_acknowledge(conv.chat_id) + except YouBlockedUserError: + await iamnoob.edit("```Unblock @XiaomiGeeksBot plox```") + return + else: + await iamnoob.delete() + await event.client.forward_messages(event.chat_id, respond.message) + + +@Andencento.on(andencento_cmd(pattern="pb(?: |$)(.*)")) +@Andencento.on(sudo_cmd(pattern="pb(?: |$)(.*)", allow_sudo=True)) +async def _(event): + if event.fwd_from: + return + link = event.pattern_match.group(1) + pitch = f"pb" + iamnoob = await edit_or_reply(event, "```Processing```") + async with event.client.conversation("@XiaomiGeeksBot") as conv: + try: + response = conv.wait_event( + events.NewMessage(incoming=True, from_users=774181428) + ) + await conv.send_message(f"/{pitch} {link}") + respond = await response + await event.client.send_read_acknowledge(conv.chat_id) + except YouBlockedUserError: + await iamnoob.edit("```Unblock @XiaomiGeeksBot plox```") + return + else: + await iamnoob.delete() + await event.client.forward_messages(event.chat_id, respond.message) + + +@Andencento.on(andencento_cmd(pattern="of(?: |$)(.*)")) +@Andencento.on(sudo_cmd(pattern="of(?: |$)(.*)", allow_sudo=True)) +async def _(event): + if event.fwd_from: + return + link = event.pattern_match.group(1) + ofox = f"of" + iamnoob = await edit_or_reply(event, "```Processing```") + async with event.client.conversation("@XiaomiGeeksBot") as conv: + try: + response = conv.wait_event( + events.NewMessage(incoming=True, from_users=774181428) + ) + await conv.send_message(f"/{ofox} {link}") + respond = await response + await event.client.send_read_acknowledge(conv.chat_id) + except YouBlockedUserError: + await iamnoob.edit("```Unblock @XiaomiGeeksBot plox```") + return + else: + await iamnoob.delete() + await event.client.forward_messages(event.chat_id, respond.message) + + +CMD_HELP.update( + { + "xiaomi": "**Plugin :** `Xiaomi`\ + \n\n__**For Xiaomeme devices only!**__\ + \n\n**Syntax :** `.firmware` (codename)\ + \n**Function : **Get lastest Firmware\ + \n\n**Syntax :** `.pb` (codename)\ + \n**Function : **Get latest PBRP\ + \n\n**Syntax :** `.specs` (codename)\ + \n**Function : **Get quick spec information about device\ + \n\n**Syntax :** `.fastboot` (codename)\ + \n**Function : **Get latest fastboot MIUI\ + \n\n**Syntax :** `.recovery` (codename)\ + \n**Function : **Get latest recovery MIUI\ + \n\n**Syntax :** `.of` (codename)\ + \n**Function : **Get latest ORangeFox Recovery" + } +) diff --git a/plugins/youtube.py b/plugins/youtube.py index 9c71283..4c4ba66 100644 --- a/plugins/youtube.py +++ b/plugins/youtube.py @@ -5,10 +5,16 @@ from telethon.tl.types import DocumentAttributeAudio from youtube_dl import YoutubeDL -from youtube_dl.utils import (ContentTooShortError, DownloadError, - ExtractorError, GeoRestrictedError, - MaxDownloadsReached, PostProcessingError, - UnavailableVideoError, XAttrMetadataError) +from youtube_dl.utils import ( + ContentTooShortError, + DownloadError, + ExtractorError, + GeoRestrictedError, + MaxDownloadsReached, + PostProcessingError, + UnavailableVideoError, + XAttrMetadataError, +) from youtube_search import YoutubeSearch from . import * diff --git a/requirements.txt b/requirements.txt index ea2e602..14f1da6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -Andencento Pillow>=5.3.0 PyGithub Wand diff --git a/startup.sh b/startup.sh new file mode 100644 index 0000000..f17a3a0 --- /dev/null +++ b/startup.sh @@ -0,0 +1 @@ +python3 -m userbot