├── .github
├── FUNDING.yml
└── workflows
│ ├── pylint.yml
│ └── pythonapp.yml
├── .gitignore
├── .gitlab-ci.yml
├── Dockerfile
├── LICENSE
├── Procfile
├── README.md
├── _config.yml
├── app.json
├── heroku.yml
├── requirements.txt
├── resources
├── README.md
├── TeleBot.jpeg
├── fonts
│ ├── DejaVuSans.ttf
│ ├── README.md
│ ├── digital.ttf
│ ├── hello_valentina.ttf
│ └── rosemary.ttf
├── startup.sh
├── telebot-setup.py
└── termux_session_gen.sh
├── telebot
├── __init__.py
├── __main__.py
├── google_images_download.py
├── plugins
│ ├── README.md
│ ├── __init__.py
│ ├── _help.py
│ ├── _inline.py
│ ├── about.py
│ ├── account_edits.py
│ ├── actressdp.py
│ ├── admin.py
│ ├── afk.py
│ ├── alive.py
│ ├── android.py
│ ├── animedp.py
│ ├── animesticker.py
│ ├── antivirus.py
│ ├── app.py
│ ├── art.py
│ ├── ascii.py
│ ├── autobio.py
│ ├── autoname.py
│ ├── autopic.py
│ ├── avengersdp.py
│ ├── barcode.py
│ ├── bash.py
│ ├── being_logical.py
│ ├── bigoof.py
│ ├── blacklist.py
│ ├── bloom.py
│ ├── botfns.py
│ ├── bye.py
│ ├── calculator.py
│ ├── calender.py
│ ├── call.py
│ ├── carbon.py
│ ├── chain.py
│ ├── channel_download.py
│ ├── chatinfo.py
│ ├── chod.py
│ ├── clone.py
│ ├── command_list.py
│ ├── congratulations.py
│ ├── core.py
│ ├── coronavirus.py
│ ├── create.py
│ ├── currency.py
│ ├── dagd.py
│ ├── deepfryer.py
│ ├── design.py
│ ├── dictionary.py
│ ├── ding.py
│ ├── dlinks.py
│ ├── downloads.py
│ ├── dumpster.py
│ ├── earth.py
│ ├── echo.py
│ ├── edits.py
│ ├── emojigames.py
│ ├── eval.py
│ ├── exec.py
│ ├── fedstuff.py
│ ├── ff_mpeg.py
│ ├── figlet.py
│ ├── fileext.py
│ ├── filemanager.py
│ ├── filters.py
│ ├── fleaveme.py
│ ├── fpost.py
│ ├── frybot.py
│ ├── fuck.py
│ ├── gDrive.py
│ ├── gaali.py
│ ├── gamerpfp.py
│ ├── gangasta.py
│ ├── gay.py
│ ├── gban_bots.py
│ ├── gbun.py
│ ├── get_infos.py
│ ├── git.py
│ ├── gitcommit.py
│ ├── github.py
│ ├── giveawayhelper.py
│ ├── globalban.py
│ ├── gmute.py
│ ├── google.py
│ ├── got_memes.py
│ ├── got_thoughts.py
│ ├── gps.py
│ ├── group.py
│ ├── hack.py
│ ├── hack_v2.py
│ ├── heroku.py
│ ├── iffuci.py
│ ├── imdb.py
│ ├── img.py
│ ├── imgmemes.py
│ ├── invite.py
│ ├── jainder.py
│ ├── jio.py
│ ├── json.py
│ ├── labstack.py
│ ├── list_user_names_reserved_by_me.py
│ ├── locks.py
│ ├── lucky.py
│ ├── lydia.py
│ ├── lyrics.py
│ ├── mal_fun.py
│ ├── management.py
│ ├── marveldp.py
│ ├── mask.py
│ ├── meme.py
│ ├── memeify.py
│ ├── memes.py
│ ├── mention.py
│ ├── mf.py
│ ├── mood.py
│ ├── moon.py
│ ├── mtn.py
│ ├── music.py
│ ├── mute.py
│ ├── mybot
│ │ ├── __init__.py
│ │ ├── pmbot
│ │ │ ├── README.md
│ │ │ ├── incoming.py
│ │ │ ├── outgoing.py
│ │ │ └── stats_bot.py
│ │ ├── sql
│ │ │ ├── __init__.py
│ │ │ ├── blacklist_sql.py
│ │ │ ├── userbase_sql.py
│ │ │ └── users_sql.py
│ │ └── start.py
│ ├── nakal.py
│ ├── ncode.py
│ ├── np.py
│ ├── ocr.py
│ ├── ok.py
│ ├── online.py
│ ├── os.py
│ ├── padmin.py
│ ├── pastebin.py
│ ├── pin_message.py
│ ├── ping.py
│ ├── pmsecurity.py
│ ├── pmto.py
│ ├── power_tools.py
│ ├── ppgrab.py
│ ├── purge.py
│ ├── qr_code.py
│ ├── quickheal.py
│ ├── quotly.py
│ ├── randomsticker.py
│ ├── removebg.py
│ ├── rename.py
│ ├── repack.py
│ ├── reveal.py
│ ├── reverseimg.py
│ ├── sangmata.py
│ ├── saver.py
│ ├── sca.py
│ ├── schd.py
│ ├── screencapture.py
│ ├── screenlong.py
│ ├── search.py
│ ├── shout.py
│ ├── smallart.py
│ ├── snake.py
│ ├── snip.py
│ ├── solarsystem.py
│ ├── song.py
│ ├── spam.py
│ ├── speedtest.py
│ ├── spotif_deez_dl.py
│ ├── spotify.py
│ ├── sprt.py
│ ├── sql_helper
│ │ ├── __init__.py
│ │ ├── blacklist_sql.py
│ │ ├── filter_sql.py
│ │ ├── ghdb_sql.py
│ │ ├── gmute_sql.py
│ │ ├── locks_sql.py
│ │ ├── mute_sql.py
│ │ ├── pmpermit_sql.py
│ │ ├── snips_sql.py
│ │ └── welcome_sql.py
│ ├── ss.py
│ ├── stat.py
│ ├── stickerize.py
│ ├── stickers.py
│ ├── sticklet.py
│ ├── sticklol.py
│ ├── sudo.py
│ ├── superfban.py
│ ├── system.py
│ ├── tagall.py
│ ├── tagnotif.py
│ ├── telegraph.py
│ ├── think.py
│ ├── time.py
│ ├── translate.py
│ ├── tts.py
│ ├── tutorial.py
│ ├── tweet.py
│ ├── updater.py
│ ├── upload_download.py
│ ├── urbandictionary.py
│ ├── user_info.py
│ ├── userstat.py
│ ├── view_counter.py
│ ├── warnbun.py
│ ├── weather.py
│ ├── webupload.py
│ ├── weebify.py
│ ├── welcome.py
│ ├── whois.py
│ ├── wtf.py
│ ├── ytdl.py
│ ├── zip.py
│ └── zombies.py
├── telebotConfig.py
└── utils.py
└── telesetup.py
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms if you would like to fund for TeleBot devlopment.
2 |
3 | patreon: xditya
4 | custom: https://t.me/xditya
5 |
--------------------------------------------------------------------------------
/.github/workflows/pylint.yml:
--------------------------------------------------------------------------------
1 | name: PyLint
2 |
3 | on: push
4 |
5 | jobs:
6 | PEP8:
7 | runs-on: ubuntu-latest
8 | steps:
9 | - uses: actions/checkout@v2
10 |
11 | - name: Setup Python
12 | uses: actions/setup-python@v1
13 | with:
14 | python-version: 3.8
15 |
16 | - name: Install Python lint libraries
17 | run: |
18 | pip install autopep8 autoflake isort black
19 | - name: Check for showstoppers
20 | run: |
21 | autopep8 --verbose --in-place --recursive --aggressive --aggressive . *.py
22 | - name: Remove unused imports and variables
23 | run: |
24 | autoflake --in-place --recursive --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports .
25 | - name: lint with isort and black
26 | run: |
27 | isort telebot/plugins/*.py
28 | black telebot/plugins/*.py
29 | # commit changes
30 | - uses: stefanzweifel/git-auto-commit-action@v4
31 | with:
32 | commit_message: 'pylint: auto fixes'
33 | commit_options: '--no-verify'
34 | repository: .
35 | commit_user_name: xditya
36 | commit_user_email: 58950863+xditya@users.noreply.github.com
37 | commit_author: xditya <58950863+xditya@users.noreply.github.com>
38 |
--------------------------------------------------------------------------------
/.github/workflows/pythonapp.yml:
--------------------------------------------------------------------------------
1 | name: FailedChecker
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | build:
7 |
8 | runs-on: ubuntu-latest
9 | strategy:
10 | max-parallel: 5
11 | matrix:
12 | python-version: [3.8]
13 |
14 | steps:
15 | - uses: actions/checkout@master
16 | - name: Set up Python ${{ matrix.python-version }}
17 | uses: actions/setup-python@master
18 | with:
19 | python-version: ${{ matrix.python-version }}
20 | - name: Install dependencies
21 | run: |
22 | sudo apt-get install libpq-dev
23 | python -m pip install --upgrade pip
24 | pip install -r requirements.txt
25 | pip install flake8 flake8-print flake8-quotes
26 | - name: Check for showstoppers
27 | run: |
28 | # stop the build if there are Python syntax errors
29 | flake8 . --count --select=E999 --show-source --statistics
30 | shellcheck:
31 |
32 | runs-on: ubuntu-latest
33 |
34 | steps:
35 | - uses: actions/checkout@master
36 | - name: Check for install script errors
37 | uses: ludeeus/action-shellcheck@master
38 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | *.egg-info/
24 | .installed.cfg
25 | *.egg
26 | MANIFEST
27 |
28 | # PyInstaller
29 | # Usually these files are written by a python script from a template
30 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
31 | *.manifest
32 | *.spec
33 |
34 | # Installer logs
35 | pip-log.txt
36 | pip-delete-this-directory.txt
37 |
38 | # Unit test / coverage reports
39 | htmlcov/
40 | .tox/
41 | .coverage
42 | .coverage.*
43 | .cache
44 | nosetests.xml
45 | coverage.xml
46 | *.cover
47 | .hypothesis/
48 | .pytest_cache/
49 |
50 | # Translations
51 | *.mo
52 | *.pot
53 |
54 | # Django stuff:
55 | *.log
56 | local_settings.py
57 | db.sqlite3
58 |
59 | # Flask stuff:
60 | instance/
61 | .webassets-cache
62 |
63 | # Scrapy stuff:
64 | .scrapy
65 |
66 | # Sphinx documentation
67 | docs/_build/
68 |
69 | # PyBuilder
70 | target/
71 |
72 | # Jupyter Notebook
73 | .ipynb_checkpoints
74 |
75 | # pyenv
76 | .python-version
77 |
78 | # celery beat schedule file
79 | celerybeat-schedule
80 |
81 | # SageMath parsed files
82 | *.sage.py
83 |
84 | # Environments
85 | .env
86 | .venv
87 | env/
88 | venv/
89 | ENV/
90 | env.bak/
91 | venv.bak/
92 |
93 | # Spyder project settings
94 | .spyderproject
95 | .spyproject
96 |
97 | # Rope project settings
98 | .ropeproject
99 |
100 | # mkdocs documentation
101 | /site
102 |
103 | # mypy
104 | .mypy_cache/
105 |
--------------------------------------------------------------------------------
/.gitlab-ci.yml:
--------------------------------------------------------------------------------
1 | CheckUserBotWorking:
2 | script:
3 | - echo "Nothing"
4 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM kalilinux/kali-rolling
2 |
3 | ARG DEBIAN_FRONTEND=noninteractive
4 |
5 | RUN apt-get update && apt upgrade -y && apt-get install sudo -y
6 |
7 | RUN apt-get install -y\
8 | coreutils \
9 | bash \
10 | nodejs \
11 | bzip2 \
12 | curl \
13 | figlet \
14 | gcc \
15 | g++ \
16 | git \
17 | util-linux \
18 | libevent-dev \
19 | libjpeg-dev \
20 | libffi-dev \
21 | libpq-dev \
22 | libwebp-dev \
23 | libxml2 \
24 | libxml2-dev \
25 | libxslt-dev \
26 | musl \
27 | neofetch \
28 | libcurl4-openssl-dev \
29 | postgresql \
30 | postgresql-client \
31 | postgresql-server-dev-all \
32 | openssl \
33 | mediainfo \
34 | wget \
35 | python3 \
36 | python3-dev \
37 | python3-pip \
38 | libreadline-dev \
39 | zipalign \
40 | sqlite3 \
41 | ffmpeg \
42 | libsqlite3-dev \
43 | zlib1g-dev \
44 | recoverjpeg \
45 | zip \
46 | unrar \
47 | megatools \
48 | libfreetype6-dev \
49 | procps \
50 | policykit-1 \
51 | p7zip-full \
52 | tree
53 |
54 | RUN apt-get autoremove --purge
55 |
56 | RUN pip3 install --upgrade pip setuptools
57 | RUN if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi
58 | RUN if [ ! -e /usr/bin/python ]; then ln -sf /usr/bin/python3 /usr/bin/python; fi
59 | RUN rm -r /root/.cache
60 | RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && apt install -y ./google-chrome-stable_current_amd64.deb && rm google-chrome-stable_current_amd64.deb
61 | RUN wget https://chromedriver.storage.googleapis.com/86.0.4240.22/chromedriver_linux64.zip && unzip chromedriver_linux64.zip && chmod +x chromedriver && mv -f chromedriver /usr/bin/ && rm chromedriver_linux64.zip
62 | RUN git clone https://github.com/xditya/TeleBot /root/telebot
63 | RUN mkdir /root/telebot/bin/
64 | WORKDIR /root/telebot/
65 | RUN chmod +x /usr/local/bin/*
66 | RUN pip3 install -r requirements.txt
67 | CMD ["bash","./resources/startup.sh"]
68 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | telebot: python -m telebot
2 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-time-machine
--------------------------------------------------------------------------------
/heroku.yml:
--------------------------------------------------------------------------------
1 | build:
2 | docker:
3 | worker: Dockerfile
4 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | Pillow>=5.3.0
2 | PyGithub
3 | aiofiles
4 | aiohttp
5 | async_generator
6 | asyncurban
7 | beautifulsoup4
8 | bs4
9 | bwb==3.0.0
10 | cfscrape
11 | coffeehouse
12 | covid
13 | cowpy
14 | cryptg
15 | dnspython
16 | emoji
17 | gTTS-token>=1.1.3
18 | gTTS>=2.0.1
19 | geopy
20 | gitpython
21 | google-api-python-client==1.8.0
22 | google-auth-oauthlib
23 | google_images_download>=2.7.1
24 | googletrans==3.1.0a0
25 | gsearch
26 | hachoir
27 | heroku3
28 | httplib2<0.18.0
29 | humanize
30 | lxml
31 | lyricsgenius
32 | oauth2client
33 | psycopg2-binary
34 | pySmartDL
35 | pybase64>=0.4.0
36 | pyfiglet
37 | pylast
38 | pymongo
39 | python-barcode
40 | python-dotenv
41 | python-magic
42 | pytube
43 | pytz
44 | qrcode
45 | regex
46 | requests>=2.18.4
47 | search-engine-parser>=0.4.2
48 | selenium
49 | spamwatch
50 | speedtest-cli>=2.0.2
51 | sqlalchemy>=1.2
52 | telegraph
53 | telethon>=1.17
54 | tswift
55 | urbandict
56 | validators
57 | wheel
58 | wikipedia>=1.4.0
59 | youtube-dl
60 | youtube-search-python
61 |
--------------------------------------------------------------------------------
/resources/README.md:
--------------------------------------------------------------------------------
1 | ## (c) 2020 TeleBot
2 | # Do not edit
3 | Files for proper functioning of the userbot.
4 |
--------------------------------------------------------------------------------
/resources/TeleBot.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/maxprogrammer007/TeleBot/6a159661a689bf6378b097e41fc50f9f5bc6a2a8/resources/TeleBot.jpeg
--------------------------------------------------------------------------------
/resources/fonts/DejaVuSans.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/maxprogrammer007/TeleBot/6a159661a689bf6378b097e41fc50f9f5bc6a2a8/resources/fonts/DejaVuSans.ttf
--------------------------------------------------------------------------------
/resources/fonts/README.md:
--------------------------------------------------------------------------------
1 | ## To store fonts
2 |
3 | How to contribute more fonts - create a pull req or leave the font link as an issue or comment.
4 | Or just send it via telegram to [TeleBot Chat](https://t.me/TeleBotHelpChat) group!
5 |
6 | (c) 2020 TeleBot
7 |
--------------------------------------------------------------------------------
/resources/fonts/digital.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/maxprogrammer007/TeleBot/6a159661a689bf6378b097e41fc50f9f5bc6a2a8/resources/fonts/digital.ttf
--------------------------------------------------------------------------------
/resources/fonts/hello_valentina.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/maxprogrammer007/TeleBot/6a159661a689bf6378b097e41fc50f9f5bc6a2a8/resources/fonts/hello_valentina.ttf
--------------------------------------------------------------------------------
/resources/fonts/rosemary.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/maxprogrammer007/TeleBot/6a159661a689bf6378b097e41fc50f9f5bc6a2a8/resources/fonts/rosemary.ttf
--------------------------------------------------------------------------------
/resources/startup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # TeleBot - UserBot
3 | # Copyright (C) 2020 TeleBot
4 |
5 | # This program is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Affero General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 |
10 | # This program is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Affero General Public License for more details.
14 |
15 | # You should have received a copy of the GNU Affero General Public License
16 | # along with this program. If not, see .
17 | #
18 |
19 | echo "
20 |
21 | ........................................................................
22 | '########:'########:'##:::::::'########:'########:::'#######::'########:
23 | ... ##..:: ##.....:: ##::::::: ##.....:: ##.... ##:'##.... ##:... ##..::
24 | ::: ##:::: ##::::::: ##::::::: ##::::::: ##:::: ##: ##:::: ##:::: ##::::
25 | ::: ##:::: ######::: ##::::::: ######::: ########:: ##:::: ##:::: ##::::
26 | ::: ##:::: ##...:::: ##::::::: ##...:::: ##.... ##: ##:::: ##:::: ##::::
27 | ::: ##:::: ##::::::: ##::::::: ##::::::: ##:::: ##: ##:::: ##:::: ##::::
28 | ::: ##:::: ########: ########: ########: ########::. #######::::: ##::::
29 | :::..:::::........::........::........::........::::.......::::::..:::::
30 |
31 | "
32 |
33 | python -m telebot
34 |
--------------------------------------------------------------------------------
/resources/telebot-setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # (c) https://t.me/TelethonChat/37677
3 | # This Source Code Form is subject to the terms of the GNU
4 | # General Public License, v.3.0. If a copy of the GPL was not distributed with this
5 | # file, You can obtain one at https://www.gnu.org/licenses/gpl-3.0.en.html.
6 |
7 | from telethon.sync import TelegramClient
8 | from telethon.sessions import StringSession
9 |
10 | print("""Please go-to my.telegram.org
11 | Login using your Telegram account
12 | Click on API Development Tools
13 | Create a new application, by entering the required details
14 | For TeleBot""")
15 | print("")
16 |
17 | APP_ID = int(input("Enter APP ID here: "))
18 | API_HASH = input("Enter API HASH here: ")
19 |
20 | with TelegramClient(StringSession(), APP_ID, API_HASH) as client:
21 | tele = client.send_message("me", client.session.save())
22 | tele.reply(
23 | "The above is the `STRING_SESSION` for your current session.\n@TeleBotSupport")
24 | print("")
25 | print("Below is the STRING_SESSION. You can also find it in your Telegram Saved Messages.")
26 | print("")
27 | print("")
28 | print(client.session.save())
29 |
--------------------------------------------------------------------------------
/resources/termux_session_gen.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | clear
3 | echo "
4 | _____ _ _ _
5 | |_ _|__| | ___| |__ ___ | |_
6 | | |/ _ \ |/ _ \ '_ \ / _ \| __|
7 | | | __/ | __/ |_) | (_) | |_
8 | |_|\___|_|\___|_.__/ \___/ \__|
9 |
10 | "
11 | # Termux session string generator for TeleBot
12 | echo Starting dependency installation in 5 seconds...
13 | sleep 5
14 | apt-get update
15 | apt-get upgrade -y
16 | pkg upgrade -y
17 | pkg install python wget -y
18 | wget https://raw.githubusercontent.com/xditya/TeleBot/master/resources/telebot-setup.py
19 | pip install telethon
20 | python telebot-setup.py
--------------------------------------------------------------------------------
/telebot/plugins/README.md:
--------------------------------------------------------------------------------
1 | # Folder containing all userbot modules
2 |
3 | ## Mandatory Imports
4 | ```python3
5 | None
6 | ```
7 | There is None Mandatory Imports. Because Var, bot and command are already automatically imported.
8 |
9 | ## Explanation
10 | The Mandatory Imports are now automatically imported.
11 |
12 | ### Formation
13 | Now I will show a short script to show the formation of the desired script.
14 | ```python3
15 | @command(pattern="^.alive", outgoing=True)
16 | async def hello_world(event):
17 | if event.fwd_from:
18 | return
19 | await event.edit("**HELLO WORLD**\n\nThe following is controlling me too!\n" + Var.SUDO_USERS)
20 | ```
21 |
--------------------------------------------------------------------------------
/telebot/plugins/__init__.py:
--------------------------------------------------------------------------------
1 | # TeleBot - UserBot
2 | # Copyright (C) 2020 TeleBot
3 |
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU Affero General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 |
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Affero General Public License for more details.
13 |
14 | # You should have received a copy of the GNU Affero General Public License
15 | # along with this program. If not, see .
16 |
17 | from telethon.tl.types import Channel
18 |
19 | from telebot import *
20 | from telebot import ALIVE_NAME, bot, telever
21 | from telebot.telebotConfig import Config, Var
22 |
23 | # stats
24 | if Var.PRIVATE_GROUP_ID:
25 | log = "Enabled"
26 | else:
27 | log = "Disabled"
28 |
29 | if Config.TG_BOT_USER_NAME_BF_HER:
30 | bots = "Enabled"
31 | else:
32 | bots = "Disabled"
33 |
34 | if Var.LYDIA_API_KEY:
35 | lyd = "Enabled"
36 | else:
37 | lyd = "Disabled"
38 |
39 | if Config.SUDO_USERS:
40 | sudo = "Disabled"
41 | else:
42 | sudo = "Enabled"
43 |
44 | if Var.PMSECURITY.lower() == "off":
45 | pm = "Disabled"
46 | else:
47 | pm = "Enabled"
48 |
49 | TELEUSER = str(ALIVE_NAME) if ALIVE_NAME else "@TeleBotSupport"
50 |
51 | tele = f"TeleBot Version: {telever}\n"
52 | tele += f"Log Group: {log}\n"
53 | tele += f"Assistant Bot: {bots}\n"
54 | tele += f"Lydia: {lyd}\n"
55 | tele += f"Sudo: {sudo}\n"
56 | tele += f"PMSecurity: {pm}\n"
57 | tele += f"\nVisit @TeleBotSupport for assistance.\n"
58 | telestats = f"{tele}"
59 |
60 | TELE_NAME = bot.me.first_name
61 | OWNER_ID = bot.me.id
62 |
63 | # count total number of groups
64 |
65 |
66 | async def tele_grps(event):
67 | a = []
68 | async for dialog in event.client.iter_dialogs():
69 | entity = dialog.entity
70 | if isinstance(entity, Channel):
71 | if entity.megagroup:
72 | if entity.creator or entity.admin_rights:
73 | a.append(entity.id)
74 | return len(a), a
75 |
--------------------------------------------------------------------------------
/telebot/plugins/about.py:
--------------------------------------------------------------------------------
1 | # Ported from other Telegram UserBots for TeleBot//Made for TeleBot
2 | # Kangers, don't remove this line
3 | # @its_xditya
4 |
5 | """Available Commands:
6 | .info
7 | """
8 |
9 | import asyncio
10 |
11 | from telebot import CMD_HELP
12 |
13 |
14 | @telebot.on(admin_cmd(pattern="info"))
15 | @telebot.on(sudo_cmd(pattern="info", allow_sudo=True))
16 | async def _(event):
17 | if event.fwd_from:
18 | return
19 | animation_interval = 0.1
20 | animation_ttl = range(0, 36)
21 | # input_str = event.pattern_match.group(1)
22 | # if input_str == "Visit this page to know more about TeleBot.":
23 | await eor(event, "Thanks")
24 | animation_chars = ["**TeleBot**", "[More Info](https://telegra.ph/TeleBot-07-08)"]
25 |
26 | for i in animation_ttl:
27 | await asyncio.sleep(animation_interval)
28 | await eor(event, animation_chars[i % 18])
29 |
30 |
31 | CMD_HELP.update({"about": "➟ .info\nUse - Get to know about your bot."})
32 |
--------------------------------------------------------------------------------
/telebot/plugins/actressdp.py:
--------------------------------------------------------------------------------
1 | # Ported from other Telegram UserBots for TeleBot//Made for TeleBot
2 | # Kangers, don't remove this line
3 | # @its_xditya
4 |
5 | # Usage .actressdp Im Not Responsible For Any Ban caused By This
6 |
7 | import asyncio
8 | import os
9 | import random
10 | import re
11 | import urllib
12 |
13 | import requests
14 | from telethon.tl import functions
15 |
16 | from telebot import CMD_HELP
17 |
18 | COLLECTION_STRING = [
19 | "indian-actress-wallpapers",
20 | "latest-bollywood-actress-wallpapers-2018-hd",
21 | "bollywood-actress-wallpaper",
22 | "hd-wallpapers-of-bollywood-actress",
23 | "new-bollywood-actress-wallpaper-2018",
24 | ]
25 |
26 |
27 | async def animepp():
28 |
29 | os.system("rm -rf donot.jpg")
30 |
31 | rnd = random.randint(0, len(COLLECTION_STRING) - 1)
32 |
33 | pack = COLLECTION_STRING[rnd]
34 |
35 | pc = requests.get("http://getwallpapers.com/collection/" + pack).text
36 |
37 | f = re.compile(r"/\w+/full.+.jpg")
38 |
39 | f = f.findall(pc)
40 |
41 | fy = "http://getwallpapers.com" + random.choice(f)
42 |
43 | print(fy)
44 |
45 | if not os.path.exists("f.ttf"):
46 |
47 | urllib.request.urlretrieve(
48 | "https://github.com/rebel6969/mym/raw/master/Rebel-robot-Regular.ttf",
49 | "f.ttf",
50 | )
51 |
52 | urllib.request.urlretrieve(fy, "donottouch.jpg")
53 |
54 |
55 | @telebot.on(admin_cmd(pattern="actressdp ?(.*)"))
56 | async def main(event):
57 |
58 | await event.edit(
59 | "**Starting Actress Profile Pic...\n\nDone !!! Check Your DP in 5 seconds. \n By [TeleBot](https://github.com/xditya/TeleBot)**"
60 | )
61 |
62 | while True:
63 |
64 | await animepp()
65 |
66 | file = await event.client.upload_file("donottouch.jpg")
67 |
68 | await event.client(functions.photos.UploadProfilePhotoRequest(file))
69 |
70 | os.system("rm -rf donottouch.jpg")
71 |
72 | await asyncio.sleep(600) # Edit this to your required needs
73 |
74 |
75 | CMD_HELP.update(
76 | {
77 | "actressdp": "➟ .actressdp\nStart auto-changing acress profile pic for your account."
78 | }
79 | )
80 |
--------------------------------------------------------------------------------
/telebot/plugins/animedp.py:
--------------------------------------------------------------------------------
1 | # Made By @TeleBotHelp Keep Credits If You Are Goanna Kang This Lol
2 | # And Thanks To The Creator Of Autopic This Script Was Made from Snippets From That Script
3 | # Usage .actressdp I'm Not Responsible For Any Ban caused By This
4 |
5 | import asyncio
6 | import os
7 | import random
8 | import re
9 | import urllib
10 |
11 | import requests
12 | from telethon.tl import functions
13 |
14 | from telebot import CMD_HELP
15 |
16 | COLLECTION_STRING = [
17 | "cute-anime-wallpapers-hd",
18 | "anime-christmas-wallpaper-hd",
19 | "anime-samurai-girl-wallpaper",
20 | "4k-anime-wallpapers",
21 | "2560-x-1440-wallpaper-anime",
22 | ]
23 |
24 |
25 | async def animepp():
26 |
27 | os.system("rm -rf donot.jpg")
28 |
29 | rnd = random.randint(0, len(COLLECTION_STRING) - 1)
30 |
31 | pack = COLLECTION_STRING[rnd]
32 |
33 | pc = requests.get("http://getwallpapers.com/collection/" + pack).text
34 |
35 | f = re.compile(r"/\w+/full.+.jpg")
36 |
37 | f = f.findall(pc)
38 |
39 | fy = "http://getwallpapers.com" + random.choice(f)
40 |
41 | print(fy)
42 |
43 | if not os.path.exists("f.ttf"):
44 |
45 | urllib.request.urlretrieve(
46 | "https://github.com/rebel6969/mym/raw/master/Rebel-robot-Regular.ttf",
47 | "f.ttf",
48 | )
49 |
50 | urllib.request.urlretrieve(fy, "donottouch.jpg")
51 |
52 |
53 | @telebot.on(admin_cmd(pattern="animedp ?(.*)"))
54 | async def main(event):
55 |
56 | await event.edit(
57 | "**Starting Anime Profile Pic...\n\nDone !!! Check Your DP in 5 seconds. By [TeleBot](https://github.com/xditya/TeleBot)**"
58 | )
59 |
60 | while True:
61 |
62 | await animepp()
63 |
64 | file = await event.client.upload_file("donottouch.jpg")
65 |
66 | await event.client(functions.photos.UploadProfilePhotoRequest(file))
67 |
68 | os.system("rm -rf donottouch.jpg")
69 |
70 | await asyncio.sleep(600) # Edit this to your required needs
71 |
72 |
73 | CMD_HELP.update(
74 | {"animedp": "➟ `.animedp`\nStart auto-changing anime profile pic for your account."}
75 | )
76 |
--------------------------------------------------------------------------------
/telebot/plugins/animesticker.py:
--------------------------------------------------------------------------------
1 | # imported from ppe-remix by @heyworld & @DeletedUser420
2 | # Translated & Updated by @Sur_vivor
3 | import random
4 | import re
5 |
6 | from telebot import CMD_HELP, bot
7 | from telebot.utils import admin_cmd
8 |
9 | EMOJI_PATTERN = re.compile(
10 | "["
11 | "\U0001F1E0-\U0001F1FF" # flags (iOS)
12 | "\U0001F300-\U0001F5FF" # symbols & pictographs
13 | "\U0001F600-\U0001F64F" # emoticons
14 | "\U0001F680-\U0001F6FF" # transport & map symbols
15 | "\U0001F700-\U0001F77F" # alchemical symbols
16 | "\U0001F780-\U0001F7FF" # Geometric Shapes Extended
17 | "\U0001F800-\U0001F8FF" # Supplemental Arrows-C
18 | "\U0001F900-\U0001F9FF" # Supplemental Symbols and Pictographs
19 | "\U0001FA00-\U0001FA6F" # Chess Symbols
20 | "\U0001FA70-\U0001FAFF" # Symbols and Pictographs Extended-A
21 | "\U00002702-\U000027B0" # Dingbats
22 | "]+"
23 | )
24 |
25 |
26 | def deEmojify(inputString: str) -> str:
27 | """Remove emojis and other non-safe characters from string"""
28 | return re.sub(EMOJI_PATTERN, "", inputString)
29 |
30 |
31 | @telebot.on(admin_cmd(outgoing=True, pattern="waifu(?: |$)(.*)"))
32 | @telebot.on(sudo_cmd(pattern="waifu(?: |$)(.*)"))
33 | async def waifu(animu):
34 | # """Creates random anime sticker!"""
35 |
36 | text = animu.pattern_match.group(1)
37 | if not text:
38 | if animu.is_reply:
39 | text = (await animu.get_reply_message()).message
40 | else:
41 | await animu.edit("`You haven't written any article, Waifu is going away.`")
42 | return
43 | animus = [1, 3, 7, 9, 13, 22, 34, 35, 36, 37, 43, 44, 45, 52, 53, 55]
44 | sticcers = await bot.inline_query(
45 | "stickerizerbot", f"#{random.choice(animus)}{(deEmojify(text))}"
46 | )
47 | await sticcers[0].click(
48 | animu.chat_id,
49 | reply_to=animu.reply_to_msg_id,
50 | silent=True if animu.is_reply else False,
51 | hide_via=True,
52 | )
53 | await animu.delete()
54 |
55 |
56 | CMD_HELP.update({"waifu": "`.waifu` : Anime that makes your writing fun."})
57 |
--------------------------------------------------------------------------------
/telebot/plugins/antivirus.py:
--------------------------------------------------------------------------------
1 | # Lots of lub to @r4v4n4 for gibing the base <3
2 | from telethon import events
3 | from telethon.errors.rpcerrorlist import YouBlockedUserError
4 |
5 | from telebot import CMD_HELP
6 |
7 |
8 | @telebot.on(admin_cmd(pattern="scan ?(.*)"))
9 | @telebot.on(sudo_cmd(pattern="scan ?(.*)"))
10 | async def _(event):
11 | if event.fwd_from:
12 | return
13 | if not event.reply_to_msg_id:
14 | await eor(event, "```Reply to any user message.```")
15 | return
16 | x = await eor(event, "scanning...")
17 | reply_message = await event.get_reply_message()
18 | if not reply_message.media:
19 | await x.edit("```reply to a media message```")
20 | return
21 | chat = "@DrWebBot"
22 | reply_message.sender
23 | if reply_message.sender.bot:
24 | await x.edit("```Reply to actual users message.```")
25 | return
26 | await x.edit(" `Sliding my tip, of fingers over it`")
27 | async with borg.conversation(chat) as conv:
28 | try:
29 | response = conv.wait_event(
30 | events.NewMessage(incoming=True, from_users=161163358)
31 | )
32 | await borg.forward_messages(chat, reply_message)
33 | response = await response
34 | except YouBlockedUserError:
35 | await event.reply("```Please unblock @sangmatainfo_bot and try again```")
36 | return
37 | if response.text.startswith("Forward"):
38 | await x.edit(
39 | "```can you kindly disable your forward privacy settings for good?```",
40 | )
41 | else:
42 | if response.text.startswith("Select"):
43 | await x.edit("`Please go to` @DrWebBot `and select your language.`")
44 | else:
45 | await x.edit(
46 | f"**Antivirus scan was completed. I got dem final results.**\n {response.message.message}",
47 | )
48 |
49 |
50 | CMD_HELP.update(
51 | {"antivirus": "➟ `.scan `\nUse - Scan the pic/doc for viruses."}
52 | )
53 |
--------------------------------------------------------------------------------
/telebot/plugins/ascii.py:
--------------------------------------------------------------------------------
1 | from telethon import events
2 | from telethon.errors.rpcerrorlist import YouBlockedUserError
3 |
4 | from telebot import CMD_HELP
5 | from telebot.utils import admin_cmd
6 |
7 |
8 | @telebot.on(admin_cmd(pattern="ascii ?(.*)"))
9 | @telebot.on(sudo_cmd(pattern="ascii ?(.*)", allow_sudo=True))
10 | async def _(event):
11 | if event.fwd_from:
12 | return
13 | if not event.reply_to_msg_id:
14 | await eor(event, "```Reply to any user message.```")
15 | return
16 | reply_message = await event.get_reply_message()
17 | if not reply_message.media:
18 | await eor(event, "```reply to media message```")
19 | return
20 | chat = "@asciiart_bot"
21 | reply_message.sender
22 | if reply_message.sender.bot:
23 | await eor(event, "```Reply to actual users message.```")
24 | return
25 | await eor(event, "```Wait making ASCII...```")
26 | # For TeleBot
27 | async with borg.conversation(chat) as conv:
28 | try:
29 | response = conv.wait_event(
30 | events.NewMessage(incoming=True, from_users=164766745)
31 | )
32 | await borg.send_message(chat, reply_message)
33 | response = await response
34 | except YouBlockedUserError:
35 | await event.reply("```Please unblock @asciiart_bot and try again```")
36 | return
37 | if response.text.startswith("Forward"):
38 | await eor(
39 | event,
40 | "```can you kindly disable your forward privacy settings for good?```",
41 | )
42 | else:
43 | await borg.send_file(event.chat_id, response.message.media)
44 |
45 |
46 | # For TeleBot
47 | CMD_HELP.update(
48 | {
49 | "ascii": "`.ascii` reply to any image file:\
50 | \nUse - Makes an image ascii style, try out your own.\
51 | "
52 | }
53 | )
54 |
--------------------------------------------------------------------------------
/telebot/plugins/autobio.py:
--------------------------------------------------------------------------------
1 | # AutoBio plugin for TeleBot
2 | # Using this might lead to ban of your account, use at your own risk.
3 | # Re-Written by @its_xditya
4 |
5 | import asyncio
6 | import time
7 |
8 | from telethon.errors import FloodWaitError
9 | from telethon.tl import functions
10 |
11 | from telebot import CMD_HELP
12 | from telebot.utils import admin_cmd
13 |
14 | DEL_TIME_OUT = 60
15 |
16 |
17 | @telebot.on(admin_cmd(pattern="autobio")) # pylint:disable=E0602
18 | async def _(event):
19 | if event.fwd_from:
20 | return
21 | while True:
22 | DMY = time.strftime("%d.%m.%Y")
23 | HM = time.strftime("%H:%M:%S")
24 | bio = f"📅 {DMY} | This is my bio, I guess.. 😁 | ⌚️ {HM}"
25 | logger.info(bio)
26 | try:
27 | await borg(
28 | functions.account.UpdateProfileRequest( # pylint:disable=E0602
29 | about=bio
30 | )
31 | )
32 | except FloodWaitError as ex:
33 | logger.warning(str(e))
34 | await asyncio.sleep(ex.seconds)
35 | # else:
36 | # logger.info(r.stringify())
37 | await borg.send_message(
38 | Var.PRIVATE_GROUP_ID, "#Auto_Bio\nSuccessfully enabled auto-bio."
39 | )
40 | await asyncio.sleep(DEL_TIME_OUT)
41 |
42 |
43 | CMD_HELP.update({"autobio": ".autobio\nUse - Auto-changing profile bio, with time"})
44 |
--------------------------------------------------------------------------------
/telebot/plugins/autoname.py:
--------------------------------------------------------------------------------
1 | """Auto Profile Updation Commands
2 | .autoname"""
3 | import asyncio
4 | import time
5 |
6 | from telethon.errors import FloodWaitError
7 | from telethon.tl import functions
8 | from uniborg.util import admin_cmd
9 |
10 | from telebot import ALIVE_NAME, CMD_HELP
11 |
12 | DEL_TIME_OUT = 60
13 | DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "TeleBot"
14 |
15 |
16 | @telebot.on(admin_cmd(pattern="autoname")) # pylint:disable=E0602
17 | async def _(event):
18 | if event.fwd_from:
19 | return
20 | while True:
21 | DM = time.strftime("%d-%m-%y")
22 | HM = time.strftime("%H:%M")
23 | name = f"🕒{HM} ⚡{DEFAULTUSER}⚡ {DM} 🗓️"
24 | logger.info(name)
25 | try:
26 | await borg(
27 | functions.account.UpdateProfileRequest( # pylint:disable=E0602
28 | first_name=name
29 | )
30 | )
31 | except FloodWaitError as ex:
32 | logger.warning(str(e))
33 | await asyncio.sleep(ex.seconds)
34 |
35 | # else:
36 | # logger.info(r.stringify())
37 | await borg.send_message(
38 | Var.PRIVATE_GROUP_ID, "#Auto_Name\nSuccessfully started AutoName"
39 | )
40 | await asyncio.sleep(DEL_TIME_OUT)
41 | await event.edit(f"Auto Name has been started...")
42 |
43 |
44 | CMD_HELP.update({"autoname": ".autoname\nUse - Auto changing profile name, with time."})
45 |
--------------------------------------------------------------------------------
/telebot/plugins/autopic.py:
--------------------------------------------------------------------------------
1 | # TeleBot - UserBot
2 | # Copyright (C) 2020 TeleBot
3 |
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU Affero General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 |
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Affero General Public License for more details.
13 |
14 | import asyncio
15 |
16 | # You should have received a copy of the GNU Affero General Public License
17 | # along with this program. If not, see .
18 | # By @buddhhu
19 | #
20 | import os
21 | import shutil
22 | from datetime import datetime
23 |
24 | from PIL import Image, ImageDraw, ImageFont
25 | from telethon.tl import functions
26 |
27 | from telebot import *
28 | from telebot import AUTO_PIC_FONT, AUTOPIC_FONT_COLOUR, AUTOPIC_TEXT, CMD_HELP
29 |
30 | fntz = str(AUTO_PIC_FONT) if AUTO_PIC_FONT else "DejaVuSans.ttf"
31 | FONT_FILE_TO_USE = f"resources/fonts/{fntz}"
32 | AUTOPIC_TEXT = (
33 | str(AUTOPIC_TEXT)
34 | if AUTOPIC_TEXT
35 | else "Life Is too Short.\n And so is your TG account."
36 | )
37 | COLOUR = str(AUTOPIC_FONT_COLOUR) if AUTOPIC_FONT_COLOUR else (255, 255, 255)
38 |
39 |
40 | @telebot.on(admin_cmd(pattern="autopic"))
41 | async def autopic(event):
42 | await event.edit("**Autopic has been enabled!!!**")
43 | a = await event.get_reply_message()
44 | downloaded_file_name = "userbot/original_pic.png"
45 | await telebot.download_media(a, downloaded_file_name)
46 | photo = "telebot/photo_pfp.png"
47 | while True:
48 | shutil.copy(downloaded_file_name, photo)
49 | current_time = datetime.now().strftime(
50 | f"Time: %H:%M \nDate: %d.%m.%y \n{AUTOPIC_TEXT}"
51 | )
52 | img = Image.open(photo)
53 | drawn_text = ImageDraw.Draw(img)
54 | fnt = ImageFont.truetype(FONT_FILE_TO_USE, 30)
55 | color = COLOUR
56 | drawn_text.text((95, 250), current_time, font=fnt, fill=color)
57 | img.save(photo)
58 | file = await event.client.upload_file(photo)
59 | try:
60 | await event.client(functions.photos.UploadProfilePhotoRequest(file))
61 | os.remove(photo)
62 | await asyncio.sleep(60)
63 | except BaseException:
64 | return
65 |
66 |
67 | CMD_HELP.update(
68 | {"autopic": ".autopic \nUse - Auto changing dp, with time and date."}
69 | )
70 |
--------------------------------------------------------------------------------
/telebot/plugins/avengersdp.py:
--------------------------------------------------------------------------------
1 | # @TeleBotSupport Keep Credits If You Are Goanna Kang This Lol
2 | # And Thanks To The Creator Of Autopic This Script Was Made from Snippets From That Script
3 | # Usage .avengersdp Im Not Responsible For Any Ban caused By This
4 |
5 | import asyncio
6 | import os
7 | import random
8 | import re
9 | import urllib
10 |
11 | import requests
12 | from telethon.tl import functions
13 |
14 | from telebot import CMD_HELP
15 | from telebot.utils import admin_cmd
16 |
17 | COLLECTION_STRING = [
18 | "avengers-logo-wallpaper",
19 | "avengers-hd-wallpapers-1080p",
20 | "avengers-iphone-wallpaper",
21 | "iron-man-wallpaper-1920x1080",
22 | "iron-man-wallpapers",
23 | ]
24 |
25 |
26 | async def animepp():
27 |
28 | os.system("rm -rf donot.jpg")
29 |
30 | rnd = random.randint(0, len(COLLECTION_STRING) - 1)
31 |
32 | pack = COLLECTION_STRING[rnd]
33 |
34 | pc = requests.get("http://getwallpapers.com/collection/" + pack).text
35 |
36 | f = re.compile(r"/\w+/full.+.jpg")
37 |
38 | f = f.findall(pc)
39 |
40 | fy = "http://getwallpapers.com" + random.choice(f)
41 |
42 | print(fy)
43 |
44 | if not os.path.exists("f.ttf"):
45 |
46 | urllib.request.urlretrieve(
47 | "https://github.com/rebel6969/mym/raw/master/Rebel-robot-Regular.ttf",
48 | "f.ttf",
49 | )
50 |
51 | urllib.request.urlretrieve(fy, "donottouch.jpg")
52 |
53 |
54 | @telebot.on(admin_cmd(pattern="avengersdp ?(.*)"))
55 | async def main(event):
56 |
57 | await event.edit(
58 | "**Starting Avengers Profile Pic...\n\nDone !!! Check Your DP in 5 seconds. By [TeleBot](https://github.com/xditya/TeleBot)**"
59 | )
60 |
61 | while True:
62 |
63 | await animepp()
64 |
65 | file = await event.client.upload_file("donottouch.jpg")
66 |
67 | await event.client(functions.photos.UploadProfilePhotoRequest(file))
68 |
69 | os.system("rm -rf donottouch.jpg")
70 |
71 | await asyncio.sleep(600) # Edit this to your required needs
72 |
73 |
74 | CMD_HELP.update({"avengersdp": ".avengersdp\nUse - Auto-changing dp of avengers."})
75 |
--------------------------------------------------------------------------------
/telebot/plugins/barcode.py:
--------------------------------------------------------------------------------
1 | """BarCode Generator
2 | Command .barcode (your text)
3 | By @snappy101
4 | """
5 |
6 | import asyncio
7 | import os
8 | from datetime import datetime
9 |
10 | import barcode
11 | from barcode.writer import ImageWriter
12 | from uniborg.util import admin_cmd
13 |
14 | from telebot import CMD_HELP
15 |
16 |
17 | @telebot.on(admin_cmd(pattern="barcode ?(.*)"))
18 | @telebot.on(sudo_cmd(pattern="barcode ?(.*)"))
19 | async def _(event):
20 | if event.fwd_from:
21 | return
22 | await eor(event, "...")
23 | start = datetime.now()
24 | input_str = event.pattern_match.group(1)
25 | message = "SYNTAX: `.barcode `"
26 | reply_msg_id = event.message.id
27 | if input_str:
28 | message = input_str
29 | elif event.reply_to_msg_id:
30 | previous_message = await event.get_reply_message()
31 | reply_msg_id = previous_message.id
32 | if previous_message.media:
33 | downloaded_file_name = await borg.download_media(
34 | previous_message,
35 | Config.TMP_DOWNLOAD_DIRECTORY,
36 | )
37 | m_list = None
38 | with open(downloaded_file_name, "rb") as fd:
39 | m_list = fd.readlines()
40 | message = ""
41 | for m in m_list:
42 | message += m.decode("UTF-8") + "\r\n"
43 | os.remove(downloaded_file_name)
44 | else:
45 | message = previous_message.message
46 | else:
47 | message = "SYNTAX: `.barcode `"
48 | bar_code_type = "code128"
49 | try:
50 | bar_code_mode_f = barcode.get(bar_code_type, message, writer=ImageWriter())
51 | filename = bar_code_mode_f.save(bar_code_type)
52 | await borg.send_file(
53 | event.chat_id,
54 | filename,
55 | caption=message,
56 | reply_to=reply_msg_id,
57 | )
58 | os.remove(filename)
59 | except Exception as e:
60 | await eor(event, str(e))
61 | return
62 | end = datetime.now()
63 | ms = (end - start).seconds
64 | await eor(event, "Created BarCode in {} seconds".format(ms))
65 | await asyncio.sleep(5)
66 | await event.delete()
67 |
68 |
69 | CMD_HELP.update(
70 | {"barcode": ".barcode \nUse - To make a barcode containing that text."}
71 | )
72 |
--------------------------------------------------------------------------------
/telebot/plugins/bash.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 | import io
3 | import time
4 |
5 | from telebot import CMD_HELP
6 | from telebot.utils import admin_cmd
7 |
8 |
9 | @telebot.on(admin_cmd(pattern="bash ?(.*)"))
10 | @telebot.on(sudo_cmd(pattern="bash ?(.*)", allow_sudo=True))
11 | async def _(event):
12 | if event.fwd_from:
13 | return
14 | PROCESS_RUN_TIME = 100
15 | cmd = event.pattern_match.group(1)
16 | reply_to_id = event.message.id
17 | if event.reply_to_msg_id:
18 | reply_to_id = event.reply_to_msg_id
19 | time.time() + PROCESS_RUN_TIME
20 | process = await asyncio.create_subprocess_shell(
21 | cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
22 | )
23 | stdout, stderr = await process.communicate()
24 | e = stderr.decode()
25 | if not e:
26 | e = "No Error"
27 | o = stdout.decode()
28 | if not o:
29 | o = "**Tip**: \n`If you want to see the results of your code, I suggest printing them to stdout.`"
30 | else:
31 | _o = o.split("\n")
32 | o = "`\n".join(_o)
33 | OUTPUT = f"**QUERY**\n\n__►__ **Command**\n`{cmd}`\n\n__►__ **PID**\n`{process.pid}`\n\n**__►__ **stderr** \n`{e}`\n\n**__►__** Output:**\n`{o}`"
34 | if len(OUTPUT) > 4095:
35 | with io.BytesIO(str.encode(OUTPUT)) as out_file:
36 | out_file.name = "exec.text"
37 | await bot.send_file(
38 | event.chat_id,
39 | out_file,
40 | force_document=True,
41 | allow_cache=False,
42 | caption=cmd,
43 | reply_to=reply_to_id,
44 | )
45 | await event.delete()
46 | await eor(event, OUTPUT)
47 |
48 |
49 | CMD_HELP.update({"bash": ".bash \nUse - Run a code."})
50 |
--------------------------------------------------------------------------------
/telebot/plugins/bigoof.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 |
3 | from telebot import CMD_HELP
4 | from telebot.utils import admin_cmd
5 |
6 |
7 | @telebot.on(admin_cmd(pattern="bigoof"))
8 | @telebot.on(sudo_cmd(pattern="bigoof"))
9 | async def _(event):
10 | if event.fwd_from:
11 | return
12 | animation_interval = 0.1
13 | animation_ttl = range(0, 36)
14 | # input_str = event.pattern_match.group(1)
15 | # if input_str == "nope":
16 | await eor(
17 | event,
18 | "┏━━━┓╋╋╋╋┏━━━┓ \n┃┏━┓┃╋╋╋╋┃┏━┓┃ \n┃┃╋┃┣┓┏┓┏┫┃╋┃┃ \n┃┃╋┃┃┗┛┗┛┃┃╋┃┃ \n┃┗━┛┣┓┏┓┏┫┗━┛┃ \n┗━━━┛┗┛┗┛┗━━━┛",
19 | )
20 | animation_chars = [
21 | "╭━━━╮╱╱╱╭━╮ \n┃╭━╮┃╱╱╱┃╭╯ \n┃┃╱┃┣━━┳╯╰╮ \n┃┃╱┃┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃┃┃ \n╰━━━┻━━╯╰╯ ",
22 | "╭━━━╮╱╱╱╱╱╱╭━╮ \n┃╭━╮┃╱╱╱╱╱╱┃╭╯ \n┃┃╱┃┣━━┳━━┳╯╰╮ \n┃┃╱┃┃╭╮┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃╰╯┃┃┃ \n ╰━━━┻━━┻━━╯╰╯",
23 | "╭━━━╮╱╱╱╱╱╱╱╱╱╭━╮ \n┃╭━╮┃╱╱╱╱╱╱╱╱╱┃╭╯ \n┃┃╱┃┣━━┳━━┳━━┳╯╰╮ \n┃┃╱┃┃╭╮┃╭╮┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃╰╯┃╰╯┃┃┃ \n╰━━━┻━━┻━━┻━━╯╰╯",
24 | "╭━━━╮╱╱╱╱╱╱╱╱╱╱╱╱╭━╮ \n┃╭━╮┃╱╱╱╱╱╱╱╱╱╱╱╱┃╭╯ \n┃┃╱┃┣━━┳━━┳━━┳━━┳╯╰╮ \n┃┃╱┃┃╭╮┃╭╮┃╭╮┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃╰╯┃╰╯┃╰╯┃┃┃ \n╰━━━┻━━┻━━┻━━┻━━╯╰╯",
25 | "╭━━━╮╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━╮ \n┃╭━╮┃╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃╭╯ \n┃┃╱┃┣━━┳━━┳━━┳━━┳━━┳╯╰╮ \n┃┃╱┃┃╭╮┃╭╮┃╭╮┃╭╮┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃╰╯┃╰╯┃╰╯┃╰╯┃┃┃ \n╰━━━┻━━┻━━┻━━┻━━┻━━╯╰╯",
26 | "╭━━━╮╱╱╱╱╱╱╱╱╱╱╱╱╭━╮ \n┃╭━╮┃╱╱╱╱╱╱╱╱╱╱╱╱┃╭╯ \n┃┃╱┃┣━━┳━━┳━━┳━━┳╯╰╮ \n┃┃╱┃┃╭╮┃╭╮┃╭╮┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃╰╯┃╰╯┃╰╯┃┃┃ \n╰━━━┻━━┻━━┻━━┻━━╯╰╯",
27 | "╭━━━╮╱╱╱╱╱╱╱╱╱╭━╮ \n┃╭━╮┃╱╱╱╱╱╱╱╱╱┃╭╯ \n┃┃╱┃┣━━┳━━┳━━┳╯╰╮ \n┃┃╱┃┃╭╮┃╭╮┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃╰╯┃╰╯┃┃┃ \n╰━━━┻━━┻━━┻━━╯╰╯",
28 | ]
29 |
30 | for i in animation_ttl:
31 |
32 | await asyncio.sleep(animation_interval)
33 | await event.eor(animation_chars[i % 40])
34 |
35 |
36 | CMD_HELP.update({"bigoof": ".bigoof\nTry it yourself!"})
37 |
--------------------------------------------------------------------------------
/telebot/plugins/bye.py:
--------------------------------------------------------------------------------
1 | # For @UniBorg
2 |
3 | # Courtesy @yasirsiddiqui
4 |
5 | """
6 |
7 | .bye
8 |
9 | """
10 |
11 |
12 | import time
13 |
14 | from telethon.tl.functions.channels import LeaveChannelRequest
15 |
16 | from telebot import CMD_HELP
17 | from telebot.utils import admin_cmd
18 |
19 |
20 | @telebot.on(admin_cmd(pattern="bye", outgoing=True))
21 | async def leave(e):
22 | x = bot.me
23 | name = x.first_name
24 | if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
25 |
26 | await e.edit(f"`{name} has left this group, bye!!.`")
27 |
28 | time.sleep(3)
29 |
30 | if "-" in str(e.chat_id):
31 |
32 | await borg(LeaveChannelRequest(e.chat_id))
33 |
34 | else:
35 |
36 | await e.edit("`This is Not A Chat. Please use this in groups :/`")
37 |
38 |
39 | CMD_HELP.update({"bye": ".bye\nUse - Leave the group."})
40 |
--------------------------------------------------------------------------------
/telebot/plugins/calculator.py:
--------------------------------------------------------------------------------
1 | # credits to @mrconfused
2 | # @TeleBotSupport
3 |
4 | import io
5 | import sys
6 | import traceback
7 |
8 | from telebot import CMD_HELP
9 | from telebot.utils import admin_cmd
10 |
11 |
12 | @telebot.on(admin_cmd(pattern="calc"))
13 | @telebot.on(sudo_cmd(pattern="calc", allow_sudo=True))
14 | async def _(event):
15 | if event.fwd_from or event.via_bot_id:
16 | return
17 | x = await eor(event, "Processing ...")
18 | cmd = event.text.split(" ", maxsplit=1)[1]
19 | event.message.id
20 | if event.reply_to_msg_id:
21 | event.reply_to_msg_id
22 |
23 | san = f"print({cmd})"
24 | old_stderr = sys.stderr
25 | old_stdout = sys.stdout
26 | redirected_output = sys.stdout = io.StringIO()
27 | redirected_error = sys.stderr = io.StringIO()
28 | stdout, stderr, exc = None, None, None
29 | try:
30 | await aexec(san, event)
31 | except Exception:
32 | exc = traceback.format_exc()
33 | stdout = redirected_output.getvalue()
34 | stderr = redirected_error.getvalue()
35 | sys.stdout = old_stdout
36 | sys.stderr = old_stderr
37 |
38 | evaluation = ""
39 | if exc:
40 | evaluation = exc
41 | elif stderr:
42 | evaluation = stderr
43 | elif stdout:
44 | evaluation = stdout
45 | else:
46 | evaluation = "Something went wrong"
47 |
48 | final_output = "**EQUATION**: `{}` \n\n **SOLUTION**: \n`{}` \n".format(
49 | cmd, evaluation
50 | )
51 | await x.edit(final_output)
52 |
53 |
54 | async def aexec(code, event):
55 | exec(f"async def __aexec(event): " + "".join(f"\n {l}" for l in code.split("\n")))
56 | return await locals()["__aexec"](event)
57 |
58 |
59 | CMD_HELP.update(
60 | {
61 | "calculator": ".calc \
62 | \nUse - solves the given maths equation by bodmass rule. "
63 | }
64 | )
65 |
--------------------------------------------------------------------------------
/telebot/plugins/calender.py:
--------------------------------------------------------------------------------
1 | """Malayalam Calendar plugin for Indian Bot
2 | SYNTAX: .calendar YYYY-MM-DD"""
3 | import json
4 | from datetime import datetime
5 |
6 | import requests
7 | from uniborg.util import admin_cmd
8 |
9 | from telebot import CMD_HELP
10 |
11 |
12 | @telebot.on(admin_cmd(pattern="calendar (.*)"))
13 | @telebot.on(sudo_cmd(pattern="calendar (.*)", allow_sudo=True))
14 | async def _(event):
15 | if event.fwd_from:
16 | return
17 | start = datetime.now()
18 | input_str = event.pattern_match.group(1)
19 | input_sgra = input_str.split("-")
20 | if len(input_sgra) == 3:
21 | yyyy = input_sgra[0]
22 | mm = input_sgra[1]
23 | dd = input_sgra[2]
24 | required_url = "https://calendar.kollavarsham.org/api/years/{}/months/{}/days/{}?lang={}".format(
25 | yyyy, mm, dd, "en"
26 | )
27 | headers = {"Accept": "application/json"}
28 | response_content = requests.get(required_url, headers=headers).json()
29 | a = ""
30 | if "error" not in response_content:
31 | current_date_detail_arraays = response_content["months"][0]["days"][0]
32 | a = json.dumps(current_date_detail_arraays, sort_keys=True, indent=4)
33 | else:
34 | a = response_content["error"]
35 | await eor(event, str(a))
36 | else:
37 | await eor(event, "SYNTAX: .calendar YYYY-MM-DD")
38 | end = datetime.now()
39 | (end - start).seconds
40 |
41 |
42 | CMD_HELP.update(
43 | {
44 | "calender": ".calendar \nUse - To get the date in the malayalam calendar."
45 | }
46 | )
47 |
--------------------------------------------------------------------------------
/telebot/plugins/call.py:
--------------------------------------------------------------------------------
1 | """Emoji
2 |
3 | Available Commands:
4 |
5 | .emoji shrug
6 |
7 | .emoji apple
8 |
9 | .emoji :/
10 |
11 | .emoji -_-"""
12 |
13 | import asyncio
14 |
15 | from telebot import CMD_HELP
16 | from telebot.utils import admin_cmd
17 |
18 |
19 | @telebot.on(admin_cmd(pattern=r"(.*)", outgoing=True))
20 | async def _(event):
21 |
22 | if event.fwd_from:
23 |
24 | return
25 |
26 | animation_interval = 3
27 |
28 | animation_ttl = range(0, 18)
29 |
30 | input_str = event.pattern_match.group(1)
31 |
32 | if input_str == "call":
33 |
34 | await event.edit(input_str)
35 |
36 | animation_chars = [
37 | "`Connecting To Telegram Headquarters...`",
38 | "`Call Connected.`",
39 | "`Telegram: Hello This is Telegram HQ. Who is this?`",
40 | "`Me: Yo this is` a TeleBot user ,`Please Connect me to my lil bro, Pavel Durov`",
41 | "`User Authorised.`",
42 | "`Calling Pavel Durov` `At +916969696969`",
43 | "`Private Call Connected...`",
44 | "`Me: Hello Sir, Please Ban This Telegram Account.`",
45 | "`Pavel: May I Know Who Is This?`",
46 | "`Me: Yo Brah, I Am from ` @TeleBotSupport ",
47 | "`Pavel: OMG!!! Long time no see, Wassup Brother...\nI'll Make Sure That Guy Account Will Get Blocked Within 24Hrs.`",
48 | "`Me: Thanks, See You Later Brah.`",
49 | "`Pavel: Please Don't Thank Brah, Telegram Is Our's. Just Gimme A Call When You Become Free.`",
50 | "`Me: Is There Any Issue/Emergency???`",
51 | "`Pavel: Yes Sur, There Is A Bug In Telegram v69.6.9.\nI Am Not Able To Fix It. If Possible, Please Help Fix The Bug.`",
52 | "`Me: Send Me The App On My Telegram Account, I Will Fix The Bug & Send You.`",
53 | "`Pavel: Sure Sur \nTC Bye Bye :)`",
54 | "`Private Call Disconnected.`",
55 | ]
56 |
57 | for i in animation_ttl:
58 |
59 | await asyncio.sleep(animation_interval)
60 |
61 | await event.edit(animation_chars[i % 18])
62 |
63 |
64 | CMD_HELP.update({"call": ".call\nUse - Animation Plugin, to make a fake call."})
65 |
--------------------------------------------------------------------------------
/telebot/plugins/chain.py:
--------------------------------------------------------------------------------
1 | # This Source Code Form is subject to the terms of the Mozilla Public
2 | # License, v. 2.0. If a copy of the MPL was not distributed with this
3 | # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 |
5 | from telethon.tl.functions.messages import SaveDraftRequest
6 |
7 | from telebot import CMD_HELP
8 | from telebot.utils import admin_cmd
9 |
10 |
11 | @telebot.on(admin_cmd(pattern="chain"))
12 | @telebot.on(sudo_cmd(pattern="chain", allow_sudo=True))
13 | async def _(event):
14 | await eor(event, "Counting...")
15 | count = -1
16 | message = event.message
17 | while message:
18 | reply = await message.get_reply_message()
19 | if reply is None:
20 | await borg(
21 | SaveDraftRequest(
22 | await event.get_input_chat(), "", reply_to_msg_id=message.id
23 | )
24 | )
25 | message = reply
26 | count += 1
27 | await eor(event, f"Chain length: {count}")
28 |
29 |
30 | CMD_HELP.update(
31 | {
32 | "chain": ".chain\nUse- Find the total number of replies to a message and it's origin."
33 | }
34 | )
35 |
--------------------------------------------------------------------------------
/telebot/plugins/command_list.py:
--------------------------------------------------------------------------------
1 | # Join @TeleBotHelp for custom plugins
2 |
3 | import asyncio
4 |
5 | import requests
6 |
7 | from telebot import CMD_HELP
8 |
9 |
10 | @telebot.on(admin_cmd(pattern="cmds", outgoing=True))
11 | @telebot.on(sudo_cmd(pattern="cmds", allow_sudo=True))
12 | async def install(event):
13 | if event.fwd_from:
14 | return
15 | tele = await eor(event, "`Searching for all plugins...`")
16 | cmd = "ls telebot/plugins"
17 | process = await asyncio.create_subprocess_shell(
18 | cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
19 | )
20 | stdout, stderr = await process.communicate()
21 | o = stdout.decode()
22 | _o = o.split("\n")
23 | o = "\n".join(_o)
24 | OUTPUT = (
25 | OUTPUT
26 | ) = f"Here is the list of plugins found in 'master' branch of TeleBot.\n{o}\n\nUse .help to learn how a paticular plugin works.\nConsider joining @TeleBotSupport for help!"
27 | await tele.edit("`Plugins extracted, pasting it...`")
28 | message = OUTPUT
29 | url = "https://del.dog/documents"
30 | r = requests.post(url, data=message.encode("UTF-8")).json()
31 | url = f"https://del.dog/{r['key']}"
32 | await tele.edit(
33 | f"`All plugins available in` **TeleBot** `can be found` [here]({url})!!"
34 | )
35 |
36 |
37 | CMD_HELP.update(
38 | {"command_list": ".cmds\nUse - Get the list of all plugins in the bot."}
39 | )
40 |
--------------------------------------------------------------------------------
/telebot/plugins/congratulations.py:
--------------------------------------------------------------------------------
1 | import random
2 |
3 | from telebot import CMD_HELP
4 |
5 | RUNSREACTS = [
6 | "`Congratulations and BRAVO!`",
7 | "`You did it! So proud of you!`",
8 | "`This calls for celebrating! Congratulations!`",
9 | "`I knew it was only a matter of time. Well done!`",
10 | "`Congratulations on your well-deserved success.`",
11 | "`Heartfelt congratulations to you.`",
12 | "`Warmest congratulations on your achievement.`",
13 | "`Congratulations and best wishes for your next adventure!”`",
14 | "`So pleased to see you accomplishing great things.`",
15 | "`Feeling so much joy for you today. What an impressive achievement!`",
16 | ]
17 |
18 |
19 | @telebot.on(admin_cmd(pattern="congo"))
20 | @telebot.on(sudo_cmd(pattern="congo", allow_sudo=True))
21 | async def _(event):
22 | if event.fwd_from:
23 | return
24 | bro = random.randint(0, len(RUNSREACTS) - 1)
25 | reply_text = RUNSREACTS[bro]
26 | await eor(event, reply_text)
27 |
28 |
29 | CMD_HELP.update({"congratulations": ".congo\nUse - Congratulate a person."})
30 |
--------------------------------------------------------------------------------
/telebot/plugins/coronavirus.py:
--------------------------------------------------------------------------------
1 | """CoronaVirus LookUp
2 | Syntax: .coronavirus """
3 | from covid import Covid
4 |
5 | from telebot import CMD_HELP
6 |
7 |
8 | @telebot.on(admin_cmd(pattern="coronavirus (.*)"))
9 | @telebot.on(sudo_cmd(pattern="coronavirus (.*)", allow_sudo=True))
10 | async def _(event):
11 | covid = Covid()
12 | data = covid.get_data()
13 | country = event.pattern_match.group(1)
14 | country_data = get_country_data(country, data)
15 | output_text = ""
16 | for name, value in country_data.items():
17 | output_text += "`{}`: `{}`\n".format(str(name), str(value))
18 | await eor(
19 | event,
20 | "**CoronaVirus Info in {}**:\n\n{}".format(country.capitalize(), output_text),
21 | )
22 |
23 |
24 | def get_country_data(country, world):
25 | for country_data in world:
26 | if country_data["country"].lower() == country.lower():
27 | return country_data
28 | return {"Status": "No information yet about this country!"}
29 |
30 |
31 | CMD_HELP.update(
32 | {
33 | "coronavirus": ".coronavirus \nUse - Get covid status of that country"
34 | }
35 | )
36 |
--------------------------------------------------------------------------------
/telebot/plugins/dagd.py:
--------------------------------------------------------------------------------
1 | """DA.GD helpers in @UniBorg
2 | Available Commands:
3 | .isup URL
4 | .dns google.com
5 | .url
6 | .unshort """
7 | import requests
8 |
9 | from telebot import CMD_HELP
10 | from telebot.utils import admin_cmd
11 |
12 |
13 | @telebot.on(admin_cmd(pattern="dns (.*)"))
14 | @telebot.on(sudo_cmd(pattern="dns (.*)", allow_sudo=True))
15 | async def _(event):
16 | if event.fwd_from:
17 | return
18 | input_str = event.pattern_match.group(1)
19 | sample_url = "https://da.gd/dns/{}".format(input_str)
20 | response_api = requests.get(sample_url).text
21 | if response_api:
22 | await eor(event, "DNS records of {} are \n{}".format(input_str, response_api))
23 | else:
24 | await eor(event, "i can't seem to find {} on the internet".format(input_str))
25 |
26 |
27 | @telebot.on(admin_cmd(pattern="url (.*)"))
28 | @telebot.on(sudo_cmd(pattern="url (.*)", allow_sudo=True))
29 | async def _(event):
30 | if event.fwd_from:
31 | return
32 | input_str = event.pattern_match.group(1)
33 | sample_url = "https://da.gd/s?url={}".format(input_str)
34 | response_api = requests.get(sample_url).text
35 | if response_api:
36 | await eor(event, "Generated {} for {}.".format(response_api, input_str))
37 | else:
38 | await eor(event, "something is wrong. please try again later.")
39 |
40 |
41 | @telebot.on(admin_cmd(pattern="unshort (.*)"))
42 | @telebot.on(sudo_cmd(pattern="unshort (.*)", allow_sudo=True))
43 | async def _(event):
44 | if event.fwd_from:
45 | return
46 | input_str = event.pattern_match.group(1)
47 | if not input_str.startswith("http"):
48 | input_str = "http://" + input_str
49 | r = requests.get(input_str, allow_redirects=False)
50 | if str(r.status_code).startswith("3"):
51 | await eor(
52 | event,
53 | "Input URL: {}\nReDirected URL: {}".format(
54 | input_str, r.headers["Location"]
55 | ),
56 | )
57 | else:
58 | await eor(
59 | event,
60 | "Input URL {} returned status_code {}".format(input_str, r.status_code),
61 | )
62 |
63 |
64 | CMD_HELP.update(
65 | {
66 | "dagd": ".dns\nUse - Find DNS records.\
67 | \n\n.url \nUse - Shorten the link via da.gd\
68 | \n\n.unshort \nUse - UnShorten the URL."
69 | }
70 | )
71 |
--------------------------------------------------------------------------------
/telebot/plugins/design.py:
--------------------------------------------------------------------------------
1 | """.admin Plugin for @UniBorg"""
2 | from telethon.tl.types import ChannelParticipantsAdmins
3 |
4 | from telebot import CMD_HELP
5 | from telebot.utils import admin_cmd
6 |
7 |
8 | @telebot.on(admin_cmd(pattern="join"))
9 | async def _(event):
10 | if event.fwd_from:
11 | return
12 | mentions = "`━━━━━┓ \n┓┓┓┓┓┃\n┓┓┓┓┓┃ ヽ○ノ ⇦ Me When You Joined \n┓┓┓┓┓┃. / \n┓┓┓┓┓┃ ノ) \n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃`"
13 | chat = await event.get_input_chat()
14 | async for x in borg.iter_participants(chat, filter=ChannelParticipantsAdmins):
15 | mentions += f""
16 | reply_message = None
17 | if event.reply_to_msg_id:
18 | reply_message = await event.get_reply_message()
19 | await reply_message.reply(mentions)
20 | else:
21 | await event.reply(mentions)
22 | await event.delete()
23 |
24 |
25 | @telebot.on(admin_cmd(pattern="pay"))
26 | async def _(event):
27 | if event.fwd_from:
28 | return
29 | mentions = "`█▀▀▀▀▀█░▀▀░░░█░░░░█▀▀▀▀▀█\n█░███░█░█▄░█▀▀░▄▄░█░███░█\n█░▀▀▀░█░▀█▀▀▄▀█▀▀░█░▀▀▀░█\n▀▀▀▀▀▀▀░▀▄▀▄▀▄█▄▀░▀▀▀▀▀▀▀\n█▀█▀▄▄▀░█▄░░░▀▀░▄█░▄▀█▀░▀\n░█▄▀░▄▀▀░░░▄▄▄█░▀▄▄▄▀▄▄▀▄\n░░▀█░▀▀▀▀▀▄█░▄░████ ██▀█▄\n▄▀█░░▄▀█▀█▀░█▄▀░▀█▄██▀░█▄\n░░▀▀▀░▀░█▄▀▀▄▄░▄█▀▀▀█░█▀▀\n█▀▀▀▀▀█░░██▀█░░▄█░▀░█▄░██\n█░███░█░▄▀█▀██▄▄▀▀█▀█▄░▄▄\n█░▀▀▀░█░█░░▀▀▀░█░▀▀▀▀▄█▀░\n▀▀▀▀▀▀▀░▀▀░░▀░▀░░░▀▀░▀▀▀▀`"
30 | chat = await event.get_input_chat()
31 | async for x in borg.iter_participants(chat, filter=ChannelParticipantsAdmins):
32 | mentions += f""
33 | reply_message = None
34 | if event.reply_to_msg_id:
35 | reply_message = await event.get_reply_message()
36 | await reply_message.reply(mentions)
37 | else:
38 | await event.reply(mentions)
39 | await event.delete()
40 |
41 |
42 | CMD_HELP.update({"design": "Random codes.\nCommands - .join\n.pay"})
43 |
--------------------------------------------------------------------------------
/telebot/plugins/dictionary.py:
--------------------------------------------------------------------------------
1 | """Dictionary Plugin for @UniBorg
2 | Syntax: .meaning """
3 |
4 | import requests
5 | from uniborg.util import admin_cmd
6 |
7 | from telebot import CMD_HELP
8 |
9 |
10 | @telebot.on(admin_cmd(pattern="meaning (.*)"))
11 | @telebot.on(sudo_cmd(pattern="meaning (.*)", allow_sudo=True))
12 | async def _(event):
13 | if event.fwd_from:
14 | return
15 | input_str = event.pattern_match.group(1)
16 | input_url = "https://bots.shrimadhavuk.me/dictionary/?s={}".format(input_str)
17 | headers = {"USER-AGENT": "UniBorg"}
18 | caption_str = f"Meaning of __{input_str}__\n"
19 | try:
20 | response = requests.get(input_url, headers=headers).json()
21 | pronounciation = response.get("p")
22 | meaning_dict = response.get("lwo")
23 | for current_meaning in meaning_dict:
24 | current_meaning_type = current_meaning.get("type")
25 | current_meaning_definition = current_meaning.get("definition")
26 | caption_str += (
27 | f"**{current_meaning_type}**: {current_meaning_definition}\n\n"
28 | )
29 | except Exception as e:
30 | caption_str = str(e)
31 | reply_msg_id = event.message.id
32 | if event.reply_to_msg_id:
33 | reply_msg_id = event.reply_to_msg_id
34 | try:
35 | await borg.send_file(
36 | event.chat_id,
37 | pronounciation,
38 | caption=f"Pronounciation of __{input_str}__",
39 | force_document=False,
40 | reply_to=reply_msg_id,
41 | allow_cache=True,
42 | voice_note=True,
43 | silent=True,
44 | supports_streaming=True,
45 | )
46 | except BaseException:
47 | pass
48 | await eor(event, caption_str)
49 |
50 |
51 | CMD_HELP.update({"dictionary": ".meaning \nUse - Get the meaning of that word."})
52 |
--------------------------------------------------------------------------------
/telebot/plugins/ding.py:
--------------------------------------------------------------------------------
1 | """Emoji
2 |
3 | Available Commands:
4 |
5 | .ding"""
6 |
7 |
8 | import asyncio
9 |
10 | from telebot import CMD_HELP
11 | from telebot.utils import admin_cmd
12 |
13 |
14 | @telebot.on(admin_cmd(pattern=r"(.*)", outgoing=True))
15 | async def _(event):
16 |
17 | if event.fwd_from:
18 |
19 | return
20 |
21 | animation_interval = 0.3
22 |
23 | animation_ttl = range(0, 10)
24 |
25 | input_str = event.pattern_match.group(1)
26 |
27 | if input_str == "ding":
28 |
29 | await event.edit(input_str)
30 |
31 | animation_chars = [
32 | "🔴⬛⬛⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜",
33 | "⬜⬜⬛⬜⬜\n⬜⬛⬜⬜⬜\n🔴⬜⬜⬜⬜",
34 | "⬜⬜⬛⬜⬜\n⬜⬜⬛⬜⬜\n⬜⬜🔴⬜⬜",
35 | "⬜⬜⬛⬜⬜\n⬜⬜⬜⬛⬜\n⬜⬜⬜⬜🔴",
36 | "⬜⬜⬛⬛🔴\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜",
37 | "⬜⬜⬛⬜⬜\n⬜⬜⬜⬛⬜\n⬜⬜⬜⬜🔴",
38 | "⬜⬜⬛⬜⬜\n⬜⬜⬛⬜⬜\n⬜⬜🔴⬜⬜",
39 | "⬜⬜⬛⬜⬜\n⬜⬛⬜⬜⬜\n🔴⬜⬜⬜⬜",
40 | "🔴⬛⬛⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜",
41 | "⬜⬜⬜⬜⬜\n⬜ [BECOME A PERU](https://github.com/Xditya/TeleBot/) ⬜\n⬜⬜⬜⬜⬜",
42 | ]
43 |
44 | for i in animation_ttl:
45 |
46 | await asyncio.sleep(animation_interval)
47 |
48 | await event.edit(animation_chars[i % 10])
49 |
50 |
51 | CMD_HELP.update({"ding": ".ding\nUse - Nothing."})
52 |
--------------------------------------------------------------------------------
/telebot/plugins/dumpster.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 |
3 | from telebot import CMD_HELP
4 | from telebot.utils import admin_cmd
5 |
6 |
7 | @telebot.on(admin_cmd(pattern="dump ?(.*)"))
8 | async def _(message):
9 | try:
10 | obj = message.pattern_match.group(1)
11 | if len(obj) != 3:
12 | raise IndexError
13 | inp = " ".join(obj)
14 | except IndexError:
15 | inp = "🥞 🎂 🍫"
16 | u, t, g, o, s, n = inp.split(), "🗑", "<(^_^ <)", "(> ^_^)>", "⠀ ", "\n"
17 | h = [(u[0], u[1], u[2]), (u[0], u[1], ""), (u[0], "", "")]
18 | for something in reversed(
19 | [
20 | y
21 | for y in (
22 | [
23 | "".join(x)
24 | for x in (
25 | f + (s, g, s + s * f.count(""), t),
26 | f + (g, s * 2 + s * f.count(""), t),
27 | f[:i] + (o, f[i], s * 2 + s * f.count(""), t),
28 | f[:i] + (s + s * f.count(""), o, f[i], s, t),
29 | f[:i] + (s * 2 + s * f.count(""), o, f[i], t),
30 | f[:i] + (s * 3 + s * f.count(""), o, t),
31 | f[:i] + (s * 3 + s * f.count(""), g, t),
32 | )
33 | ]
34 | for i, f in enumerate(reversed(h))
35 | )
36 | ]
37 | ):
38 | for something_else in something:
39 | await asyncio.sleep(0.3)
40 | try:
41 | await message.edit(something_else)
42 | except errors.MessageIdInvalidError:
43 | return
44 |
45 |
46 | CMD_HELP.update({"dumpster": ".dump\nUse - useless."})
47 |
--------------------------------------------------------------------------------
/telebot/plugins/earth.py:
--------------------------------------------------------------------------------
1 | # (c) @UniBorg
2 | # Original written by @UniBorg edit by @I_m_Rock
3 |
4 | import asyncio
5 | from collections import deque
6 |
7 | from telebot import CMD_HELP
8 | from telebot.utils import admin_cmd
9 |
10 |
11 | @telebot.on(admin_cmd(pattern=r"earth", outgoing=True))
12 | async def _(event):
13 | if event.fwd_from:
14 | return
15 | deq = deque(list("🌏🌍🌎🌎🌍🌏🌍🌎"))
16 | for _ in range(48):
17 | await asyncio.sleep(0.1)
18 | await event.edit("".join(deq))
19 | deq.rotate(1)
20 |
21 |
22 | CMD_HELP.update({"earth": ".earth\nUse - useless."})
23 |
--------------------------------------------------------------------------------
/telebot/plugins/echo.py:
--------------------------------------------------------------------------------
1 | # TeleBot - UserBot
2 | # Copyright (C) 2020 TeleBot
3 |
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU Affero General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 |
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Affero General Public License for more details.
13 |
14 | # You should have received a copy of the GNU Affero General Public License
15 | # along with this program. If not, see .
16 |
17 | """
18 | Echoes the message via your bot
19 | """
20 |
21 | from telebot import CMD_HELP
22 |
23 |
24 | @telebot.on(admin_cmd(pattern=r"echo (.*)"))
25 | @telebot.on(sudo_cmd(pattern=r"echo ( .*)", allow_sudo=True))
26 | async def _(event):
27 | bxt = Var.TG_BOT_USER_NAME_BF_HER
28 | try:
29 | tex = str(event.text[6:])
30 | await tgbot.send_message(event.chat_id, tex)
31 | await event.delete()
32 | except BaseException:
33 | await event.client.send_message(event.chat_id, f"Please add @{bxt} here first!")
34 | await event.delete()
35 |
36 |
37 | CMD_HELP.update(
38 | {
39 | "echo": ".echo \nUse - Echoes the message you send via your bot. You must add it to this chat first, ofc."
40 | }
41 | )
42 |
--------------------------------------------------------------------------------
/telebot/plugins/emojigames.py:
--------------------------------------------------------------------------------
1 | # fix by @heyworld for OUB
2 | # bug fixed by @d3athwarrior
3 |
4 | from telethon.tl.types import InputMediaDice
5 |
6 | from telebot import CMD_HELP
7 | from telebot.utils import admin_cmd
8 |
9 |
10 | @telebot.on(admin_cmd(outgoing=True, pattern="dice(?: |$)(.*)"))
11 | async def _(event):
12 | if event.fwd_from:
13 | return
14 | input_str = event.pattern_match.group(1)
15 | await event.delete()
16 | r = await event.reply(file=InputMediaDice(""))
17 | if input_str:
18 | try:
19 | required_number = int(input_str)
20 | while not r.media.value == required_number:
21 | await r.delete()
22 | r = await event.reply(file=InputMediaDice(""))
23 | except BaseException:
24 | pass
25 |
26 |
27 | @telebot.on(admin_cmd(outgoing=True, pattern="dart(?: |$)(.*)"))
28 | async def _(event):
29 | if event.fwd_from:
30 | return
31 | input_str = event.pattern_match.group(1)
32 | await event.delete()
33 | r = await event.reply(file=InputMediaDice("🎯"))
34 | if input_str:
35 | try:
36 | required_number = int(input_str)
37 | while not r.media.value == required_number:
38 | await r.delete()
39 | r = await event.reply(file=InputMediaDice("🎯"))
40 | except BaseException:
41 | pass
42 |
43 |
44 | @telebot.on(admin_cmd(outgoing=True, pattern="bb(?: |$)(.*)"))
45 | async def _(event):
46 | if event.fwd_from:
47 | return
48 | input_str = event.pattern_match.group(1)
49 | await event.delete()
50 | r = await event.reply(file=InputMediaDice("🏀"))
51 | if input_str:
52 | try:
53 | required_number = int(input_str)
54 | while not r.media.value == required_number:
55 | await r.delete()
56 | r = await event.reply(file=InputMediaDice("🏀"))
57 | except BaseException:
58 | pass
59 |
60 |
61 | CMD_HELP.update(
62 | {
63 | "emojigames": "`.dice` 1-6 or `.dart`1-6 or `.bb`1-5\
64 | \nUsage: hahaha just a magic.\nWarning:`Don't use any other values or bot will crash`"
65 | }
66 | )
67 |
--------------------------------------------------------------------------------
/telebot/plugins/eval.py:
--------------------------------------------------------------------------------
1 | """Evaluate Python Code inside Telegram
2 | Syntax: .eval PythonCode"""
3 | import io
4 | import sys
5 | import traceback
6 |
7 | from telebot import CMD_HELP
8 |
9 |
10 | @telebot.on(admin_cmd(pattern="eval"))
11 | async def _(event):
12 | if event.fwd_from:
13 | return
14 | await event.edit("Processing ...")
15 | cmd = event.text.split(" ", maxsplit=1)[1]
16 | reply_to_id = event.message.id
17 | if event.reply_to_msg_id:
18 | reply_to_id = event.reply_to_msg_id
19 |
20 | old_stderr = sys.stderr
21 | old_stdout = sys.stdout
22 | redirected_output = sys.stdout = io.StringIO()
23 | redirected_error = sys.stderr = io.StringIO()
24 | stdout, stderr, exc = None, None, None
25 |
26 | try:
27 | await aexec(cmd, event)
28 | except Exception:
29 | exc = traceback.format_exc()
30 |
31 | stdout = redirected_output.getvalue()
32 | stderr = redirected_error.getvalue()
33 | sys.stdout = old_stdout
34 | sys.stderr = old_stderr
35 |
36 | evaluation = ""
37 | if exc:
38 | evaluation = exc
39 | elif stderr:
40 | evaluation = stderr
41 | elif stdout:
42 | evaluation = stdout
43 | else:
44 | evaluation = "Success"
45 |
46 | final_output = "__►__ **EVAL**\n`{}` \n\n __►__ **OUTPUT**: \n`{}` \n".format(
47 | cmd, evaluation
48 | )
49 |
50 | if len(final_output) > Config.MAX_MESSAGE_SIZE_LIMIT:
51 | with io.BytesIO(str.encode(final_output)) as out_file:
52 | out_file.name = "eval.text"
53 | await borg.send_file(
54 | event.chat_id,
55 | out_file,
56 | force_document=True,
57 | allow_cache=False,
58 | caption=cmd,
59 | reply_to=reply_to_id,
60 | )
61 | await event.delete()
62 | else:
63 | await event.edit(final_output)
64 |
65 |
66 | async def aexec(code, event):
67 | exec(f"async def __aexec(event): " + "".join(f"\n {l}" for l in code.split("\n")))
68 | return await locals()["__aexec"](event)
69 |
70 |
71 | CMD_HELP.update({"eval": ".eval \nUse - Evalualte that code."})
72 |
--------------------------------------------------------------------------------
/telebot/plugins/exec.py:
--------------------------------------------------------------------------------
1 | import io
2 | import sys
3 | import traceback
4 |
5 | from telebot import CMD_HELP
6 |
7 |
8 | @telebot.on(admin_cmd(pattern="exec"))
9 | @telebot.on(sudo_cmd(pattern="exec", allow_sudo=True))
10 | async def _(event):
11 | if event.fwd_from:
12 | return
13 | await eor(event, "Processing ...")
14 | cmd = event.text.split(" ", maxsplit=1)[1]
15 | reply_to_id = event.message.id
16 | if event.reply_to_msg_id:
17 | reply_to_id = event.reply_to_msg_id
18 |
19 | old_stderr = sys.stderr
20 | old_stdout = sys.stdout
21 | redirected_output = sys.stdout = io.StringIO()
22 | redirected_error = sys.stderr = io.StringIO()
23 | stdout, stderr, exc = None, None, None
24 |
25 | try:
26 | await aexec(cmd, event)
27 | except Exception:
28 | exc = traceback.format_exc()
29 |
30 | stdout = redirected_output.getvalue()
31 | stderr = redirected_error.getvalue()
32 | sys.stdout = old_stdout
33 | sys.stderr = old_stderr
34 |
35 | evaluation = ""
36 | if exc:
37 | evaluation = exc
38 | elif stderr:
39 | evaluation = stderr
40 | elif stdout:
41 | evaluation = stdout
42 | else:
43 | evaluation = "Success"
44 |
45 | final_output = "**EXEC**: `{}` \n\n **OUTPUT**: \n`{}` \n".format(cmd, evaluation)
46 |
47 | if len(final_output) > 4096:
48 | with io.BytesIO(str.encode(final_output)) as out_file:
49 | out_file.name = "eval.text"
50 | await bot.send_file(
51 | event.chat_id,
52 | out_file,
53 | force_document=True,
54 | allow_cache=False,
55 | caption=f"**PROCCESSED**: `{cmd}`",
56 | reply_to=reply_to_id,
57 | )
58 | await event.delete()
59 | else:
60 | await eor(event, final_output)
61 |
62 |
63 | async def aexec(code, event):
64 | exec(f"async def __aexec(event): " + "".join(f"\n {l}" for l in code.split("\n")))
65 | return await locals()["__aexec"](event)
66 |
67 |
68 | CMD_HELP.update({"exec": ".exec \nUse - Execute the code."})
69 |
--------------------------------------------------------------------------------
/telebot/plugins/figlet.py:
--------------------------------------------------------------------------------
1 | import pyfiglet
2 |
3 | from telebot import CMD_HELP
4 | from telebot.utils import admin_cmd
5 |
6 |
7 | @telebot.on(admin_cmd(pattern="figlet ?(.*)", outgoing=True))
8 | @telebot.on(sudo_cmd(pattern="figlet ?(.*)", allow_sudo=True))
9 | async def figlet(event):
10 | if event.fwd_from:
11 | return
12 | CMD_FIG = {
13 | "slant": "slant",
14 | "3D": "3-d",
15 | "5line": "5lineoblique",
16 | "alpha": "alphabet",
17 | "banner": "banner3-D",
18 | "doh": "doh",
19 | "iso": "isometric1",
20 | "letter": "letters",
21 | "allig": "alligator",
22 | "dotm": "dotmatrix",
23 | "bubble": "bubble",
24 | "bulb": "bulbhead",
25 | "digi": "digital",
26 | }
27 | input_str = event.pattern_match.group(1)
28 | if "|" in input_str:
29 | text, cmd = input_str.split("|", maxsplit=1)
30 | elif input_str is not None:
31 | cmd = None
32 | text = input_str
33 | else:
34 | await eor(event, "Please add some text to figlet")
35 | return
36 | if cmd is not None:
37 | try:
38 | font = CMD_FIG[cmd]
39 | except KeyError:
40 | await eor(event, "Invalid selected font.")
41 | return
42 | result = pyfiglet.figlet_format(text, font=font)
43 | else:
44 | result = pyfiglet.figlet_format(text)
45 | await event.respond("`{}`".format(result))
46 | await event.delete()
47 |
48 |
49 | CMD_HELP.update({"figlet": ".figlet \nUse - Try it yourself."})
50 |
--------------------------------------------------------------------------------
/telebot/plugins/fileext.py:
--------------------------------------------------------------------------------
1 | """Get info about a File Extension
2 | Syntax: .filext EXTENSION"""
3 | import requests
4 | from bs4 import BeautifulSoup
5 | from uniborg.util import admin_cmd
6 |
7 | from telebot import CMD_HELP
8 |
9 |
10 | @telebot.on(admin_cmd(pattern="filext (.*)"))
11 | @telebot.on(admin_cmd(pattern="filext (.*)", allow_sudo=True))
12 | async def _(event):
13 | if event.fwd_from:
14 | return
15 | await eor(event, "Processing ...")
16 | sample_url = "https://www.fileext.com/file-extension/{}.html"
17 | input_str = event.pattern_match.group(1).lower()
18 | response_api = requests.get(sample_url.format(input_str))
19 | status_code = response_api.status_code
20 | if status_code == 200:
21 | raw_html = response_api.content
22 | soup = BeautifulSoup(raw_html, "html.parser")
23 | ext_details = soup.find_all("td", {"colspan": "3"})[-1].text
24 | await eor(
25 | event,
26 | "**File Extension**: `{}`\n**Description**: `{}`".format(
27 | input_str, ext_details
28 | ),
29 | )
30 | else:
31 | await eor(
32 | event,
33 | "https://www.fileext.com/ responded with {} for query: {}".format(
34 | status_code, input_str
35 | ),
36 | )
37 |
38 |
39 | CMD_HELP.update(
40 | {"fileext": ".fileext \nUse - Get info on that file extension."}
41 | )
42 |
--------------------------------------------------------------------------------
/telebot/plugins/fleaveme.py:
--------------------------------------------------------------------------------
1 | # Credit: @r4v4n4
2 | """Emoji
3 |
4 | Available Commands:
5 |
6 | .fleave"""
7 |
8 | import asyncio
9 |
10 | from telebot import CMD_HELP
11 | from telebot.utils import admin_cmd
12 |
13 |
14 | @telebot.on(admin_cmd(pattern=r"(.*)", outgoing=True))
15 | async def _(event):
16 |
17 | if event.fwd_from:
18 |
19 | return
20 |
21 | animation_interval = 1
22 |
23 | animation_ttl = range(0, 17)
24 |
25 | input_str = event.pattern_match.group(1)
26 |
27 | if input_str == "fleave":
28 |
29 | await event.edit(input_str)
30 |
31 | animation_chars = [
32 | "⬛⬛⬛\n⬛⬛⬛\n⬛⬛⬛",
33 | "⬛⬛⬛\n⬛🔄⬛\n⬛⬛⬛",
34 | "⬛⬆️⬛\n⬛🔄⬛\n⬛⬛⬛",
35 | "⬛⬆️↗️\n⬛🔄⬛\n⬛⬛⬛",
36 | "⬛⬆️↗️\n⬛🔄➡️\n⬛⬛⬛",
37 | "⬛⬆️↗️\n⬛🔄➡️\n⬛⬛↘️",
38 | "⬛⬆️↗️\n⬛🔄➡️\n⬛⬇️↘️",
39 | "⬛⬆️↗️\n⬛🔄➡️\n↙️⬇️↘️",
40 | "⬛⬆️↗️\n⬅️🔄➡️\n↙️⬇️↘️",
41 | "↖️⬆️↗️\n⬅️🔄➡️\n↙️⬇️↘️",
42 | "**Chat Message Exported To** `./Inpu/`",
43 | "**Chat Message Exported To** `./Inpu/homework/`",
44 | "**Chat Message Exported To** `./Inpu/homework/groupchat.txt`",
45 | "__Legend is leaving this chat.....!..__",
46 | "__Legend is leaving this chat.....!..__",
47 | ]
48 |
49 | for i in animation_ttl:
50 |
51 | await asyncio.sleep(animation_interval)
52 |
53 | await event.edit(animation_chars[i % 17])
54 |
55 |
56 | CMD_HELP.update({"fleaveme": ".fleave\nUse - useless/leave the chat."})
57 |
--------------------------------------------------------------------------------
/telebot/plugins/fpost.py:
--------------------------------------------------------------------------------
1 | # This Source Code Form is subject to the terms of the Mozilla Public
2 | # License, v. 2.0. If a copy of the MPL was not distributed with this
3 | # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 | """ Command: .fpost word
5 |
6 | credit: @r4v4n4"""
7 |
8 | import string
9 |
10 | from telebot.utils import admin_cmd
11 |
12 | msg_cache = {}
13 |
14 |
15 | @telebot.on(admin_cmd(pattern=r"fpost\s+(.*)", outgoing=True))
16 | @telebot.on(sudo_cmd(pattern=r"fpost\s+(.*)", allow_sudo=True))
17 | async def _(event):
18 | await event.delete()
19 | text = event.pattern_match.group(1)
20 | destination = await event.get_input_chat()
21 |
22 | for c in text.lower():
23 | if c not in string.ascii_lowercase:
24 | continue
25 | if c not in msg_cache:
26 | async for msg in borg.iter_messages(None, search=c):
27 | if msg.raw_text.lower() == c and msg.media is None:
28 | msg_cache[c] = msg
29 | break
30 | await borg.forward_messages(destination, msg_cache[c])
31 |
--------------------------------------------------------------------------------
/telebot/plugins/frybot.py:
--------------------------------------------------------------------------------
1 | # credits: @r4v4n4
2 | from telethon import events
3 | from telethon.errors.rpcerrorlist import YouBlockedUserError
4 |
5 | from telebot import CMD_HELP
6 | from telebot.utils import admin_cmd
7 |
8 |
9 | @telebot.on(admin_cmd(pattern="frybot ?(.*)"))
10 | @telebot.on(sudo_cmd(pattern="frybot ?(.*)", allow_sudo=True))
11 | async def _(event):
12 | if event.fwd_from:
13 | return
14 | if not event.reply_to_msg_id:
15 | await eor(event, "```Reply to any user message.```")
16 | return
17 | reply_message = await event.get_reply_message()
18 | if not reply_message.media:
19 | await eor(event, "```reply to text message```")
20 | return
21 | chat = "@image_deepfrybot"
22 | reply_message.sender
23 | if reply_message.sender.bot:
24 | await eor(event, "```Reply to actual users message.```")
25 | return
26 | await eor(event, "```Processing```")
27 | async with borg.conversation(chat) as conv:
28 | try:
29 | response = conv.wait_event(
30 | events.NewMessage(incoming=True, from_users=432858024)
31 | )
32 | await borg.forward_messages(chat, reply_message)
33 | response = await response
34 | except YouBlockedUserError:
35 | await event.reply("```Please unblock @sangmatainfo_bot and try again```")
36 | return
37 | if response.text.startswith("Forward"):
38 | await eor(
39 | event,
40 | "```can you kindly disable your forward privacy settings for good?```",
41 | )
42 | else:
43 | await borg.send_file(event.chat_id, response.message.media)
44 |
45 |
46 | CMD_HELP.update({"frybot": ".frybot \nUse - Fry the pic xD"})
47 |
--------------------------------------------------------------------------------
/telebot/plugins/fuck.py:
--------------------------------------------------------------------------------
1 | """
2 |
3 | Available Commands:
4 |
5 | .sux
6 |
7 | .fuk
8 |
9 | .kiss"""
10 |
11 |
12 | import asyncio
13 |
14 | from telebot import CMD_HELP
15 | from telebot.utils import admin_cmd
16 |
17 |
18 | @telebot.on(admin_cmd(pattern=r"\.(.*)", outgoing=True))
19 | async def _(event):
20 |
21 | if event.fwd_from:
22 |
23 | return
24 |
25 | animation_interval = 0.1
26 |
27 | animation_ttl = range(0, 101)
28 |
29 | input_str = event.pattern_match.group(1)
30 |
31 | if input_str == "fuk":
32 |
33 | await event.edit(input_str)
34 |
35 | animation_chars = ["👉 ✊️", "👉 ✊️", "👉 ✊️", "👉✊️💦"]
36 |
37 | for i in animation_ttl:
38 |
39 | await asyncio.sleep(animation_interval)
40 |
41 | await event.edit(animation_chars[i % 4])
42 |
43 |
44 | @telebot.on(admin_cmd(pattern=r"(.*)", outgoing=True))
45 | async def _(event):
46 |
47 | if event.fwd_from:
48 |
49 | return
50 |
51 | animation_interval = 0.2
52 |
53 | animation_ttl = range(0, 101)
54 |
55 | input_str = event.pattern_match.group(1)
56 |
57 | if input_str == "sux":
58 |
59 | await event.edit(input_str)
60 |
61 | animation_chars = ["🤵 👰", "🤵 👰", "🤵 👰", "🤵👼👰"]
62 |
63 | for i in animation_ttl:
64 |
65 | await asyncio.sleep(animation_interval)
66 |
67 | await event.edit(animation_chars[i % 4])
68 |
69 |
70 | ""
71 |
72 |
73 | @telebot.on(admin_cmd(pattern=r"(.*)", outgoing=True))
74 | async def _(event):
75 |
76 | if event.fwd_from:
77 |
78 | return
79 |
80 | animation_interval = 0.2
81 |
82 | animation_ttl = range(0, 101)
83 |
84 | input_str = event.pattern_match.group(1)
85 |
86 | if input_str == "kiss":
87 |
88 | await event.edit(input_str)
89 |
90 | animation_chars = ["🤵 👰", "🤵 👰", "🤵 👰", "🤵💋👰"]
91 |
92 | for i in animation_ttl:
93 |
94 | await asyncio.sleep(animation_interval)
95 |
96 | await event.edit(animation_chars[i % 4])
97 |
98 |
99 | CMD_HELP.update({"fuck": "Nothing to say.\n.fuk\n.sux\n.kiss"})
100 |
--------------------------------------------------------------------------------
/telebot/plugins/gaali.py:
--------------------------------------------------------------------------------
1 | from telethon.tl.types import ChannelParticipantsAdmins
2 | from uniborg.util import admin_cmd
3 |
4 | from telebot import CMD_HELP
5 |
6 |
7 | @telebot.on(admin_cmd(pattern="gaali"))
8 | async def _(event):
9 | if event.fwd_from:
10 | return
11 | mentions = "Madarchod Randi ke bacche Oye bosdike madarchod bhen ke lode tere gand me lohe ka danda garam karke dalu randwe tujhetho gali ke kutte gand pe chut rakh ke katenge me bata raha hu tere lode pe madhu makkhi Katelode ke ando pe Road roller chale tu kab bathroom me muthne Jaye tho Tera loda ghir Jaye fir tere ando me se lizard ke bacche nikle teko kidnap Kare aur childporn banaye maa ke chuttad ke lode tere saat Johnny sins rape Kare aur jab wo teko anal de tab loda andar fas Jaye bkl tere jhaat pe waxing karunga me dhek lio fir jab tu chillayega na tab tere muh me Mai gai ka gobar dalunga sale tere gand ke balo pe tel laga ke jala du me teko Anaconda leke gand me dalu tho muh se nikle maa ke lode hamesha chutiyo jaisa bartav kartha he tu maa ke Dai chawal drugs tere gand Me dalunga thi tatti nahi nikle maa darchod kabhi teko Marne ka mouka mil gaya na tho bas I'll do my best to get that tatti outof you aur tere jaise chutio ko is duniya me jagaha bhi nahi maa ke lode bandarchod tere gand me chitiya Kate wo bhi bullet ants maadarchod samj nahi aaraha tere baap NE teko kya khake paida kiya Tha kesa chutiya he tu rand ke bacche teko shadi me khana khane na mile teko gand pe 4 thappad mare sab log aur blade se likhe I want anal madarchod bosdike maccharki tatte ke baal chutiye maa ke chut pe ghode ka Lund tere gand me jaltha hu koila Dale bhen ke lode MAA KI CHUT MAI TALWAR DUNGA BC CHUT FAT JAEGI AUR USME SE ITNA KHOON NIKLEGA MZA AJAEGA DEKHNE KA SALE MAA KE BHOSDE SE BAHR AJA FIR BAAP SE ZUBAN DA TERI MAA KI CHUT CHOD CHOD KE BHOSDABNADU MADARCHOD AUR USKE UPAR CENENT LAGADU KI TERE JESA GANDU INSAAN KABHI BAHR NA A SKE ESI GANDI CHUT MAI SE LODA LASUN MADRCHOD TERI MAA KI CHUT GASTI AMA KA CHUTIA BACHA TERI MAA KO CHOD CHOD K PAGAL KAR DUNGA MAA K LODY KISI SASTIII RANDII K BACHY TERI MAA KI CHOOT MAIN TEER MAARUN GANDU HARAMI TERI COLLEGE JATI BAJI KA ROAD PEY RAPE KARONGANDU KI OLAAD HARAM KI NASAL PAPA HUN TERA BHEN PESH KAR AB PAPA KO TERI MAA KKALE KUSS MAIN KISI !"
12 | chat = await event.get_input_chat()
13 | async for x in borg.iter_participants(chat, filter=ChannelParticipantsAdmins):
14 | mentions += f""
15 | reply_message = None
16 | if event.reply_to_msg_id:
17 | reply_message = await event.get_reply_message()
18 | await reply_message.reply(mentions)
19 | else:
20 | await event.reply(mentions)
21 | await event.delete()
22 |
23 |
24 | CMD_HELP.update({"gaali": ".gaali\nUse - Long abuse, in hindi."})
25 |
--------------------------------------------------------------------------------
/telebot/plugins/gamerpfp.py:
--------------------------------------------------------------------------------
1 | # Made By @TeleBotComms Keep Credits If You Are Goanna Kang This Lol
2 |
3 | # And Thanks To The Creator Of Autopic This Script Was Made from Snippets
4 | # From That Script
5 |
6 | # Usage .gamerpfp Im Not Responsible For Any Ban caused By This
7 |
8 | import asyncio
9 | import os
10 | import random
11 | import re
12 | import urllib
13 |
14 | import requests
15 | from telethon.tl import functions
16 | from uniborg.util import admin_cmd
17 |
18 | from telebot import CMD_HELP
19 |
20 | COLLECTION_STRING = [
21 | "star-wars-wallpaper-1080p",
22 | "4k-sci-fi-wallpaper",
23 | "star-wars-iphone-6-wallpaper",
24 | "kylo-ren-wallpaper",
25 | "darth-vader-wallpaper",
26 | ]
27 |
28 |
29 | async def animepp():
30 |
31 | os.system("rm -rf donot.jpg")
32 |
33 | rnd = random.randint(0, len(COLLECTION_STRING) - 1)
34 |
35 | pack = COLLECTION_STRING[rnd]
36 |
37 | pc = requests.get("http://getwallpapers.com/collection/" + pack).text
38 |
39 | f = re.compile(r"/\w+/full.+.jpg")
40 |
41 | f = f.findall(pc)
42 |
43 | fy = "http://getwallpapers.com" + random.choice(f)
44 |
45 | print(fy)
46 |
47 | if not os.path.exists("f.ttf"):
48 |
49 | urllib.request.urlretrieve(
50 | "https://github.com/rebel6969/mym/raw/master/Rebel-robot-Regular.ttf",
51 | "f.ttf",
52 | )
53 |
54 | urllib.request.urlretrieve(fy, "donottouch.jpg")
55 |
56 |
57 | @telebot.on(admin_cmd(pattern="gamerpfp ?(.*)"))
58 | async def main(event):
59 |
60 | # Owner @NihiNivi
61 | await event.edit(
62 | "**Starting Gamer Profile Pic.\n\nModded by[TeleBot](https://github.com/xditya/TeleBot)"
63 | )
64 |
65 | while True:
66 |
67 | await animepp()
68 |
69 | file = await event.client.upload_file("donottouch.jpg")
70 |
71 | await event.client(functions.photos.UploadProfilePhotoRequest(file))
72 |
73 | os.system("rm -rf donottouch.jpg")
74 |
75 | await asyncio.sleep(3600) # Edit this to your required needs
76 |
77 |
78 | CMD_HELP.update({"gamerpfp": ".gamerpfp\nUse - Autochanging gamer profile pic."})
79 |
--------------------------------------------------------------------------------
/telebot/plugins/gangasta.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 |
3 | from telebot import CMD_HELP
4 | from telebot.utils import admin_cmd
5 |
6 |
7 | @telebot.on(admin_cmd(pattern="gangasta ?(.*)"))
8 | async def _(event):
9 | if not event.text[0].isalpha() and event.text[0] not in ("/", "#", "@", "!"):
10 | await event.edit("EVERyBOdy")
11 | await asyncio.sleep(0.3)
12 | await event.edit("iZ")
13 | await asyncio.sleep(0.2)
14 | await event.edit("GangSTur")
15 | await asyncio.sleep(0.5)
16 | await event.edit("UNtIL ")
17 | await asyncio.sleep(0.2)
18 | await event.edit("I")
19 | await asyncio.sleep(0.3)
20 | await event.edit("ArRivE")
21 | await asyncio.sleep(0.3)
22 | await event.edit("🔥🔥🔥")
23 | await asyncio.sleep(0.3)
24 | await event.edit("EVERyBOdy iZ GangSTur UNtIL I ArRivE 🔥🔥🔥")
25 |
26 |
27 | CMD_HELP.update({"gangsta": ".gangsta\nUse - Spam recents of a group lel."})
28 |
--------------------------------------------------------------------------------
/telebot/plugins/gay.py:
--------------------------------------------------------------------------------
1 | # python 3.7.1
2 |
3 | """Available Commands:
4 | .gay"""
5 |
6 |
7 | import asyncio
8 |
9 | from telebot import CMD_HELP
10 | from telebot.utils import admin_cmd
11 |
12 |
13 | @telebot.on(admin_cmd(pattern="(.*)"))
14 | async def _(event):
15 | if event.fwd_from:
16 | return
17 | animation_interval = 0.3
18 | animation_ttl = range(0, 5)
19 | input_str = event.pattern_match.group(1)
20 | if input_str == "gay":
21 | await event.edit(input_str)
22 | animation_chars = [
23 | "HI USER",
24 | "HI USER , WAIT",
25 | "HI USER , WAIT ARE YOU....",
26 | "HI USER , WAIT ARE YOU UMH...",
27 | "HI USRR , WAIT ARE YOU A GAY??😬",
28 | ]
29 |
30 | for i in animation_ttl:
31 |
32 | await asyncio.sleep(animation_interval)
33 | await event.edit(animation_chars[i % 5])
34 |
35 |
36 | CMD_HELP.update({"gay": ".gay\nUse - useless."})
37 |
--------------------------------------------------------------------------------
/telebot/plugins/gban_bots.py:
--------------------------------------------------------------------------------
1 | # For TeleBot.
2 | # Add G_BAN_LOGGER_GROUP as config var for it to work.
3 |
4 | """Globally Ban users from all the
5 | Group Administrations bots where you are SUDO
6 | Available Commands:
7 | .gban REASON
8 | .ungban"""
9 |
10 | from telebot import CMD_HELP
11 | from telebot.utils import admin_cmd
12 |
13 |
14 | @telebot.on(admin_cmd(pattern="botgban ?(.*)"))
15 | @telebot.on(sudo_cmd(pattern="botgban ?(.*)", allow_sudo=True))
16 | async def _(event):
17 | if Config.G_BAN_LOGGER_GROUP is None:
18 | await eor(
19 | event,
20 | "Make a group, add all your sudo bots and paste it's id in ENV VAR (G_BAN_LOGGER_GROUP) for this module to work.",
21 | )
22 | return
23 | if event.fwd_from:
24 | return
25 | reason = event.pattern_match.group(1)
26 | if event.reply_to_msg_id:
27 | r = await event.get_reply_message()
28 | if r.forward:
29 | r_from_id = r.forward.from_id or r.from_id
30 | else:
31 | r_from_id = r.from_id
32 | await borg.send_message(
33 | Config.G_BAN_LOGGER_GROUP,
34 | "/gban [user](tg://user?id={}) {}".format(r_from_id, reason),
35 | )
36 | await event.delete()
37 |
38 |
39 | @telebot.on(admin_cmd(pattern="botungban ?(.*)"))
40 | @telebot.on(sudo_cmd(pattern="botungban ?(.*)", allow_sudo=True))
41 | async def _(event):
42 | if Config.G_BAN_LOGGER_GROUP is None:
43 | await eor(
44 | event,
45 | "Make a group, add all your sudo bots and paste it's id in ENV VAR (G_BAN_LOGGER_GROUP) for this module to work.",
46 | )
47 | return
48 | if event.fwd_from:
49 | return
50 | reason = event.pattern_match.group(1)
51 | if event.reply_to_msg_id:
52 | r = await event.get_reply_message()
53 | r_from_id = r.from_id
54 | await borg.send_message(
55 | Config.G_BAN_LOGGER_GROUP,
56 | "/ungban [user](tg://user?id={}) {}".format(r_from_id, reason),
57 | )
58 | await event.delete()
59 |
60 |
61 | CMD_HELP.update(
62 | {
63 | "gban_bots": ".botgban \nUse - Gban in all bots you are sudo.\
64 | \n\n.botungban \nUse - Ungban from all bots."
65 | }
66 | )
67 |
--------------------------------------------------------------------------------
/telebot/plugins/gbun.py:
--------------------------------------------------------------------------------
1 | # This is a troll indeed ffs *facepalm*
2 | import asyncio
3 |
4 | from telethon.tl.functions.users import GetFullUserRequest
5 | from telethon.tl.types import ChannelParticipantsAdmins
6 |
7 | from telebot import CMD_HELP
8 | from telebot.utils import admin_cmd
9 |
10 |
11 | @telebot.on(admin_cmd(pattern="gbun"))
12 | @telebot.on(sudo_cmd(pattern="gbun", allow_sudo=True))
13 | async def gbun(event):
14 | if event.fwd_from:
15 | return
16 | gbunVar = event.text
17 | gbunVar = gbunVar[6:]
18 | mentions = "`Warning!! User 𝙂𝘽𝘼𝙉𝙉𝙀𝘿 By Admin...\n`"
19 | no_reason = "__Reason: Retarded Dumb af Spammer. __"
20 | await eor(event, "**Summoning out le Gungnir ❗️⚜️☠️**")
21 | asyncio.sleep(3.5)
22 | chat = await event.get_input_chat()
23 | async for x in borg.iter_participants(chat, filter=ChannelParticipantsAdmins):
24 | mentions += f""
25 | reply_message = None
26 | if event.reply_to_msg_id:
27 | reply_message = await event.get_reply_message()
28 | replied_user = await event.client(GetFullUserRequest(reply_message.sender_id))
29 | firstname = replied_user.user.first_name
30 | usname = replied_user.user.username
31 | idd = reply_message.sender_id
32 | # make myself invulnerable cuz why not xD
33 | if idd == 719195224:
34 | await reply_message.reply(
35 | "`Wait a second, This is my master!`\n**How dare you threaten to ban my master nigger!**\n\n__Your account has been hacked! 😏"
36 | )
37 | else:
38 | jnl = (
39 | "`Warning!! `"
40 | "[{}](tg://user?id={})"
41 | "` 𝙂𝘽𝘼𝙉𝙉𝙀𝘿 By Admin...\n\n`"
42 | "**Name: ** __{}__\n"
43 | "**ID : ** `{}`\n"
44 | ).format(firstname, idd, firstname, idd)
45 | if usname is None:
46 | jnl += "**Victim's username: ** `Doesn't own a username!`\n"
47 | elif usname != "None":
48 | jnl += "**Victim's username** : @{}\n".format(usname)
49 | if len(gbunVar) > 0:
50 | gbunm = "`{}`".format(gbunVar)
51 | gbunr = "**Reason: **" + gbunm
52 | jnl += gbunr
53 | else:
54 | jnl += no_reason
55 | await reply_message.reply(jnl)
56 | else:
57 | mention = (
58 | "`Warning!! User 𝙂𝘽𝘼𝙉𝙉𝙀𝘿 By Admin...\nReason: Potential Porn Addict. `"
59 | )
60 | await event.reply(mention)
61 | await event.delete()
62 |
63 |
64 | CMD_HELP.update({"gbun": ".gbun \nUse - Fake Gban."})
65 |
--------------------------------------------------------------------------------
/telebot/plugins/git.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 |
3 | from telebot import CMD_HELP
4 |
5 |
6 | @telebot.on(admin_cmd(pattern=r"(.*)", outgoing=True))
7 | async def _(event):
8 |
9 | if event.fwd_from:
10 |
11 | return
12 |
13 | animation_interval = 0.1
14 |
15 | animation_ttl = range(0, 101)
16 |
17 | input_str = event.pattern_match.group(1)
18 |
19 | if input_str == "guthub":
20 |
21 | await eor(event, input_str)
22 |
23 | animation_chars = [
24 | "https://github.com/xditya/TeleBot",
25 | "https://github.com/spechide/UniBorg",
26 | ]
27 |
28 | for i in animation_ttl:
29 |
30 | await asyncio.sleep(animation_interval)
31 |
32 | await eor(event, animation_chars[i % 2])
33 |
34 |
35 | CMD_HELP.update({"git": ".guthub\nUse - Spam recents lol.."})
36 |
--------------------------------------------------------------------------------
/telebot/plugins/github.py:
--------------------------------------------------------------------------------
1 | """Get information about an user on GitHub
2 | Syntax: .github USERNAME"""
3 | import requests
4 |
5 | from telebot import CMD_HELP
6 |
7 |
8 | @borg.on(admin_cmd(pattern="github (.*)"))
9 | @borg.on(sudo_cmd(pattern="github (.*)", allow_sudo=True))
10 | async def _(event):
11 | if event.fwd_from:
12 | return
13 | input_str = event.pattern_match.group(1)
14 | url = "https://api.github.com/users/{}".format(input_str)
15 | r = requests.get(url)
16 | if r.status_code != 404:
17 | b = r.json()
18 | avatar_url = b["avatar_url"]
19 | html_url = b["html_url"]
20 | gh_type = b["type"]
21 | name = b["name"]
22 | company = b["company"]
23 | blog = b["blog"]
24 | location = b["location"]
25 | bio = b["bio"]
26 | created_at = b["created_at"]
27 | await borg.send_file(
28 | event.chat_id,
29 | caption="""Name: [{}]({})
30 | Type: {}
31 | Company: {}
32 | Blog: {}
33 | Location: {}
34 | Bio: {}
35 | Profile Created: {}""".format(
36 | name, html_url, gh_type, company, blog, location, bio, created_at
37 | ),
38 | file=avatar_url,
39 | force_document=False,
40 | allow_cache=False,
41 | reply_to=event,
42 | )
43 | await event.delete()
44 | else:
45 | await eor(event, "`{}`: {}".format(input_str, r.text))
46 |
47 |
48 | CMD_HELP.update(
49 | {"github": ".github \nUse - Get info of that user's github profile."}
50 | )
51 |
--------------------------------------------------------------------------------
/telebot/plugins/google.py:
--------------------------------------------------------------------------------
1 | """ Powered by @Google
2 | Available Commands:
3 | .go credits to owner of bot
4 | """
5 |
6 | from re import findall
7 |
8 | from search_engine_parser import GoogleSearch
9 |
10 | from telebot import CMD_HELP
11 |
12 |
13 | def progress(current, total):
14 | logger.info(
15 | "Downloaded {} of {}\nCompleted {}".format(
16 | current, total, (current / total) * 100
17 | )
18 | )
19 |
20 |
21 | @telebot.on(admin_cmd(outgoing=True, pattern="go (.*)"))
22 | async def gsearch(q_event):
23 | """ For .google command, do a Google search. """
24 | match = q_event.pattern_match.group(1)
25 | tele = await eor(q_event, "Searching for `{}`".format(match))
26 | page = findall(r"page=\d+", match)
27 | try:
28 | page = page[0]
29 | page = page.replace("page=", "")
30 | match = match.replace("page=" + page[0], "")
31 | except IndexError:
32 | page = 1
33 | search_args = (str(match), int(page))
34 | gsearch = GoogleSearch()
35 | gresults = await gsearch.async_search(*search_args)
36 | res = ""
37 | for i in range(len(gresults["links"])):
38 | try:
39 | teletitle = gresults["titles"][i]
40 | telelink = gresults["links"][i]
41 | teledescrp = gresults["descriptions"][i]
42 | res += f"[{teletitle}]({telelink})\n`{teledescrp}`\n\n"
43 | except IndexError:
44 | break
45 | await tele.edit(
46 | "**GᴏᴏɢʟᴇSᴇᴀʀᴄʜ**\n__Qᴜᴇʀʏ:__\n `{}` \n\n**Rᴇsᴜʟᴛs:**\n {}".format(match, res),
47 | link_preview=False,
48 | )
49 |
50 |
51 | CMD_HELP.update({"google": ".go \nUse - Search the query on Google"})
52 |
--------------------------------------------------------------------------------
/telebot/plugins/gps.py:
--------------------------------------------------------------------------------
1 | """
2 | Syntax : .gps
3 | credits :@mrconfused
4 | """
5 |
6 | # help from @sunda005 and @SpEcHIDe
7 | # don't edit credits
8 | # Plugin for TeleBot
9 |
10 | from geopy.geocoders import Nominatim
11 | from telethon.tl import types
12 |
13 | from telebot import CMD_HELP
14 | from telebot.utils import admin_cmd
15 |
16 |
17 | @telebot.on(admin_cmd(pattern="gps ?(.*)"))
18 | @telebot.on(sudo_cmd(pattern="gps ?(.*)", allow_sudo=True))
19 | async def gps(event):
20 | if event.fwd_from:
21 | return
22 | reply_to_id = event.message
23 | if event.reply_to_msg_id:
24 | reply_to_id = await event.get_reply_message()
25 | input_str = event.pattern_match.group(1)
26 |
27 | if not input_str:
28 | return await eor(event, "What should I find? Give me a location.")
29 |
30 | await eor(event, "Finding...")
31 |
32 | geolocator = Nominatim(user_agent="telebot")
33 | geoloc = geolocator.geocode(input_str)
34 |
35 | if geoloc:
36 | lon = geoloc.longitude
37 | lat = geoloc.latitude
38 | await reply_to_id.reply(
39 | input_str, file=types.InputMediaGeoPoint(types.InputGeoPoint(lat, lon))
40 | )
41 | await event.delete()
42 | else:
43 | await eor(event, "Sorry, I coudn't find it")
44 |
45 |
46 | CMD_HELP.update({"gps": ".gps \nUse - Locate the place in the map."})
47 |
--------------------------------------------------------------------------------
/telebot/plugins/group.py:
--------------------------------------------------------------------------------
1 | from telebot import CMD_HELP
2 | from telebot.utils import admin_cmd
3 |
4 |
5 | @telebot.on(admin_cmd(outgoing=True, pattern="group"))
6 | @telebot.on(sudo_cmd(allow_sudo=True, pattern="group"))
7 | async def join(e):
8 | if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
9 | await eor(
10 | e,
11 | "This is my community.\n\n[Channel](http://t.me/giveaways_24hrs)\n\n[Chat Group](https://t.me/giveaways24hrsdiscuss)\n\n[UserBot Tutorial - TeleBot](https://t.me/TeleBotHelp)\n\n[TeleBot Chat](https://t.me/TeleBotHelpChat)\n\n[Github](https://github.com/xditya)\n\n[YouTube](https://bit.ly/adityas7)",
12 | )
13 |
14 |
15 | CMD_HELP.update({"group": ".group\nUse - None."})
16 |
--------------------------------------------------------------------------------
/telebot/plugins/hack.py:
--------------------------------------------------------------------------------
1 | """Emoji
2 | Available Commands:
3 | .emoji shrug
4 | .emoji apple
5 | .emoji :/
6 | .emoji -_-"""
7 |
8 |
9 | import asyncio
10 |
11 | from telebot import CMD_HELP
12 | from telebot.utils import admin_cmd
13 |
14 |
15 | @telebot.on(admin_cmd(pattern=r"(.*)", outgoing=True))
16 | async def _(event):
17 |
18 | if event.fwd_from:
19 |
20 | return
21 |
22 | animation_interval = 2
23 |
24 | animation_ttl = range(0, 11)
25 |
26 | input_str = event.pattern_match.group(1)
27 |
28 | if input_str == "hack":
29 |
30 | await event.edit(input_str)
31 |
32 | animation_chars = [
33 | "`Connecting To Hacked Private Server...`",
34 | "`Target Selected.`",
35 | "`Hacking... 0%\n▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
36 | "`Hacking... 4%\n█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
37 | "`Hacking... 8%\n██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
38 | "`Hacking... 20%\n█████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
39 | "`Hacking... 36%\n█████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ `",
40 | "`Hacking... 52%\n█████████████▒▒▒▒▒▒▒▒▒▒▒▒ `",
41 | "`Hacking... 84%\n█████████████████████▒▒▒▒ `",
42 | "`Hacking... 100%\n█████████HACKED███████████ `",
43 | "`Targeted Account Hacked...\n\n `All data stored in ./hacked`",
44 | ]
45 |
46 | for i in animation_ttl:
47 |
48 | await asyncio.sleep(animation_interval)
49 |
50 | await event.edit(animation_chars[i % 11])
51 |
52 |
53 | CMD_HELP.update({"hack": ".hack\nUse - Animation Plugin."})
54 |
--------------------------------------------------------------------------------
/telebot/plugins/iffuci.py:
--------------------------------------------------------------------------------
1 | """iffuci.tk pastebin site
2 | Code written by @loxxi {iffuci}
3 | Syntax: .iffuci"""
4 | import os
5 | from datetime import datetime
6 |
7 | import requests
8 |
9 | from telebot import CMD_HELP
10 | from telebot.utils import admin_cmd
11 |
12 |
13 | def progress(current, total):
14 | logger.info(
15 | "Downloaded {} of {}\nCompleted {}".format(
16 | current, total, (current / total) * 100
17 | )
18 | )
19 |
20 |
21 | @telebot.on(admin_cmd(pattern="iffuci ?(.*)"))
22 | @telebot.on(sudo_cmd(pattern="iffuci ?(.*)", allow_sudo=True))
23 | async def _(event):
24 | if event.fwd_from:
25 | return
26 | start = datetime.now()
27 | if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
28 | os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
29 | input_str = event.pattern_match.group(1)
30 | message = "SYNTAX: `.iffuci `"
31 | if input_str:
32 | message = input_str
33 | elif event.reply_to_msg_id:
34 | previous_message = await event.get_reply_message()
35 | if previous_message.media:
36 | downloaded_file_name = await borg.download_media(
37 | previous_message,
38 | Config.TMP_DOWNLOAD_DIRECTORY,
39 | progress_callback=progress,
40 | )
41 | m_list = None
42 | with open(downloaded_file_name, "rb") as fd:
43 | m_list = fd.readlines()
44 | message = ""
45 | for m in m_list:
46 | message += m.decode("UTF-8") + "\r\n"
47 | os.remove(downloaded_file_name)
48 | else:
49 | message = previous_message.message
50 | else:
51 | message = "SYNTAX: `.iffuci `"
52 | url = "https://www.iffuci.tk/documents"
53 | r = requests.post(url, data=message.encode("UTF-8")).json()
54 | url = f"https://iffuci.tk/{r['key']}"
55 | end = datetime.now()
56 | ms = (end - start).seconds
57 | if r["isUrl"]:
58 | nurl = f"https://iffuci.tk/v/{r['key']}"
59 | await eor(
60 | event,
61 | "code is pasted to {} in {} seconds. GoTo Original URL: {}".format(
62 | url, ms, nurl
63 | ),
64 | )
65 | else:
66 | await eor(event, "code is pasted to {} in {} seconds".format(url, ms))
67 |
68 |
69 | CMD_HELP.update({"iffuci": ".iffuci \nUse - Paste the text to iffuci.tk"})
70 |
--------------------------------------------------------------------------------
/telebot/plugins/img.py:
--------------------------------------------------------------------------------
1 | # Adapted from OpenUserBot for Uniborg
2 |
3 | """Download & Upload Images on Telegram\n
4 | Syntax: `.img ` or `.img (replied message)`
5 | \n Upgraded and Google Image Error Fixed by @NeoMatrix90 aka @kirito6969
6 | """
7 |
8 | import os
9 | import shutil
10 | from re import findall
11 |
12 | from uniborg.util import admin_cmd
13 |
14 | from telebot import CMD_HELP
15 | from telebot.google_images_download import googleimagesdownload
16 |
17 |
18 | @telebot.on(admin_cmd(pattern="img ?(.*)"))
19 | @telebot.on(sudo_cmd(pattern="img ?(.*)", allow_sudo=True))
20 | async def img_sampler(event):
21 | await eor(event, "`Processing ...`")
22 | reply = await event.get_reply_message()
23 | if event.pattern_match.group(1):
24 | query = event.pattern_match.group(1)
25 | elif reply:
26 | query = reply.message
27 | else:
28 | await eor(event, "`What I am Supposed to Search u Dumb Ass(Donkey)`")
29 | return
30 |
31 | lim = findall(r"lim=\d+", query)
32 | # lim = event.pattern_match.group(1)
33 | try:
34 | lim = lim[0]
35 | lim = lim.replace("lim=", "")
36 | query = query.replace("lim=" + lim[0], "")
37 | except IndexError:
38 | lim = 5
39 | response = googleimagesdownload()
40 |
41 | # creating list of arguments
42 | arguments = {
43 | "keywords": query,
44 | "limit": lim,
45 | "format": "jpg",
46 | "no_directory": "no_directory",
47 | }
48 |
49 | # passing the arguments to the function
50 | paths = response.download(arguments)
51 | lst = paths[0][query]
52 | await event.client.send_file(
53 | await event.client.get_input_entity(event.chat_id), lst
54 | )
55 | shutil.rmtree(os.path.dirname(os.path.abspath(lst[0])))
56 | await event.delete()
57 |
58 |
59 | CMD_HELP.update({"img": ".img \nUse - Get images matching the query."})
60 |
--------------------------------------------------------------------------------
/telebot/plugins/invite.py:
--------------------------------------------------------------------------------
1 | """Invite the user(s) to the current chat
2 | Syntax: .invite """
3 |
4 | from telethon import functions
5 |
6 | from telebot import CMD_HELP
7 | from telebot.utils import admin_cmd
8 |
9 |
10 | @telebot.on(admin_cmd(pattern="invite ?(.*)"))
11 | @telebot.on(sudo_cmd(pattern="invite ?(.*)", allow_sudo=True))
12 | async def _(event):
13 | if event.fwd_from:
14 | return
15 | to_add_users = event.pattern_match.group(1)
16 | if event.is_private:
17 | await eor(event, "`.invite` users to a chat, not to a Private Message")
18 | else:
19 | logger.info(to_add_users)
20 | if not event.is_channel and event.is_group:
21 | # https://lonamiwebs.github.io/Telethon/methods/messages/add_chat_user.html
22 | for user_id in to_add_users.split(" "):
23 | try:
24 | await borg(
25 | functions.messages.AddChatUserRequest(
26 | chat_id=event.chat_id, user_id=user_id, fwd_limit=1000000
27 | )
28 | )
29 | except Exception as e:
30 | await event.reply(str(e))
31 | await eor(event, "Invited Successfully")
32 | else:
33 | # https://lonamiwebs.github.io/Telethon/methods/channels/invite_to_channel.html
34 | for user_id in to_add_users.split(" "):
35 | try:
36 | await borg(
37 | functions.channels.InviteToChannelRequest(
38 | channel=event.chat_id, users=[user_id]
39 | )
40 | )
41 | except Exception as e:
42 | await event.reply(str(e))
43 | await eor(event, "TeleBot has invited the user to the chat.")
44 |
45 |
46 | CMD_HELP.update({"invite": ".invite \nUse - Add user to the chat."})
47 |
--------------------------------------------------------------------------------
/telebot/plugins/jio.py:
--------------------------------------------------------------------------------
1 | """Emoji
2 | .jio"""
3 |
4 |
5 | import asyncio
6 |
7 | from uniborg.util import admin_cmd
8 |
9 | from telebot import CMD_HELP
10 |
11 |
12 | @telebot.on(admin_cmd(pattern=r"jio"))
13 | async def _(event):
14 |
15 | if event.fwd_from:
16 |
17 | return
18 |
19 | animation_interval = 1
20 |
21 | animation_ttl = range(0, 19)
22 |
23 | # input_str = event.pattern_match.group(1)
24 |
25 | # if input_str == "JIO":
26 |
27 | await event.edit("jio")
28 |
29 | animation_chars = [
30 | "`Connecting 🙄To JIO NG ....`",
31 | "`█ ▇ ▆ ▅ ▄ ▂ ▁`",
32 | "`▒ ▇ ▆ ▅ ▄ ▂ ▁`",
33 | "`▒ ▒ ▆ ▅ ▄ ▂ ▁`",
34 | "`▒ ▒ ▒ ▅ ▄ ▂ ▁`",
35 | "`▒ ▒ ▒ ▒ ▄ ▂ ▁`",
36 | "`▒ ▒ ▒ ▒ ▒ ▂ ▁`",
37 | "`▒ ▒ ▒ ▒ ▒ ▒ ▁`",
38 | "`▒ ▒ ▒ ▒ ▒ ▒ ▒`",
39 | "*Optimising Network...*",
40 | "`▒ ▒ ▒ ▒ ▒ ▒ ▒`",
41 | "`▁ ▒ ▒ ▒ ▒ ▒ ▒`",
42 | "`▁ ▂ ▒ ▒ ▒ ▒ ▒`",
43 | "`▁ ▂ ▄ ▒ ▒ ▒ ▒`",
44 | "`▁ ▂ ▄ ▅ ▒ ▒ ▒`",
45 | "`▁ ▂ ▄ ▅ ▆ ▒ ▒`",
46 | "`▁ ▂ ▄ ▅ ▆ ▇ ▒`",
47 | "`▁ ▂ ▄ ▅ ▆ ▇ █`",
48 | "**JIO Network Boosted....**",
49 | ]
50 |
51 | for i in animation_ttl:
52 |
53 | await asyncio.sleep(animation_interval)
54 |
55 | await event.edit(animation_chars[i % 19])
56 |
57 |
58 | CMD_HELP.update({"jio": ".jio\nUse - Animation plugin."})
59 |
--------------------------------------------------------------------------------
/telebot/plugins/json.py:
--------------------------------------------------------------------------------
1 | """Get Detailed info about any message
2 | Syntax: .json"""
3 | import io
4 |
5 | from telebot import CMD_HELP
6 | from telebot.utils import admin_cmd
7 |
8 |
9 | @telebot.on(admin_cmd(pattern="json"))
10 | @telebot.on(sudo_cmd(pattern="json", allow_sudo=True))
11 | async def _(event):
12 | if event.fwd_from:
13 | return
14 | the_real_message = None
15 | reply_to_id = None
16 | if event.reply_to_msg_id:
17 | previous_message = await event.get_reply_message()
18 | the_real_message = previous_message.stringify()
19 | reply_to_id = event.reply_to_msg_id
20 | else:
21 | the_real_message = event.stringify()
22 | reply_to_id = event.message.id
23 | if len(the_real_message) > Config.MAX_MESSAGE_SIZE_LIMIT:
24 | with io.BytesIO(str.encode(the_real_message)) as out_file:
25 | out_file.name = "json.text"
26 | await borg.send_file(
27 | event.chat_id,
28 | out_file,
29 | force_document=True,
30 | allow_cache=False,
31 | reply_to=reply_to_id,
32 | )
33 | await event.delete()
34 | else:
35 | await eor(event, "`{}`".format(the_real_message))
36 |
37 |
38 | CMD_HELP.update({"json": ".json \nUse - Get json encoding of the mssg."})
39 |
--------------------------------------------------------------------------------
/telebot/plugins/labstack.py:
--------------------------------------------------------------------------------
1 | import json
2 | import os
3 | import subprocess
4 |
5 | import requests
6 |
7 | from telebot import CMD_HELP
8 | from telebot.utils import admin_cmd
9 |
10 |
11 | @telebot.on(admin_cmd(pattern="labstack ?(.*)"))
12 | @telebot.on(sudo_cmd(pattern="labstack ?(.*)", allow_sudo=True))
13 | async def labstack(event):
14 | if event.fwd_from:
15 | return
16 | await eor(event, "Processing...")
17 | input_str = event.pattern_match.group(1)
18 | reply = await event.get_reply_message()
19 | if input_str:
20 | filebase = input_str
21 | elif reply:
22 | filebase = await event.client.download_media(
23 | reply.media, Var.TEMP_DOWNLOAD_DIRECTORY
24 | )
25 | else:
26 | await eor(
27 | event,
28 | "Reply to a media file or provide a directory to upload the file to labstack",
29 | )
30 | return
31 | filesize = os.path.getsize(filebase)
32 | filename = os.path.basename(filebase)
33 | headers2 = {"Up-User-ID": "IZfFbjUcgoo3Ao3m"}
34 | files2 = {
35 | "ttl": 604800,
36 | "files": [{"name": filename, "type": "", "size": filesize}],
37 | }
38 | r2 = requests.post(
39 | "https://up.labstack.com/api/v1/links", json=files2, headers=headers2
40 | )
41 | r2json = json.loads(r2.text)
42 |
43 | url = "https://up.labstack.com/api/v1/links/{}/send".format(r2json["code"])
44 | max_days = 7
45 | command_to_exec = [
46 | "curl",
47 | "-F",
48 | "files=@" + filebase,
49 | "-H",
50 | "Transfer-Encoding: chunked",
51 | "-H",
52 | "Up-User-ID: IZfFbjUcgoo3Ao3m",
53 | url,
54 | ]
55 | try:
56 | logger.info(command_to_exec)
57 | t_response = subprocess.check_output(command_to_exec, stderr=subprocess.STDOUT)
58 | except subprocess.CalledProcessError as exc:
59 | logger.info("Status : FAIL", exc.returncode, exc.output)
60 | await eor(event, exc.output.decode("UTF-8"))
61 | return
62 | else:
63 | logger.info(t_response)
64 | t_response_arry = "https://up.labstack.com/api/v1/links/{}/receive".format(
65 | r2json["code"]
66 | )
67 | await eor(
68 | event, t_response_arry + "\nMax Days:" + str(max_days), link_preview=False
69 | )
70 |
71 |
72 | CMD_HELP.update({"labstack": ".labstack \nUse - Upload to labstack."})
73 |
--------------------------------------------------------------------------------
/telebot/plugins/list_user_names_reserved_by_me.py:
--------------------------------------------------------------------------------
1 | # For @UniBorg
2 | # (c) Shrimadhav U K
3 |
4 | from telethon import functions
5 |
6 | from telebot import CMD_HELP
7 | from telebot.utils import admin_cmd
8 |
9 |
10 | @telebot.on(admin_cmd(pattern=r"listmyusernames", outgoing=True))
11 | async def _(event):
12 | if event.fwd_from:
13 | return
14 | result = await borg(functions.channels.GetAdminedPublicChannelsRequest())
15 | output_str = ""
16 | for channel_obj in result.chats:
17 | output_str += f"- {channel_obj.title} @{channel_obj.username} \n"
18 | await event.edit(output_str)
19 |
20 |
21 | CMD_HELP.update(
22 | {
23 | "list_user_names_reserved_by_me": ".listmyusernames\nUse - List all usernames you have reserved."
24 | }
25 | )
26 |
--------------------------------------------------------------------------------
/telebot/plugins/lucky.py:
--------------------------------------------------------------------------------
1 | # plugin by lejend @r4r4n4
2 | """Emoji
3 |
4 | Available Commands:
5 |
6 | .lucky"""
7 |
8 | import asyncio
9 |
10 | from telebot import CMD_HELP
11 | from telebot.utils import admin_cmd
12 |
13 |
14 | @telebot.on(admin_cmd(pattern=r"(.*)", outgoing=True))
15 | async def _(event):
16 |
17 | if event.fwd_from:
18 |
19 | return
20 |
21 | animation_interval = 0.5
22 |
23 | animation_ttl = range(0, 17)
24 |
25 | input_str = event.pattern_match.group(1)
26 |
27 | if input_str == "lucky":
28 |
29 | await event.edit(input_str)
30 |
31 | animation_chars = [
32 | "⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜[🎁](https://github.com/xditya/TeleBot/)⬜",
33 | "⬛⬜⬜⬜⬜\n👇⬜⬜⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜[🎁](https://github.com/xditya/TeleBot/)⬜",
34 | "⬛⬛⬜⬜⬜\n⬜👇⬜⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜[🎁](https://github.com/xditya/TeleBot/)⬜",
35 | "⬛⬛⬛⬜⬜\n⬜⬜👇⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜[🎁](https://github.com/xditya/TeleBot/)⬜",
36 | "⬛⬛⬛⬛⬜\n⬜⬜⬜👇⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜[🎁](https://github.com/xditya/TeleBot/)⬜",
37 | "⬛⬛⬛⬛⬜\n⬜⬜⬜⬛⬜\n⬜⬜⬜👇⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜[🎁](https://github.com/xditya/TeleBot/)⬜",
38 | "⬛⬛⬛⬛⬜\n⬜⬜⬜⬛⬜\n⬜⬜⬜⬛⬜\n⬜⬜⬜👇⬜\n⬜⬜⬜[🎁](https://github.com/xditya/TeleBot/)⬜",
39 | "⬛⬛⬛⬛⬜\n⬜⬜⬜⬛⬜\n⬜⬜⬜👇⬜\n⬜⬜⬜[🎁](https://github.com/Dark-Princ3/X-tra-Telegram/)⬜\n⬜⬜⬜⬜⬜",
40 | "⬛⬛⬛⬛⬜\n⬜⬜⬜👇⬜\n⬜⬜⬜[🎁](https://github.com/Dark-Princ3/X-tra-Telegram/)⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜",
41 | "⬛⬛⬛⬜⬜\n⬜⬜👇⬜⬜\n⬜⬜[🎁](https://github.com/Dark-Princ3/X-tra-Telegram/)⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜",
42 | "⬛⬛⬜⬜⬜\n⬜👇⬜⬜⬜\n⬜[🎁](https://github.com/Dark-Princ3/X-tra-Telegram/)⬜⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜",
43 | "⬛⬜⬜⬜⬜\n👇⬜⬜⬜⬜\n[🎁](https://github.com/Dark-Princ3/X-tra-Telegram/)⬜⬜⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜",
44 | "⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜",
45 | "⬜⬜⬜⬜\n⬜⬜⬜⬜\n⬜⬜⬜⬜\n⬜⬜⬜⬜",
46 | "⬜⬜⬜\n⬜⬜⬜\n⬜⬜⬜",
47 | "⬜⬜\n⬜⬜",
48 | "[🎁](https://github.com/xditya/TeleBot/)",
49 | ]
50 |
51 | for i in animation_ttl:
52 |
53 | await asyncio.sleep(animation_interval)
54 |
55 | await event.edit(animation_chars[i % 17])
56 |
57 |
58 | CMD_HELP.update({"lucky": ".lucky\nUse - None."})
59 |
--------------------------------------------------------------------------------
/telebot/plugins/mask.py:
--------------------------------------------------------------------------------
1 | from telethon import events
2 | from telethon.errors.rpcerrorlist import YouBlockedUserError
3 | from uniborg.util import admin_cmd
4 |
5 | from telebot import CMD_HELP
6 |
7 |
8 | @telebot.on(admin_cmd(pattern="mask ?(.*)"))
9 | @telebot.on(sudo_cmd(pattern="mask ?(.*)", allow_sudo=True))
10 | async def _(event):
11 | if event.fwd_from:
12 | return
13 | if not event.reply_to_msg_id:
14 | await eor(event, "```Reply to any user message.```")
15 | return
16 | reply_message = await event.get_reply_message()
17 | if not reply_message.media:
18 | await eor(event, "```reply to text message```")
19 | return
20 | chat = "@hazmat_suit_bot"
21 | reply_message.sender
22 | if reply_message.sender.bot:
23 | await eor(event, "```Reply to actual users message.```")
24 | return
25 | await eor(event, "```Processing```")
26 | async with borg.conversation(chat) as conv:
27 | try:
28 | response = conv.wait_event(
29 | events.NewMessage(incoming=True, from_users=905164246)
30 | )
31 | await borg.send_message(chat, reply_message)
32 | response = await response
33 | except YouBlockedUserError:
34 | await event.reply("```Please unblock @hazmat_suit_bot and try again```")
35 | return
36 | if response.text.startswith("Forward"):
37 | await eor(
38 | event,
39 | "```can you kindly disable your forward privacy settings for good?```",
40 | )
41 | else:
42 | await borg.send_file(event.chat_id, response.message.media)
43 |
44 |
45 | CMD_HELP.update({"mask": ".mask "})
46 |
--------------------------------------------------------------------------------
/telebot/plugins/mention.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | # (c) @INF1N17Y
4 |
5 | from telebot import CMD_HELP
6 |
7 |
8 | @telebot.on(admin_cmd(pattern=r"mention (.*)"))
9 | @telebot.on(sudo_cmd(pattern=r"mention (.*)", allow_sudo=True))
10 | async def _(event):
11 | x = await eor(event, "...")
12 | if event.fwd_from:
13 | return
14 | input_str = event.pattern_match.group(1)
15 | if event.reply_to_msg_id:
16 | previous_message = await event.get_reply_message()
17 | if previous_message.forward:
18 | replied_user = previous_message.forward.sender_id
19 | else:
20 | replied_user = previous_message.sender_id
21 | else:
22 | await x.edit("Reply To Somone's Message")
23 | user_id = replied_user
24 | caption = """{}""".format(user_id, input_str)
25 | await x.edit(caption, parse_mode="HTML")
26 |
27 |
28 | CMD_HELP.update(
29 | {
30 | "mention": ".mention (reply to user)\nUse - Mention that user by that word."
31 | }
32 | )
33 |
--------------------------------------------------------------------------------
/telebot/plugins/mf.py:
--------------------------------------------------------------------------------
1 | import sys
2 |
3 | from telethon import __version__, functions
4 |
5 | from telebot.utils import admin_cmd
6 |
7 |
8 | @telebot.on(admin_cmd(pattern="mf ?(.*)")) # pylint:disable=E0602
9 | async def _(event):
10 | if event.fwd_from:
11 | return
12 | splugin_name = event.pattern_match.group(1)
13 | if splugin_name in borg._plugins:
14 | s_help_string = borg._plugins[splugin_name].__doc__
15 | else:
16 | s_help_string = ""
17 | help_string = """
18 | ......................................../´¯/)
19 | ......................................,/¯../
20 | ...................................../..../
21 | ..................................../´.¯/
22 | ..................................../´¯/
23 | ..................................,/¯../
24 | ................................../..../
25 | ................................./´¯./
26 | ................................/´¯./
27 | ..............................,/¯../
28 | ............................./..../
29 | ............................/´¯/
30 | ........................../´¯./
31 | ........................,/¯../
32 | ......................./..../
33 | ....................../´¯/
34 | ....................,/¯../
35 | .................../..../
36 | ............./´¯/'...'/´¯¯`·¸
37 | ........../'/.../..../......./¨¯\
38 | ........('(...´...´.... ¯~/'...')
39 | .........\.................'...../
40 | ..........''...\.......... _.·´
41 | ............\..............(
42 | ..............\.............\...
43 | """.format(
44 | sys.version, __version__
45 | )
46 | tgbotusername = Config.TG_BOT_USER_NAME_BF_HER # pylint:disable=E0602
47 | if tgbotusername is not None:
48 | results = await borg.inline_query( # pylint:disable=E0602
49 | tgbotusername, help_string + "\n\n" + s_help_string
50 | )
51 | await results[0].click(
52 | event.chat_id, reply_to=event.reply_to_msg_id, hide_via=True
53 | )
54 | await event.delete()
55 | else:
56 | await event.reply(help_string + "\n\n" + s_help_string)
57 | await event.delete()
58 |
59 |
60 | @telebot.on(admin_cmd(pattern="dc")) # pylint:disable=E0602
61 | async def _(event):
62 | if event.fwd_from:
63 | return
64 | result = await borg(functions.help.GetNearestDcRequest()) # pylint:disable=E0602
65 | await event.edit(result.stringify())
66 |
67 |
68 | @telebot.on(admin_cmd(pattern="config")) # pylint:disable=E0602
69 | async def _(event):
70 | if event.fwd_from:
71 | return
72 | result = await borg(functions.help.GetConfigRequest()) # pylint:disable=E0602
73 | result = result.stringify()
74 | logger.info(result) # pylint:disable=E0602
75 | await event.edit("""TeleBot - A Telethon UserBot powered by @UniBorg""")
76 |
--------------------------------------------------------------------------------
/telebot/plugins/mood.py:
--------------------------------------------------------------------------------
1 | # (c)2020 TeleBot
2 | #
3 | # You may not use this plugin without proper authorship and consent from @TeleBotSupport
4 | #
5 | from telethon.tl import functions
6 |
7 | from telebot import ALIVE_NAME, CMD_HELP
8 | from telebot.utils import admin_cmd
9 |
10 | TELENAME = ALIVE_NAME if ALIVE_NAME else "TeleBot"
11 |
12 | # set your mood
13 |
14 |
15 | @telebot.on(admin_cmd(pattern="mood ((.|\n)*)")) # pylint:disable=E0602,W0703
16 | async def _(event):
17 | if event.fwd_from:
18 | return
19 | names = event.pattern_match.group(1)
20 | first_name = f"「{names}」 {ALIVE_NAME}"
21 | last_name = ""
22 | try:
23 | await borg(
24 | functions.account.UpdateProfileRequest( # pylint:disable=E0602
25 | first_name=first_name, last_name=last_name
26 | )
27 | )
28 | await event.edit("Mood set xD")
29 | except Exception as e: # pylint:disable=C0103,W0703
30 | await event.edit(str(e))
31 |
32 |
33 | # reset back
34 |
35 |
36 | @telebot.on(admin_cmd(pattern="resetmood")) # pylint:disable=E0602,W0703
37 | async def _(event):
38 | if event.fwd_from:
39 | return
40 | first_name = f"{ALIVE_NAME}"
41 | last_name = ""
42 | try:
43 | await borg(
44 | functions.account.UpdateProfileRequest( # pylint:disable=E0602
45 | first_name=first_name, last_name=last_name
46 | )
47 | )
48 | await event.edit("Mood reset xD")
49 | except Exception as e: # pylint:disable=C0103,W0703
50 | await event.edit(str(e))
51 |
52 |
53 | CMD_HELP.update(
54 | {
55 | "mood": ".mood \nUse - Sets name to [text] ALIVE_NAME\
56 | .resetmood - revert changes"
57 | }
58 | )
59 |
--------------------------------------------------------------------------------
/telebot/plugins/mtn.py:
--------------------------------------------------------------------------------
1 | """Emoji
2 | Available Commands:
3 | .emoji shrug
4 | .emoji apple
5 | .emoji :/
6 | .emoji -_-"""
7 |
8 |
9 | import asyncio
10 |
11 | from telebot.utils import admin_cmd
12 |
13 |
14 | @telebot.on(admin_cmd(pattern=r"(.*)", outgoing=True))
15 | async def _(event):
16 |
17 | if event.fwd_from:
18 |
19 | return
20 |
21 | animation_interval = 1
22 |
23 | animation_ttl = range(0, 19)
24 |
25 | input_str = event.pattern_match.group(1)
26 |
27 | if input_str == "mtn":
28 |
29 | await event.edit(input_str)
30 |
31 | animation_chars = [
32 | "`Connecting To MTN NG ....`",
33 | "`█ ▇ ▆ ▅ ▄ ▂ ▁`",
34 | "`▒ ▇ ▆ ▅ ▄ ▂ ▁`",
35 | "`▒ ▒ ▆ ▅ ▄ ▂ ▁`",
36 | "`▒ ▒ ▒ ▅ ▄ ▂ ▁`",
37 | "`▒ ▒ ▒ ▒ ▄ ▂ ▁`",
38 | "`▒ ▒ ▒ ▒ ▒ ▂ ▁`",
39 | "`▒ ▒ ▒ ▒ ▒ ▒ ▁`",
40 | "`▒ ▒ ▒ ▒ ▒ ▒ ▒`",
41 | "*Optimising Network...*",
42 | "`▒ ▒ ▒ ▒ ▒ ▒ ▒`",
43 | "`▁ ▒ ▒ ▒ ▒ ▒ ▒`",
44 | "`▁ ▂ ▒ ▒ ▒ ▒ ▒`",
45 | "`▁ ▂ ▄ ▒ ▒ ▒ ▒`",
46 | "`▁ ▂ ▄ ▅ ▒ ▒ ▒`",
47 | "`▁ ▂ ▄ ▅ ▆ ▒ ▒`",
48 | "`▁ ▂ ▄ ▅ ▆ ▇ ▒`",
49 | "`▁ ▂ ▄ ▅ ▆ ▇ █`",
50 | "**MTN Network Boosted....**",
51 | ]
52 |
53 | for i in animation_ttl:
54 |
55 | await asyncio.sleep(animation_interval)
56 |
57 | await event.edit(animation_chars[i % 19])
58 |
--------------------------------------------------------------------------------
/telebot/plugins/mybot/__init__.py:
--------------------------------------------------------------------------------
1 | # TeleBot - UserBot
2 | # Copyright (C) 2020 TeleBot
3 |
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU Affero General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 |
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Affero General Public License for more details.
13 |
14 | # You should have received a copy of the GNU Affero General Public License
15 | # along with this program. If not, see .
16 |
17 | from telebot.plugins import OWNER_ID, TELE_NAME
18 | import time
19 | from datetime import datetime
20 | from telebot.telebotConfig import Var
21 |
22 | # start-other disabled
23 | startotherdis = """
24 | Hi there. I am {}'s bot. Nice to see you here.
25 | """.format(TELE_NAME)
26 |
27 | # start-other enabled
28 | if Var.PMBOT_START_MSSG is None:
29 | MSSG = """
30 | Hi there, I am {}'s personal bot.
31 | You can contact him through me 😌.
32 |
33 | Have a nice time!
34 | """.format(TELE_NAME)
35 | else:
36 | MSSG = Var.PMBOT_START_MSSG
37 | startotherena = MSSG
38 |
39 | # start-owner
40 | startowner = """
41 | Welcome back {}. Choose the options available from below:
42 | """.format(TELE_NAME)
43 |
44 | # for ping
45 |
46 |
47 | def get_readable_time(seconds: int) -> str:
48 | count = 0
49 | ping_time = ""
50 | time_list = []
51 | time_suffix_list = ["s", "m", "h", "days"]
52 |
53 | while count < 4:
54 | count += 1
55 | if count < 3:
56 | remainder, result = divmod(seconds, 60)
57 | else:
58 | remainder, result = divmod(seconds, 24)
59 | if seconds == 0 and remainder == 0:
60 | break
61 | time_list.append(int(result))
62 | seconds = int(remainder)
63 |
64 | for x in range(len(time_list)):
65 | time_list[x] = str(time_list[x]) + time_suffix_list[x]
66 | if len(time_list) == 4:
67 | ping_time += time_list.pop() + ", "
68 | time_list.reverse()
69 | ping_time += ":".join(time_list)
70 | return ping_time
71 |
72 |
73 | xstart = datetime.now()
74 | xend = datetime.now()
75 | ms = (xend - xstart).microseconds / 1000
76 | ping = f"🏓Pong\nPing speed: {ms}"
77 |
--------------------------------------------------------------------------------
/telebot/plugins/mybot/pmbot/README.md:
--------------------------------------------------------------------------------
1 | PM Bot
2 |
--------------------------------------------------------------------------------
/telebot/plugins/mybot/pmbot/incoming.py:
--------------------------------------------------------------------------------
1 | # TeleBot - UserBot
2 | # Copyright (C) 2020 TeleBot
3 |
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU Affero General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 |
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Affero General Public License for more details.
13 |
14 | # You should have received a copy of the GNU Affero General Public License
15 | # along with this program. If not, see .
16 |
17 | # Incoming message checker.
18 | from telebot.plugins.mybot.sql.users_sql import add_user_to_db
19 | from telebot.plugins.mybot.sql.blacklist_sql import check_is_black_list
20 | from telethon import events
21 | from telebot.plugins import OWNER_ID
22 |
23 | # if incoming
24 |
25 |
26 | @tgbot.on(events.NewMessage(func=lambda e: e.is_private))
27 | async def one_new_mssg(event):
28 | incoming = event.raw_text
29 | who = event.sender_id
30 | if check_is_black_list(who):
31 | return
32 | if incoming.startswith("/"):
33 | pass
34 | elif who == OWNER_ID:
35 | return
36 | else:
37 | await event.get_sender()
38 | event.chat_id
39 | to = await event.forward_to(OWNER_ID)
40 | add_user_to_db(to.id, who, event.id)
41 |
--------------------------------------------------------------------------------
/telebot/plugins/mybot/pmbot/outgoing.py:
--------------------------------------------------------------------------------
1 | # by @StarkGang 😋
2 |
3 | from telebot.plugins.mybot.sql.users_sql import get_user_id
4 | from telethon import events
5 | from telethon.utils import pack_bot_file_id
6 | from telebot.plugins import OWNER_ID
7 |
8 | # outgoing, aka, replying to mssg
9 |
10 |
11 | @tgbot.on(events.NewMessage(func=lambda e: e.is_private))
12 | async def on_out_mssg(event):
13 | to_send = await event.get_reply_message()
14 | if to_send is None:
15 | return
16 | to_send.id
17 | send_mssg = event.raw_text
18 | who = event.sender_id
19 | user_id, reply_message_id = get_user_id(to_send.id)
20 | if who == OWNER_ID:
21 | if send_mssg.startswith("/"):
22 | return
23 | if event.text is not None and event.media:
24 | # if sending media
25 | bot_api_file_id = pack_bot_file_id(event.media)
26 | await tgbot.send_file(user_id, file=bot_api_file_id, caption=event.text, reply_to=reply_message_id)
27 | else:
28 | await tgbot.send_message(user_id, send_mssg, reply_to=reply_message_id,)
29 |
--------------------------------------------------------------------------------
/telebot/plugins/mybot/pmbot/stats_bot.py:
--------------------------------------------------------------------------------
1 | # TeleBot - UserBot
2 | # Copyright (C) 2020 TeleBot
3 |
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU Affero General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 |
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Affero General Public License for more details.
13 |
14 | # You should have received a copy of the GNU Affero General Public License
15 | # along with this program. If not, see .
16 |
17 | from telebot.plugins.mybot.sql.blacklist_sql import all_bl_users
18 | from telebot.plugins.mybot.sql.userbase_sql import full_userbase
19 | from telethon import events
20 | from telebot.plugins import OWNER_ID
21 |
22 |
23 | @tgbot.on(events.NewMessage(pattern="^/stats", from_users=OWNER_ID))
24 | async def tele(event):
25 | allu = len(full_userbase())
26 | blu = len(all_bl_users())
27 | await tgbot.send_message(event.chat_id,
28 | "Here is the stats for your bot:\nTotal Users = {}\nBlacklisted Users = {}".format(allu, blu)
29 | )
30 |
--------------------------------------------------------------------------------
/telebot/plugins/mybot/sql/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | # (c) Shrimadhav U K
4 |
5 | """ init SQL """
6 |
7 | import os
8 | from sqlalchemy import create_engine
9 | from sqlalchemy.ext.declarative import declarative_base
10 | from sqlalchemy.orm import sessionmaker, scoped_session
11 |
12 | # the secret configuration specific things
13 | from telebot.telebotConfig import Var
14 |
15 |
16 | def start() -> scoped_session:
17 | engine = create_engine(Var.DB_URI)
18 | BASE.metadata.bind = engine
19 | BASE.metadata.create_all(engine)
20 | return scoped_session(sessionmaker(bind=engine, autoflush=False))
21 |
22 |
23 | try:
24 | BASE = declarative_base()
25 | SESSION = start()
26 | except AttributeError as e:
27 | # this is a dirty way for the work-around required for #23
28 | print("DB_URI is not configured. Features depending on the database might have issues.")
29 | print(str(e))
30 |
--------------------------------------------------------------------------------
/telebot/plugins/mybot/sql/blacklist_sql.py:
--------------------------------------------------------------------------------
1 | # (c) @SpEcHIDe
2 |
3 | from sqlalchemy import (
4 | Column,
5 | String
6 | )
7 | from . import (
8 | SESSION,
9 | BASE
10 | )
11 |
12 |
13 | class blacklist(BASE):
14 | __tablename__ = "blacklist"
15 | chat_id = Column(String(14), primary_key=True)
16 | # reason = Column(UnicodeText)
17 |
18 | def __init__(self, chat_id):
19 | self.chat_id = int(chat_id)
20 | # self.reason = reason
21 |
22 | def __repr__(self):
23 | return "" % self.chat_id
24 |
25 |
26 | blacklist.__table__.create(checkfirst=True)
27 |
28 |
29 | def add_user_to_bl(chat_id: int):
30 | """Adding the user to the blacklist"""
31 | __user = blacklist(str(chat_id))
32 | SESSION.add(__user)
33 | SESSION.commit()
34 |
35 |
36 | def check_is_black_list(chat_id):
37 | """check if blacklisted"""
38 | try:
39 | return SESSION.query(blacklist).filter(
40 | blacklist.chat_id == str(chat_id)).one()
41 | except BaseException:
42 | return None
43 | finally:
44 | SESSION.close()
45 |
46 |
47 | def rem_user_from_bl(chat_id):
48 | """remove from bl"""
49 | __user = SESSION.query(blacklist).get(str(chat_id))
50 | if __user:
51 | SESSION.delete(__user)
52 | SESSION.commit()
53 |
54 |
55 | def all_bl_users():
56 | """get all bl users"""
57 | __user = SESSION.query(blacklist).all()
58 | SESSION.close()
59 | return __user
60 |
--------------------------------------------------------------------------------
/telebot/plugins/mybot/sql/userbase_sql.py:
--------------------------------------------------------------------------------
1 | # (c) @its_xditya
2 | from sqlalchemy import Column, String
3 | from . import BASE, SESSION
4 |
5 |
6 | class userbase(BASE):
7 | __tablename__ = "UserBase"
8 | chat_id = Column(String(14), primary_key=True)
9 |
10 | def __init__(self, chat_id):
11 | self.chat_id = chat_id
12 |
13 |
14 | userbase.__table__.create(checkfirst=True)
15 |
16 |
17 | def add_to_userbase(chat_id: int):
18 | __user = userbase(str(chat_id))
19 | SESSION.add(__user)
20 | SESSION.commit()
21 |
22 |
23 | def full_userbase():
24 | users = SESSION.query(userbase).all()
25 | SESSION.close()
26 | return users
27 |
28 |
29 | def present_in_userbase(chat_id):
30 | try:
31 | return SESSION.query(userbase).filter(
32 | userbase.chat_id == str(chat_id)).one()
33 | except BaseException:
34 | return None
35 | finally:
36 | SESSION.close()
37 |
--------------------------------------------------------------------------------
/telebot/plugins/mybot/sql/users_sql.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | # (c) Shrimadhav U K
4 |
5 | """ users Table """
6 |
7 | from sqlalchemy import (
8 | Column,
9 | String,
10 | Integer
11 | )
12 | from . import (
13 | SESSION,
14 | BASE
15 | )
16 |
17 |
18 | class Users(BASE):
19 | """ Table to store the received messages """
20 | __tablename__ = "users"
21 | message_id = Column(Integer, primary_key=True)
22 | chat_id = Column(String(14))
23 | um_id = Column(Integer)
24 |
25 | def __init__(self, message_id, chat_id, um_id):
26 | self.message_id = message_id
27 | self.chat_id = str(chat_id) # ensure string
28 | self.um_id = um_id
29 |
30 | def __repr__(self):
31 | return "" % self.chat_id
32 |
33 |
34 | Users.__table__.create(checkfirst=True)
35 |
36 |
37 | def add_user_to_db(message_id: int, chat_id: int, um_id: int):
38 | """ add the message to the table """
39 | __user = Users(message_id, str(chat_id), um_id)
40 | SESSION.add(__user)
41 | SESSION.commit()
42 |
43 |
44 | def get_user_id(message_id: int):
45 | """ get the user_id from the message_id """
46 | try:
47 | s__ = SESSION.query(Users).get(str(message_id))
48 | return int(s__.chat_id), s__.um_id
49 | finally:
50 | SESSION.close()
51 |
52 |
53 | def all_users():
54 | """get all bot users"""
55 | tele = SESSION.query(Users).all()
56 | SESSION.close()
57 | return tele
58 |
--------------------------------------------------------------------------------
/telebot/plugins/nakal.py:
--------------------------------------------------------------------------------
1 | """Emoji
2 |
3 | Available Commands:
4 |
5 | .emoji shrug
6 |
7 | .emoji apple
8 |
9 | .emoji :/
10 |
11 | .emoji -_-"""
12 |
13 | import asyncio
14 |
15 | from telebot.utils import admin_cmd
16 |
17 |
18 | @telebot.on(admin_cmd(pattern=r"(.*)", outgoing=True))
19 | async def _(event):
20 |
21 | if event.fwd_from:
22 |
23 | return
24 |
25 | animation_interval = 0.5
26 |
27 | animation_ttl = range(0, 11)
28 |
29 | input_str = event.pattern_match.group(1)
30 |
31 | if input_str == "nakal":
32 |
33 | await event.edit(input_str)
34 |
35 | animation_chars = [
36 | "`⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀⢠⠞⠉⠙⠲⡀⠀\n ⠀⣴⠿⠏⠀⠀⠀⠀⠀ ⢳⡀⠀⡏⠀⠀⠀ ⠀⢷\n⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀⢸⠀⠀⠀ ⠀ ⡇\n⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿ ⣸ Nikal ⡇\n ⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀ ⣿ ⢹⠀ ⡇\n ⠙⢿⣯⠄⠀⠀⠀__⠀⠀⡿ ⠀⡇⠀⠀⠀⠀ ⡼\n⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀ ⠘⠤⣄⣠⠞⠀\n⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀\n⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀\n⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀ ⠀⣄⢸⠀⠀⠀⠀⠀⠀`",
37 | "`⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀⢠⠞⠉⠙⠲⡀⠀\n ⠀⣴⠿⠏⠀⠀⠀⠀⠀ ⠀⢳⡀⠀⡏⠀⠀⠀ ⠀⢷\n⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀⢸⠀⠀⠀ ⡇\n⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿ ⣸ Lavde ⡇\n ⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀ ⣿ ⢹⠀ ⡇\n ⠙⢿⣯⠄⠀⠀|__|⠀⠀⡿ ⠀⡇⠀⠀⠀⠀ ⡼\n⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀ ⠘⠤⣄⣠⠞⠀\n⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀\n⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀\n⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀ ⠀⣄⢸⠀⠀⠀⠀⠀⠀`",
38 | "`⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀⢠⠞⠉⠙⠲⡀⠀\n ⠀⣴⠿⠏⠀⠀ ⠀⢳⡀⠀⡏⠀⠀ ⠀⢷\n⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀⢸⠀⠀⠀⠀ ⡇\n⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿ ⣸ Pehli ⡇\n ⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀ ⣿ ⢹⠀ ⡇\n ⠙⢿⣯⠄⠀⠀(P)⠀⠀⡿ ⠀⡇⠀⠀⠀⠀ ⡼\n⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀ ⠘⠤⣄⣠⠞⠀\n⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀\n⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀\n⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀ ⠀⣄⢸⠀⠀⠀⠀⠀⠀`",
39 | "`⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀⢠⠞⠉⠙⠲⡀⠀\n ⠀⣴⠿⠏⠀⠀ ⠀⢳⡀⠀⡏⠀⠀ ⠀⢷\n⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀⢸⠀ ⠀ ⡇\n⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿ ⣸ Fursat ⡇\n ⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀ ⣿ ⢹⠀ ⡇\n ⠙⢿⣯⠄⠀⠀⠀__ ⠀⠀⡿ ⠀⡇⠀⠀⠀⠀ ⡼\n⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀ ⠘⠤⣄⣠⠞⠀\n⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀\n⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀\n⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀ ⠀⣄⢸⠀⠀⠀⠀⠀⠀`",
40 | "`⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀⢠⠞⠉⠙⠲⡀⠀\n ⠀⣴⠿⠏⠀⠀⠀⠀⠀ ⢳⡀⠀⡏⠀⠀ ⠀⢷\n⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀⢸⠀⠀ ⠀ ⡇\n⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿ ⣸ Meeee ⡇\n ⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀ ⣿ ⢹⠀ ⡇\n ⠙⢿⣯⠄⠀⠀|__| ⠀⡿ ⠀⡇⠀⠀⠀⠀ ⡼\n⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀ ⠘⠤⣄⣠⠞⠀\n⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀\n⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀\n⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀ ⠀⣄⢸⠀⠀⠀⠀⠀⠀`",
41 | "`⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀⢠⠞⠉⠙⠲⡀⠀\n ⠀⣴⠿⠏⠀⠀⠀⠀⠀ ⠀⢳⡀⠀⡏⠀⠀ ⠀⢷\n⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀⢸⠀ ⠀ ⡇\n⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿ ⣸ Nikal ⡇\n ⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀ ⣿ ⢹⠀ ⡇\n ⠙⢿⣯⠄⠀⠀lodu⠀⠀⡿ ⠀⡇⠀⠀⠀⠀ ⡼\n⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀ ⠘⠤⣄⣠⠞⠀\n⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀\n⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀\n⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀ ⠀⣄⢸⠀⠀⠀⠀⠀⠀`",
42 | ]
43 |
44 | for i in animation_ttl:
45 |
46 | await asyncio.sleep(animation_interval)
47 |
48 | await event.edit(animation_chars[i % 11])
49 |
--------------------------------------------------------------------------------
/telebot/plugins/ncode.py:
--------------------------------------------------------------------------------
1 | # Credits @buddhhu
2 | # This software is a part of https://github.com/buddhhu/Plus
3 | #
4 | # Ported to TeleBot by @its_xditya
5 | #
6 |
7 | import os
8 |
9 | import pygments
10 | from pygments.formatters import ImageFormatter
11 | from pygments.lexers import Python3Lexer
12 |
13 | from telebot import CMD_HELP
14 | from telebot.utils import admin_cmd, sudo_cmd
15 |
16 |
17 | @telebot.on(admin_cmd(pattern=r"ncode"))
18 | @telebot.on(sudo_cmd(pattern=r"ncode", allow_sudo=True))
19 | async def coder_print(event):
20 | a = await event.client.download_media(
21 | await event.get_reply_message(), Var.TEMP_DOWNLOAD_DIRECTORY
22 | )
23 | s = open(a, "r")
24 | c = s.read()
25 | s.close()
26 | pygments.highlight(
27 | f"{c}",
28 | Python3Lexer(),
29 | ImageFormatter(font_name="DejaVu Sans Mono", line_numbers=True),
30 | "result.png",
31 | )
32 | res = await event.client.send_message(
33 | event.chat_id,
34 | "**Pasting this code on my page...**",
35 | reply_to=event.reply_to_msg_id,
36 | )
37 | await event.client.send_file(
38 | event.chat_id, "result.png", force_document=True, reply_to=event.reply_to_msg_id
39 | )
40 | # await event.client.send_file(event.chat_id, "resuly.png",
41 | # force_document=False, reply_to=event.reply_to_msg_id)
42 | await res.delete()
43 | await event.delete()
44 | os.remove(a)
45 | os.remove("result.png")
46 |
47 |
48 | CMD_HELP.update(
49 | {"ncode": ".ncode \nUse - Paste the contents of file and send as pic."}
50 | )
51 |
--------------------------------------------------------------------------------
/telebot/plugins/np.py:
--------------------------------------------------------------------------------
1 | """Emoji
2 | Available Commands:
3 | .np
4 | """
5 |
6 |
7 | import asyncio
8 |
9 | from telebot.utils import admin_cmd
10 |
11 |
12 | @telebot.on(admin_cmd(pattern="np"))
13 | async def _(event):
14 | if event.fwd_from:
15 | return
16 | animation_interval = 0.1
17 | animation_ttl = range(0, 36)
18 | # input_str = event.pattern_match.group(1)
19 | # if input_str == "np":
20 | await event.edit("np")
21 | animation_chars = [
22 | "No",
23 | "Problem",
24 | "Sar 😇",
25 | "No Problem Sar 😇",
26 | "No Problem Sar 😇. Jao",
27 | "No Problem Sar 😇. Jao gand",
28 | "No Problem Sar 😇. Jao gand Marao",
29 | ]
30 |
31 | for i in animation_ttl:
32 |
33 | await asyncio.sleep(animation_interval)
34 | await event.edit(animation_chars[i % 18])
35 |
--------------------------------------------------------------------------------
/telebot/plugins/ocr.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | import requests
4 |
5 | from telebot import CMD_HELP, OCR_SPACE_API_KEY, TEMP_DOWNLOAD_DIRECTORY, bot
6 | from telebot.utils import admin_cmd
7 |
8 |
9 | async def ocr_space_file(
10 | filename, overlay=False, api_key=OCR_SPACE_API_KEY, language="eng"
11 | ):
12 | """OCR.space API request with local file.
13 | Python3.5 - not tested on 2.7
14 | :param filename: Your file path & name.
15 | :param overlay: Is OCR.space overlay required in your response.
16 | Defaults to False.
17 | :param api_key: OCR.space API key.
18 | Defaults to 'helloworld'.
19 | :param language: Language code to be used in OCR.
20 | List of available language codes can be found on https://ocr.space/OCRAPI
21 | Defaults to 'en'.
22 | :return: Result in JSON format.
23 | """
24 |
25 | payload = {
26 | "isOverlayRequired": overlay,
27 | "apikey": api_key,
28 | "language": language,
29 | }
30 | with open(filename, "rb") as f:
31 | r = requests.post(
32 | "https://api.ocr.space/parse/image",
33 | files={filename: f},
34 | data=payload,
35 | )
36 | return r.json()
37 |
38 |
39 | @telebot.on(admin_cmd(pattern="ocr(?: |$)(.*)", outgoing=True))
40 | @telebot.on(sudo_cmd(pattern="ocr(?: |$)(.*)", allow_sudo=True))
41 | async def ocr(event):
42 | await eor(event, "`Reading...`")
43 | if not os.path.isdir(TEMP_DOWNLOAD_DIRECTORY):
44 | os.makedirs(TEMP_DOWNLOAD_DIRECTORY)
45 | lang_code = event.pattern_match.group(1)
46 | downloaded_file_name = await bot.download_media(
47 | await event.get_reply_message(), TEMP_DOWNLOAD_DIRECTORY
48 | )
49 | test_file = await ocr_space_file(filename=downloaded_file_name, language=lang_code)
50 | try:
51 | ParsedText = test_file["ParsedResults"][0]["ParsedText"]
52 | except BaseException:
53 | await eor(event, "`Couldn't read it.`\nTry using `.ocr eng`")
54 | else:
55 | await eor(event, f"`Here's what I could read from it:`\n\n{ParsedText}")
56 | os.remove(downloaded_file_name)
57 |
58 |
59 | CMD_HELP.update(
60 | {
61 | "ocr": ".ocr \nUsage: Reply to an image or sticker to extract text from it.\n\nGet language codes from [here](https://ocr.space/ocrapi)"
62 | }
63 | )
64 |
--------------------------------------------------------------------------------
/telebot/plugins/ok.py:
--------------------------------------------------------------------------------
1 | """Emoji
2 |
3 | Available Commands:
4 |
5 | .ok"""
6 |
7 |
8 | import asyncio
9 |
10 | from telebot.utils import admin_cmd
11 |
12 |
13 | @telebot.on(admin_cmd(pattern="(.*)"))
14 | async def _(event):
15 | if event.fwd_from:
16 | return
17 | animation_interval = 0.00001
18 | animation_ttl = range(0, 90)
19 | input_str = event.pattern_match.group(1)
20 | if input_str == "ok":
21 | await event.edit(input_str)
22 | animation_chars = [
23 | "F",
24 | "U",
25 | "C",
26 | "K",
27 | "Y",
28 | "O",
29 | "U",
30 | "B",
31 | "C",
32 | "FK",
33 | "UU",
34 | "FCUK",
35 | "UOY",
36 | "C",
37 | "F",
38 | "Y",
39 | "F",
40 | "Ok Sar 😇",
41 | ]
42 |
43 | for i in animation_ttl:
44 |
45 | await asyncio.sleep(animation_interval)
46 | await event.edit(animation_chars[i % 18])
47 |
--------------------------------------------------------------------------------
/telebot/plugins/online.py:
--------------------------------------------------------------------------------
1 | # Copyright TeleBot
2 | # For @TeleBotHelp coded by @xditya
3 | # Kangers keep credits else I'll take down 🧐
4 |
5 | import random
6 | import sys
7 |
8 | from telethon import version
9 |
10 | from telebot import ALIVE_NAME
11 | from telebot.utils import admin_cmd
12 |
13 | DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "TeleBot User"
14 |
15 | ONLINESTR = [
16 | "█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█ \n█░╦─╦╔╗╦─╔╗╔╗╔╦╗╔╗░█ █░║║║╠─║─║─║║║║║╠─░█ \n█░╚╩╝╚╝╚╝╚╝╚╝╩─╩╚╝░█ \n█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█ \n\n**TeleBot is online.**\n\n**All systems functioning normally !** \n\n**Bot by** [Aditya 🇮🇳](tg://user?id=719195224) \n\n**More help -** @TeleBotHelpChat \n\n [🚧 GitHub Repository 🚧](https://github.com/xditya/TeleBot)",
17 | f"╦─╦╔╗╦─╔╗╔╗╔╦╗╔╗\n║║║╠─║─║─║║║║║╠─\n╚╩╝╚╝╚╝╚╝╚╝╩─╩╚╝\n **Welcome to TeleBot**\n\n**Hey master! I'm alive. All systems online and functioning normally ✅**\n\n**✔️ Telethon version:** `{version.__version__}` \n\n**✔️ Python:** `{sys.version}` \n\n✔️ More info: @TeleBotHelpChat \n\n✔️ Created by: [Aditya 🇮🇳](tg://user?id=719195224) \n\n**✔️ Database status:** All ok 👌 \n\n**✔️ My master:** {DEFAULTUSER} \n\n [🌟 Github repository 🌟](https://github.com/xditya/TeleBot)",
18 | ]
19 |
20 |
21 | @telebot.on(admin_cmd(outgoing=True, pattern="online"))
22 | @telebot.on(sudo_cmd(allow_sudo=True, pattern="online"))
23 | async def online(event):
24 | """ Greet everyone! """
25 | if not event.text[0].isalpha() and event.text[0] not in ("/", "#", "@", "!"):
26 | await eor(event, random.choice(ONLINESTR))
27 |
--------------------------------------------------------------------------------
/telebot/plugins/padmin.py:
--------------------------------------------------------------------------------
1 | """Emoji
2 |
3 | Available Commands:
4 |
5 | .padmin"""
6 |
7 |
8 | import asyncio
9 |
10 | from telebot.utils import admin_cmd
11 |
12 |
13 | @telebot.on(admin_cmd(pattern=r"(.*)", outgoing=True))
14 | async def _(event):
15 |
16 | if event.fwd_from:
17 |
18 | return
19 |
20 | animation_interval = 1
21 |
22 | animation_ttl = range(0, 20)
23 |
24 | input_str = event.pattern_match.group(1)
25 |
26 | if input_str == "padmin":
27 |
28 | await event.edit(input_str)
29 |
30 | animation_chars = [
31 | "**Promoting User As Admin...**",
32 | "**Enabling All Permissions To User...**",
33 | "**(1) Send Messages: ☑️**",
34 | "**(1) Send Messages: ✅**",
35 | "**(2) Send Media: ☑️**",
36 | "**(2) Send Media: ✅**",
37 | "**(3) Send Stickers & GIFs: ☑️**",
38 | "**(3) Send Stickers & GIFs: ✅**",
39 | "**(4) Send Polls: ☑️**",
40 | "**(4) Send Polls: ✅**",
41 | "**(5) Embed Links: ☑️**",
42 | "**(5) Embed Links: ✅**",
43 | "**(6) Add Users: ☑️**",
44 | "**(6) Add Users: ✅**",
45 | "**(7) Pin Messages: ☑️**",
46 | "**(7) Pin Messages: ✅**",
47 | "**(8) Change Chat Info: ☑️**",
48 | "**(8) Change Chat Info: ✅**",
49 | "**Permission Granted Successfully**",
50 | "**pRoMooTeD SuCcEsSfUlLy**",
51 | ]
52 |
53 | for i in animation_ttl:
54 |
55 | await asyncio.sleep(animation_interval)
56 |
57 | await event.edit(animation_chars[i % 20])
58 |
--------------------------------------------------------------------------------
/telebot/plugins/pastebin.py:
--------------------------------------------------------------------------------
1 | """IX.IO pastebin like site
2 | Syntax: .paste"""
3 | import os
4 | from datetime import datetime
5 |
6 | import requests
7 |
8 | from telebot import CMD_HELP
9 | from telebot.utils import admin_cmd
10 |
11 |
12 | def progress(current, total):
13 | logger.info(
14 | "Downloaded {} of {}\nCompleted {}".format(
15 | current, total, (current / total) * 100
16 | )
17 | )
18 |
19 |
20 | @telebot.on(admin_cmd(pattern="paste ?(.*)"))
21 | @telebot.on(sudo_cmd(pattern="paste ?(.*)", allow_sudo=True))
22 | async def _(event):
23 | if event.fwd_from:
24 | return
25 | start = datetime.now()
26 | if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
27 | os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
28 | input_str = event.pattern_match.group(1)
29 | message = "SYNTAX: `.paste `"
30 | if input_str:
31 | message = input_str
32 | elif event.reply_to_msg_id:
33 | previous_message = await event.get_reply_message()
34 | if previous_message.media:
35 | downloaded_file_name = await borg.download_media(
36 | previous_message,
37 | Config.TMP_DOWNLOAD_DIRECTORY,
38 | progress_callback=progress,
39 | )
40 | m_list = None
41 | with open(downloaded_file_name, "rb") as fd:
42 | m_list = fd.readlines()
43 | message = ""
44 | for m in m_list:
45 | message += m.decode("UTF-8") + "\r\n"
46 | os.remove(downloaded_file_name)
47 | else:
48 | message = previous_message.message
49 | else:
50 | message = "SYNTAX: `.paste `"
51 | url = "https://del.dog/documents"
52 | r = requests.post(url, data=message.encode("UTF-8")).json()
53 | url = f"https://del.dog/{r['key']}"
54 | end = datetime.now()
55 | ms = (end - start).seconds
56 | if r["isUrl"]:
57 | nurl = f"https://del.dog/v/{r['key']}"
58 | await eor(
59 | event,
60 | "Dogged to [dogbin]({}) in {} seconds. GoTo Original URL: {}".format(
61 | url, ms, nurl
62 | ),
63 | )
64 | else:
65 | await eor(event, "Dogged to [dogbin]({}) in {} seconds".format(url, ms))
66 |
67 |
68 | CMD_HELP.update(
69 | {"pastebin": ".paste \nUse - Paste it to pastebin."}
70 | )
71 |
--------------------------------------------------------------------------------
/telebot/plugins/pin_message.py:
--------------------------------------------------------------------------------
1 | """Pins the replied message
2 | Syntax: .cpin [LOUD]"""
3 | from telethon.tl import functions
4 |
5 | from telebot import CMD_HELP
6 | from telebot.utils import admin_cmd
7 |
8 |
9 | @telebot.on(admin_cmd(pattern="cpin ?(.*)"))
10 | @telebot.on(sudo_cmd(pattern="cpin ?(.*)", allow_sudo=True))
11 | async def _(event):
12 | if event.fwd_from:
13 | return
14 | silent = True
15 | input_str = event.pattern_match.group(1)
16 | if input_str:
17 | silent = False
18 | if event.message.reply_to_msg_id is not None:
19 | message_id = event.message.reply_to_msg_id
20 | try:
21 | await borg(
22 | functions.messages.UpdatePinnedMessageRequest(
23 | event.chat_id, message_id, silent
24 | )
25 | )
26 | except Exception as e:
27 | await eor(event, str(e))
28 | else:
29 | await event.delete()
30 | else:
31 | await eor(event, "Reply to a message to pin the message in this Channel.")
32 |
33 |
34 | CMD_HELP.update({"pin_message": ".cpin \nUse - Pin the message."})
35 |
--------------------------------------------------------------------------------
/telebot/plugins/ping.py:
--------------------------------------------------------------------------------
1 | # special thanks to Sur_vivor
2 | # Re-written for TeleBot by @its_xditya
3 |
4 | import time
5 | from datetime import datetime
6 |
7 | from telebot import CMD_HELP
8 | from telebot.__init__ import StartTime
9 | from telebot.plugins import OWNER_ID, TELE_NAME
10 |
11 |
12 | def get_readable_time(seconds: int) -> str:
13 | count = 0
14 | ping_time = ""
15 | time_list = []
16 | time_suffix_list = ["s", "m", "h", "days"]
17 |
18 | while count < 4:
19 | count += 1
20 | if count < 3:
21 | remainder, result = divmod(seconds, 60)
22 | else:
23 | remainder, result = divmod(seconds, 24)
24 | if seconds == 0 and remainder == 0:
25 | break
26 | time_list.append(int(result))
27 | seconds = int(remainder)
28 |
29 | for x in range(len(time_list)):
30 | time_list[x] = str(time_list[x]) + time_suffix_list[x]
31 | if len(time_list) == 4:
32 | ping_time += time_list.pop() + ", "
33 |
34 | time_list.reverse()
35 | ping_time += ":".join(time_list)
36 |
37 | return ping_time
38 |
39 |
40 | # @command(pattern="^.ping$")
41 |
42 |
43 | @telebot.on(admin_cmd(pattern="ping$"))
44 | @telebot.on(sudo_cmd(pattern="ping$", allow_sudo=True))
45 | async def _(event):
46 | if event.fwd_from:
47 | return
48 | start = datetime.now()
49 | x = await eor(event, "⛝ Pong! ⛝")
50 | end = datetime.now()
51 | ms = (end - start).microseconds / 1000
52 | uptime = get_readable_time((time.time() - StartTime))
53 | await x.edit(
54 | f"⪼ **Ping speed** : `{ms}`\n⪼ **Uptime** : `{uptime}`\n⪼ **Owner** : [{TELE_NAME}](tg://user?id={OWNER_ID})"
55 | )
56 |
57 |
58 | CMD_HELP.update({"ping": ".ping\nUse - See the ping stats and uptime of userbot."})
59 |
--------------------------------------------------------------------------------
/telebot/plugins/pmto.py:
--------------------------------------------------------------------------------
1 | # By @HeisenbergTheDanger for TeleBot
2 | # @its_xditya
3 | # Kangers keep credits
4 |
5 | from telebot import CMD_HELP
6 | from telebot.utils import admin_cmd
7 |
8 |
9 | @telebot.on(admin_cmd(pattern="pmto ?(.*)"))
10 | async def pmto(event):
11 | a = event.pattern_match.group(1)
12 | b = a.split(" ")
13 | chat_id = b[0]
14 | try:
15 | chat_id = int(chat_id)
16 | except BaseException:
17 | pass
18 | msg = ""
19 | for i in b[1:]:
20 | msg += i + " "
21 | if msg == "":
22 | return
23 | try:
24 | await borg.send_message(chat_id, msg)
25 | await event.edit("Message sent!")
26 | except BaseException:
27 | await event.edit("Something went wrong.")
28 |
29 |
30 | CMD_HELP.update({"pmto": ".pmto "})
31 |
--------------------------------------------------------------------------------
/telebot/plugins/power_tools.py:
--------------------------------------------------------------------------------
1 | """Restart or Terminate the bot from any chat
2 | Available Commands:
3 | .restart
4 | .shutdown"""
5 | # This Source Code Form is subject to the terms of the GNU
6 | # General Public License, v.3.0. If a copy of the GPL was not distributed with this
7 | # file, You can obtain one at https://www.gnu.org/licenses/gpl-3.0.en.html
8 | import os
9 | import sys
10 |
11 | from telebot import CMD_HELP, CMD_HNDLR
12 | from telebot.utils import admin_cmd
13 |
14 |
15 | @telebot.on(admin_cmd(pattern="restart"))
16 | async def _(event):
17 | if event.fwd_from:
18 | return
19 | # await asyncio.sleep(2)
20 | # await event.edit("Restarting \n□□□□□□□□□□")
21 | # await asyncio.sleep(2)
22 | # await event.edit(f"Restarting \n■■■■□□□□□□ ")
23 | # await asyncio.sleep(2)
24 | # await event.edit(f"Restarting \n■■■■■■■■□□ ")
25 | # await asyncio.sleep(2)
26 | # await event.edit(f"Done! \n■■■■■■■■■■ ")
27 | # await asyncio.sleep(2)
28 | await event.edit(
29 | f"__TeleBot is Restarting...__\nPlease give it **a minute or two** and then use `{CMD_HNDLR}alive`! "
30 | )
31 | await borg.disconnect()
32 | # https://archive.is/im3rt
33 | os.execl(sys.executable, sys.executable, *sys.argv)
34 | # You probably don't need it but whatever
35 | quit()
36 |
37 |
38 | @telebot.on(admin_cmd(pattern="shutdown"))
39 | async def _(event):
40 | if event.fwd_from:
41 | return
42 | await event.edit(
43 | "TeleBot is turning off... Manually turn me on later, from heroku."
44 | )
45 | await borg.disconnect()
46 |
47 |
48 | CMD_HELP.update(
49 | {
50 | "power_tools": ".restart\nUse - Restart the bot.\
51 | \n\n.shutdown\nUse - shutdown the bot."
52 | }
53 | )
54 |
--------------------------------------------------------------------------------
/telebot/plugins/ppgrab.py:
--------------------------------------------------------------------------------
1 | """Type `.poto` for get **All profile pics of that User**
2 | \n Or type `.poto (number)` to get the **desired number of photo of a User** .
3 | """
4 |
5 | import logging
6 |
7 | from uniborg.util import admin_cmd
8 |
9 | from telebot import CMD_HELP
10 |
11 | logger = logging.getLogger(__name__)
12 |
13 |
14 | if 1 == 1:
15 | name = "Profile Photos"
16 | client = borg
17 |
18 | @telebot.on(admin_cmd(pattern="poto(.*)"))
19 | @telebot.on(sudo_cmd(pattern="poto(.*)", allow_sudo=True))
20 | async def potocmd(event):
21 | """Gets the profile photos of replied users, channels or chats"""
22 | id = "".join(event.raw_text.split(maxsplit=2)[1:])
23 | user = await event.get_reply_message()
24 | chat = event.input_chat
25 | if user:
26 | photos = await event.client.get_profile_photos(user.sender)
27 | else:
28 | photos = await event.client.get_profile_photos(chat)
29 | if id.strip() == "":
30 | try:
31 | await event.client.send_file(event.chat_id, photos)
32 | except a:
33 | photo = await event.client.download_profile_photo(chat)
34 | await borg.send_file(event.chat_id, photo)
35 | else:
36 | try:
37 | id = int(id)
38 | if id <= 0:
39 | await eor(event, "`ID number you entered is invalid`")
40 | return
41 | except BaseException:
42 | await eor(event, "`Are you Comedy Me ?`")
43 | return
44 | if int(id) <= (len(photos)):
45 | send_photos = await event.client.download_media(photos[id - 1])
46 | await borg.send_file(event.chat_id, send_photos)
47 | else:
48 | await eor(event, "`That user has no photos 🙄`")
49 | return
50 |
51 |
52 | CMD_HELP.update(
53 | {
54 | "ppgrab": ".poto \nUse - get the persons profile pic(s)."
55 | }
56 | )
57 |
--------------------------------------------------------------------------------
/telebot/plugins/quotly.py:
--------------------------------------------------------------------------------
1 | """QuotLy: Avaible commands: .qbot
2 | """
3 | from telethon import events
4 | from telethon.errors.rpcerrorlist import YouBlockedUserError
5 | from uniborg.util import admin_cmd
6 |
7 | from telebot import CMD_HELP
8 |
9 |
10 | @telebot.on(admin_cmd(pattern="qbot ?(.*)"))
11 | @telebot.on(sudo_cmd(pattern="qbot ?(.*)", allow_sudo=True))
12 | async def _(event):
13 | if event.fwd_from:
14 | return
15 | if not event.reply_to_msg_id:
16 | await eor(event, "```Reply to any user message.```")
17 | return
18 | reply_message = await event.get_reply_message()
19 | if not reply_message.text:
20 | await eor(event, "```Reply to text message```")
21 | return
22 | chat = "@QuotLyBot"
23 | reply_message.sender
24 | if reply_message.sender.bot:
25 | await eor(event, "```Reply to actual users message.```")
26 | return
27 | await eor(event, "```Making a Quote```")
28 | async with event.client.conversation(chat) as conv:
29 | try:
30 | response = conv.wait_event(
31 | events.NewMessage(incoming=True, from_users=1031952739)
32 | )
33 | await event.client.forward_messages(chat, reply_message)
34 | response = await response
35 | except YouBlockedUserError:
36 | await event.reply("```Please unblock me (@QuotLyBot) u Nigga```")
37 | return
38 | if response.text.startswith("Hi!"):
39 | await eor(
40 | event,
41 | "```Can you kindly disable your forward privacy settings for good?```",
42 | )
43 | else:
44 | await event.delete()
45 | await event.client.send_message(event.chat_id, response.message)
46 |
47 |
48 | CMD_HELP.update({"quotly": ".qbot \nUse - To make a quote."})
49 |
--------------------------------------------------------------------------------
/telebot/plugins/randomsticker.py:
--------------------------------------------------------------------------------
1 | # This Source Code Form is subject to the terms of the Mozilla Public
2 | # License, v. 2.0. If a copy of the MPL was not distributed with this
3 | # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 |
5 | """ Command: .dab , .brain
6 |
7 | credit: lejend @r4v4n4"""
8 |
9 | import random
10 |
11 | from telethon import functions, types, utils
12 |
13 | from telebot import CMD_HELP
14 | from telebot.utils import admin_cmd
15 |
16 |
17 | def choser(cmd, pack, blacklist=None):
18 | if blacklist is None:
19 | blacklist = {}
20 | docs = None
21 |
22 | @telebot.on(admin_cmd(pattern=rf"{cmd}", outgoing=True))
23 | async def handler(event):
24 | await event.delete()
25 |
26 | nonlocal docs
27 | if docs is None:
28 | docs = [
29 | utils.get_input_document(x)
30 | for x in (
31 | await borg(
32 | functions.messages.GetStickerSetRequest(
33 | types.InputStickerSetShortName(pack)
34 | )
35 | )
36 | ).documents
37 | if x.id not in blacklist
38 | ]
39 |
40 | await event.respond(file=random.choice(docs))
41 |
42 |
43 | choser("brain", "supermind")
44 | choser(
45 | "dab",
46 | "DabOnHaters",
47 | {
48 | 1653974154589768377,
49 | 1653974154589768312,
50 | 1653974154589767857,
51 | 1653974154589768311,
52 | 1653974154589767816,
53 | 1653974154589767939,
54 | 1653974154589767944,
55 | 1653974154589767912,
56 | 1653974154589767911,
57 | 1653974154589767910,
58 | 1653974154589767909,
59 | 1653974154589767863,
60 | 1653974154589767852,
61 | 1653974154589768677,
62 | },
63 | )
64 |
65 | CMD_HELP.update({"randomsticker": ".brain\n.dab\nUse - Gen random stickers."})
66 |
--------------------------------------------------------------------------------
/telebot/plugins/rename.py:
--------------------------------------------------------------------------------
1 | # Code from pro sar Spechide's fork of Uniborg.
2 | """Rename Telegram Files
3 | Syntax:
4 | .rename new.file.name"""
5 |
6 | import os
7 | import time
8 | from datetime import datetime
9 |
10 | from uniborg.util import admin_cmd
11 |
12 | from telebot import CMD_HELP
13 | from telebot.telebotConfig import Config
14 |
15 | thumb_image_path = Config.TMP_DOWNLOAD_DIRECTORY + "/thumb_image.jpg"
16 |
17 |
18 | @telebot.on(admin_cmd(pattern="rename (.*)"))
19 | @telebot.on(sudo_cmd(pattern="rename (.*)", allow_sudo=True))
20 | async def _(event):
21 | if event.fwd_from:
22 | return
23 | thumb = None
24 | xyz = Config.CMD_HNDLR
25 | if os.path.exists(thumb_image_path):
26 | thumb = thumb_image_path
27 | await eor(event, "**Downloading, renaming and uploading...**")
28 | input_str = event.pattern_match.group(1)
29 | if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
30 | os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
31 | if event.reply_to_msg_id:
32 | start = datetime.now()
33 | end = datetime.now()
34 | file_name = input_str
35 | reply_message = await event.get_reply_message()
36 | to_download_directory = Config.TMP_DOWNLOAD_DIRECTORY
37 | downloaded_file_name = os.path.join(to_download_directory, file_name)
38 | downloaded_file_name = await borg.download_media(
39 | reply_message,
40 | downloaded_file_name,
41 | )
42 | ms_one = (end - start).seconds
43 | if os.path.exists(downloaded_file_name):
44 | time.time()
45 | await borg.send_file(
46 | event.chat_id,
47 | downloaded_file_name,
48 | force_document=False,
49 | supports_streaming=False,
50 | allow_cache=False,
51 | reply_to=event.message.id,
52 | thumb=thumb,
53 | )
54 | end_two = datetime.now()
55 | os.remove(downloaded_file_name)
56 | ms_two = (end_two - end).seconds
57 | await eor(
58 | event,
59 | "Downloaded in {} seconds 😎. Uploaded in {} seconds 🥳.".format(
60 | ms_one, ms_two
61 | ),
62 | )
63 | else:
64 | await eor(event, "File Not Found {}".format(input_str))
65 | else:
66 | await eor(
67 | event,
68 | f"Syntax ~ `{xyz}rename file_name.extension` as reply to a Telegram media",
69 | )
70 |
71 |
72 | CMD_HELP.update(
73 | {"rename": ".rename \nUse - Rename the media."}
74 | )
75 |
--------------------------------------------------------------------------------
/telebot/plugins/repack.py:
--------------------------------------------------------------------------------
1 | # (c)2020 TeleBot
2 | #
3 | # You may not use this plugin without proper authorship and consent from @TeleBotSupport
4 | #
5 | # Creted by @buddhhu, @itzsjdude
6 | #
7 | import asyncio
8 | import os
9 |
10 | from telebot import CMD_HELP
11 | from telebot.utils import admin_cmd, sudo_cmd
12 |
13 |
14 | @telebot.on(admin_cmd(pattern="repack ?(.*)", outgoing=True))
15 | @telebot.on(sudo_cmd(pattern="repack ?(.*)", allow_sudo=True))
16 | async def _(event):
17 | a = await event.get_reply_message()
18 | input_str = event.pattern_match.group(1)
19 | b = open(input_str, "w")
20 | b.write(str(a.message))
21 | b.close()
22 | a = await event.reply(f"**Packing into** `{input_str}`")
23 | await asyncio.sleep(2)
24 | await a.edit(f"**Uploading** `{input_str}`")
25 | await asyncio.sleep(2)
26 | await event.client.send_file(event.chat_id, input_str)
27 | await a.delete()
28 | os.remove(input_str)
29 |
30 |
31 | CMD_HELP.update(
32 | {
33 | "repack": ".repack \nUse - Pack the text and send as a file."
34 | }
35 | )
36 |
--------------------------------------------------------------------------------
/telebot/plugins/reveal.py:
--------------------------------------------------------------------------------
1 | # (c)2020 TeleBot
2 | #
3 | # You may not use this plugin without proper authorship and consent from @TeleBotSupport
4 | #
5 | # By @buddhhu, @Itzsjdude
6 | #
7 | import os
8 |
9 | from telebot import CMD_HELP
10 | from telebot.utils import admin_cmd, sudo_cmd
11 |
12 |
13 | @telebot.on(admin_cmd(pattern=r"reveal", outgoing=True))
14 | @telebot.on(sudo_cmd(pattern=r"reveal"))
15 | async def _(event):
16 | b = await event.client.download_media(await event.get_reply_message())
17 | a = open(b, "r")
18 | c = a.read()
19 | a.close()
20 | a = await event.reply("**Reading file...**")
21 | if len(c) > 4095:
22 | await a.edit("`The Total words in this file is more than telegram limits.`")
23 | else:
24 | await event.client.send_message(event.chat_id, f"```{c}```")
25 | await a.delete()
26 | os.remove(b)
27 |
28 |
29 | CMD_HELP.update(
30 | {
31 | "reveal": ".reveal \nUse - Read contents of file and send as a telegram message."
32 | }
33 | )
34 |
--------------------------------------------------------------------------------
/telebot/plugins/sangmata.py:
--------------------------------------------------------------------------------
1 | # Made For DARK COBRA and TELEBOT...
2 | # Made by team cobra with @xditya
3 | # Retrieves the name history and the username history of the replied user..
4 |
5 | from telethon import events
6 | from telethon.errors.rpcerrorlist import YouBlockedUserError
7 |
8 | from telebot import CMD_HELP
9 |
10 |
11 | @telebot.on(admin_cmd(pattern="sg ?(.*)"))
12 | @telebot.on(sudo_cmd(pattern="sg ?(.*)", allow_sudo=True))
13 | async def _(event):
14 | if event.fwd_from:
15 | return
16 | ok = await eor(event, "Checking...")
17 | if not event.reply_to_msg_id:
18 | await ok.edit("Reply to any user message.")
19 | return
20 | reply_message = await event.get_reply_message()
21 | chat = "Sangmatainfo_bot"
22 | sender = reply_message.sender.id
23 | if reply_message.sender.bot:
24 | await ok.edit("Reply to actual users message and not a bots...")
25 | return
26 | async with event.client.conversation(chat) as conv:
27 | try:
28 | response1 = conv.wait_event(
29 | events.NewMessage(incoming=True, from_users=461843263)
30 | )
31 | response2 = conv.wait_event(
32 | events.NewMessage(incoming=True, from_users=461843263)
33 | )
34 | response3 = conv.wait_event(
35 | events.NewMessage(incoming=True, from_users=461843263)
36 | )
37 | await conv.send_message("/search_id {}".format(sender))
38 | response1 = await response1
39 | response2 = await response2
40 | response3 = await response3
41 | except YouBlockedUserError:
42 | await ok.edit("Please unblock ( @Sangmatainfo_bot ) ")
43 | return
44 | if response1.text.startswith("No records found"):
45 | await event.edit("User never changed his Username...")
46 | else:
47 | await event.delete()
48 | await telebot.send_message(event.chat_id, response2.message)
49 |
50 | await telebot.send_message(event.chat_id, response3.message)
51 |
52 |
53 | CMD_HELP.update(
54 | {
55 | "sangmata": ".sg \nUse - Get full name and username history of the person."
56 | }
57 | )
58 |
--------------------------------------------------------------------------------
/telebot/plugins/sca.py:
--------------------------------------------------------------------------------
1 | """Send Chat Actions
2 | Syntax: .scha