├── .deepsource.toml
├── .github
├── FUNDING.yml
└── workflows
│ ├── main.yml
│ ├── pylint.yml
│ └── python-app.yml
├── .gitignore
├── CODE_OF_CONDUCT
├── Dockerfile
├── LICENSE
├── Procfile
├── README.md
├── app.json
├── heroku.yml
├── requirements.txt
├── resources
├── Roboto-Light.ttf
├── Roboto-Medium.ttf
├── assfont.ttf
├── black.png
├── extras
│ ├── 33193e0075fc37c000379.jpg
│ └── __init__.py
├── fonts
│ ├── 1.ttf
│ ├── 10.ttf
│ ├── 11.otf
│ ├── 12.otf
│ ├── 2.ttf
│ ├── 3.ttf
│ ├── 4.ttf
│ ├── 5.ttf
│ ├── 6.ttf
│ ├── 7.ttf
│ ├── 8.ttf
│ ├── 9.ttf
│ └── __init__.py
├── hejo.png
├── kertas.jpg
├── rrc.png
└── sky_blank.png
├── sample_config.env
├── sessions
└── redis.py
├── string_session.py
├── termux_install.sh
├── userbot
├── __init__.py
├── __main__.py
├── clients
│ ├── __init__.py
│ ├── logger.py
│ └── startup.py
├── conf.py
├── core
│ ├── __init__.py
│ ├── decorator.py
│ └── pool.py
├── events.py
├── modules
│ ├── .bin
│ │ └── readme
│ ├── __help.py
│ ├── __init__.py
│ ├── admin.py
│ ├── adzan.py
│ ├── aesthetic.py
│ ├── afk.py
│ ├── allunban.py
│ ├── androids.py
│ ├── anilist.py
│ ├── animasi.py
│ ├── animasi1.py
│ ├── animasi2.py
│ ├── animasi3.py
│ ├── animasi4.py
│ ├── animasi5.py
│ ├── animasi6.py
│ ├── animasi7.py
│ ├── animasi8.py
│ ├── animasi9.py
│ ├── animations.py
│ ├── anime.py
│ ├── anti_spambot.py
│ ├── antiflood.py
│ ├── aria.py
│ ├── ascii.py
│ ├── asupan.py
│ ├── bikinbot.py
│ ├── bitly.py
│ ├── blacklist.py
│ ├── broadcast.py
│ ├── button.py
│ ├── carbon.py
│ ├── chat.py
│ ├── chatbot.py
│ ├── clone.py
│ ├── converter.py
│ ├── coolprofilepics.py
│ ├── core.py
│ ├── costum.py
│ ├── covid.py
│ ├── create.py
│ ├── deebfry.py
│ ├── deezloader.py
│ ├── detection.py
│ ├── deteksigrub.py
│ ├── direct_message.py
│ ├── downloads.py
│ ├── echo.py
│ ├── emojigames.py
│ ├── erpe.py
│ ├── eval.py
│ ├── fakeAction.py
│ ├── fakeaddress.py
│ ├── fakegban.py
│ ├── fban.py
│ ├── federasi.py
│ ├── figlet.py
│ ├── filemanager.py
│ ├── filter.py
│ ├── gabut.py
│ ├── games.py
│ ├── gban.py
│ ├── gban_bot.py
│ ├── gcast.py
│ ├── getmusic.py
│ ├── gid.py
│ ├── gitcommit.py
│ ├── github.py
│ ├── glitcher.py
│ ├── globalkick.py
│ ├── google.py
│ ├── googlephotos.py
│ ├── gps.py
│ ├── grouplink.py
│ ├── hack.py
│ ├── hash.py
│ ├── hentai.py
│ ├── herokuapp.py
│ ├── honkasays.py
│ ├── image.py
│ ├── imp.py
│ ├── info.py
│ ├── inviteall.py
│ ├── kamuii.py
│ ├── lastfm.py
│ ├── limited.py
│ ├── lock.py
│ ├── logger.py
│ ├── logo.py
│ ├── lyrics.py
│ ├── mega_downloads.py
│ ├── memes1.py
│ ├── memify.py
│ ├── mentions.py
│ ├── misc.py
│ ├── notes.py
│ ├── nulis.py
│ ├── offline.py
│ ├── oi.py
│ ├── paste.py
│ ├── phreaker.py
│ ├── ping.py
│ ├── pmpermit.py
│ ├── ppcouple.py
│ ├── private.py
│ ├── profile.py
│ ├── purge.py
│ ├── quotly.py
│ ├── rastick.py
│ ├── resi.py
│ ├── reverse.py
│ ├── rosehamzat.py
│ ├── rosehelper.py
│ ├── rosewc.py
│ ├── salam.py
│ ├── sangmata.py
│ ├── santet.py
│ ├── saver.py
│ ├── scraper.py
│ ├── scrapers.py
│ ├── sed.py
│ ├── shazam.py
│ ├── snips.py
│ ├── spam.py
│ ├── specialtools.py
│ ├── spotifynow.py
│ ├── sql_helper
│ │ ├── __init__.py
│ │ ├── antiflood_sql.py
│ │ ├── blacklist_sql.py
│ │ ├── bot_blacklists.py
│ │ ├── bot_pms_sql.py
│ │ ├── bot_starters.py
│ │ ├── broadcast_sql.py
│ │ ├── echo_sql.py
│ │ ├── fban_sql.py
│ │ ├── filter_sql.py
│ │ ├── gban_sql.py
│ │ ├── globals.py
│ │ ├── gmute_sql.py
│ │ ├── google_drive_sql.py
│ │ ├── keep_read_sql.py
│ │ ├── locks_sql.py
│ │ ├── lydia_sql.py
│ │ ├── mute_sql.py
│ │ ├── no_log_pms_sql.py
│ │ ├── notes_sql.py
│ │ ├── pm_permit_sql.py
│ │ ├── snips_sql.py
│ │ ├── spam_mute_sql.py
│ │ ├── tede_chatbot_sql.py
│ │ ├── warns_sql.py
│ │ └── welcome_sql.py
│ ├── ss_video.py
│ ├── statme.py
│ ├── status.py
│ ├── stickers.py
│ ├── stickerspam.py
│ ├── stickertext.py
│ ├── sudo.py
│ ├── surat.py
│ ├── system_stats.py
│ ├── tag_all.py
│ ├── tags.py
│ ├── telegraph.py
│ ├── tempmail.py
│ ├── tiktok.py
│ ├── timedate.py
│ ├── tiny.py
│ ├── tonicbot.py
│ ├── tonimisc.py
│ ├── torrentseacrh.py
│ ├── total_message.py
│ ├── toxic.py
│ ├── toxic2.py
│ ├── transform.py
│ ├── truth_dare.py
│ ├── updater.py
│ ├── upload_download.py
│ ├── vcg.py
│ ├── vcplugin.py
│ ├── waifu.py
│ ├── wallpaper.py
│ ├── war.py
│ ├── war2.py
│ ├── weather.py
│ ├── webupload.py
│ ├── welcomes.py
│ ├── whois.py
│ ├── wibu.py
│ ├── xgban.py
│ ├── xiaomi.py
│ ├── youtube_downloader.py
│ └── zipfile.py
├── resource
│ ├── __init__.py
│ ├── extras
│ │ ├── Tonic.jpg
│ │ └── __init__.py
│ └── session
│ │ ├── session.sh
│ │ └── string_session.py
├── storage.py
└── utils
│ ├── FastTelethon.py
│ ├── __init__.py
│ ├── chattitle.py
│ ├── chrome.py
│ ├── converter
│ ├── __init__.py
│ └── converter.py
│ ├── decorator.py
│ ├── events.py
│ ├── exceptions.py
│ ├── format.py
│ ├── funtions.py
│ ├── google_images_download.py
│ ├── logger.py
│ ├── misc.py
│ ├── paste.py
│ ├── pastebin.py
│ ├── prettyjson.py
│ ├── progress.py
│ ├── queues
│ ├── __init__.py
│ └── queues.py
│ ├── start.py
│ ├── styles
│ ├── GeezFont.otf
│ └── alice.txt
│ ├── thumbnail.py
│ ├── tools.py
│ └── utils.py
└── varshelper.txt
/.deepsource.toml:
--------------------------------------------------------------------------------
1 | version = 1
2 |
3 | [[analyzers]]
4 | name = "python"
5 | enabled = true
6 |
7 | [analyzers.meta]
8 | runtime_version = "3.x.x"
9 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [adekmaulana] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g. npm/babel
8 | custom: # Replace with a single custom sponsorship URL
9 |
--------------------------------------------------------------------------------
/.github/workflows/main.yml:
--------------------------------------------------------------------------------
1 | # This is a basic workflow to help you get started with Actions
2 |
3 | name: CI
4 |
5 | # Controls when the action will run.
6 | on:
7 | # Triggers the workflow on push or pull request events but only for the Rose-Userbot branch
8 | push:
9 | branches: [ Tonic-Userbot ]
10 | pull_request:
11 | branches: [ Tonic-Userbot ]
12 |
13 | # Allows you to run this workflow manually from the Actions tab
14 | workflow_dispatch:
15 |
16 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel
17 | jobs:
18 | # This workflow contains a single job called "build"
19 | build:
20 | # The type of runner that the job will run on
21 | runs-on: ubuntu-latest
22 |
23 | # Steps represent a sequence of tasks that will be executed as part of the job
24 | steps:
25 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
26 | - uses: actions/checkout@v2
27 |
28 | # Runs a single command using the runners shell
29 | - name: Run a one-line script
30 | run: echo Hello, world!
31 |
32 | # Runs a set of commands using the runners shell
33 | - name: Run a multi-line script
34 | run: |
35 | echo Add other actions to build,
36 | echo test, and deploy your project.
37 |
--------------------------------------------------------------------------------
/.github/workflows/pylint.yml:
--------------------------------------------------------------------------------
1 | name: PyLint
2 | on: push
3 | jobs:
4 | PEP8:
5 | runs-on: ubuntu-latest
6 | steps:
7 | - uses: actions/checkout@v2
8 | - name: Setup Python
9 | uses: actions/setup-python@v1
10 | with:
11 | python-version: 3.9
12 | - name: Install Python lint libraries
13 | run: |
14 | pip install autoflake isort black
15 | - name: Remove unused imports and variables
16 | run: |
17 | autoflake --in-place --recursive --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports .
18 |
19 |
20 |
--------------------------------------------------------------------------------
/.github/workflows/python-app.yml:
--------------------------------------------------------------------------------
1 | #repoUserbot
2 | name: FailCheck
3 |
4 | on: [push, pull_request]
5 |
6 | jobs:
7 | build:
8 |
9 | runs-on: ubuntu-latest
10 | strategy:
11 | max-parallel: 5
12 | matrix:
13 | python-version: [3.9]
14 |
15 | steps:
16 | - uses: actions/checkout@v1
17 | - name: Set up Python ${{ matrix.python-version }}
18 | uses: actions/setup-python@v1
19 | with:
20 | python-version: ${{ matrix.python-version }}
21 | - name: Install dependencies
22 | run: |
23 | sudo apt-get install libpq-dev
24 | python -m pip install --upgrade pip
25 | pip install -r requirements.txt
26 | pip install flake8 flake8-print flake8-quotes
27 | - name: Check for showstoppers
28 | run: |
29 | flake8 . --count --select=E999 --show-source --statistics
30 | shellcheck:
31 |
32 | runs-on: ubuntu-latest
33 |
34 | steps:
35 | - uses: actions/checkout@v1
36 | - name: Check for install script errors
37 | uses: ludeeus/action-shellcheck@0.1.0
38 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | config.env
2 | error.log
3 | __pycache__/*
4 | userbot.db
5 | *.session
6 | *.session-journal
7 | TG_BOT_TOKEN.session
8 | TG_BOT_TOKEN.session-journal
9 | userbot/__pycache__/*
10 | userbot/modules/__pycache__/*
11 | userbot/modules/sql_helper/__pycache__/*
12 | .git
13 | .github
14 | .config
15 | .progress
16 | .vscode/*
17 | bin/*
18 | venv
19 | *.pyc
20 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | # Using Python Slim-Buster
2 | FROM kyyex/kyy-userbot:busterv2
3 | #━━━━━ Userbot Telegram ━━━━━
4 | #━━━━━ By Tonic-Userbot ━━━━━
5 |
6 | RUN apt-get update && apt-get upgrade -y
7 | RUN apt-get install ffmpeg -y
8 | RUN git clone -b Tonic-Userbot https://github.com/Toni880/Tonic-Userbot /root/userbot
9 | RUN mkdir /root/userbot/.bin
10 | RUN pip install --upgrade pip setuptools
11 | WORKDIR /root/userbot
12 |
13 | #Install python requirements
14 | RUN pip3 install -r https://raw.githubusercontent.com/Toni880/Tonic-Userbot/Tonic-Userbot/requirements.txt
15 |
16 | EXPOSE 80 443
17 |
18 | # Finalization
19 | CMD ["python3", "-m", "userbot"]
20 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | build:
2 | docker:
3 | worker: Dockerfile
4 | run:
5 | worker: python3 -m userbot
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Tonic-Userbot Telegram
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | ## DEPLOY TO HEROKU
17 |
18 |
19 | 
20 |
21 | ## DEPLOY TO WEB HEROKU
22 |
23 |
24 | 
25 |
26 |
27 |
28 | ## Group Support:
29 |
30 |
31 |
32 | ## String Session :
33 |
34 |
35 |
36 |
37 | ## Stay Support 🚀
38 | ❁ [LonamiWebs](https://github.com/LonamiWebs/) and [Telethon](https://github.com/LonamiWebs/Telethon)
39 |
40 |
41 | # **THANKS YOU TO** ❤️
42 | * [Sendi](https://github.com/SendiAp/Rose-Userbot) Rose-Userbot
43 | * [Risman](https://github.com/mrismanaziz/Man-Userbot) Man - Userbot
44 | * [Skyzu](https://github.com/Skyzu/skyzu-userbot) skyzu paling ganteng
45 | * DAN TERIMAKASIH KEPADA USERBOT LAINNYA
46 |
47 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "✨ ᴛᴏɴɪᴄ-ᴜsᴇʀʙᴏᴛ ✨",
3 | "description": "🚫Tonic-Userbot🚫 USERBOT KHUSUS YANG DIGUNAKAN UNTUK BERSENANG-SENANG DI TELEGRAM.",
4 | "logo": "https://telegra.ph/file/33193e0075fc37c000379.jpg",
5 | "keywords": [
6 | "telegram",
7 | "userbot",
8 | "plugin",
9 | "modular",
10 | "productivity"
11 | ],
12 | "repository": "https://github.com/Tonic990/Tonic-User",
13 | "telegram": "https://t.me/Bukan_guudlooking",
14 | "success_url": "https://t.me/PrimeSupportGroup",
15 | "stack": "container",
16 | "env": {
17 | "API_KEY": {
18 | "description": "Dapatkan Api Key di web my.telegram.org atau dari bot @PrimeApiBot",
19 | "required": true
20 | },
21 | "API_HASH": {
22 | "description": "Dapatkan Api Hash Di Web my.telegram.org atau dari bot @PrimeApiBot",
23 | "required": true
24 | },
25 | "ALIVE_NAME": {
26 | "description": "Isi nama kalian yang akan ditampilkan ketika ketik .alive",
27 | "required": true
28 | },
29 | "STRING_SESSION": {
30 | "description": "Dapatkan String Session di termux caranya ada di repo atau ambil di @PrimeStringBot",
31 | "required": true
32 | },
33 | "HEROKU_APP_NAME": {
34 | "description": "Nama App heroku, Nama App yang paling pertama di isi (liat paling atas)",
35 | "required": true
36 | },
37 | "HEROKU_API_KEY": {
38 | "description": "Heroku API KEY mu, dapatkan dari web 'https://dashboard.heroku.com/account'",
39 | "value": "Check Di Heroku Dashboard Mu",
40 | "required": true
41 | },
42 | "PM_AUTO_BAN": {
43 | "description": "Pengalihan Fitur Larangan Otomatis PM. atau /skip",
44 | "value": "False",
45 | "required": true
46 | }
47 | },
48 | "addons": [
49 | {
50 | "plan": "heroku-postgresql",
51 | "options": {
52 | "version": "12"
53 | }
54 | }
55 | ],"buildpacks": [{
56 | "url": "https://github.com/heroku/heroku-buildpack-python.git"
57 | }, {
58 | "url": "https://github.com/heroku/heroku-buildpack-redis"
59 | }, {
60 | "url": "https://github.com/heroku/heroku-buildpack-google-chrome"
61 | }, {
62 | "url": "https://github.com/HasibulKabir/heroku-buildpack-rarlab"
63 | },{
64 | "url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest"
65 | }, {
66 | "url": "https://github.com/opendoor-labs/heroku-buildpack-p7zip"
67 | }, {
68 | "url": "https://github.com/amivin/aria2-heroku"
69 | }, {
70 | "url": "https://github.com/stevo550/buildpack-slug-cleaner"
71 | }],
72 | "formation": {
73 | "worker": {
74 | "quantity": 1,
75 | "size": "free"
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/heroku.yml:
--------------------------------------------------------------------------------
1 | build:
2 | docker:
3 | worker: Dockerfile
4 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | aiohttp[speedups]>=3.5.4
2 | aiofiles
3 | aria2p
4 | aiofile
5 | asyncurban
6 | async_generator
7 | bitlyshortener
8 | beautifulsoup4>=4.8.1bs4
9 | base
10 | cffi>=1.0.0
11 | covid>=2.2.9
12 | coffeehouse>=2.1.0
13 | colour
14 | cowpy
15 | cryptg
16 | csvfaker
17 | deezloader
18 | dnspython
19 | emoji
20 | fontTools
21 | gitpython
22 | git+https://github.com/ahupp/python-magic
23 | git+https://github.com/johnwmillr/LyricsGenius.git
24 | git+https://github.com/voins/google-images-download.git@2cd68173c961324a2c41c61e8b6f40a49663ce60
25 | git+https://github.com/yt-dlp/yt-dlp@master
26 | geopy
27 | glitch_this
28 | google-api-python-client==2.3.0
29 | google-auth-httplib2
30 | google_trans_new
31 | googletrans==4.0.0rc1
32 | google-auth-oauthlib
33 | google_images_download
34 | gTTS>=2.1.1
35 | gTTS-token>=1.1.3
36 | heroku3>=3.4.0
37 | httplib2>=0.18.0
38 | humanize
39 | html_telegraph_poster
40 | hachoir>=3.0a5
41 | jikanpy
42 | justwatch
43 | jotquote
44 | lxml
45 | lottie
46 | lyrics_extractor
47 | lyricsgenius
48 | markdown
49 | moviepy
50 | opencv-python
51 | oauth2client
52 | patool
53 | pendulum
54 | pillow
55 | psutil
56 | py-tgcalls==0.9.0b1
57 | psycopg2
58 | psycopg2-binary
59 | pybase64
60 | pylast
61 | pydub
62 | pySmartDL
63 | python-barcode
64 | python-dotenv
65 | pytz
66 | pyaztro
67 | pytube>=9.5.1
68 | pymongo[srv]
69 | python-dateutil
70 | pyfiglet
71 | PyGithub
72 | pip>=19.2.3
73 | PyPDF2
74 | PyDrive2
75 | pyDownload
76 | qrcode
77 | requests>=2.18.4
78 | redis>=3.3.10
79 | REPO_LINK
80 | search-engine-parser>=0.6.1
81 | speedtest-cli>=2.0.2
82 | sqlalchemy<=1.3.23
83 | scikit-image
84 | scipy
85 | setuptools>=28.8.0
86 | selenium>=3.141.0
87 | telethon-session-sqlalchemy
88 | twitter_scraper
89 | telegraph
90 | telethon==1.24.0
91 | telethon-tgcrypto
92 | urbandict>=0.5
93 | vcsi
94 | validators
95 | wheel
96 | wget
97 | wikipedia>=1.4.0
98 | wand
99 | wordcloud
100 | youtube-search-python
101 | youtube-dl
102 | youtube_dl
103 | youtube_search
104 | youtube-search-python==1.4.9
105 | zipfile38
106 |
--------------------------------------------------------------------------------
/resources/Roboto-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/Roboto-Light.ttf
--------------------------------------------------------------------------------
/resources/Roboto-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/Roboto-Medium.ttf
--------------------------------------------------------------------------------
/resources/assfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/assfont.ttf
--------------------------------------------------------------------------------
/resources/black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/black.png
--------------------------------------------------------------------------------
/resources/extras/33193e0075fc37c000379.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/extras/33193e0075fc37c000379.jpg
--------------------------------------------------------------------------------
/resources/extras/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/extras/__init__.py
--------------------------------------------------------------------------------
/resources/fonts/1.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/fonts/1.ttf
--------------------------------------------------------------------------------
/resources/fonts/10.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/fonts/10.ttf
--------------------------------------------------------------------------------
/resources/fonts/11.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/fonts/11.otf
--------------------------------------------------------------------------------
/resources/fonts/12.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/fonts/12.otf
--------------------------------------------------------------------------------
/resources/fonts/2.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/fonts/2.ttf
--------------------------------------------------------------------------------
/resources/fonts/3.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/fonts/3.ttf
--------------------------------------------------------------------------------
/resources/fonts/4.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/fonts/4.ttf
--------------------------------------------------------------------------------
/resources/fonts/5.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/fonts/5.ttf
--------------------------------------------------------------------------------
/resources/fonts/6.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/fonts/6.ttf
--------------------------------------------------------------------------------
/resources/fonts/7.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/fonts/7.ttf
--------------------------------------------------------------------------------
/resources/fonts/8.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/fonts/8.ttf
--------------------------------------------------------------------------------
/resources/fonts/9.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/fonts/9.ttf
--------------------------------------------------------------------------------
/resources/fonts/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/fonts/__init__.py
--------------------------------------------------------------------------------
/resources/hejo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/hejo.png
--------------------------------------------------------------------------------
/resources/kertas.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/kertas.jpg
--------------------------------------------------------------------------------
/resources/rrc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/rrc.png
--------------------------------------------------------------------------------
/resources/sky_blank.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/resources/sky_blank.png
--------------------------------------------------------------------------------
/sample_config.env:
--------------------------------------------------------------------------------
1 | # Remove this line first before doing anything
2 | ___________PLOX_______REMOVE_____THIS_____LINE__________=True
3 |
4 | # Get these from https://my.telegram.org/
5 | API_KEY = "YOUR API KEY"
6 | API_HASH = "YOUR API HASH"
7 |
8 | # Get this value by running python3 string_session.py locally
9 | STRING_SESSION = ""
10 |
11 | # Set this to enable inline bot helper. get the token from @BotFather
12 | BOT_TOKEN = ""
13 | BOT_USERNAME = ""
14 |
15 | # ChatID for the Log group
16 | # Add a Hypen or a Negative Sign before ID
17 | # This is a integer, Please don't use Strings
18 | BOTLOG_CHATID = # this is an integer, please don't use quotes.
19 |
20 | # Your Database URL
21 | # Example: 'postgres://userbot:userbot@localhost:5432/userbot'
22 | DATABASE_URL = ""
23 |
24 | # PM Auto-Ban Feature Switch
25 | PM_AUTO_BAN = False
26 |
--------------------------------------------------------------------------------
/string_session.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # (c) https://t.me/TelethonChat/37677 and SpEcHiDe
3 | #
4 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
5 | # you may not use this file except in compliance with the License.
6 | #
7 |
8 | from telethon.sync import TelegramClient
9 | from telethon.sessions import StringSession
10 |
11 | print("""Please go-to my.telegram.org
12 | Login using your Telegram account
13 | Click on API Development Tools
14 | Create a new application, by entering the required details
15 | Check your Telegram saved messages section to copy the STRING_SESSION""")
16 | API_KEY = int(input("Enter API_KEY here: "))
17 | API_HASH = input("Enter API_HASH here: ")
18 |
19 | with TelegramClient(StringSession(), API_KEY, API_HASH) as client:
20 | print("Check Telegram Save Message Mu Untuk Copy STRING_SESSION ")
21 | session_string = client.session.save()
22 | saved_messages_template = """😼 Thank u for Support Tonic-Userbot | Grup @PrimeSupportGroup
23 |
24 | STRING_SESSION
: {}
25 |
26 | ⚠️ Please be careful before passing this value to third parties""".format(session_string)
27 | client.send_message("me", saved_messages_template, parse_mode="html")
28 |
--------------------------------------------------------------------------------
/termux_install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | clear
3 | echo -E " ******,*,. ... "
4 | echo -E " /////*****,*... . . "
5 | echo -E " . . /((//*/*,*///*. . .. "
6 | echo -E ".. . . .((*,,. .*//*. . . . .. "
7 | echo -E ". . ../(((**((//,,/.......... .. .. .. "
8 | echo -E ". . . ./(/, ., , . . ...... "
9 | echo -E "..,,.... .. .. . **//*/*/*.... . . ...*,. "
10 | echo -E " .,,,..,,,.,...... //((/. /**,. ... .. .....,*,** "
11 | echo -E " /(/(*,/// ..,,,,,,,.,,,,,,,,*, "
12 | echo -E ". ((((((/ ., . ..**** "
13 | echo -E "....... */(##//((/ ,.*, ..... .,,,*** "
14 | echo -E "......................../((##(((###( .,.,. ,.... . ,.,*/ "
15 | echo -E " ...*, *,,...,//(((((((####(((*,.**.. **, ,*/***((# "
16 | echo -E " *((/,***(((((((((####((//*/*,,**(//(//(//((((( "
17 | echo -E " .(/ ,(#((((###((((((((#((/(#(*(#/(*((/((((.*,(//// "
18 | echo -E " (((//(( (###(((((/(##(*/((.(#/##((((((/**(/(#*( "
19 | echo -E "/////**/ /((//,*,,../(/,((((/((#(##/(*(/#%#(((/(((/. *****/ "
20 | echo -E " .*////(/((/(/*,**/((((##((//.,####/((#(#%#(((((((/ , .**** "
21 | echo -E ". /(//(#( (#(#(*,/#(#/#####%##(((((((/(////*, "
22 | echo -E "........ ((/((#( /((#(((/ /((#/###%%%#(((/(((//////(( "
23 | echo -E "........./((#(#*.... ((,(((((# /((#((#%%%/* **((. . .., "
24 | echo -E "........./((#(/(.......((((((///(/*((#((%%%%%##(((,*/. , . "
25 | echo -E "........./((((((......*###(((/(/*(# ####%%%%#(.*((..,. "
26 | echo -E ".........((####(......(#(##.(#(((,*((.#%%%%##(*((/..,,*. "
27 | echo -E "//(/***,*(###(//,,..,///#/(. /(((/((((*#%%##(/(,,,.. "
28 | echo -E "**/**,,,,####(/**//((////(##(.*..*((/*##%%%(((,/ .,/ . "
29 | echo -E ",,,,,,,,,#####%(,*///////(((((/(((((((###%##//*., ,/. "
30 | echo -E ",,,,,,,,,#####%(,,,,///((((((///*.,.. (##((((#/(*///*.. "
31 | echo -E " "
32 | sleep 5
33 | clear
34 |
35 | pkg update && pkg upgrade -y
36 | pkg install clang curl git libcrypt libffi libiconv libjpeg* libjpeg-turbo libwebp libxml2 libxslt make ndk-sysroot openssl postgresql python readline wget zlib -y
37 |
38 | git clone https://github.com/muhammadrizky16/Kyy-Userbot.git
39 | cd Kyy-Userbot
40 |
41 | pip install --upgrade pip setuptools
42 | pip install -r requirements.txt
43 |
44 | mv sample_config.env config.env
45 |
46 | mkdir -p $PREFIX/var/lib/postgresql
47 | initdb $PREFIX/var/lib/postgresql
48 | pg_ctl -D $PREFIX/var/lib/postgresql start
49 | createdb botdb
50 | createuser botuser
51 |
52 | cd ..
53 | echo "pg_ctl -D $PREFIX/var/lib/postgresql start" > startbot.sh
54 | echo "cd Tonic-Userbot" >> startbot.sh
55 | echo "python3 -m userbot" >> startbot.sh
56 | chmod 755 startbot.sh
57 |
58 | echo "Done."
59 | echo "Now edit config.env with nano or anything you want, then run the userbot with startbot.sh"
60 | echo "Please edit the db to postgresql://botuser:@localhost:5432/botdb"
61 | echo "Good luck!"
62 |
--------------------------------------------------------------------------------
/userbot/__main__.py:
--------------------------------------------------------------------------------
1 | """ Userbot start point """
2 |
3 | import sys
4 | from importlib import import_module
5 |
6 | import requests
7 |
8 | from userbot import (
9 | BOT_TOKEN,
10 | BOT_USERNAME,
11 | BOT_VER,
12 | BOTLOG_CHATID,
13 | DEVS,
14 | LOGS,
15 | bot,
16 | call_py,
17 | blacklistuser,
18 | CMD_HANDLER as cmd,
19 | )
20 | from userbot.modules import ALL_MODULES
21 | from userbot.utils import autobot, autopilot
22 |
23 | try:
24 | bot.start()
25 | call_py.start()
26 | user = bot.get_me()
27 | blacklistuser = requests.get(
28 | "https://raw.githubusercontent.com/Tonic990/blacklist/master/toniblacklist.json"
29 | ).json()
30 | if user.id in blacklistuser:
31 | LOGS.warning(
32 | "MAKANYA GA USAH BERTINGKAH GOBLOK, USERBOTnya GUA MATIIN NAJIS BANGET DIPAKE JAMET KEK LU.\nCredits: @Bukan_guudlooking"
33 | )
34 | sys.exit(1)
35 | if not DEVS:
36 | LOGS.warning(
37 | f"EOL\nTonic-UserBot v{BOT_VER}, Copyright © 2021-2022 Tonic-Userbot• "
38 | )
39 | sys.exit(1)
40 | except Exception as e:
41 | LOGS.info(str(e), exc_info=True)
42 | sys.exit(1)
43 |
44 | for module_name in ALL_MODULES:
45 | imported_module = import_module("userbot.modules." + module_name)
46 |
47 | if not BOTLOG_CHATID:
48 | LOGS.info(
49 | "BOTLOG_CHATID Vars tidak terisi, Memulai Membuat Grup Otomatis..."
50 | )
51 | bot.loop.run_until_complete(autopilot())
52 |
53 | LOGS.info(
54 | f"Jika {user.first_name} Membutuhkan Bantuan, Silahkan Tanyakan di Grup https://t.me/PrimeSupportGroup"
55 | )
56 |
57 | LOGS.info(f"Tonic-Userbot ⚙️ V{BOT_VER} [🔥 BERHASIL DIAKTIFKAN! 🔥]")
58 |
59 | async def check_alive():
60 | try:
61 | if BOTLOG_CHATID != 0:
62 | await bot.send_message(BOTLOG_CHATID, f"✨ **Tonic Userbot Berhasil Diaktifkan**!!\n━━━━━━━━━━━━━━━\n➠ **Userbot Version** - 3.1.0@Tonic-Userbot\n➠ **Ketik** `{cmd}ping` **Untuk Mengecheck Bot**\n━━━━━━━━━━━━━━━\n➠ **Powered By:** @PrimeSupportGroup ")
63 | except Exception as e:
64 | LOGS.info(str(e))
65 | try:
66 | await bot(Addbot(int(BOTLOG_CHATID), [BOT_USERNAME]))
67 | except BaseException:
68 | pass
69 |
70 |
71 | bot.loop.run_until_complete(check_alive())
72 | if not BOT_TOKEN:
73 | LOGS.info(
74 | "BOT_TOKEN Vars tidak terisi, Memulai Membuat BOT Otomatis di @Botfather..."
75 | )
76 | bot.loop.run_until_complete(autobot())
77 |
78 |
79 | if len(sys.argv) not in (1, 3, 4):
80 | bot.disconnect()
81 | else:
82 | bot.run_until_disconnected()
83 |
--------------------------------------------------------------------------------
/userbot/clients/__init__.py:
--------------------------------------------------------------------------------
1 | # Man - UserBot
2 | # Copyright (c) 2022 Man-Userbot
3 | # Credits: @mrismanaziz || https://github.com/mrismanaziz
4 | #
5 | # This file is a part of < https://github.com/mrismanaziz/Man-Userbot/ >
6 | # t.me/SharingUserbot & t.me/Lunatic0de
7 |
8 | from .logger import toni_userbot_on
9 | from .startup import toni_client, multi_toni
10 |
--------------------------------------------------------------------------------
/userbot/clients/logger.py:
--------------------------------------------------------------------------------
1 | # Credit @mrismanaziz
2 |
3 | import asyncio
4 |
5 | from telethon.tl.functions.channels import EditAdminRequest, InviteToChannelRequest
6 | from telethon.tl.types import ChatAdminRights
7 |
8 | from userbot import (
9 | BOT_VER as version,
10 | BOTLOG_CHATID,
11 | CMD_HANDLER as cmd,
12 | branch,
13 | tgbot,
14 | bot,
15 | )
16 | from userbot.utils import checking
17 |
18 | MSG_ON = """
19 | ✨ **Tonic-Userbot Berhasil Di Aktifkan**
20 | ━━
21 | ➠ **Userbot Version -** `{}@{}`
22 | ➠ **Ketik** `{}alive` **untuk Mengecheck Bot**
23 | ➠ **Powered By:** @PrimeSupportGroup
24 | ━━
25 | """
26 | async def toni_userbot_on():
27 | new_rights = ChatAdminRights(
28 | add_admins=True,
29 | invite_users=True,
30 | change_info=True,
31 | ban_users=True,
32 | delete_messages=True,
33 | pin_messages=True,
34 | manage_call=True,
35 | )
36 | try:
37 | if bot and tgbot:
38 | ToniUBOT = await tgbot.get_me()
39 | BOT_USERNAME = ToniUBOT.username
40 | await bot(InviteToChannelRequest(int(BOTLOG_CHATID), [BOT_USERNAME]))
41 | await asyncio.sleep(3)
42 | except BaseException:
43 | pass
44 | try:
45 | if bot and tgbot:
46 | ToniUBOT = await tgbot.get_me()
47 | BOT_USERNAME = ToniUBOT.username
48 | await bot(EditAdminRequest(BOTLOG_CHATID, BOT_USERNAME, new_rights, "BOT"))
49 | await asyncio.sleep(3)
50 | except BaseException:
51 | pass
52 | try:
53 | if bot:
54 | await checking(bot)
55 | await asyncio.sleep(3)
56 | if BOTLOG_CHATID != 0:
57 | await bot.send_message(
58 | BOTLOG_CHATID,
59 | MSG_ON.format(version, branch, cmd),
60 | )
61 | except BaseException:
62 | pass
63 |
--------------------------------------------------------------------------------
/userbot/clients/startup.py:
--------------------------------------------------------------------------------
1 | # Credit @mrismanaziz
2 |
3 | import sys
4 | from telethon.utils import get_peer_id
5 | from userbot import (
6 | BOT_TOKEN,
7 | BOT_VER as version,
8 | DEVS,
9 | LOGS,
10 | LOOP,
11 | STRING_SESSION,
12 | blacklistuser,
13 | call_py,
14 | tgbot,
15 | bot,
16 | )
17 | from userbot.modules.gcast import GCAST_BLACKLIST as GBL
18 |
19 | EOL = "EOL\nTonic-UserBot v{}, Copyright © 2021-2022 ᴛᴏɴɪ• "
20 | MSG_BLACKLIST = "MAKANYA GA USAH BERTINGKAH GOBLOK, USERBOT {} GUA MATIIN NAJIS BANGET DIPAKE JAMET KEK LU.\nTonic-UserBot v{}, Copyright © 2021-2022 ᴛᴏɴɪ• "
21 |
22 | async def toni_client(client):
23 | client.me = await client.get_me()
24 | client.uid = get_peer_id(client.me)
25 |
26 | def multi_toni():
27 | if 1416529201 not in DEVS:
28 | LOGS.warning(EOL.format(version))
29 | sys.exit(1)
30 | if -1001578091827 not in GBL:
31 | LOGS.warning(EOL.format(version))
32 | sys.exit(1)
33 | if 1416529201 not in DEFAULT:
34 | LOGS.warning(EOL.format(version))
35 | sys.exit(1)
36 | failed = 0
37 | if STRING_SESSION:
38 | try:
39 | bot.start()
40 | call_py.start()
41 | LOOP.run_until_complete(toni_client(bot))
42 | user = bot.get_me()
43 | name = user.first_name
44 | uid = user.id
45 | LOGS.info(
46 | f"STRING_SESSION detected!\n┌ First Name: {name}\n└ User ID: {uid}\n——"
47 | )
48 | if user.id in blacklistman:
49 | LOGS.warning(MSG_BLACKLIST.format(name, version))
50 | sys.exit(1)
51 | except Exception as e:
52 | LOGS.info(str(e))
53 |
54 | if BOT_TOKEN:
55 | try:
56 | user = tgbot.get_me()
57 | name = user.first_name
58 | uname = user.username
59 | LOGS.info(
60 | f"BOT_TOKEN detected!\n┌ First Name: {name}\n└ Username: @{uname}\n——"
61 | )
62 | except Exception as e:
63 | LOGS.info(str(e))
64 |
65 | if not STRING_SESSION:
66 | failed += 1
67 | return failed
68 |
--------------------------------------------------------------------------------
/userbot/conf.py:
--------------------------------------------------------------------------------
1 | from envparse import env
2 | from userbot import LOGGER
3 |
4 | DEFAULTS = {
5 | "LOAD_MODULES": True,
6 | }
7 |
8 |
9 | def get_str_key(name, required=False):
10 | if name in DEFAULTS:
11 | default = DEFAULTS[name]
12 | else:
13 | default = None
14 | if not (data := env.str(name, default=default)) and not required:
15 | LOGGER.warn("No str key: " + name)
16 | return None
17 | elif not data:
18 | LOGGER.critical("No str key: " + name)
19 | sys.exit(2)
20 | else:
21 | return data
22 |
23 |
24 | def get_int_key(name, required=False):
25 | if name in DEFAULTS:
26 | default = DEFAULTS[name]
27 | else:
28 | default = None
29 | if not (data := env.int(name, default=default)) and not required:
30 | LOGGER.warn("No int key: " + name)
31 | return None
32 | elif not data:
33 | LOGGER.critical("No int key: " + name)
34 | sys.exit(2)
35 | else:
36 | return data
37 |
--------------------------------------------------------------------------------
/userbot/core/__init__.py:
--------------------------------------------------------------------------------
1 | from .decorators import check_owner
2 |
3 | CMD_INFO = {}
4 | PLG_INFO = {}
5 | GRP_INFO = {}
6 | BOT_INFO = []
7 | LOADED_CMDS = {}
8 |
--------------------------------------------------------------------------------
/userbot/core/decorator.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 |
3 | from telethon.errors import FloodWaitError, MessageNotModifiedError
4 | from telethon.events import CallbackQuery
5 |
6 | from userbot import SUDO_USERS, bot, owner
7 | from userbot.modules.sql_helper.globals import gvarstatus
8 |
9 |
10 | def check_owner(func):
11 | async def wrapper(c_q: CallbackQuery):
12 | user = await bot.get_me()
13 | uid = user.id
14 | if c_q.query.user_id and (
15 | c_q.query.user_id == uid or c_q.query.user_id in SUDO_USERS
16 | ):
17 | try:
18 | await func(c_q)
19 | except FloodWaitError as e:
20 | await asyncio.sleep(e.seconds + 5)
21 | except MessageNotModifiedError:
22 | pass
23 | else:
24 | HELP_TEXT = (
25 | gvarstatus("HELP_TEXT")
26 | or f"Hanya {owner} yang dapat Mengakses Ini!!\nSilahkan Buat UserBot Anda sendiri."
27 | )
28 | await c_q.answer(
29 | HELP_TEXT,
30 | alert=True,
31 | )
32 |
--------------------------------------------------------------------------------
/userbot/core/pool.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 | from concurrent.futures import Future, ThreadPoolExecutor
3 | from functools import partial, wraps
4 | from typing import Any, Callable
5 |
6 | from motor.frameworks.asyncio import _EXECUTOR
7 |
8 | from userbot.utils.logger import logging
9 |
10 | _LOG = logging.getLogger(__name__)
11 | _LOG_STR = "<<<[ %s ]>>>"
12 |
13 |
14 | def submit_thread(func: Callable[[Any], Any], *args: Any, **kwargs: Any) -> Future:
15 | """submit thread to thread pool"""
16 | return _EXECUTOR.submit(func, *args, **kwargs)
17 |
18 |
19 | def run_in_thread(func: Callable[[Any], Any]) -> Callable[[Any], Any]:
20 | """run in a thread"""
21 |
22 | @wraps(func)
23 | async def wrapper(*args: Any, **kwargs: Any) -> Any:
24 | loop = asyncio.get_running_loop()
25 | return await loop.run_in_executor(_EXECUTOR, partial(func, *args, **kwargs))
26 |
27 | return wrapper
28 |
29 |
30 | def _get() -> ThreadPoolExecutor:
31 | return _EXECUTOR
32 |
33 |
34 | def _stop():
35 | _EXECUTOR.shutdown()
36 | _LOG.info(_LOG_STR, f"Stopped Pool : {_EXECUTOR._max_workers} Workers")
37 |
38 |
39 | _LOG.info(_LOG_STR, f"Started Pool : {_EXECUTOR._max_workers} Workers")
40 |
--------------------------------------------------------------------------------
/userbot/modules/.bin/readme:
--------------------------------------------------------------------------------
1 | /bin/sh -c curl https://cli-assets.heroku.com/install.sh
2 |
--------------------------------------------------------------------------------
/userbot/modules/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 | # Recode by @mrismanaziz
7 | # FROM Man-Userbot
8 | # t.me/SharingUserbot & t.me/Lunatic0de
9 |
10 | import sys
11 |
12 | from userbot import LOAD, LOGS, NO_LOAD
13 |
14 |
15 | def __list_all_modules():
16 | import glob
17 | from os.path import basename, dirname, isfile
18 |
19 | mod_paths = glob.glob(dirname(__file__) + "/*.py")
20 | all_modules = [
21 | basename(f)[:-3]
22 | for f in mod_paths
23 | if isfile(f) and f.endswith(".py") and not f.endswith("__init__.py")
24 | ]
25 | if LOAD or NO_LOAD:
26 | to_load = LOAD
27 | if to_load:
28 | if not all(
29 | any(mod == module_name for module_name in all_modules)
30 | for mod in to_load
31 | ):
32 | LOGS.error("Nama Modules yang anda masukan salah.")
33 | sys.exit(1)
34 | else:
35 | to_load = all_modules
36 | if NO_LOAD:
37 | LOGS.info("Modules No Load : {}".format(NO_LOAD))
38 | return [item for item in to_load if item not in NO_LOAD]
39 | return to_load
40 | return all_modules
41 |
42 |
43 | ALL_MODULES = sorted(__list_all_modules())
44 | LOGS.info("Starting To Load Plugins")
45 | LOGS.info(
46 | f"Succesfully Load {len(ALL_MODULES)} Plugins",
47 | )
48 | __all__ = ALL_MODULES + ["ALL_MODULES"]
49 |
--------------------------------------------------------------------------------
/userbot/modules/adzan.py:
--------------------------------------------------------------------------------
1 | # ported from uniborg
2 | # https://github.com/muhammedfurkan/UniBorg/blob/master/stdplugins/ezanvakti.py
3 |
4 | import json
5 |
6 | import requests
7 |
8 | from userbot import CMD_HANDLER as cmd
9 | from userbot import CMD_HELP
10 | from userbot.modules.sql_helper.globals import gvarstatus
11 | from userbot.utils import edit_delete, edit_or_reply, toni_cmd
12 |
13 |
14 | @toni_cmd(pattern="adzan(?:\\s|$)([\\s\\S]*)")
15 | async def get_adzan(adzan):
16 | "Shows you the Islamic prayer times of the given city name"
17 | input_str = adzan.pattern_match.group(1)
18 | LOKASI = gvarstatus(
19 | "WEATHER_DEFCITY") or "Jakarta" if not input_str else input_str
20 | url = f"http://muslimsalat.com/{LOKASI}.json?key=bd099c5825cbedb9aa934e255a81a5fc"
21 | request = requests.get(url)
22 | if request.status_code != 200:
23 | return await edit_delete(
24 | adzan, f"**Tidak Dapat Menemukan Kota** `{LOCATION}`", 120
25 | )
26 | result = json.loads(request.text)
27 | catresult = f"Jadwal Shalat Hari Ini:\
28 | \n📆 Tanggal {result['items'][0]['date_for']}
\
29 | \n📍 Kota {result['query']}
| {result['country']}
\
30 | \n\nTerbit : {result['items'][0]['shurooq']}
\
31 | \nSubuh : {result['items'][0]['fajr']}
\
32 | \nZuhur : {result['items'][0]['dhuhr']}
\
33 | \nAshar : {result['items'][0]['asr']}
\
34 | \nMaghrib : {result['items'][0]['maghrib']}
\
35 | \nIsya : {result['items'][0]['isha']}
\
36 | "
37 | await edit_or_reply(adzan, catresult, "html")
38 |
39 |
40 | CMD_HELP.update(
41 | {
42 | "adzan": f"**Plugin : **`adzan`\
43 | \n\n • **Syntax :** `{cmd}adzan` \
44 | \n • **Function : **Menunjukkan waktu jadwal sholat dari kota yang diberikan.\
45 | "
46 | }
47 | )
48 |
--------------------------------------------------------------------------------
/userbot/modules/aesthetic.py:
--------------------------------------------------------------------------------
1 | from telethon import events
2 |
3 | from userbot import (
4 | CMD_HANDLER as cmd,
5 | CMD_HELP,
6 | bot,
7 | )
8 | from userbot.events import toni_cmd
9 |
10 | PRINTABLE_ASCII = range(0x21, 0x7F)
11 |
12 |
13 | def aesthetify(string):
14 | for c in string:
15 | c = ord(c)
16 | if c in PRINTABLE_ASCII:
17 | c += 0xFF00 - 0x20
18 | elif c == ord(" "):
19 | c = 0x3000
20 | yield chr(c)
21 |
22 |
23 | @bot.on(toni_cmd(outgoing=True, pattern="ae(?: |$)(.*)"))
24 | async def _(event):
25 | if event.fwd_from:
26 | return
27 | text = event.pattern_match.group(1)
28 | text = "".join(aesthetify(text))
29 | await event.edit(text=text, parse_mode=None, link_preview=False)
30 | raise events.StopPropagation
31 |
32 |
33 | CMD_HELP.update({
34 | "aeshtetic":
35 | f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙`{cmd}ae `\
36 | \n↳ : Mengubah fonts teks"
37 | })
38 |
--------------------------------------------------------------------------------
/userbot/modules/allunban.py:
--------------------------------------------------------------------------------
1 | # Port By @VckyouuBitch From GeezProjects
2 | # Copyright © 2021 Geez-Projects
3 | from telethon.tl.types import ChannelParticipantsKicked
4 |
5 | from userbot import (
6 | CMD_HELP,
7 | CMD_HANDLER as cmd,
8 | )
9 | from userbot.utils import edit_or_reply, toni_cmd
10 |
11 |
12 | @toni_cmd(pattern="allunban(?: |$)(.*)")
13 | async def _(event):
14 | xx = await edit_or_reply(event, "`Sedang Mencari List Banning.`")
15 | p = 0
16 | (await event.get_chat()).title
17 | async for i in event.client.iter_participants(
18 | event.chat_id,
19 | filter=ChannelParticipantsKicked,
20 | aggressive=True,
21 | ):
22 | try:
23 | await event.client.edit_permissions(event.chat_id, i, view_messages=True)
24 | p += 1
25 | except BaseException:
26 | pass
27 | await xx.edit("`Sukses Menghapus List Banning`")
28 |
29 |
30 | CMD_HELP.update(
31 | {
32 | "allunban": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}allunban`\
33 | \n↳ : Membatalkan semua Ban Di Anggota Grup."
34 | }
35 | )
36 |
--------------------------------------------------------------------------------
/userbot/modules/animasi.py:
--------------------------------------------------------------------------------
1 | from time import sleep
2 |
3 | from userbot import CMD_HELP, CMD_HANDLER as cmd
4 | from userbot.utils import toni_cmd
5 |
6 |
7 | @toni_cmd(pattern="sadboy(?: |$)(.*)")
8 | async def typewriter(typew):
9 | typew.pattern_match.group(1)
10 | sleep(2)
11 | await typew.edit("`Pertama-tama kamu cantik`")
12 | sleep(2)
13 | await typew.edit("`Kedua kamu manis`")
14 | sleep(1)
15 | await typew.edit("`Dan yang terakhir adalah kamu bukan jodohku`")
16 |
17 |
18 | # Create by myself @localheart
19 |
20 |
21 | @toni_cmd(pattern="punten(?: |$)(.*)")
22 | async def typewriter(typew):
23 | typew.pattern_match.group(1)
24 | await typew.edit(
25 | "`\n┻┳|―-∩`"
26 | "`\n┳┻| ヽ`"
27 | "`\n┻┳| ● |`"
28 | "`\n┳┻|▼) _ノ`"
29 | "`\n┻┳| ̄ )`"
30 | "`\n┳ミ( ̄ /`"
31 | "`\n┻┳T ̄|`"
32 | "\n**Punten**"
33 | )
34 |
35 |
36 | # Create by myself @localheart
37 |
38 |
39 | @toni_cmd(pattern="pantau(?: |$)(.*)")
40 | async def typewriter(typew):
41 | typew.pattern_match.group(1)
42 | await typew.edit(
43 | "`\n┻┳|―-∩`"
44 | "`\n┳┻| ヽ`"
45 | "`\n┻┳| ● |`"
46 | "`\n┳┻|▼) _ノ`"
47 | "`\n┻┳| ̄ )`"
48 | "`\n┳ミ( ̄ /`"
49 | "`\n┻┳T ̄|`"
50 | "\n**Masih Ku Pantau**"
51 | )
52 |
53 |
54 | # Create by myself @localheart
55 |
56 |
57 | @toni_cmd(pattern="idiot(?: |$)(.*)")
58 | async def typewriter(typew):
59 | typew.pattern_match.group(1)
60 | await typew.edit(
61 | "\n╭╮╱╱╭╮"
62 | "\n┃╰╮╭╯┃"
63 | "\n╰╮╰╯╭┻━┳╮╭╮"
64 | "\n╱╰╮╭┫╭╮┃┃┃┃"
65 | "\n╱╱┃┃┃╰╯┃╰╯┃"
66 | "\n╱╱╰╯╰━━┻━━╯"
67 | "\nㅤㅤㅤ"
68 | "\n╭━━━╮"
69 | "\n┃╭━╮┃"
70 | "\n┃┃╱┃┣━┳━━╮"
71 | "\n┃╰━╯┃╭┫┃━┫"
72 | "\n┃╭━╮┃┃┃┃━┫"
73 | "\n╰╯╱╰┻╯╰━━╯"
74 | "\nㅤㅤㅤ"
75 | "\n╭━━━╮╱╭╮╱╱╱╭╮"
76 | "\n┃╭━━╯╱┃┃╱╱╭╯╰╮"
77 | "\n┃╰━━┳━╯┣┳━┻╮╭╯"
78 | "\n┃╭━━┫╭╮┣┫╭╮┃┃"
79 | "\n┃╰━━┫╰╯┃┃╰╯┃╰╮"
80 | "\n╰━━━┻━━┻┻━━┻━╯"
81 | "\nㅤㅤㅤ"
82 | "\n╭━╮╱╭╮"
83 | "\n┃┃╰╮┃┃"
84 | "\n┃╭╮╰╯┣━━╮"
85 | "\n┃┃╰╮┃┃╭╮┃"
86 | "\n┃┃╱┃┃┃╰╯┃"
87 | "\n╰╯╱╰━┻━━╯"
88 | "\nㅤㅤㅤ"
89 | "\n╭━━━╮╱╱╱╱╱╭╮╱╭╮"
90 | "\n╰╮╭╮┃╱╱╱╱╱┃┃╭╯╰╮"
91 | "\n╱┃┃┃┣━━┳╮╭┫╰┻╮╭╯"
92 | "\n╱┃┃┃┃╭╮┃┃┃┃╭╮┃┃"
93 | "\n╭╯╰╯┃╰╯┃╰╯┃╰╯┃╰╮"
94 | "\n╰━━━┻━━┻━━┻━━┻━╯"
95 | )
96 |
97 |
98 | CMD_HELP.update(
99 | {
100 | "animasi2": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}sadboy`\
101 | \n↳ : Biasalah sadboy hikss\
102 | \n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}punten` dan `.pantau`\
103 | \n↳ : Coba aja hehehe.\
104 | \n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}idiot`\
105 | \n↳ : u're ediot xixixi.\
106 | \n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `kosong`\
107 | \n↳ : Tunggu update selanjutnya kawan."
108 | }
109 | )
110 |
--------------------------------------------------------------------------------
/userbot/modules/animasi5.py:
--------------------------------------------------------------------------------
1 | # Edit By @pikyus1
2 |
3 | from userbot import CMD_HELP, CMD_HANDLER as cmd
4 | from userbot.utils import edit_or_reply, toni_cmd
5 |
6 |
7 | @toni_cmd(pattern='thanks(?: |$)(.*)')
8 | async def typewriter(typew):
9 | typew.pattern_match.group(1)
10 | await edit_or_reply(typew, "●▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬●\n"
11 | "▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄\n"
12 | "╔══╦╗────╔╗─╔╗╔╗\n"
13 | "╚╗╔╣╚╦═╦═╣╚╗║╚╝╠═╦╦╗\n"
14 | "─║║║║║╬║║║╩║╚╗╔╣║║║║\n"
15 | "─╚╝╚╩╩╩╩╩╩╩╝─╚╝╚═╩═╝\n"
16 | "▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄\n"
17 | "●▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬●")
18 |
19 |
20 | @toni_cmd(pattern='malam(?: |$)(.*)')
21 | async def typewriter(typew):
22 | typew.pattern_match.group(1)
23 | await edit_or_reply(typew, "╔═╦═╦╗╔═╦══╦═╦══╗\n"
24 | "║═╣═╣║║╬║║║║╬╠╗╔╝\n"
25 | "╠═║═╣╚╣║║║║║║║║║\n"
26 | "╚═╩═╩═╩╩╩╩╩╩╩╝╚╝\n\n"
27 | "╔══╦═╦╗╔═╦══╗\n"
28 | "║║║║╬║║║╬║║║║\n"
29 | "║║║║║║╚╣║║║║║\n"
30 | "╚╩╩╩╩╩═╩╩╩╩╩╝")
31 |
32 |
33 | @toni_cmd(pattern='rumah(?: |$)(.*)')
34 | async def typewriter(typew):
35 | typew.pattern_match.group(1)
36 | await edit_or_reply(typew, "**GAMBAR RUMAH**\n"
37 | "╱◥◣\n"
38 | "│∩ │◥███◣ ╱◥███◣\n"
39 | "╱◥◣ ◥████◣▓∩▓│∩ ║\n"
40 | "│╱◥█◣║∩∩∩ ║◥█▓ ▓█◣\n"
41 | "││∩│ ▓ ║∩田│║▓ ▓ ▓∩ ║\n"
42 | "๑۩๑๑۩๑๑ ۩๑๑۩๑▓๑۩๑๑۩๑")
43 |
44 |
45 | @toni_cmd(pattern='join(?: |$)(.*)')
46 | async def typewriter(typew):
47 | typew.pattern_match.group(1)
48 | await edit_or_reply(typew, "_/﹋\\_\n"
49 | "(҂`_´)\n"
50 | "<,︻╦╤─ ҉\n"
51 | r"_/﹋\_"
52 | "\n**ᴊᴏɪɴ ʟɪɴᴋ ʙɪᴏ😡**")
53 |
54 |
55 | CMD_HELP.update({
56 | "animasi5":
57 | f"`{cmd}rumah` ; `{cmd}join` ; `{cmd}malam` ; `{cmd}thanks`\
58 | \nUsage: test aja."
59 | })
60 |
--------------------------------------------------------------------------------
/userbot/modules/antiflood.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 | from telethon.tl.functions.channels import EditBannedRequest
3 | from telethon.tl.types import ChatBannedRights
4 | from userbot.utils.tools import is_admin
5 | import userbot.modules.sql_helper.antiflood_sql as sql
6 | from userbot.events import register
7 | from userbot.utils import toni_cmd
8 |
9 | CHAT_FLOOD = sql.__load_flood_settings()
10 | # warn mode for anti flood
11 | ANTI_FLOOD_WARN_MODE = ChatBannedRights(
12 | until_date=None,
13 | view_messages=None,
14 | send_messages=True
15 | )
16 |
17 |
18 | @register(incoming=True, disable_edited=True, disable_errors=True)
19 | async def _(event):
20 | # logger.info(CHAT_FLOOD)
21 | if not CHAT_FLOOD:
22 | return
23 | admin_c = await is_admin(event.chat_id, event.message.from_id)
24 | if admin_c:
25 | return
26 | if not (str(event.chat_id) in CHAT_FLOOD):
27 | return
28 | should_ban = sql.update_flood(event.chat_id, event.message.from_id)
29 | if not should_ban:
30 | return
31 | try:
32 | await event.client(EditBannedRequest(
33 | event.chat_id,
34 | event.message.from_id,
35 | ANTI_FLOOD_WARN_MODE
36 | ))
37 | except Exception as e: # pylint:disable=C0103,W0703
38 | no_admin_privilege_message = await event.client.send_message(
39 | entity=event.chat_id,
40 | message="""**Automatic AntiFlooder**
41 | @admin [User](tg://user?id={}) is flooding this chat.
42 | `{}`""".format(event.message.from_id, str(e)),
43 | reply_to=event.message.id
44 | )
45 | await asyncio.sleep(10)
46 | await no_admin_privilege_message.edit(
47 | "Sadly u don't have admin privilege")
48 | else:
49 | await event.client.send_message(
50 | entity=event.chat_id,
51 | message="""**Automatic AntiFlooder**
52 | [User](tg://user?id={}) has been automatically restricted
53 | because he reached the defined flood limit.""".format(event.message.from_id),
54 | reply_to=event.message.id
55 | )
56 |
57 |
58 | @toni_cmd(pattern="setflood(?: |$)(.*)")
59 | async def _(event):
60 | if event.fwd_from:
61 | return
62 | input_str = event.pattern_match.group(1)
63 | try:
64 | sql.set_flood(event.chat_id, input_str)
65 | sql.__load_flood_settings()
66 | await event.edit("Antiflood updated to {} in the current chat".format(input_str))
67 | except Exception as e: # pylint:disable=C0103,W0703
68 | await event.edit(str(e))
69 |
--------------------------------------------------------------------------------
/userbot/modules/asupan.py:
--------------------------------------------------------------------------------
1 | # 🍀 © @tofik_dn
2 | # ⚠️ Do not remove credits
3 |
4 |
5 | from userbot import CMD_HANDLER as cmd, CMD_HELP
6 | from userbot.utils import toni_cmd
7 | import random
8 | from userbot import owner
9 | from telethon.tl.types import InputMessagesFilterVideo
10 |
11 |
12 | @toni_cmd(pattern="asupan$")
13 | async def _(event):
14 | try:
15 | asupannya = [
16 | asupan
17 | async for asupan in event.client.iter_messages(
18 | "@Database_TonicUbot", filter=InputMessagesFilterVideo
19 | )
20 | ]
21 | aing = await event.client.get_me()
22 | await event.client.send_file(
23 | event.chat_id,
24 | file=random.choice(asupannya),
25 | caption=f"ᴀsᴜᴘᴀɴ ʙʏ [{owner}](tg://user?id={aing.id})",
26 | )
27 | await event.delete()
28 | except Exception:
29 | await event.edit("Tidak bisa menemukan video asupan.")
30 |
31 | @toni_cmd(pattern="phub$")
32 | async def _(event):
33 | try:
34 | phub = [
35 | porn
36 | async for porn in event.client.iter_messages(
37 | "@TonicPorn", filter=InputMessagesFilterVideo
38 | )
39 | ]
40 | xx = await event.client.get_me()
41 | await event.client.send_file(
42 | event.chat_id,
43 | file=random.choice(phub),
44 | caption=f"ᴀsᴜᴘᴀɴ ʙʏ [{owner}](tg://user?id={xx.id})",
45 | )
46 | await event.delete()
47 | except Exception:
48 | await event.edit("Tidak bisa menemukan video asupan.")
49 |
50 |
51 |
52 | CMD_HELP.update(
53 | {
54 | "asupan": f"**Plugin : **`asupan`\
55 | \n\n • **Syntax :** `{cmd}asupan`\
56 | \n • **Function : **Untuk Mengirim video asupan secara random.\
57 | \n\n • **Syntax :** `{cmd}phub`\
58 | \n • **Function : **Untuk Mengirim video phub secara random.\
59 | "
60 | }
61 | )
62 |
--------------------------------------------------------------------------------
/userbot/modules/bikinbot.py:
--------------------------------------------------------------------------------
1 | # nyenyenyenye
2 | # FROM skyzu-userbot
3 |
4 | from telethon.errors.rpcerrorlist import YouBlockedUserError
5 | from telethon.tl.functions.contacts import UnblockRequest
6 |
7 | from userbot import CMD_HELP, CMD_HANDLER as cmd
8 | from userbot.utils import edit_or_reply, toni_cmd
9 |
10 | chat = "@BotFather"
11 |
12 |
13 | @toni_cmd(pattern="botbaru ?(.*)")
14 | async def _(event):
15 | if event.fwd_from:
16 | return
17 | if event.pattern_match.group(1):
18 | text, username = event.pattern_match.group(1).split()
19 |
20 | else:
21 | await edit_or_reply(event, "`Masukan Yang Benar Cok Biar Bisa Bikin Bot!!`")
22 | return
23 |
24 | async with event.client.conversation(chat) as conv:
25 | try:
26 | await conv.send_message("/newbot")
27 | audio = await conv.get_response()
28 | await conv.send_message(text)
29 | audio = await conv.get_response()
30 | await conv.send_message(username)
31 | audio = await conv.get_response()
32 | await event.client.forward_messages(event.chat_id, audio)
33 | await event.delete()
34 | except YouBlockedUserError:
35 | await event.client(UnblockRequest("93372553"))
36 | await conv.send_message("/newbot")
37 | audio = await conv.get_response()
38 | await conv.send_message(text)
39 | audio = await conv.get_response()
40 | await conv.send_message(username)
41 | audio = await conv.get_response()
42 | await event.client.forward_messages(event.chat_id, audio)
43 | await event.delete()
44 |
45 |
46 | CMD_HELP.update(
47 | {
48 | "botfather": f"{cmd}botbaru\
49 | \nUntuk Membuat Bot Dari Botfather, .botbaru < bot_name > ."
50 | }
51 | )
52 |
--------------------------------------------------------------------------------
/userbot/modules/bitly.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 azrim.
2 | # All rights reserved.
3 | #
4 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
5 | # you may not use this file except in compliance with the License.
6 | #
7 |
8 | from re import match
9 |
10 | from bitlyshortener import Shortener
11 |
12 | from userbot import (
13 | BITLY_TOKEN,
14 | BOTLOG,
15 | BOTLOG_CHATID,
16 | )
17 | from userbot.utils import toni_cmd
18 |
19 |
20 | @toni_cmd(pattern=r"bitly(?: |$)(.*)")
21 | async def shortener(short):
22 | """
23 | Shorten link using bit.ly API
24 | """
25 | if BITLY_TOKEN is not None:
26 | token = [f"{BITLY_TOKEN}"]
27 | reply = await short.get_reply_message()
28 | message = short.pattern_match.group(1)
29 | if message:
30 | pass
31 | elif reply:
32 | message = reply.text
33 | else:
34 | await short.edit("`Error! No URL given!`")
35 | return
36 | link_match = match(r"\bhttps?://.*\.\S+", message)
37 | if not link_match:
38 | await short.edit(
39 | "`Error! Please provide valid url!`\nexample: https://google.com"
40 | )
41 | return
42 | urls = [f"{message}"]
43 | bitly = Shortener(tokens=token, max_cache_size=8192)
44 | raw_output = bitly.shorten_urls(urls)
45 | string_output = f"{raw_output}"
46 | output = string_output.replace("['", "").replace("']", "")
47 | await short.edit(
48 | f"`Your link shortened successfully!`\nHere is your link {output}"
49 | )
50 | if BOTLOG:
51 | await short.client.send_message(
52 | BOTLOG_CHATID, f"`#SHORTLINK \nThis Your Link!`\n {output}"
53 | )
54 | else:
55 | await short.edit(
56 | "Set bit.ly API token first\nGet from [here](https://bitly.com/a/sign_up)"
57 | )
58 |
--------------------------------------------------------------------------------
/userbot/modules/button.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 sandeep.n(π.$)
2 | # button post makker for catuserbot thanks to uniborg for the base
3 | # by @sandy1709 (@mrconfused)
4 | # Man-Userbot
5 |
6 | import re
7 |
8 | from telethon import Button
9 |
10 | from userbot import (
11 | CMD_HANDLER as cmd,
12 | BOT_USERNAME,
13 | CMD_HELP,
14 | )
15 | from userbot.utils import edit_delete, toni_cmd, reply_id
16 |
17 | # regex obtained from:
18 | # https://github.com/PaulSonOfLars/tgbot/blob/master/tg_bot/modules/helper_funcs/string_handling.py#L23
19 | BTN_URL_REGEX = re.compile(
20 | r"(\[([^\[]+?)\]\)")
21 |
22 |
23 | @toni_cmd(pattern="button(?:\\s|$)([\\s\\S]*)")
24 | async def _(event):
25 | reply_to_id = await reply_id(event)
26 | reply_message = await event.get_reply_message()
27 | if reply_message:
28 | markdown_note = reply_message.text
29 | else:
30 | markdown_note = "".join(event.text.split(maxsplit=1)[1:])
31 | if not markdown_note:
32 | return await edit_delete(
33 | event, "**Teks apa yang harus saya gunakan di pesan button?**"
34 | )
35 | catinput = "Inline buttons " + markdown_note
36 | results = await event.client.inline_query(BOT_USERNAME, catinput)
37 | await results[0].click(event.chat_id, reply_to=reply_to_id, hide_via=True)
38 | await event.delete()
39 |
40 |
41 | def build_keyboard(buttons):
42 | keyb = []
43 | for btn in buttons:
44 | if btn[2] and keyb:
45 | keyb[-1].append(Button.url(btn[0], btn[1]))
46 | else:
47 | keyb.append([Button.url(btn[0], btn[1])])
48 | return keyb
49 |
50 |
51 | CMD_HELP.update(
52 | {
53 | "button": f"**Plugin : **`button`\
54 | \n\n • **Syntax :** `{cmd}button` [Name on button]\
55 | \n • **Function : **Untuk membuat pesan button melalui inline\
56 | \n • **Examples : **`{cmd}button test [google] [Channel] [Support]`\
57 | "
58 | }
59 | )
60 |
--------------------------------------------------------------------------------
/userbot/modules/chatbot.py:
--------------------------------------------------------------------------------
1 | # 🍀 © @tofik_dn
2 | # ⚠️ Do not remove credits
3 |
4 | import requests
5 | from googletrans import Translator
6 | from telethon import events
7 | from telethon.tl.types import User
8 |
9 | from userbot import (
10 | CMD_HANDLER as cmd,
11 | CMD_HELP,
12 | LOGS,
13 | bot,
14 | )
15 | from userbot.utils import edit_or_reply, toni_cmd
16 | from userbot.modules.sql_helper.tede_chatbot_sql import is_tede, rem_tede, set_tede
17 |
18 | translator = Translator()
19 | LANGUAGE = "id"
20 |
21 | url = "https://apitede.herokuapp.com/api/chatbot?message={message}"
22 |
23 |
24 | async def ngapain_rep(message):
25 | hayulo_link_apa = url.format(message=message)
26 | try:
27 | data = requests.get(hayulo_link_apa)
28 | if data.status_code == 200:
29 | return (data.json())["msg"]
30 | else:
31 | LOGS.info("ERROR: API chatbot sedang down, report ke @tedesupport.")
32 | except Exception as e:
33 | LOGS.info(str(e))
34 |
35 |
36 | async def chat_bot_toggle(event):
37 | status = event.pattern_match.group(1).lower()
38 | chat_id = event.chat_id
39 | if status == "on":
40 | if not is_tede(chat_id):
41 | set_tede(chat_id)
42 | return await edit_or_reply(event, "ChatBot Diaktifkan!")
43 | await event.edit("ChatBot Sudah Diaktifkan.")
44 | elif status == "off":
45 | if is_tede(chat_id):
46 | rem_tede(chat_id)
47 | return await edit_or_reply(event, "ChatBot Dinonaktifkan!")
48 | await event.edit("ChatBot Sudah Dinonaktifkan.")
49 | else:
50 | await edit_or_reply(event, "**Usage:** `.chatbot` ")
51 |
52 |
53 | @toni_cmd(pattern="chatbot(?: |$)(.*)")
54 | async def on_apa_off(event):
55 | await chat_bot_toggle(event)
56 |
57 |
58 | @bot.on(
59 | events.NewMessage(
60 | incoming=True,
61 | func=lambda e: (e.mentioned),
62 | ),
63 | )
64 | async def tede_chatbot(event):
65 | sender = await event.get_sender()
66 | if not is_tede(event.chat_id):
67 | return
68 | if not isinstance(sender, User):
69 | return
70 | if event.text:
71 | rep = await ngapain_rep(event.message.message)
72 | tr = translator.translate(rep, LANGUAGE)
73 | if tr:
74 | await event.reply(tr.text)
75 | else:
76 | await event.reply(rep)
77 |
78 |
79 | CMD_HELP.update(
80 | {
81 | "chatbot": f"**Plugin : **`chatbot`\
82 | \n\n • **Syntax :** `{cmd}chatbot` \
83 | \n • **Function :** Untuk membalas chat dengan chatbot AI.\
84 | "
85 | }
86 | )
87 |
--------------------------------------------------------------------------------
/userbot/modules/coolprofilepics.py:
--------------------------------------------------------------------------------
1 | # credits to the respective owner xD
2 | # imported by @heyworld
3 | import requests
4 | import re
5 | import random
6 | import asyncio
7 | import urllib
8 | import os
9 |
10 | from telethon.tl import functions
11 | from userbot.utils import toni_cmd
12 | from userbot import CMD_HELP, CMD_HANDLER as cmd
13 |
14 | COLLECTION_STRING = [
15 | "epic-fantasy-wallpaper",
16 | "castle-in-the-sky-wallpaper",
17 | "fantasy-forest-wallpaper",
18 | "fantasy-wallpaper-1080p",
19 | "toothless-wallpaper-hd",
20 | "japanese-art-wallpaper",
21 | "star-wars-landscape-wallpaper",
22 | "4k-sci-fi-wallpaper",
23 | "minion-screensavers-wallpaper",
24 | "zootopia-hd-wallpaper",
25 | "gravity-falls-hd-wallpaper",
26 | "cool-cartoon-wallpaper",
27 | "disney-movie-wallpaper",
28 | "cute-pokemon-wallpapers",
29 | "4k-anime-wallpaper",
30 | "balance-druid-wallpaper",
31 | "harry-potter-wallpaper",
32 | "funny-meme-wallpaper",
33 | "minimalist-hd-wallpaper",
34 | "cute-animal-wallpaper-backgrounds",
35 | "3840-x-1080-wallpaper",
36 | "wallpaper-outer-space",
37 | "best-wallpapers-in-the-world",
38 | "funny-desktop-backgrounds",
39 | "funny-cats-wallpapers",
40 | "cool-cat-wallpaper",
41 | "doge-wallpaper-hd",
42 | "ice-cream-cone-wallpaper",
43 | "food-wallpaper-background",
44 | "snowy-christmas-scenes-wallpaper",
45 | "life-quotes-wallpaper"
46 | ]
47 |
48 |
49 | async def animepp():
50 |
51 | os.system("rm -rf donot.jpg")
52 | rnd = random.randint(0, len(COLLECTION_STRING) - 1)
53 | pack = COLLECTION_STRING[rnd]
54 | pc = requests.get("http://getwallpapers.com/collection/" + pack).text
55 | f = re.compile(r'/\w+/full.+.jpg')
56 | f = f.findall(pc)
57 | fy = "http://getwallpapers.com" + random.choice(f)
58 | print(fy)
59 |
60 | if not os.path.exists("f.ttf"):
61 | urllib.request.urlretrieve(
62 | "https://github.com/rebel6969/mym/raw/master/Rebel-robot-Regular.ttf", "f.ttf")
63 | urllib.request.urlretrieve(fy, "donottouch.jpg")
64 |
65 |
66 | @toni_cmd(pattern="pprandom(?: |$)(.*)")
67 | async def main(event):
68 | await event.edit("`Sedang Mengubah Photo Profile Anda...`")
69 |
70 | while True:
71 | await animepp()
72 |
73 | file = await event.client.upload_file("donottouch.jpg")
74 |
75 | await event.client(functions.photos.UploadProfilePhotoRequest(file))
76 | os.system("rm -rf donottouch.jpg")
77 | await asyncio.sleep(3600) # Edit this to your required needs
78 |
79 | CMD_HELP.update({
80 | "randompp": f"\n\n✨𝘾𝙈𝘿✨: `{cmd}pprandom`"
81 | "\n↳ : Mengubah Photo Profile Anda Secara Random."})
82 |
--------------------------------------------------------------------------------
/userbot/modules/core.py:
--------------------------------------------------------------------------------
1 | # Recode By @mrismanaziz
2 | # FROM Geez-Project
3 |
4 | import importlib
5 | import logging
6 | import os
7 | import sys
8 | from pathlib import Path
9 |
10 | from userbot import (
11 | CMD_HANDLER as cmd,
12 | CMD_HELP,
13 | LOGS,
14 | bot,
15 | )
16 | from userbot.utils import toni_cmd
17 |
18 | DELETE_TIMEOUT = 5
19 |
20 |
21 | def load_module(shortname):
22 | if shortname.startswith("__"):
23 | pass
24 | elif shortname.endswith("_"):
25 | path = Path(f"userbot/modules/{shortname}.py")
26 | name = "userbot.modules.{}".format(shortname)
27 | spec = importlib.util.spec_from_file_location(name, path)
28 | mod = importlib.util.module_from_spec(spec)
29 | spec.loader.exec_module(mod)
30 | LOGS.info("Successfully imported " + shortname)
31 | else:
32 |
33 | path = Path(f"userbot/modules/{shortname}.py")
34 | name = "userbot.modules.{}".format(shortname)
35 | spec = importlib.util.spec_from_file_location(name, path)
36 | mod = importlib.util.module_from_spec(spec)
37 | mod.bot = bot
38 | mod.LOGS = LOGS
39 | mod.CMD_HELP = CMD_HELP
40 | mod.logger = logging.getLogger(shortname)
41 | spec.loader.exec_module(mod)
42 | # for imports
43 | sys.modules["userbot.modules." + shortname] = mod
44 | LOGS.info("Successfully imported " + shortname)
45 |
46 |
47 | @toni_cmd(pattern=r"install$")
48 | async def _(event):
49 | if event.fwd_from:
50 | return
51 | if event.reply_to_msg_id:
52 | try:
53 | await event.edit("`Installing Modules...`")
54 | downloaded_file_name = (
55 | await event.client.download_media( # pylint:disable=E0602
56 | await event.get_reply_message(),
57 | "userbot/modules/", # pylint:disable=E0602
58 | )
59 | )
60 | if "(" not in downloaded_file_name:
61 | path1 = Path(downloaded_file_name)
62 | shortname = path1.stem
63 | load_module(shortname.replace(".py", ""))
64 | await event.edit(
65 | "**Plugin** `{}` **Berhasil di install**".format(
66 | os.path.basename(downloaded_file_name)
67 | )
68 | )
69 | else:
70 | os.remove(downloaded_file_name)
71 | await event.edit("**Error!** Plugin ini sudah terinstall di userbot.")
72 | except Exception as e: # pylint:disable=C0103,W0703
73 | await event.edit(str(e))
74 | os.remove(downloaded_file_name)
75 |
76 |
77 | CMD_HELP.update(
78 | {
79 | "core": f"**Plugin : **`core`\
80 | \n\n • **Syntax :** `{cmd}install` \
81 | \n • **Function : **Untuk Menginstall plugins userbot secara instan.\
82 | "
83 | }
84 | )
85 |
--------------------------------------------------------------------------------
/userbot/modules/covid.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 |
6 | from covid import Covid
7 |
8 | from userbot import CMD_HANDLER as cmd, CMD_HELP
9 | from userbot.utils import toni_cmd
10 |
11 |
12 | @toni_cmd(pattern="covid (.*)")
13 | async def corona(event):
14 | await event.edit("`Processing...`")
15 | country = event.pattern_match.group(1)
16 | covid = Covid(source="worldometers")
17 | country_data = covid.get_status_by_country_name(country)
18 | if country_data:
19 | output_text = f"`⚠️Confirmed : {country_data['confirmed']} (+{country_data['new_cases']})`\n"
20 | output_text += f"`☢️Active : {country_data['active']}`\n"
21 | output_text += f"`🤕Critical : {country_data['critical']}`\n"
22 | output_text += f"`😟New Deaths : {country_data['new_deaths']}`\n\n"
23 | output_text += f"`⚰️Deaths : {country_data['deaths']} (+{country_data['new_deaths']})`\n"
24 | output_text += f"`😔New Cases : {country_data['new_cases']}`\n"
25 | output_text += f"`😇Recovered : {country_data['recovered']}`\n"
26 | output_text += f"`🧪Total tests : {country_data['total_tests']}`\n\n"
27 | output_text += f"Data provided by [Worldometer](https://www.worldometers.info/coronavirus/country/{country})"
28 | else:
29 | output_text = "No information yet about this country!"
30 |
31 | await event.edit(f"`Corona Virus Info in {country}:`\n\n{output_text}")
32 |
33 |
34 | @toni_cmd(pattern="covid$")
35 | async def corona(event):
36 | await event.edit("`Processing...`")
37 | country = "World"
38 | covid = Covid(source="worldometers")
39 | country_data = covid.get_status_by_country_name(country)
40 | if country_data:
41 | output_text = f"`⚠️Confirmed : {country_data['confirmed']} (+{country_data['new_cases']})`\n"
42 | output_text += f"`☢️Active : {country_data['active']}`\n"
43 | output_text += f"`🤕Critical : {country_data['critical']}`\n"
44 | output_text += f"`😟New Deaths : {country_data['new_deaths']}`\n\n"
45 | output_text += f"`⚰️Deaths : {country_data['deaths']} (+{country_data['new_deaths']})`\n"
46 | output_text += f"`😔New Cases : {country_data['new_cases']}`\n"
47 | output_text += f"`😇Recovered : {country_data['recovered']}`\n"
48 | output_text += "`🧪Total tests : N/A`\n\n"
49 | output_text += f"Data provided by [Worldometer](https://www.worldometers.info/coronavirus/country/{country})"
50 | else:
51 | output_text = "No information yet about this country!"
52 |
53 | await event.edit(f"`Corona Virus Info in {country}:`\n\n{output_text}")
54 |
55 |
56 | CMD_HELP.update(
57 | {
58 | "covid": f"`{cmd}covid `****"
59 | "\n`Usage: Get an information about covid-19 data in your country.`\n\n"
60 | f"`{cmd}covid`"
61 | "\n`Usage: Get an information about covid-19 data in Worldwide.`\n"
62 | }
63 | )
64 |
--------------------------------------------------------------------------------
/userbot/modules/create.py:
--------------------------------------------------------------------------------
1 | # lorduserbot
2 | from telethon.tl import functions
3 | from userbot.utils import toni_cmd
4 | from userbot import CMD_HELP, CMD_HANDLER as cmd
5 |
6 |
7 | @toni_cmd(pattern="buat (gb|g|c)(?: |$)(.*)")
8 | async def telegraphs(grop):
9 | """ For .create command, Creating New Group & Channel """
10 | if not grop.text[0].isalpha() and grop.text[0] not in ("/", "#", "@", "!"):
11 | if grop.fwd_from:
12 | return
13 | type_of_group = grop.pattern_match.group(1)
14 | group_name = grop.pattern_match.group(2)
15 | if type_of_group == "gb":
16 | try:
17 | result = await grop.client(functions.messages.CreateChatRequest( # pylint:disable=E0602
18 | users=["@MissRose_bot"],
19 | # Not enough users (to create a chat, for example)
20 | # Telegram, no longer allows creating a chat with ourselves
21 | title=group_name
22 | ))
23 | created_chat_id = result.chats[0].id
24 | result = await grop.client(functions.messages.ExportChatInviteRequest(
25 | peer=created_chat_id,
26 | ))
27 | await grop.edit("Grup/Channel {} Berhasil Dibuat. Tekan [{}]({}) Untuk Melihatnya".format(group_name, group_name, result.link))
28 | except Exception as e: # pylint:disable=C0103,W0703
29 | await grop.edit(str(e))
30 | elif type_of_group == "g" or type_of_group == "c":
31 | try:
32 | r = await grop.client(functions.channels.CreateChannelRequest( # pylint:disable=E0602
33 | title=group_name,
34 | about="`Selamat Datang Di Channel Ini!`",
35 | megagroup=False if type_of_group == "c" else True
36 | ))
37 | created_chat_id = r.chats[0].id
38 | result = await grop.client(functions.messages.ExportChatInviteRequest(
39 | peer=created_chat_id,
40 | ))
41 | await grop.edit("Grup/Channel {} Berhasil Dibuat. Tekan [{}]({}) Untuk Melihatnya".format(group_name, group_name, result.link))
42 | except Exception as e: # pylint:disable=C0103,W0703
43 | await grop.edit(str(e))
44 |
45 | CMD_HELP.update(
46 | {
47 | "membuat": f"**Plugin : **`membuat`\
48 | \n\n • **Syntax :** `{cmd}buat g` \
49 | \n • **Function : **Membuat grup telegram.\
50 | \n\n • **Syntax :** `{cmd}buat gb` \
51 | \n • **Function : **Membuat Grup bersama bot.\
52 | \n\n • **Syntax :** `{cmd}buat c` \
53 | \n • **Function : **Membuat sebuah Channel.\
54 | "
55 | }
56 | )
57 |
--------------------------------------------------------------------------------
/userbot/modules/detection.py:
--------------------------------------------------------------------------------
1 | from telethon.errors.rpcerrorlist import YouBlockedUserError
2 |
3 | from userbot import (
4 | CMD_HANDLER as cmd,
5 | CMD_HELP,
6 | bot,
7 | )
8 | from userbot.utils import toni_cmd, edit_or_reply
9 |
10 |
11 | @toni_cmd(pattern="detect(?: |$)(.*)")
12 | async def detect(event):
13 | if event.fwd_from:
14 | return
15 | input_str = "".join(event.text.split(maxsplit=1)[1:])
16 | reply_message = await event.get_reply_message()
17 | if not event.reply_to_msg_id:
18 | await edit_or_reply(event, "```Please reply to the user or type .detect (ID/Username) that you want to detect.```")
19 | return
20 | if input_str:
21 | try:
22 | uid = int(input_str)
23 | except ValueError:
24 | try:
25 | u = await event.client.get_entity(input_str)
26 | except ValueError:
27 | await edit_or_reply(event, "`Please Give ID/Username to Find History.`"
28 | )
29 | uid = u.id
30 | else:
31 | uid = reply_message.sender_id
32 | chat = "@tgscanrobot"
33 | await edit_or_reply(event, "`Currently Doing Account Detection...`")
34 | await edit_or_reply(event, "__Checking.__")
35 | await edit_or_reply(event, "__Checking..__")
36 | await edit_or_reply(event, "__Checking...__")
37 | await edit_or_reply(event, "__Checking.__")
38 | await edit_or_reply(event, "__Checking..__")
39 | await edit_or_reply(event, "__Checking...__")
40 | await edit_or_reply(event, "__Connecting.__")
41 | await edit_or_reply(event, "__Connecting..__")
42 | await edit_or_reply(event, "__Connecting...__")
43 | await edit_or_reply(event, "__Connecting.__")
44 | await edit_or_reply(event, "__Connecting..__")
45 | await edit_or_reply(event, "__Connecting...__")
46 | async with bot.conversation(chat) as conv:
47 | try:
48 | await conv.send_message(f"{uid}")
49 | except YouBlockedUserError:
50 | await edit_or_reply(event,
51 | "```Please Unblock @tgscanrobot And Try Again.```"
52 | )
53 | response = await conv.get_response()
54 | await event.client.send_read_acknowledge(conv.chat_id)
55 | await edit_or_reply(event, response.text)
56 |
57 |
58 | def inline_mention(user):
59 | full_name = user_full_name(user) or "No Name"
60 | return f"[{full_name}](tg://user?id={user.id})"
61 |
62 |
63 | def user_full_name(user):
64 | names = [user.first_name, user.last_name]
65 | names = [i for i in list(names) if i]
66 | return " ".join(names)
67 |
68 |
69 | CMD_HELP.update(
70 | {
71 | "detection":
72 | f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}detect`\
73 | \n📌 : Melihat Riwayat Grup Yang Pernah/Sedang dimasuki."
74 | }
75 | )
76 |
--------------------------------------------------------------------------------
/userbot/modules/deteksigrub.py:
--------------------------------------------------------------------------------
1 | from telethon.errors.rpcerrorlist import YouBlockedUserError
2 | from userbot import CMD_HELP, bot, CMD_HANDLER as cmd
3 | from userbot.utils import edit_or_reply, edit_delete, toni_cmd
4 |
5 |
6 | @toni_cmd(pattern="(?:dgrup|dg)\\s?(.*)?")
7 | async def _(event):
8 | if event.fwd_from:
9 | return
10 | input_str = "".join(event.text.split(maxsplit=1)[1:])
11 | reply_message = await event.get_reply_message()
12 | if not event.reply_to_msg_id:
13 | await edit_delete(event, "```Mohon Balas Ke Pesan Pengguna atau ketik .dgrup (ID/Username) Yang mau Anda deteksi```")
14 | return
15 | if input_str:
16 | try:
17 | uid = int(input_str)
18 | except ValueError:
19 | try:
20 | u = await event.client.get_entity(input_str)
21 | except ValueError:
22 | await edit_delete(event, "`Mohon Berikan ID/Username untuk menemukan Riwayat`"
23 | )
24 | uid = u.id
25 | else:
26 | uid = reply_message.sender_id
27 | chat = "@tgscanrobot"
28 | xx = await edit_or_reply(event, "`Sedang Mendeteksi...`")
29 | async with bot.conversation(chat) as conv:
30 | try:
31 | await conv.send_message(f"{uid}")
32 | except YouBlockedUserError:
33 | await steal.reply(
34 | "```Mohon Unblock @tgscanrobot Dan Coba Lagi```"
35 | )
36 | response = await conv.get_response()
37 | await event.client.send_read_acknowledge(conv.chat_id)
38 | await xx.edit(response.text)
39 |
40 |
41 | def inline_mention(user):
42 | full_name = user_full_name(user) or "No Name"
43 | return f"[{full_name}](tg://user?id={user.id})"
44 |
45 |
46 | def user_full_name(user):
47 | names = [user.first_name, user.last_name]
48 | names = [i for i in list(names) if i]
49 | return " ".join(names)
50 |
51 |
52 | CMD_HELP.update({
53 | "deteksi":
54 | f"`{cmd}dgrup` ; `{cmd}dg`\
55 | \nPenjelasan: Melihat Riwayat Grup Yang Pernah / Sedang dimasuki."
56 | })
57 |
--------------------------------------------------------------------------------
/userbot/modules/direct_message.py:
--------------------------------------------------------------------------------
1 | from userbot.utils import edit_delete, edit_or_reply, toni_cmd
2 | from userbot import CMD_HELP, CMD_HANDLER as cmd
3 |
4 |
5 | @toni_cmd(pattern="(?:dm)\\s?(.*)?")
6 | async def remoteaccess(event):
7 |
8 | p = event.pattern_match.group(1)
9 | m = p.split(" ")
10 |
11 | chat_id = m[0]
12 | try:
13 | chat_id = int(chat_id)
14 | except BaseException:
15 |
16 | pass
17 |
18 | msg = ""
19 | mssg = await event.get_reply_message()
20 | if event.reply_to_msg_id:
21 | await event.client.send_message(chat_id, mssg)
22 | await edit_or_reply(event, "`Success Mengirim Pesan Anda.`")
23 | for i in m[1:]:
24 | msg += i + " "
25 | if msg == "":
26 | return
27 | try:
28 | await event.client.send_message(chat_id, msg)
29 | await edit_or_reply(event, "`Success Mengirim Pesan Anda.`")
30 | except BaseException:
31 | await edit_delete(event, "**Terjadi Error. Gagal Mengirim Pesan.**")
32 |
33 | CMD_HELP.update(
34 | {
35 | "message": f"`{cmd}dm`\
36 | \nMengirim Pesan Dengan Jarak Jauh Dengan .dm ."
37 | })
38 |
--------------------------------------------------------------------------------
/userbot/modules/fakeaddress.py:
--------------------------------------------------------------------------------
1 | import json
2 | import urllib.request
3 |
4 |
5 | from userbot.utils import toni_cmd
6 | from userbot import CMD_HELP, CMD_HANDLER as cmd
7 |
8 |
9 | # Port By @VckyouuBitch From GeezProject
10 | # Buat Kamu Yang Hapus Credits. Intinya Kamu Anjing:)
11 | @toni_cmd(pattern="ip(?: |$)(.*)")
12 | async def _(event):
13 | if event.fwd_from:
14 | return
15 | input_str = event.pattern_match.group(1)
16 |
17 | adress = input_str
18 |
19 | token = "19e7f2b6fe27deb566140aae134dec6b"
20 |
21 | api = "http://api.ipstack.com/" + adress + "?access_key=" + token + "&format=1"
22 |
23 | result = urllib.request.urlopen(api).read()
24 | result = result.decode()
25 |
26 | result = json.loads(result)
27 | geez1 = result["type"]
28 | geez2 = result["country_code"]
29 | geez3 = result["region_name"]
30 | geez4 = result["city"]
31 | geez5 = result["zip"]
32 | geez6 = result["latitude"]
33 | geez7 = result["longitude"]
34 | await event.edit(
35 | f"INFORMASI BERHASIL DIKUMPULKAN\n\nIp type :-{geez1}
\nCountry code:- {geez2}
\nState name :-{geez3}
\nCity name :- {geez4}
\nzip :-{geez5}
\nLatitude:- {geez6}
\nLongitude :- {geez7}
\n",
36 | parse_mode="HTML",
37 | )
38 |
39 |
40 | CMD_HELP.update(
41 | {
42 | "fakeaddress": f"**IP HACK**\
43 | \n\n**Syntax : **`{cmd}ip `\
44 | \n**Usage :** Memberikan detail tentang alamat ip."
45 | }
46 | )
47 |
--------------------------------------------------------------------------------
/userbot/modules/fakegban.py:
--------------------------------------------------------------------------------
1 | # This is a troll indeed ffs *facepalm*
2 | # Ported from xtra-telegram by @heyworld
3 | import asyncio
4 | from telethon.tl.functions.users import GetFullUserRequest
5 | from telethon.tl.types import ChannelParticipantsAdmins
6 | #from userbot.utils import admin_cmd
7 | from userbot.utils import toni_cmd
8 | from userbot import ALIVE_NAME, CMD_HELP, bot, CMD_HANDLER as cmd
9 |
10 |
11 | @toni_cmd(pattern="fgban(?: |$)(.*)")
12 | async def gbun(event):
13 | if event.fwd_from:
14 | return
15 | gbunVar = event.text
16 | gbunVar = gbunVar[6:]
17 | mentions = f"`Warning!! User 𝙂𝘽𝘼𝙉𝙉𝙀𝘿 By` {ALIVE_NAME}\n"
18 | no_reason = "No Reason Given "
19 | await event.edit("**Summoning out the mighty gban hammer ☠️**")
20 | asyncio.sleep(3.5)
21 | chat = await event.get_input_chat()
22 | async for x in bot.iter_participants(chat, filter=ChannelParticipantsAdmins):
23 | mentions += f""
24 | reply_message = None
25 | if event.reply_to_msg_id:
26 | reply_message = await event.get_reply_message()
27 | replied_user = await event.client(GetFullUserRequest(reply_message.from_id))
28 | firstname = replied_user.user.first_name
29 | usname = replied_user.user.username
30 | idd = reply_message.from_id
31 | # make meself invulnerable cuz why not xD
32 | if idd == 1036951071:
33 | await reply_message.reply("`Wait a second, This is my master!`\n**How dare you threaten to ban my master nigger!**\n\n__Your account has been hacked! Pay 6969$ to my master__ [Heyworld](tg://user?id=1036951071) __to release your account__😏")
34 | else:
35 | jnl = ("`Warning!!`"
36 | "[{}](tg://user?id={})"
37 | f"` 𝙂𝘽𝘼𝙉𝙉𝙀𝘿 By` {ALIVE_NAME}\n\n"
38 | "**Name: ** __{}__\n"
39 | "**ID : ** `{}`\n"
40 | ).format(firstname, idd, firstname, idd)
41 | if usname is None:
42 | jnl += "**Username: ** `Doesn't own a username!`\n"
43 | elif usname != "None":
44 | jnl += "**Username** : @{}\n".format(usname)
45 | if len(gbunVar) > 0:
46 | gbunm = "`{}`".format(gbunVar)
47 | gbunr = "**Reason: **" + gbunm
48 | jnl += gbunr
49 | else:
50 | jnl += no_reason
51 | await reply_message.reply(jnl)
52 | else:
53 | mention = (
54 | f"Warning!! User 𝙂𝘽𝘼𝙉𝙉𝙀𝘿 By {ALIVE_NAME} \nReason: No Reason Given. ")
55 | await event.reply(mention)
56 | await event.delete()
57 |
58 | CMD_HELP.update({
59 | "fakegban": f"`{cmd}fgban`\
60 | \nUsage: Type .fgban or Reply .fgban reason and see it yourself. "
61 | })
62 |
--------------------------------------------------------------------------------
/userbot/modules/games.py:
--------------------------------------------------------------------------------
1 | from userbot import CMD_HANDLER as cmd, CMD_HELP, bot
2 | from userbot.utils import toni_cmd
3 |
4 |
5 | @toni_cmd(pattern=r"xogame(?: |$)(.*)")
6 | async def _(event):
7 | if event.fwd_from:
8 | return
9 | botusername = "@xobot"
10 | noob = "play"
11 | if event.reply_to_msg_id:
12 | await event.get_reply_message()
13 | tap = await bot.inline_query(botusername, noob)
14 | await tap[0].click(event.chat_id)
15 | await event.delete()
16 |
17 |
18 | @toni_cmd(pattern=r"whisp(?: |$)(.*)")
19 | async def _(event):
20 | if event.fwd_from:
21 | return
22 | wwwspr = event.pattern_match.group(1)
23 | botusername = "@whisperBot"
24 | if event.reply_to_msg_id:
25 | await event.get_reply_message()
26 | tap = await bot.inline_query(botusername, wwwspr)
27 | await tap[0].click(event.chat_id)
28 | await event.delete()
29 |
30 |
31 | @toni_cmd(pattern=r"mod(?: |$)(.*)")
32 | async def _(event):
33 | if event.fwd_from:
34 | return
35 | modr = event.pattern_match.group(1)
36 | botusername = "@PremiumAppBot"
37 | if event.reply_to_msg_id:
38 | await event.get_reply_message()
39 | tap = await bot.inline_query(botusername, modr)
40 | await tap[0].click(event.chat_id)
41 | await event.delete()
42 |
43 |
44 | CMD_HELP.update(
45 | {
46 | "games": f"\
47 | 𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}xogame`\
48 | \n↳ : Mainkan game XO bersama temanmu.\
49 | \n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}mod `\
50 | \n↳ : Dapatkan applikasi mod\
51 | \n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}whisp `\
52 | \n↳ : Berikan pesan rahasia"
53 | }
54 | )
55 |
--------------------------------------------------------------------------------
/userbot/modules/gban_bot.py:
--------------------------------------------------------------------------------
1 | """Globally Ban users from all the
2 | Group Administrations bots where you are SUDO
3 | Available Commands:
4 | .gban REASON
5 | .ungban REASON"""
6 | import asyncio
7 | from userbot.utils import toni_cmd
8 | from userbot import (
9 | G_BAN_LOGGER_GROUP,
10 | CMD_HANDLER as cmd,
11 | ALIVE_NAME,
12 | CMD_HELP,
13 | bot,
14 | )
15 |
16 |
17 | @toni_cmd(pattern="gbanb(?: |$)(.*)")
18 | async def _(event):
19 | if G_BAN_LOGGER_GROUP is None:
20 | await event.edit("Set G_BAN_LOGGER_GROUP in vars otherwise module won't work.")
21 | return
22 | if event.fwd_from:
23 | return
24 | reason = event.pattern_match.group(1)
25 | if event.reply_to_msg_id:
26 | r = await event.get_reply_message()
27 | if r.forward:
28 | r_from_id = r.forward.from_id or r.from_id
29 | else:
30 | r_from_id = r.from_id
31 | await bot.send_message(
32 | G_BAN_LOGGER_GROUP,
33 | "/gban [user](tg://user?id={}) {}".format(r_from_id, reason)
34 | )
35 | await event.delete()
36 | await event.reply("**gbanning...**")
37 | asyncio.sleep(3.5)
38 | await event.edit(f"**User gbanned by {ALIVE_NAME}**")
39 | asyncio.sleep(5)
40 | await event.delete()
41 |
42 |
43 | @toni_cmd(pattern="ungbanb(?: |$)(.*)")
44 | async def _(event):
45 | if G_BAN_LOGGER_GROUP is None:
46 | await event.edit("Set G_BAN_LOGGER_GROUP in vars otherwise module won't work.")
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 bot.send_message(
55 | G_BAN_LOGGER_GROUP,
56 | "/ungban [user](tg://user?id={}) {}".format(r_from_id, reason)
57 | )
58 | await event.delete()
59 | await event.reply("**ungbanning...**")
60 | asyncio.sleep(3.5)
61 | await event.edit(f"**User ungbanned by {ALIVE_NAME}**")
62 | asyncio.sleep(5)
63 | await event.delete()
64 |
65 | CMD_HELP.update({
66 | "gbanbot": f"`{cmd}gbanb`\
67 | \nUsage: globally Ban Bot.\
68 | \n\n`{cmd}ungbanb` :\
69 | \nUsage: Cancel globally Ban Bot."
70 | })
71 |
--------------------------------------------------------------------------------
/userbot/modules/gid.py:
--------------------------------------------------------------------------------
1 | from PIL import Image, ImageDraw, ImageFont
2 |
3 | from userbot import CMD_HELP, CMD_HANDLER as cmd
4 | from userbot.utils import toni_cmd
5 |
6 |
7 | @toni_cmd(pattern=r"gid$")
8 | async def image_maker(event):
9 | replied_user = await event.get_reply_message()
10 | await event.client.download_profile_photo(
11 | replied_user.from_id, file="user.png", download_big=True
12 | )
13 | user_photo = Image.open("user.png")
14 | id_template = Image.open("userbot/resources/FrameID.png")
15 | user_photo = user_photo.resize((989, 1073))
16 | id_template.paste(user_photo, (1229, 573))
17 | position = (2473, 481)
18 | draw = ImageDraw.Draw(id_template)
19 | color = "rgb(23, 43, 226)" # red color
20 | font = ImageFont.truetype("userbot/resources/fontx.ttf", size=200)
21 | draw.text(
22 | position,
23 | replied_user.sender.first_name.replace("\u2060", ""),
24 | fill=color,
25 | font=font,
26 | )
27 | id_template.save("user_id.png")
28 | await event.edit("`Membuat ID Card..`")
29 | await event.client.send_message(
30 | event.chat_id,
31 | "Generated User ID",
32 | reply_to=event.message.reply_to_msg_id,
33 | file="user_id.png",
34 | force_document=False,
35 | silent=True,
36 | )
37 | await event.delete()
38 |
39 |
40 | CMD_HELP.update(
41 | {
42 | "gid": f"⚡**CMD**⚡ : `{cmd}gid`\
43 | \n↳ : Reply to a user to generate ID Card."
44 | }
45 | )
46 |
--------------------------------------------------------------------------------
/userbot/modules/github.py:
--------------------------------------------------------------------------------
1 | import aiohttp
2 | from userbot.utils import edit_or_reply, toni_cmd
3 | from userbot import CMD_HELP, CMD_HANDLER as cmd
4 |
5 |
6 | @toni_cmd(pattern="git (.*)")
7 | async def github(event):
8 | URL = f"https://api.github.com/users/{event.pattern_match.group(1)}"
9 | await event.get_chat()
10 | async with aiohttp.ClientSession() as session:
11 | async with session.get(URL) as request:
12 | if request.status == 404:
13 | return await event.reply("`" + event.pattern_match.group(1) +
14 | " not found`")
15 |
16 | result = await request.json()
17 |
18 | url = result.get("html_url", None)
19 | name = result.get("name", None)
20 | company = result.get("company", None)
21 | bio = result.get("bio", None)
22 | created_at = result.get("created_at", "Not Found")
23 |
24 | REPLY = (
25 | f"GitHub Info for `{event.pattern_match.group(1)}`"
26 | f"\nUsername: `{name}`\nBio: `{bio}`\nURL: {url}"
27 | f"\nCompany: `{company}`\nCreated at: `{created_at}`"
28 | )
29 |
30 | if not result.get("repos_url", None):
31 | return await edit_or_reply(event, REPLY)
32 | async with session.get(result.get("repos_url", None)) as request:
33 | result = request.json
34 | if request.status == 404:
35 | return await edit_or_reply(event, REPLY)
36 |
37 | result = await request.json()
38 |
39 | REPLY += "\nRepos:\n"
40 |
41 | for nr in range(len(result)):
42 | REPLY += f"[{result[nr].get('name', None)}]({result[nr].get('html_url', None)})\n"
43 |
44 | await edit_or_reply(event, REPLY)
45 |
46 |
47 | CMD_HELP.update({
48 | "github": f"{cmd}git "
49 | "\nPenjelasan: Seperti .whois tetapi untuk nama pengguna GitHub."
50 | })
51 |
--------------------------------------------------------------------------------
/userbot/modules/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 userbot import CMD_HELP, CMD_HANDLER as cmd
11 | from userbot.utils import toni_cmd
12 |
13 |
14 | def progress(current, total):
15 | logger.info(
16 | "Downloaded {} of {}\nCompleted {}".format(
17 | current, total, (current / total) * 100
18 | )
19 | )
20 |
21 |
22 | @toni_cmd(pattern=r"go")
23 | async def gsearch(q_event):
24 | """For .google command, do a Google search."""
25 | match = q_event.pattern_match.group(1)
26 | tele = await eor(q_event, "Searching for `{}`".format(match))
27 | page = findall(r"page=\d+", match)
28 | try:
29 | page = page[0]
30 | page = page.replace("page=", "")
31 | match = match.replace("page=" + page[0], "")
32 | except IndexError:
33 | page = 1
34 | search_args = (str(match), int(page))
35 | gsearch = GoogleSearch()
36 | gresults = await gsearch.async_search(*search_args)
37 | res = ""
38 | for i in range(len(gresults["links"])):
39 | try:
40 | teletitle = gresults["titles"][i]
41 | telelink = gresults["links"][i]
42 | teledescrp = gresults["descriptions"][i]
43 | res += f"[{teletitle}]({telelink})\n`{teledescrp}`\n\n"
44 | except IndexError:
45 | break
46 | await tele.edit(
47 | "**GᴏᴏɢʟᴇSᴇᴀʀᴄʜ**\n__Qᴜᴇʀʏ:__\n `{}` \n\n**Rᴇsᴜʟᴛs:**\n {}".format(match, res),
48 | link_preview=False,
49 | )
50 |
51 |
52 | CMD_HELP.update(
53 | {
54 | "google": f"{cmd}go \nUse - Search the query on Google"})
55 |
--------------------------------------------------------------------------------
/userbot/modules/gps.py:
--------------------------------------------------------------------------------
1 | # credits: mrconfused
2 | from geopy.geocoders import Nominatim
3 | from telethon.tl import types
4 |
5 | from userbot import CMD_HELP, CMD_HANDLER as cmd
6 | from userbot.utils import toni_cmd
7 |
8 |
9 | @toni_cmd(pattern="gps(?: |$)(.*)")
10 | async def gps(event):
11 | if event.fwd_from:
12 | return
13 | reply_to_id = event.message
14 | if event.reply_to_msg_id:
15 | reply_to_id = await event.get_reply_message()
16 | input_str = event.pattern_match.group(1)
17 |
18 | if not input_str:
19 | return await event.edit("`Mohon Berikan Tempat Yang Dicari`")
20 |
21 | await event.edit("`Menemukan Lokasi Ini Di Server Map....`")
22 |
23 | geolocator = Nominatim(user_agent="Geez")
24 | geoloc = geolocator.geocode(input_str)
25 |
26 | if geoloc:
27 | lon = geoloc.longitude
28 | lat = geoloc.latitude
29 | await reply_to_id.reply(
30 | input_str, file=types.InputMediaGeoPoint(types.InputGeoPoint(lat, lon))
31 | )
32 | await event.delete()
33 | else:
34 | await event.edit("`Saya Tidak Dapat Menemukannya`")
35 |
36 |
37 | CMD_HELP.update(
38 | {
39 | "gps": f">{cmd}`gps`" "\nUsage: Untuk Mendapatkan Lokasi Map"
40 | }
41 | )
42 |
--------------------------------------------------------------------------------
/userbot/modules/grouplink.py:
--------------------------------------------------------------------------------
1 | # port by KOALA 🐨 /@manusiarakitann
2 |
3 | from userbot.utils import edit_or_reply, toni_cmd
4 | from userbot import CMD_HELP, CMD_HANDLER as cmd
5 |
6 |
7 | @toni_cmd(pattern="gsend ?(.*)")
8 | async def remoteaccess(event):
9 |
10 | p = event.pattern_match.group(1)
11 | m = p.split(" ")
12 |
13 | chat_id = m[0]
14 | try:
15 | chat_id = int(chat_id)
16 | except BaseException:
17 |
18 | pass
19 |
20 | msg = ""
21 | mssg = await event.get_reply_message()
22 | if event.reply_to_msg_id:
23 | await event.client.send_message(chat_id, mssg)
24 | await edit_or_reply(event, "`Pesan Di Di Teruskan Ke Grup Tujuan`")
25 | for i in m[1:]:
26 | msg += i + " "
27 | if msg == "":
28 | return
29 | try:
30 | await event.client.send_message(chat_id, msg)
31 | await edit_or_reply(event, "Pesan Di Di Teruskan Ke Grup Tujuan`")
32 | except BaseException:
33 | await edit_or_reply(event, "** Gagal Mengirim Pesan, Emang Lu Join Grup Nya Goblok ? **")
34 |
35 | CMD_HELP.update(
36 | {
37 | "grouplink": f"{cmd}gsend\
38 | \nMengirim Pesan Jarak Jauh Ke Grup Lain .gsend ."
39 | })
40 |
--------------------------------------------------------------------------------
/userbot/modules/hash.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.c (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 | """ Userbot module containing hash and encode/decode commands. """
7 | from subprocess import PIPE
8 | from subprocess import run as runapp
9 |
10 | import pybase64
11 |
12 | from userbot import CMD_HELP, CMD_HANDLER as cmd
13 | from userbot.utils import toni_cmd
14 |
15 |
16 | @toni_cmd(pattern="hash (.*)")
17 | async def gethash(hash_q):
18 | """ For .hash command, find the md5, sha1, sha256, sha512 of the string. """
19 | hashtxt_ = hash_q.pattern_match.group(1)
20 | hashtxt = open("hashdis.txt", "w+")
21 | hashtxt.write(hashtxt_)
22 | hashtxt.close()
23 | md5 = runapp(["md5sum", "hashdis.txt"], stdout=PIPE)
24 | md5 = md5.stdout.decode()
25 | sha1 = runapp(["sha1sum", "hashdis.txt"], stdout=PIPE)
26 | sha1 = sha1.stdout.decode()
27 | sha256 = runapp(["sha256sum", "hashdis.txt"], stdout=PIPE)
28 | sha256 = sha256.stdout.decode()
29 | sha512 = runapp(["sha512sum", "hashdis.txt"], stdout=PIPE)
30 | runapp(["rm", "hashdis.txt"], stdout=PIPE)
31 | sha512 = sha512.stdout.decode()
32 | ans = (
33 | "Text: `"
34 | + hashtxt_
35 | + "`\nMD5: `"
36 | + md5
37 | + "`SHA1: `"
38 | + sha1
39 | + "`SHA256: `"
40 | + sha256
41 | + "`SHA512: `"
42 | + sha512[:-1]
43 | + "`"
44 | )
45 | if len(ans) > 4096:
46 | hashfile = open("hashes.txt", "w+")
47 | hashfile.write(ans)
48 | hashfile.close()
49 | await hash_q.client.send_file(
50 | hash_q.chat_id,
51 | "hashes.txt",
52 | reply_to=hash_q.id,
53 | caption="`It's too big, sending a text file instead. `",
54 | )
55 | runapp(["rm", "hashes.txt"], stdout=PIPE)
56 | else:
57 | await hash_q.reply(ans)
58 |
59 |
60 | @toni_cmd(pattern="base64 (en|de) (.*)")
61 | async def endecrypt(query):
62 | """For .base64 command, find the base64 encoding of the given string."""
63 | if query.pattern_match.group(1) == "en":
64 | lething = str(pybase64.b64encode(bytes(query.pattern_match.group(2), "utf-8")))[
65 | 2:
66 | ]
67 | await query.reply("**Encoded:** `" + lething[:-1] + "`")
68 | else:
69 | lething = str(
70 | pybase64.b64decode(
71 | bytes(query.pattern_match.group(2), "utf-8"), validate=True
72 | )
73 | )[2:]
74 | await query.reply("**Decoded:** `" + lething[:-1] + "`")
75 |
76 |
77 | CMD_HELP.update(
78 | {
79 | "hash": f">`{cmd}hash`"
80 | "\nUsage: Find the md5, sha1, sha256, sha512 of the string when written into a txt file.",
81 | "base64": f">`{cmd}base64 [en or de]`"
82 | "\nUsage: Find the base64 encoding of the given string or decode it.",
83 | })
84 |
--------------------------------------------------------------------------------
/userbot/modules/hentai.py:
--------------------------------------------------------------------------------
1 | from telethon import events
2 | from telethon.errors.rpcerrorlist import YouBlockedUserError
3 |
4 | from userbot import CMD_HELP, CMD_HANDLER as cmd, bot
5 | from userbot.utils import toni_cmd
6 |
7 |
8 | @toni_cmd(pattern=r"hentai(?: |$)(.*)")
9 | async def _(event):
10 | if event.fwd_from:
11 | return
12 | link = event.pattern_match.group(1)
13 | chat = "@nHentaiBot"
14 | await event.edit("```Processing```")
15 | async with bot.conversation(chat) as conv:
16 | try:
17 | response = conv.wait_event(
18 | events.NewMessage(incoming=True, from_users=424466890)
19 | )
20 | await bot.send_message(chat, link)
21 | response = await response
22 | except YouBlockedUserError:
23 | await event.reply("```Please unblock @nHentaiBot and try again```")
24 | return
25 | if response.text.startswith("**Sorry I couldn't get manga from**"):
26 | await event.edit("```I think this is not the right link```")
27 | else:
28 | await event.delete()
29 | await bot.send_message(event.chat_id, response.message)
30 |
31 |
32 | CMD_HELP.update(
33 | {
34 | "hentai": f"`{cmd}hentai` \
35 | \nUsage: view nhentai in telegra.ph XD\n"
36 | }
37 | )
38 |
--------------------------------------------------------------------------------
/userbot/modules/honkasays.py:
--------------------------------------------------------------------------------
1 | from telethon.errors import ChatSendInlineForbiddenError, ChatSendStickersForbiddenError
2 |
3 | from userbot import CMD_HELP, CMD_HANDLER as cmd, bot
4 | from userbot.utils import toni_cmd
5 |
6 |
7 | @toni_cmd(pattern=r"frog (.*)")
8 | async def honkasays(event):
9 | await event.edit("`Sedang Memproses, Mohon Tunggu Sebentar...`")
10 | text = event.pattern_match.group(1)
11 | if not text:
12 | return await event.edit(
13 | "Beri Aku Bebeberapa Text, Contoh : `.honka space `"
14 | )
15 | try:
16 | if not text.endswith("."):
17 | text = text + "."
18 | if len(text) <= 9:
19 | results = await bot.inline_query("honka_says_bot", text)
20 | await results[2].click(
21 | event.chat_id,
22 | silent=True,
23 | hide_via=True,
24 | )
25 | elif len(text) >= 14:
26 | results = await bot.inline_query("honka_says_bot", text)
27 | await results[0].click(
28 | event.chat_id,
29 | silent=True,
30 | hide_via=True,
31 | )
32 | else:
33 | results = await bot.inline_query("honka_says_bot", text)
34 | await results[1].click(
35 | event.chat_id,
36 | silent=True,
37 | hide_via=True,
38 | )
39 | await event.delete()
40 | except ChatSendInlineForbiddenError:
41 | await event.edit(
42 | "`Mohon Maaf, Saya Tidak Bisa Menggunakan Hal-Hal Sebaris Disini.`"
43 | )
44 | except ChatSendStickersForbiddenError:
45 | await event.edit("Mohon Maaf, Tidak Bisa Mengirim Sticker Disini.")
46 |
47 |
48 | CMD_HELP.update(
49 | {
50 | "frog": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}frog` space \
51 | \n↳ : Menampilkan Pesan (text) di Sticker Animasi."
52 | }
53 | )
54 |
--------------------------------------------------------------------------------
/userbot/modules/image.py:
--------------------------------------------------------------------------------
1 | # Ported By VCKYOU @VckyouuBitch
2 | # Credits © Rose-Userbot
3 | # Ya gitu deh:')
4 |
5 | from shutil import rmtree
6 | from userbot.utils import toni_cmd
7 | from userbot import CMD_HELP, CMD_HANDLER as cmd
8 | from userbot.utils import googleimagesdownload
9 |
10 |
11 | @toni_cmd(pattern="img (.*)")
12 | async def goimg(event):
13 | query = event.pattern_match.group(1)
14 | if not query:
15 | return await event.edit("`Give something to search...`")
16 | await event.edit("`Processing Keep Patience...`")
17 | if ";" in query:
18 | try:
19 | lmt = int(query.split(";")[1])
20 | query = query.split(";")[0]
21 | except BaseExceptaion:
22 | lmt = 5
23 | else:
24 | lmt = 5
25 | gi = googleimagesdownload()
26 | args = {
27 | "keywords": query,
28 | "limit": lmt,
29 | "format": "jpg",
30 | "output_directory": "./downloads/",
31 | }
32 | pth = gi.download(args)
33 | ok = pth[0][query]
34 | await event.client.send_file(event.chat_id, ok, caption=query, album=True)
35 | rmtree(f"./downloads/{query}/")
36 | await event.delete()
37 |
38 |
39 | CMD_HELP.update(
40 | {
41 | "img": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}img `\
42 | \n↳ : Does an image search on Google and shows 5 images."
43 | }
44 | )
45 |
--------------------------------------------------------------------------------
/userbot/modules/imp.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 |
7 | from io import BytesIO
8 | from random import choice, randint
9 | from textwrap import wrap
10 |
11 | from PIL import Image, ImageDraw, ImageFont
12 | from requests import get
13 |
14 | from userbot import CMD_HELP, CMD_HANDLER as cmd
15 | from userbot.utils import toni_cmd
16 |
17 |
18 | @toni_cmd(pattern="imp (.*)")
19 | async def f_load(message):
20 | clrs = {
21 | "red": 1,
22 | "lime": 2,
23 | "green": 3,
24 | "blue": 4,
25 | "cyan": 5,
26 | "brown": 6,
27 | "purple": 7,
28 | "pink": 8,
29 | "orange": 9,
30 | "yellow": 10,
31 | "white": 11,
32 | "black": 12,
33 | }
34 | clr = randint(1, 12)
35 | text = message.pattern_match.group(1)
36 | reply = await message.get_reply_message()
37 | if text in clrs:
38 | clr = clrs[text]
39 | text = None
40 | if not text:
41 | if not reply:
42 | await bruh(message, message.sender)
43 | return
44 | if not reply.text:
45 | await bruh(message, reply.sender)
46 | return
47 | text = reply.pattern_match.group(1)
48 |
49 | if text.split(" ")[0] in clrs:
50 | clr = clrs[text.split(" ")[0]]
51 | text = " ".join(text.split(" ")[1:])
52 |
53 | if text == "colors":
54 | await message.edit(
55 | "Cores disponíveis:\n"
56 | + ("\n".join([f"• `{i}`" for i in list(clrs.keys())]))
57 | )
58 | return
59 |
60 | url = "https://raw.githubusercontent.com/KeyZenD/AmongUs/master/"
61 | font = ImageFont.truetype(BytesIO(get(url + "bold.ttf").content), 60)
62 | imposter = Image.open(BytesIO(get(f"{url}{clr}.png").content))
63 | text_ = "\n".join(["\n".join(wrap(part, 30)) for part in text.split("\n")])
64 | w, h = ImageDraw.Draw(Image.new("RGB", (1, 1))).multiline_textsize(
65 | text_, font, stroke_width=2
66 | )
67 | text = Image.new("RGBA", (w + 30, h + 30))
68 | ImageDraw.Draw(text).multiline_text(
69 | (15, 15), text_, "#FFF", font, stroke_width=2, stroke_fill="#000"
70 | )
71 | w = imposter.width + text.width + 10
72 | h = max(imposter.height, text.height)
73 | image = Image.new("RGBA", (w, h))
74 | image.paste(imposter, (0, h - imposter.height), imposter)
75 | image.paste(text, (w - text.width, 0), text)
76 | image.thumbnail((512, 512))
77 | output = BytesIO()
78 | output.name = "imposter.webp"
79 | image.save(output)
80 | output.seek(0)
81 | await message.delete()
82 | await message.client.send_file(message.to_id, output, reply_to=reply)
83 |
84 |
85 | async def bruh(message, user):
86 | fn = user.first_name
87 | ln = user.last_name
88 | name = fn + (" " + ln if ln else "")
89 | name = "***" + name
90 | await message.edit(name + choice([" ", " Tidak "]) + "Adalah Seorang Penipu! ***")
91 |
92 |
93 | CMD_HELP.update(
94 | {
95 | "amongus": f"`{cmd}imp`\
96 | \nUsage: Kirimkan gambar seorang impostor Among US dengan kalimat dari Anda."
97 | }
98 | )
99 |
--------------------------------------------------------------------------------
/userbot/modules/limited.py:
--------------------------------------------------------------------------------
1 | # Credits By @VckyouuBitch From Geez - Project
2 | # BUATLO NI ANAK ANAK ANJING YANG KALO NGAMBIL MODUL DENGAN HAPUS CREDITS.
3 | # INTINYA LO ANJING!!!!!!
4 |
5 | from telethon import events
6 | from telethon.errors.rpcerrorlist import YouBlockedUserError
7 |
8 | from userbot import (
9 | bot,
10 | CMD_HELP,
11 | CMD_HANDLER as cmd,
12 | )
13 | from userbot.utils import toni_cmd
14 |
15 |
16 | @toni_cmd(pattern="limit(?: |$)(.*)")
17 | async def _(event):
18 | await event.edit("`Checking If You Are Limited...`")
19 | async with bot.conversation("@SpamBot") as conv:
20 | try:
21 | response = conv.wait_event(
22 | events.NewMessage(incoming=True, from_users=178220800)
23 | )
24 | await conv.send_message("/start")
25 | response = await response
26 | await bot.send_read_acknowledge(conv.chat_id)
27 | except YouBlockedUserError:
28 | await event.edit("`Boss! Please Unblock @SpamBot`")
29 | return
30 | await event.edit(f"~ {response.message.message}")
31 |
32 |
33 | CMD_HELP.update({"limit": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}limit`"
34 | "\n•: ngecek akun kena limit"})
35 |
--------------------------------------------------------------------------------
/userbot/modules/logo.py:
--------------------------------------------------------------------------------
1 | # 🍀 © @tofik_dn
2 | # ⚠️ Do not remove credits
3 | import asyncio
4 |
5 | from telethon.errors.rpcerrorlist import YouBlockedUserError
6 |
7 | from userbot import (
8 | ALIVE_NAME,
9 | CMD_HELP,
10 | CMD_HANDLER as cmd,
11 | )
12 | from userbot.utils import edit_or_reply, toni_cmd
13 |
14 |
15 | @toni_cmd(pattern="logo(?: |$)(.*)")
16 | async def _(event):
17 | if event.fwd_from:
18 | return
19 | aing = await event.client.get_me()
20 | text = event.pattern_match.group(1)
21 | if not text:
22 | await edit_or_reply(event, "`Give a name too!`")
23 | else:
24 | await edit_or_reply(event, "`Processing`")
25 | chat = "@PrimeMegaBot"
26 | async with event.client.conversation(chat) as conv:
27 | try:
28 | msg = await conv.send_message(f"/logo {text}")
29 | response = await conv.get_response()
30 | logo = await conv.get_response()
31 | """ - don't spam notif - """
32 | await event.client.send_read_acknowledge(conv.chat_id)
33 | except YouBlockedUserError:
34 | await event.edit(
35 | "**Error: Mohon Buka Blokir** @Nastymusiicbot **Dan Coba Lagi!**"
36 | )
37 | return
38 | await asyncio.sleep(0.5)
39 | await event.client.send_file(
40 | event.chat_id,
41 | logo,
42 | caption=f"ʟᴏɢᴏ ʙʏ [{ALIVE_NAME}](tg://user?id={aing.id})",
43 | )
44 | await event.client.delete_messages(conv.chat_id, [msg.id, response.id, logo.id])
45 | await event.delete()
46 |
47 |
48 | CMD_HELP.update(
49 | {
50 | "logo": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}logo `"
51 | "\n↳ : Hasilkan logo dari Teks atau Balas Ke gambar yang diberikan, untuk menulis teks Anda di atasnya. Atau Balas Ke File Font, Untuk menulis dengan font itu."
52 | }
53 | )
54 |
--------------------------------------------------------------------------------
/userbot/modules/lyrics.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 |
7 | import os
8 | import lyricsgenius
9 |
10 | from userbot.utils import toni_cmd
11 | from userbot import (
12 | CMD_HELP,
13 | GENIUS,
14 | lastfm,
15 | LASTFM_USERNAME,
16 | CMD_HANDLER as cmd,
17 | )
18 | from pylast import User
19 |
20 | if GENIUS is not None:
21 | genius = lyricsgenius.Genius(GENIUS)
22 |
23 |
24 | @toni_cmd(pattern="lyrics (?:(now)|(.*) - (.*))")
25 | async def lyrics(lyric):
26 | await lyric.edit("`Getting information...`")
27 | if GENIUS is None:
28 | await lyric.edit(
29 | "`Provide genius access token to Heroku ConfigVars...`")
30 | return False
31 | if lyric.pattern_match.group(1) == "now":
32 | playing = User(LASTFM_USERNAME, lastfm).get_now_playing()
33 | if playing is None:
34 | await lyric.edit(
35 | "`No information current lastfm scrobbling...`"
36 | )
37 | return False
38 | artist = playing.get_artist()
39 | song = playing.get_title()
40 | else:
41 | artist = lyric.pattern_match.group(2)
42 | song = lyric.pattern_match.group(3)
43 | await lyric.edit(f"`Searching lyrics for {artist} - {song}...`")
44 | songs = genius.search_song(song, artist)
45 | if songs is None:
46 | await lyric.edit(f"`Song` **{artist} - {song}** `not found...`")
47 | return False
48 | if len(songs.lyrics) > 4096:
49 | await lyric.edit("`Lyrics is too big, view the file to see it.`")
50 | with open("lyrics.txt", "w+") as f:
51 | f.write(f"Search query: \n{artist} - {song}\n\n{songs.lyrics}")
52 | await lyric.client.send_file(
53 | lyric.chat_id,
54 | "lyrics.txt",
55 | reply_to=lyric.id,
56 | )
57 | os.remove("lyrics.txt")
58 | return True
59 | else:
60 | await lyric.edit(
61 | f"**Search query**:\n`{artist}` - `{song}`"
62 | f"\n\n```{songs.lyrics}```"
63 | )
64 | return True
65 |
66 |
67 | CMD_HELP.update({
68 | "lyrics":
69 | f"`{cmd}lyrics` ** - **"
70 | "\nUsage: Get lyrics matched artist and song."
71 | f"\n\n`{cmd}lyrics now`"
72 | "\nUsage: Get lyrics artist and song from current lastfm scrobbling."
73 | })
74 |
--------------------------------------------------------------------------------
/userbot/modules/mentions.py:
--------------------------------------------------------------------------------
1 | import re
2 |
3 | from telethon.tl import types
4 |
5 | from userbot import CMD_HELP, bot
6 | from userbot.events import register
7 |
8 | usernexp = re.compile(r"@(\w{3,32})\[(.+?)\]")
9 | nameexp = re.compile(r"\[([\w\S]+)\]\(tg://user\?id=(\d+)\)\[(.+?)\]")
10 |
11 |
12 | @register(outgoing=True, ignore_unsafe=True, disable_errors=True)
13 | async def mention(event):
14 | newstr = event.text
15 | if event.entities:
16 | newstr = nameexp.sub(r'\3', newstr, 0)
17 | for match in usernexp.finditer(newstr):
18 | user = match.group(1)
19 | text = match.group(2)
20 | name, entities = await bot._parse_message_text(text, "md")
21 | rep = f'{name}'
22 | if entities:
23 | for e in entities:
24 | tag = None
25 | if isinstance(e, types.MessageEntityBold):
26 | tag = "{}"
27 | elif isinstance(e, types.MessageEntityItalic):
28 | tag = "{}"
29 | elif isinstance(e, types.MessageEntityCode):
30 | tag = "{}
"
31 | elif isinstance(e, types.MessageEntityStrike):
32 | tag = "{}"
33 | elif isinstance(e, types.MessageEntityPre):
34 | tag = "{}
"
35 | elif isinstance(e, types.MessageEntityUnderline):
36 | tag = "{}"
37 | if tag:
38 | rep = tag.format(rep)
39 | newstr = re.sub(re.escape(match.group(0)), rep, newstr)
40 | if newstr != event.text:
41 | await event.edit(newstr, parse_mode="html")
42 |
43 |
44 | CMD_HELP.update(
45 | {
46 | "mentions": "Mentions users with a custom name."
47 | "\nUsage: `Hi @ender1324[bluid boi]`"
48 | "\nResult: Hi [bluid boi](tg://resolve?domain=ender1324)"
49 | }
50 | )
51 |
--------------------------------------------------------------------------------
/userbot/modules/nulis.py:
--------------------------------------------------------------------------------
1 | # from ultroid
2 | # © @greyyvbss
3 | # ⚠️ Don't Remove Credits
4 |
5 | import os
6 |
7 | from PIL import Image, ImageDraw, ImageFont
8 | from userbot.utils import toni_cmd, edit_or_reply, edit_delete, text_set
9 | from userbot import CMD_HANDLER as cmd
10 | from userbot import CMD_HELP
11 |
12 | @toni_cmd(pattern="nulis(?: |$)(.*)")
13 | async def writer(event):
14 | if event.reply_to:
15 | reply = await event.get_reply_message()
16 | text = reply.message
17 | elif event.pattern_match.group(1).strip():
18 | text = event.text.split(maxsplit=1)[1]
19 | else:
20 | return await edit_delete(event, "Berikan Beberapa Teks")
21 | k = await edit_or_reply(event, "Sedang Memproses..")
22 | img = Image.open("resources/kertas.jpg")
23 | draw = ImageDraw.Draw(img)
24 | font = ImageFont.truetype("resources/assfont.ttf", 30)
25 | x, y = 150, 140
26 | lines = text_set(text)
27 | line_height = font.getsize("hg")[1]
28 | for line in lines:
29 | draw.text((x, y), line, fill=(1, 22, 55), font=font)
30 | y = y + line_height - 5
31 | file = "toni.jpg"
32 | img.save(file)
33 | await event.reply(file=file)
34 | os.remove(file)
35 | await k.delete()
36 |
37 |
38 | CMD_HELP.update(
39 | {
40 | "nulis": f"**plugin : **`nulis`\
41 | \n\n • **syntax :** `{cmd}nulis` \
42 | \n • **function : **menulis Teks Di buku ,buat Lu Yang mager nulis\
43 | "
44 | }
45 | )
46 |
--------------------------------------------------------------------------------
/userbot/modules/paste.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 | """Userbot module containing commands for interacting with dogbin(https://del.dog)"""
7 |
8 | import os
9 |
10 | from userbot import (
11 | TEMP_DOWNLOAD_DIRECTORY,
12 | CMD_HANDLER as cmd,
13 | CMD_HELP,
14 | )
15 | from userbot.utils import (
16 | edit_delete,
17 | edit_or_reply,
18 | toni_cmd,
19 | )
20 | from userbot.utils.pastebin import PasteBin
21 |
22 |
23 | @toni_cmd(pattern="paste(?: (-d|-n|-h|-k|-s)|$)?(?: ([\\s\\S]+)|$)")
24 | async def paste(pstl):
25 | """For .paste command, pastes the text directly to a pastebin."""
26 | service = pstl.pattern_match.group(1)
27 | match = pstl.pattern_match.group(2)
28 | reply_id = pstl.reply_to_msg_id
29 |
30 | if not (match or reply_id):
31 | return await edit_delete(pstl, "`Elon Musk said I cannot paste void.`")
32 |
33 | if match:
34 | message = match.strip()
35 | elif reply_id:
36 | message = await pstl.get_reply_message()
37 | if message.media:
38 | downloaded_file_name = await pstl.client.download_media(
39 | message,
40 | TEMP_DOWNLOAD_DIRECTORY,
41 | )
42 | m_list = None
43 | with open(downloaded_file_name, "rb") as fd:
44 | m_list = fd.readlines()
45 | message = "".join(m.decode("UTF-8") for m in m_list)
46 | os.remove(downloaded_file_name)
47 | else:
48 | message = message.message
49 |
50 | xxnx = await edit_or_reply(pstl, "`Pasting text . . .`")
51 | async with PasteBin(message) as client:
52 | if service:
53 | service = service.strip()
54 | if service not in ["-d", "-n", "-k", "-s", "-h"]:
55 | return await xxnx.edit("Invalid flag")
56 | await client(client.service_match[service])
57 | else:
58 | await client.post()
59 |
60 | if client:
61 | reply_text = (
62 | "**Pasted successfully!**\n\n"
63 | f"[URL]({client.link})\n"
64 | f"[View RAW]({client.raw_link})"
65 | )
66 | else:
67 | reply_text = "**Failed to reach Pastebin Service**"
68 |
69 | await xxnx.edit(reply_text, link_preview=False)
70 |
71 |
72 | CMD_HELP.update(
73 | {
74 | "paste": f"**Plugin : **`paste`\
75 | \n\n • **Syntax :** `{cmd}paste` \
76 | \n • **Function : **Untuk Menyimpan text ke ke layanan pastebin gunakan flags [`-d`, `-n`, `-h`, `-s`, `-k`]\
77 | \n\n • **NOTE :** `-d` = **Dogbin** atau `-n` = **Nekobin** atau `-h` = **Hastebin** atau `-k` = **katbin** atau `-s` = **spacebin**\
78 | "
79 | }
80 | )
81 |
--------------------------------------------------------------------------------
/userbot/modules/ppcouple.py:
--------------------------------------------------------------------------------
1 | # @greyyvbss
2 |
3 | from userbot import CMD_HANDLER as cmd
4 | from userbot import CMD_HELP
5 | from userbot.utils import toni_cmd
6 | import random
7 | from userbot import owner
8 | from telethon.tl.types import InputMessagesFilterPhotos
9 |
10 |
11 | @toni_cmd(pattern="ppcp$")
12 | async def _(event):
13 | try:
14 | ayangnya = [
15 | ayang
16 | async for ayang in event.client.iter_messages(
17 | "@ppcpcilik", filter=InputMessagesFilterPhotos
18 | )
19 | ]
20 | aing = await event.client.get_me()
21 | await event.client.send_file(
22 | event.chat_id,
23 | file=random.choice(ayangnya),
24 | caption=f" Nih Kak PP Couple nya 😎 [{owner}](tg://user?id={aing.id})",
25 | )
26 | await event.delete()
27 | except Exception:
28 | await event.edit("PPCP nya Gada Karena Lu Jelek _-.")
29 |
30 |
31 | CMD_HELP.update(
32 | {
33 | "ppcouple": f"**Plugin : **ppcouple\
34 | \n\n • **Syntax :** {cmd}ppcp\
35 | \n • **Function : **Untuk Mencari PP Couple secara random.\
36 | "
37 | }
38 | )
39 |
--------------------------------------------------------------------------------
/userbot/modules/rastick.py:
--------------------------------------------------------------------------------
1 | import random
2 | import re
3 | from asyncio import sleep
4 |
5 | from userbot import CMD_HANDLER as cmd, CMD_HELP, bot
6 | from userbot.utils import toni_cmd
7 |
8 | EMOJI_PATTERN = re.compile(
9 | "["
10 | "\U0001F1E0-\U0001F1FF" # flags (iOS)
11 | "\U0001F300-\U0001F5FF" # symbols & pictographs
12 | "\U0001F600-\U0001F64F" # emoticons
13 | "\U0001F680-\U0001F6FF" # transport & map symbols
14 | "\U0001F700-\U0001F77F" # alchemical symbols
15 | "\U0001F780-\U0001F7FF" # Geometric Shapes Extended
16 | "\U0001F800-\U0001F8FF" # Supplemental Arrows-C
17 | "\U0001F900-\U0001F9FF" # Supplemental Symbols and Pictographs
18 | "\U0001FA00-\U0001FA6F" # Chess Symbols
19 | "\U0001FA70-\U0001FAFF" # Symbols and Pictographs Extended-A
20 | "\U00002702-\U000027B0" # Dingbats
21 | "]+"
22 | )
23 |
24 |
25 | def deEmojify(inputString: str) -> str:
26 | return re.sub(EMOJI_PATTERN, "", inputString)
27 |
28 |
29 | @toni_cmd(pattern=r"rst(?: |$)(.*)")
30 | async def rastick(animu):
31 | text = animu.pattern_match.group(1)
32 | if not text:
33 | if animu.is_reply:
34 | text = (await animu.get_reply_message()).message
35 | else:
36 | await animu.answer("`No text given, hence no stickers.`")
37 | return
38 | animus = [
39 | 1,
40 | 2,
41 | 3,
42 | 4,
43 | 5,
44 | 6,
45 | 7,
46 | 8,
47 | 9,
48 | 10,
49 | 11,
50 | 12,
51 | 13,
52 | 14,
53 | 15,
54 | 16,
55 | 17,
56 | 18,
57 | 19,
58 | 20,
59 | 21,
60 | 22,
61 | 23,
62 | 24,
63 | 25,
64 | 26,
65 | 27,
66 | 28,
67 | 29,
68 | 30,
69 | 31,
70 | 32,
71 | 33,
72 | 34,
73 | 35,
74 | 36,
75 | 37,
76 | 38,
77 | 39,
78 | 40,
79 | 41,
80 | 42,
81 | 43,
82 | 44,
83 | 45,
84 | 46,
85 | 47,
86 | 48,
87 | 49,
88 | 50,
89 | 51,
90 | 52,
91 | 53,
92 | 54,
93 | 55,
94 | 56,
95 | 57,
96 | 58,
97 | 59,
98 | 60,
99 | 61,
100 | 62,
101 | 63,
102 | ]
103 | sticcers = await bot.inline_query(
104 | "stickerizerbot", f"#{random.choice(animus)}{(deEmojify(text))}"
105 | )
106 | try:
107 | await sticcers[0].click(
108 | animu.chat_id,
109 | reply_to=animu.reply_to_msg_id,
110 | silent=True if animu.is_reply else False,
111 | hide_via=True,
112 | )
113 | except Exception:
114 | return await animu.edit(
115 | "`You cannot send inline results in this chat (caused by SendInlineBotResultRequest)`"
116 | )
117 | await sleep(5)
118 | await animu.delete()
119 |
120 |
121 | CMD_HELP.update(
122 | {
123 | "rastick": f">`{cmd}rst`"
124 | "\nUsage: To stickerize your text with random sticker templates."
125 | "\n@StickerizerBot"
126 | }
127 | )
128 |
--------------------------------------------------------------------------------
/userbot/modules/resi.py:
--------------------------------------------------------------------------------
1 | from telethon import events
2 | from telethon.errors.rpcerrorlist import YouBlockedUserError
3 |
4 | from userbot import CMD_HELP, CMD_HANDLER as cmd, bot
5 | from userbot.utils import toni_cmd
6 |
7 |
8 | @toni_cmd(pattern=r"resi(?: |$)(.*)")
9 | async def _(event):
10 | if event.fwd_from:
11 | return
12 | event.pattern_match.group(1)
13 | chat = "@GeDebugBetaBot" # pylint:disable=E0602
14 | resi = f"resi" # pylint:disable=E0602
15 | await event.edit("Processing....")
16 | async with bot.conversation("@GeDebugBetaBot") as conv:
17 | try:
18 | response = conv.wait_event(
19 | events.NewMessage(incoming=True, from_users=443213072)
20 | )
21 | await conv.send_message(f"{kurir} {resi}")
22 | response = await response
23 | except YouBlockedUserError:
24 | await event.reply("Unblock @GeDebugBetaBot dulu Goblok!!")
25 | return
26 | else:
27 | await event.edit(f"{response.message.message}")
28 | await event.client.delete_messages(response.message.message)
29 |
30 |
31 | CMD_HELP.update(
32 | {
33 | "resi": f"`{cmd}resi`\
34 | \nUsage: Cek resi \
35 | \n\n`{cmd}lacak`\
36 | \nUsage:lacak paket"
37 | }
38 | )
39 |
--------------------------------------------------------------------------------
/userbot/modules/rosehelper.py:
--------------------------------------------------------------------------------
1 | """ Userbot module for other small commands. """
2 | from userbot import ALIVE_NAME, CMD_HELP, CMD_HANDLER as cmd
3 | from userbot.utils import toni_cmd
4 |
5 | @toni_cmd(pattern="lhelp$")
6 | async def usit(e):
7 | await e.edit(
8 | f"**Halo {ALIVE_NAME} Jika Anda Tidak Tau Perintah Untuk Memerintah Ku Ketik** `{cmd}help` Atau Bisa Minta Bantuan Ke:\n"
9 | "\n[Telegram](t.me/Bukan_guudlooking)"
10 | "\n[Repo](https://github.com/Tonic990/Tonic-UserBot)"
11 | )
12 |
13 |
14 | @toni_cmd(pattern="vars$")
15 | async def var(m):
16 | await m.edit(
17 | f"**Disini Daftar Vars Dari {ALIVE_NAME}:**\n"
18 | "\n[DAFTAR VARS](https://raw.githubusercontent.com/SendiAp/Rose-Userbot/Rose-Userbot/varshelper.txt)"
19 | )
20 |
21 |
22 | CMD_HELP.update(
23 | {
24 | "helper": f"`{cmd}lhelp`\
25 | \nUsage: Bantuan Untuk Tonic-Userbot.\
26 | \n`{cmd}vars`\
27 | \nUsage: Melihat Daftar Vars."
28 | }
29 | )
30 |
--------------------------------------------------------------------------------
/userbot/modules/salam.py:
--------------------------------------------------------------------------------
1 | from platform import uname
2 | from userbot import ALIVE_NAME, CMD_HELP, CMD_HANDLER as cmd
3 | from userbot.utils import toni_cmd
4 |
5 | # ================= CONSTANT =================
6 | DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else uname().node
7 | # ============================================
8 |
9 |
10 | @toni_cmd(pattern='^P(?: |$)(.*)')
11 | async def typewriter(typew):
12 | typew.pattern_match.group(1)
13 | await typew.edit("𝐀𝐬𝐬𝐚𝐥𝐚𝐦𝐮'𝐚𝐥𝐚𝐢𝐤𝐮𝐦...")
14 |
15 |
16 | @toni_cmd(pattern='atg(?: |$)(.*)')
17 | async def typewriter(typew):
18 | typew.pattern_match.group(1)
19 | await typew.edit("𝐀𝐒𝐓𝐀𝐆𝐇𝐅𝐈𝐑𝐔𝐋𝐋𝐀𝐇....SAYANG!!!!")
20 |
21 |
22 | @toni_cmd(pattern='^L(?: |$)(.*)')
23 | async def typewriter(typew):
24 | typew.pattern_match.group(1)
25 | await typew.edit("𝐖𝐚'𝐚𝐥𝐚𝐢𝐤𝐮𝐦𝐬𝐚𝐥𝐚𝐦...")
26 |
27 |
28 | @toni_cmd(pattern='ast(?: |$)(.*)')
29 | async def typewriter(typew):
30 | typew.pattern_match.group(1)
31 | await typew.edit("𝐀𝐒𝐓𝐀𝐆𝐇𝐅𝐈𝐑𝐔𝐋𝐋𝐀𝐇......")
32 |
33 |
34 | CMD_HELP.update({
35 | "salam":
36 | "P\
37 | \nUsage: Untuk Memberi salam.\
38 | \n\nL\
39 | \nUsage: Untuk Menjawab Salam."
40 | })
41 |
42 |
43 | CMD_HELP.update({
44 | "salam2":
45 | f"{cmd}atg\
46 | \nUsage: Istighfar 1.\
47 | \n\n{cmd}ast\
48 | \nUsage: Istighfaf 2."
49 | })
50 |
--------------------------------------------------------------------------------
/userbot/modules/sangmata.py:
--------------------------------------------------------------------------------
1 | from telethon.errors.rpcerrorlist import YouBlockedUserError
2 | from userbot import (
3 | bot,
4 | CMD_HELP,
5 | CMD_HANDLER as cmd,
6 | )
7 | from userbot.utils import (
8 | edit_or_reply,
9 | edit_delete,
10 | toni_cmd,
11 | )
12 | from asyncio.exceptions import TimeoutError
13 |
14 |
15 | @toni_cmd(pattern="sg(?: |$)(.*)")
16 | async def lastname(steal):
17 | if steal.fwd_from:
18 | return
19 | if not steal.reply_to_msg_id:
20 | await steal.edit("```Mohon Balas Ke Pesan Pengguna.```")
21 | return
22 | message = await steal.get_reply_message()
23 | chat = "@SangMataInfo_bot"
24 | user_id = message.sender.id
25 | id = f"/search_id {user_id}"
26 | if message.sender.bot:
27 | await edit_delete(steal, "```Balas Ke Pesan Pengguna Yang Sebenarnya.```")
28 | return
29 | xx = await edit_or_reply(steal, "```Mengambil Informasi Pengguna Tersebut, Mohon Menunggu..```")
30 | try:
31 | async with bot.conversation(chat) as conv:
32 | try:
33 | msg = await conv.send_message(id)
34 | r = await conv.get_response()
35 | response = await conv.get_response()
36 | except YouBlockedUserError:
37 | await steal.reply(
38 | "```Mohon Unblock @sangmatainfo_bot Dan Coba Lagi```"
39 | )
40 | return
41 | if r.text.startswith("Name"):
42 | respond = await conv.get_response()
43 | await xx.edit(f"`{r.message}`")
44 | await steal.client.delete_messages(
45 | conv.chat_id, [msg.id, r.id, response.id, respond.id]
46 | )
47 | return
48 | if response.text.startswith("No records") or r.text.startswith(
49 | "No records"
50 | ):
51 | await xx.edit("```Saya Tidak Menemukan Informasi Pengguna Ini, Pengguna Ini Belum Pernah Mengganti Nama Sebelumnya```")
52 | await steal.client.delete_messages(
53 | conv.chat_id, [msg.id, r.id, response.id]
54 | )
55 | return
56 | else:
57 | respond = await conv.get_response()
58 | await xx.edit(f"```{response.message}```")
59 | await steal.client.delete_messages(
60 | conv.chat_id, [msg.id, r.id, response.id, respond.id]
61 | )
62 | except TimeoutError:
63 | return await xx.edit("`Saya Sedang Sakit Mohon Maaf`")
64 |
65 |
66 | CMD_HELP.update(
67 | {
68 | "sangmata":
69 | f"`{cmd}sg`\
70 | \nUsage: Mendapatkan Riwayat Nama Pengguna."
71 | }
72 | )
73 |
--------------------------------------------------------------------------------
/userbot/modules/saver.py:
--------------------------------------------------------------------------------
1 | from telethon import events
2 | from telethon.errors.rpcerrorlist import YouBlockedUserError
3 | from userbot.utils import (
4 | edit_or_reply,
5 | edit_delete,
6 | toni_cmd,
7 | )
8 | from userbot import (
9 | bot,
10 | CMD_HELP,
11 | ALIVE_NAME,
12 | CMD_HANDLER as cmd,
13 | )
14 | from platform import uname
15 |
16 |
17 | # ================= CONSTANT =================
18 | DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else uname().node
19 | # ============================================
20 |
21 |
22 | @toni_cmd(pattern="igsaver ?(.*)")
23 | async def igsaver(event):
24 | if event.fwd_from:
25 | return
26 | if not event.reply_to_msg_id:
27 | await edit_delete(event, "`Mohon Reply Ke Link Instagram Ya..`")
28 | return
29 | reply_message = await event.get_reply_message()
30 | if not reply_message.text:
31 | await edit_delete(event, "`Mohon Maaf, Saya Membutuhkan Link Media Instagram Untuk di Download`")
32 | return
33 | chat = "@SaveAsBot"
34 | reply_message.sender
35 | if reply_message.sender.bot:
36 | xx = await edit_or_reply(event, "`Sedang Memproses...`")
37 | return
38 | await xx.edit("`Sedang Memproses...`")
39 | async with event.client.conversation(chat) as conv:
40 | try:
41 | response = conv.wait_event(
42 | events.NewMessage(incoming=True, from_users=523131145)
43 | )
44 | await event.client.send_message(chat, reply_message)
45 | response = await response
46 | except YouBlockedUserError:
47 | await xx.edit("`Mohon Pergi ke ` @SaveAsbot `Lalu Tekan Start dan Coba Lagi.`")
48 | return
49 | if response.text.startswith("Forward"):
50 | await xx.edit(
51 | "Uhmm Sepertinya Private."
52 | )
53 | else:
54 | await xx.delete()
55 | await event.client.send_file(
56 | event.chat_id,
57 | response.message.media,
58 | caption=f"**Download By {DEFAULTUSER}**",
59 | )
60 | await event.client.send_read_acknowledge(conv.chat_id)
61 | await bot(functions.messages.DeleteHistoryRequest(peer=chat, max_id=0))
62 | await xx.delete()
63 |
64 |
65 | CMD_HELP.update(
66 | {
67 | "instasaver": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}igsaver`"
68 | f"\n↳ : Download Postingan di Instagram, Silahkan Salin Link Postingan Instagram Yang Ingin Anda Download Terus Kirim Link, Lalu Reply dan Ketik `{cmd}igsaver`"
69 | }
70 | )
71 |
--------------------------------------------------------------------------------
/userbot/modules/scraper.py:
--------------------------------------------------------------------------------
1 | # Coded By Abdul
2 | # Ported By VckyAuliaZulfikar @VckyouuBitch
3 | #
4 | # Geez Projects UserBot
5 | # Copyright (C) 2021 GeezProjects
6 | #
7 | # This file is a part of
8 | # PLease read the GNU Affero General Public License in
9 | # .
10 |
11 | import asyncio
12 | import csv
13 | import random
14 |
15 | from telethon.errors.rpcerrorlist import (
16 | UserAlreadyParticipantError,
17 | UserPrivacyRestrictedError,
18 | UserNotMutualContactError
19 | )
20 |
21 | from userbot.utils import toni_cmd
22 | from userbot import CMD_HELP, CMD_HANDLER as cmd
23 | from telethon.tl.functions.channels import InviteToChannelRequest
24 | from telethon.tl.types import InputPeerUser
25 |
26 |
27 | @toni_cmd(pattern="getmemb$")
28 | async def scrapmem(event):
29 | chat = event.chat_id
30 | await event.edit("`Mohon tunggu...`")
31 | event.client
32 | members = await event.client.get_participants(chat, aggressive=True)
33 |
34 | with open("members.csv", "w", encoding="UTF-8") as f:
35 | writer = csv.writer(f, delimiter=",", lineterminator="\n")
36 | writer.writerow(["user_id", "hash"])
37 | for member in members:
38 | writer.writerow([member.id, member.access_hash])
39 | await event.edit("`Berhasil Mengumpulkan Member..`")
40 |
41 |
42 | @toni_cmd(pattern="addmemb$")
43 | async def admem(event):
44 | await event.edit("`Proses Menambahkan 0 Member...`")
45 | chat = await event.get_chat()
46 | event.client
47 | users = []
48 | with open("members.csv", encoding="UTF-8") as f:
49 | rows = csv.reader(f, delimiter=",", lineterminator="\n")
50 | next(rows, None)
51 | for row in rows:
52 | user = {'id': int(row[0]), 'hash': int(row[1])}
53 | users.append(user)
54 | n = 0
55 | for user in users:
56 | n += 1
57 | if n % 30 == 0:
58 | await event.edit(f"**Mencapai 30 anggota, tunggu selama {900/60} menit**")
59 | await asyncio.sleep(900)
60 | try:
61 | userin = InputPeerUser(user['id'], user['hash'])
62 | await event.client(InviteToChannelRequest(chat, [userin]))
63 | await asyncio.sleep(random.randrange(5, 7))
64 | await event.edit(f"`Prosess Menambahkan {n} Member...`")
65 | except TypeError:
66 | n -= 1
67 | continue
68 | except UserAlreadyParticipantError:
69 | n -= 1
70 | continue
71 | except UserPrivacyRestrictedError:
72 | n -= 1
73 | continue
74 | except UserNotMutualContactError:
75 | n -= 1
76 | continue
77 |
78 |
79 | CMD_HELP.update(
80 | {
81 | "scraper":
82 | f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}getmemb`\
83 | \nUsage : Mengumpulkan Anggota dari Obrolan\
84 | \n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}addmemb`\
85 | \nUsage : Menambahkan Anggota ke Obrolan\
86 | \nTata Cara Menggunakannya: Pertama, Anda harus melakukan {cmd}getmemb terlebih dahulu dari Obrolan. Lalu buka grup Anda dan ketik {cmd}addmemb untuk menambahkan mereka ke grup Anda."
87 | })
88 |
--------------------------------------------------------------------------------
/userbot/modules/shazam.py:
--------------------------------------------------------------------------------
1 | # Ported By VICKY <@VckyouuBitch>
2 | #
3 | # Geez Projects UserBot
4 | # Copyright (C) 2021 GeezProjects
5 | #
6 | # This file is a part of
7 | # PLease read the GNU Affero General Public License in
8 | # .
9 |
10 |
11 | from telethon.errors.rpcerrorlist import YouBlockedUserError
12 | from userbot import CMD_HELP, CMD_HANDLER as cmd
13 | from userbot.utils import toni_cmd
14 |
15 |
16 | @toni_cmd(pattern="shazam(?: |$)(.*)")
17 | async def _(event):
18 | "To reverse search music by bot."
19 | if not event.reply_to_msg_id:
20 | return await edit_delete(event, "```Membalas pesan audio.```")
21 | reply_message = await event.get_reply_message()
22 | chat = "@auddbot"
23 | try:
24 | async with event.client.conversation(chat) as conv:
25 | try:
26 | xx = await edit_or_reply(event, "```Mengidentifikasi lagu```")
27 | start_msg = await conv.send_message("/start")
28 | response = await conv.get_response()
29 | send_audio = await conv.send_message(reply_message)
30 | check = await conv.get_response()
31 | if not check.text.startswith("Audio received"):
32 | return await xx.edit(
33 | "Terjadi kesalahan saat mengidentifikasi lagu. Coba gunakan pesan audio berdurasi 5-10 detik."
34 | )
35 | await xx.edit("```Tunggu sebentar...```")
36 | result = await conv.get_response()
37 | await event.client.send_read_acknowledge(conv.chat_id)
38 | except YouBlockedUserError:
39 | await xx.edit("```Mohon buka blokir (@auddbot) dan coba lagi```")
40 | return
41 | namem = f"**Judul : **{result.text.splitlines()[0]}\
42 | \n\n**Details : **__{result.text.splitlines()[2]}__"
43 | await xx.edit(namem)
44 | await event.client.delete_messages(
45 | conv.chat_id, [start_msg.id, send_audio.id, check.id, result.id, response.id]
46 | )
47 | except TimeoutError:
48 | return await xx.edit("`Error: `@auddbot` tidak merespons, coba lagi nanti")
49 |
50 | CMD_HELP.update(
51 | {
52 | "shazam": f">`{cmd}shazam "
53 | "\nUsage: Reverse search audio file using (@auddbot)"
54 | }
55 | )
56 |
--------------------------------------------------------------------------------
/userbot/modules/specialtools.py:
--------------------------------------------------------------------------------
1 | # Credits By @VckyouuBitch From Geez-Project
2 | # Tolong Haragai ya:)
3 | # Kalo emg Bisa Menghargai seseorang pasti pahamm la ya:)
4 | # Credits © Geez - Projects
5 |
6 | import os
7 |
8 | import moviepy.editor as m
9 |
10 | from userbot import CMD_HELP, CMD_HANDLER as cmd
11 | from userbot.utils import toni_cmd
12 |
13 |
14 | @toni_cmd(pattern="getaudio(?: |$)(.*)")
15 | async def _(event):
16 | ureply = await event.get_reply_message()
17 | if not (ureply and ("audio" in ureply.document.mime_type)):
18 | await event.edit("`Reply To Audio Only..`")
19 | return
20 | await event.edit("`processing...`")
21 | d = os.path.join("resources/extras", "ul.mp3")
22 | await event.edit("`Downloading... Large Files Takes Time..`")
23 | await event.client.download_media(ureply, d)
24 | await event.edit("`Done.. Now reply to video In which u want to add that Audio`")
25 |
26 |
27 | @toni_cmd(pattern="addaudio(?: |$)(.*)")
28 | async def _(event):
29 | ureply = await event.get_reply_message()
30 | if not (ureply and ("video" in ureply.document.mime_type)):
31 | await event.edit("`Reply To Gif/Video In which u want to add audio.`")
32 | return
33 | xx = await event.edit("`processing...`")
34 | ultt = await ureply.download_media()
35 | ls = os.listdir("resources/extras")
36 | z = "ul.mp3"
37 | x = "resources/extras/ul.mp3"
38 | if z not in ls:
39 | await event.edit("`First reply an audio with .aw`")
40 | return
41 | video = m.VideoFileClip(ultt)
42 | audio = m.AudioFileClip(x)
43 | out = video.set_audio(audio)
44 | out.write_videofile("ok.mp4", fps=30)
45 | await event.client.send_file(
46 | event.chat_id,
47 | file="ok.mp4",
48 | force_document=False,
49 | reply_to=event.reply_to_msg_id,
50 | )
51 | os.remove("ok.mp4")
52 | os.remove(x)
53 | os.remove(ultt)
54 | await xx.delete()
55 |
56 | CMD_HELP.update(
57 | {
58 | "specialtools": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}getaudio`\
59 | \n↳ : Download Audio To put in ur Desired Video/Gif..\
60 | \n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}addaudio`\
61 | \n↳ : It will put the above audio to the replied video/gif.."
62 | }
63 | )
64 |
--------------------------------------------------------------------------------
/userbot/modules/spotifynow.py:
--------------------------------------------------------------------------------
1 | # Ported by Aidil Aryanto
2 |
3 | import os
4 |
5 | from telethon.errors.rpcerrorlist import YouBlockedUserError
6 |
7 | from userbot import (
8 | CMD_HELP,
9 | TEMP_DOWNLOAD_DIRECTORY,
10 | bot,
11 | CMD_HANDLER as cmd,
12 | )
13 | from userbot.utils import toni_cmd
14 |
15 |
16 | @toni_cmd(pattern=r"spotnow(:? |$)(.*)?")
17 | async def _(event):
18 | if event.fwd_from:
19 | return
20 | chat = "@SpotifyNowBot"
21 | now = f"/now"
22 | await event.edit("`Processing...`")
23 | async with event.client.conversation(chat) as conv:
24 | try:
25 | msg = await conv.send_message(now)
26 | response = await conv.get_response()
27 | """ - don't spam notif - """
28 | await bot.send_read_acknowledge(conv.chat_id)
29 | except YouBlockedUserError:
30 | await event.reply("`Please unblock` @SpotifyNowBot`...`")
31 | return
32 | if response.text.startswith("You're"):
33 | await event.edit(
34 | "`You're not listening to anything on Spotify at the moment`"
35 | )
36 | await event.client.delete_messages(conv.chat_id, [msg.id, response.id])
37 | return
38 | if response.text.startswith("Ads."):
39 | await event.edit("`You're listening to those annoying ads.`")
40 | await event.client.delete_messages(conv.chat_id, [msg.id, response.id])
41 | return
42 | else:
43 | downloaded_file_name = await event.client.download_media(
44 | response.media, TEMP_DOWNLOAD_DIRECTORY
45 | )
46 | await event.client.send_file(
47 | event.chat_id,
48 | downloaded_file_name,
49 | force_document=False,
50 | )
51 | """ - cleanup chat after completed - """
52 | await event.client.delete_messages(conv.chat_id, [msg.id, response.id])
53 | await event.delete()
54 | return os.remove(downloaded_file_name)
55 |
56 |
57 | CMD_HELP.update(
58 | {
59 | "spotifynow": f"✘ **Plugin spotifynow** :\
60 | \n\n • **Perintah** : `{cmd}spotnow` \
61 | \n • **Fungsi** : Tunjukkan apa yang Anda dengarkan di spotify."
62 | }
63 | )
64 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/__init__.py:
--------------------------------------------------------------------------------
1 | from sqlalchemy import create_engine
2 | from sqlalchemy.ext.declarative import declarative_base
3 | from sqlalchemy.orm import sessionmaker, scoped_session
4 | from userbot import DB_URI
5 |
6 | BASE = declarative_base()
7 |
8 |
9 | def start() -> scoped_session:
10 | engine = create_engine(DB_URI)
11 | BASE.metadata.bind = engine
12 | BASE.metadata.create_all(engine)
13 | return scoped_session(sessionmaker(bind=engine, autoflush=False))
14 |
15 |
16 | SESSION = start()
17 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/antiflood_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 | import threading
6 | from sqlalchemy import Column, Integer, String
7 |
8 | DEF_COUNT = 0
9 | DEF_LIMIT = 0
10 | DEF_OBJ = (None, DEF_COUNT, DEF_LIMIT)
11 |
12 |
13 | class FloodControl(BASE):
14 | __tablename__ = "antiflood"
15 | chat_id = Column(String(14), primary_key=True)
16 | user_id = Column(Integer)
17 | count = Column(Integer, default=DEF_COUNT)
18 | limit = Column(Integer, default=DEF_LIMIT)
19 |
20 | def __init__(self, chat_id):
21 | self.chat_id = str(chat_id) # ensure string
22 |
23 | def __repr__(self):
24 | return "" % self.chat_id
25 |
26 |
27 | FloodControl.__table__.create(checkfirst=True)
28 |
29 | INSERTION_LOCK = threading.RLock()
30 |
31 | CHAT_FLOOD = {}
32 |
33 |
34 | def set_flood(chat_id, amount):
35 | with INSERTION_LOCK:
36 | flood = SESSION.query(FloodControl).get(str(chat_id))
37 | if not flood:
38 | flood = FloodControl(str(chat_id))
39 |
40 | flood.user_id = None
41 | flood.limit = amount
42 |
43 | CHAT_FLOOD[str(chat_id)] = (None, DEF_COUNT, amount)
44 |
45 | SESSION.add(flood)
46 | SESSION.commit()
47 |
48 |
49 | def update_flood(chat_id: str, user_id) -> bool:
50 | if str(chat_id) in CHAT_FLOOD:
51 | curr_user_id, count, limit = CHAT_FLOOD.get(str(chat_id), DEF_OBJ)
52 |
53 | if limit == 0: # no antiflood
54 | return False
55 |
56 | if user_id != curr_user_id or user_id is None: # other user
57 | CHAT_FLOOD[str(chat_id)] = (user_id, DEF_COUNT + 1, limit)
58 | return False
59 |
60 | count += 1
61 | if count > limit: # too many msgs, kick
62 | CHAT_FLOOD[str(chat_id)] = (None, DEF_COUNT, limit)
63 | return True
64 |
65 | # default -> update
66 | CHAT_FLOOD[str(chat_id)] = (user_id, count, limit)
67 | return False
68 |
69 |
70 | def get_flood_limit(chat_id):
71 | return CHAT_FLOOD.get(str(chat_id), DEF_OBJ)[2]
72 |
73 |
74 | def migrate_chat(old_chat_id, new_chat_id):
75 | with INSERTION_LOCK:
76 | flood = SESSION.query(FloodControl).get(str(old_chat_id))
77 | if flood:
78 | CHAT_FLOOD[str(new_chat_id)] = CHAT_FLOOD.get(
79 | str(old_chat_id), DEF_OBJ)
80 | flood.chat_id = str(new_chat_id)
81 | SESSION.commit()
82 |
83 | SESSION.close()
84 |
85 |
86 | def __load_flood_settings():
87 | global CHAT_FLOOD
88 | try:
89 | all_chats = SESSION.query(FloodControl).all()
90 | CHAT_FLOOD = {
91 | chat.chat_id: (
92 | None,
93 | DEF_COUNT,
94 | chat.limit) for chat in all_chats}
95 | finally:
96 | SESSION.close()
97 | return CHAT_FLOOD
98 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/bot_blacklists.py:
--------------------------------------------------------------------------------
1 | from sqlalchemy import Column, String, UnicodeText
2 |
3 | from userbot.modules.sql_helper import BASE, SESSION
4 |
5 |
6 | class Bot_BlackList(BASE):
7 | __tablename__ = "bot_blacklist"
8 | chat_id = Column(String(14), primary_key=True)
9 | first_name = Column(UnicodeText)
10 | username = Column(UnicodeText)
11 | reason = Column(UnicodeText)
12 | date = Column(UnicodeText)
13 |
14 | def __init__(self, chat_id, first_name, username, reason, date):
15 | self.chat_id = str(chat_id)
16 | self.username = username
17 | self.reason = reason
18 | self.date = date
19 | self.first_name = first_name
20 |
21 | def __repr__(self):
22 | return "" % self.chat_id
23 |
24 |
25 | Bot_BlackList.__table__.create(checkfirst=True)
26 |
27 |
28 | def add_user_to_bl(
29 | chat_id: int, first_name: str, username: str, reason: str, date: str
30 | ):
31 | """add the user to the blacklist"""
32 | to_check = check_is_black_list(chat_id)
33 | if not to_check:
34 | __user = Bot_BlackList(
35 | str(chat_id),
36 | first_name,
37 | username,
38 | reason,
39 | date)
40 | SESSION.add(__user)
41 | SESSION.commit()
42 | rem = SESSION.query(Bot_BlackList).get(str(chat_id))
43 | SESSION.delete(rem)
44 | SESSION.commit()
45 | user = Bot_BlackList(str(chat_id), first_name, username, reason, date)
46 | SESSION.add(user)
47 | SESSION.commit()
48 | return True
49 |
50 |
51 | def check_is_black_list(chat_id: int):
52 | """check if user_id is blacklisted"""
53 | try:
54 | return SESSION.query(Bot_BlackList).get(str(chat_id))
55 | finally:
56 | SESSION.close()
57 |
58 |
59 | def rem_user_from_bl(chat_id: int):
60 | """remove the user from the blacklist"""
61 | s__ = SESSION.query(Bot_BlackList).get(str(chat_id))
62 | if s__:
63 | SESSION.delete(s__)
64 | SESSION.commit()
65 | return True
66 | SESSION.close()
67 | return False
68 |
69 |
70 | def get_all_bl_users():
71 | try:
72 | return SESSION.query(Bot_BlackList).all()
73 | except BaseException:
74 | return None
75 | finally:
76 | SESSION.close()
77 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/bot_starters.py:
--------------------------------------------------------------------------------
1 | from sqlalchemy import Column, String, UnicodeText
2 |
3 | from userbot.modules.sql_helper import BASE, SESSION
4 |
5 |
6 | class Bot_Starters(BASE):
7 | __tablename__ = "bot_starters"
8 | user_id = Column(String(14), primary_key=True)
9 | first_name = Column(UnicodeText)
10 | date = Column(UnicodeText)
11 | username = Column(UnicodeText)
12 |
13 | def __init__(self, user_id, first_name, date, username):
14 | self.user_id = str(user_id)
15 | self.first_name = first_name
16 | self.date = date
17 | self.username = username
18 |
19 |
20 | Bot_Starters.__table__.create(checkfirst=True)
21 |
22 |
23 | def add_starter_to_db(
24 | user_id,
25 | first_name,
26 | date,
27 | username,
28 | ):
29 | to_check = get_starter_details(user_id)
30 | if not to_check:
31 | user = Bot_Starters(str(user_id), first_name, date, username)
32 | SESSION.add(user)
33 | SESSION.commit()
34 | return True
35 | rem = SESSION.query(Bot_Starters).get(str(user_id))
36 | SESSION.delete(rem)
37 | SESSION.commit()
38 | user = Bot_Starters(str(user_id), first_name, date, username)
39 | SESSION.add(user)
40 | SESSION.commit()
41 | return True
42 |
43 |
44 | def del_starter_from_db(user_id):
45 | to_check = get_starter_details(user_id)
46 | if not to_check:
47 | return False
48 | rem = SESSION.query(Bot_Starters).get(str(user_id))
49 | SESSION.delete(rem)
50 | SESSION.commit()
51 | return True
52 |
53 |
54 | def get_starter_details(user_id):
55 | try:
56 | _result = SESSION.query(Bot_Starters).get(str(user_id))
57 | if _result:
58 | return _result
59 | return None
60 | finally:
61 | SESSION.close()
62 |
63 |
64 | def get_all_starters():
65 | try:
66 | return SESSION.query(Bot_Starters).all()
67 | except BaseException:
68 | return None
69 | finally:
70 | SESSION.close()
71 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/fban_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 |
6 | from sqlalchemy import Column, String, UnicodeText
7 |
8 |
9 | class Fban(BASE):
10 | __tablename__ = "fban"
11 | chat_id = Column(String(14), primary_key=True)
12 | fed_name = Column(UnicodeText)
13 |
14 | def __init__(self, chat_id, fed_name):
15 | self.chat_id = str(chat_id)
16 | self.fed_name = fed_name
17 |
18 |
19 | Fban.__table__.create(checkfirst=True)
20 |
21 |
22 | def get_flist():
23 | try:
24 | return SESSION.query(Fban).all()
25 | finally:
26 | SESSION.close()
27 |
28 |
29 | def add_flist(chat_id, fed_name):
30 | adder = Fban(str(chat_id), fed_name)
31 | SESSION.add(adder)
32 | SESSION.commit()
33 |
34 |
35 | def del_flist(chat_id):
36 | rem = SESSION.query(Fban).get(str(chat_id))
37 | if rem:
38 | SESSION.delete(rem)
39 | SESSION.commit()
40 |
41 |
42 | def del_flist_all():
43 | SESSION.execute("""TRUNCATE TABLE fban""")
44 | SESSION.commit()
45 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/filter_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 | from sqlalchemy import Column, UnicodeText, Numeric, String
6 |
7 |
8 | class Filters(BASE):
9 | __tablename__ = "filters"
10 | chat_id = Column(String(14), primary_key=True)
11 | keyword = Column(UnicodeText, primary_key=True, nullable=False)
12 | reply = Column(UnicodeText)
13 | f_mesg_id = Column(Numeric)
14 |
15 | def __init__(self, chat_id, keyword, reply, f_mesg_id):
16 | self.chat_id = str(chat_id)
17 | self.keyword = keyword
18 | self.reply = reply
19 | self.f_mesg_id = f_mesg_id
20 |
21 | def __eq__(self, other):
22 | return bool(
23 | isinstance(other, Filters) and self.chat_id == other.chat_id
24 | and self.keyword == other.keyword)
25 |
26 |
27 | Filters.__table__.create(checkfirst=True)
28 |
29 |
30 | def get_filter(chat_id, keyword):
31 | try:
32 | return SESSION.query(Filters).get((str(chat_id), keyword))
33 | finally:
34 | SESSION.close()
35 |
36 |
37 | def get_filters(chat_id):
38 | try:
39 | return SESSION.query(Filters).filter(
40 | Filters.chat_id == str(chat_id)).all()
41 | finally:
42 | SESSION.close()
43 |
44 |
45 | def add_filter(chat_id, keyword, reply, f_mesg_id):
46 | to_check = get_filter(chat_id, keyword)
47 | if not to_check:
48 | adder = Filters(str(chat_id), keyword, reply, f_mesg_id)
49 | SESSION.add(adder)
50 | SESSION.commit()
51 | return True
52 | else:
53 | rem = SESSION.query(Filters).get((str(chat_id), keyword))
54 | SESSION.delete(rem)
55 | SESSION.commit()
56 | adder = Filters(str(chat_id), keyword, reply, f_mesg_id)
57 | SESSION.add(adder)
58 | SESSION.commit()
59 | return False
60 |
61 |
62 | def remove_filter(chat_id, keyword):
63 | to_check = get_filter(chat_id, keyword)
64 | if not to_check:
65 | return False
66 | else:
67 | rem = SESSION.query(Filters).get((str(chat_id), keyword))
68 | SESSION.delete(rem)
69 | SESSION.commit()
70 | return True
71 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/gban_sql.py:
--------------------------------------------------------------------------------
1 | from sqlalchemy import Column, String
2 |
3 | from userbot.modules.sql_helper import BASE, SESSION
4 |
5 |
6 | class GBan(BASE):
7 | __tablename__ = "gban"
8 | chat_id = Column(String(14), primary_key=True)
9 | reason = Column(String(127))
10 |
11 | def __init__(self, chat_id, reason=""):
12 | self.chat_id = chat_id
13 | self.reason = reason
14 |
15 |
16 | GBan.__table__.create(checkfirst=True)
17 |
18 |
19 | def is_gbanned(chat_id):
20 | try:
21 | return SESSION.query(GBan).filter(
22 | GBan.chat_id == str(chat_id)).one()
23 | except BaseException:
24 | return None
25 | finally:
26 | SESSION.close()
27 |
28 |
29 | def get_gbanuser(chat_id):
30 | try:
31 | return SESSION.query(GBan).get(str(chat_id))
32 | finally:
33 | SESSION.close()
34 |
35 |
36 | def freakgban(chat_id):
37 | adder = GBan(str(chat_id))
38 | SESSION.add(adder)
39 | SESSION.commit()
40 |
41 |
42 | def freakungban(chat_id):
43 | rem = SESSION.query(GBan).get(str(chat_id))
44 | if rem:
45 | SESSION.delete(rem)
46 | SESSION.commit()
47 |
48 |
49 | def get_all_gbanned():
50 | rem = SESSION.query(GBan).all()
51 | SESSION.close()
52 | return rem
53 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/globals.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 |
6 | from sqlalchemy import Column, String, UnicodeText
7 |
8 |
9 | class Globals(BASE):
10 | __tablename__ = "globals"
11 | variable = Column(String, primary_key=True, nullable=False)
12 | value = Column(UnicodeText, primary_key=True, nullable=False)
13 |
14 | def __init__(self, variable, value):
15 | self.variable = str(variable)
16 | self.value = value
17 |
18 |
19 | Globals.__table__.create(checkfirst=True)
20 |
21 |
22 | def gvarstatus(variable):
23 | try:
24 | return SESSION.query(Globals).filter(
25 | Globals.variable == str(variable)).first().value
26 | except BaseException:
27 | return None
28 | finally:
29 | SESSION.close()
30 |
31 |
32 | def addgvar(variable, value):
33 | if SESSION.query(Globals).filter(
34 | Globals.variable == str(variable)).one_or_none():
35 | delgvar(variable)
36 | adder = Globals(str(variable), value)
37 | SESSION.add(adder)
38 | SESSION.commit()
39 |
40 |
41 | def delgvar(variable):
42 | rem = SESSION.query(Globals).filter(Globals.variable == str(variable))\
43 | .delete(synchronize_session="fetch")
44 | if rem:
45 | SESSION.commit()
46 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/gmute_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 |
6 | from sqlalchemy import Column, String
7 |
8 |
9 | class GMute(BASE):
10 | __tablename__ = "gmute"
11 | sender = Column(String(14), primary_key=True)
12 |
13 | def __init__(self, sender):
14 | self.sender = str(sender)
15 |
16 |
17 | GMute.__table__.create(checkfirst=True)
18 |
19 |
20 | def is_gmuted(sender_id):
21 | try:
22 | return SESSION.query(GMute).all()
23 | except BaseException:
24 | return None
25 | finally:
26 | SESSION.close()
27 |
28 |
29 | def gmute(sender):
30 | adder = GMute(str(sender))
31 | SESSION.add(adder)
32 | SESSION.commit()
33 |
34 |
35 | def ungmute(sender):
36 | rem = SESSION.query(GMute).get((str(sender)))
37 | if rem:
38 | SESSION.delete(rem)
39 | SESSION.commit()
40 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/google_drive_sql.py:
--------------------------------------------------------------------------------
1 | from userbot.modules.sql_helper import SESSION, BASE
2 | from sqlalchemy import Column, String, Text
3 |
4 |
5 | class GoogleDriveCreds(BASE):
6 | __tablename__ = 'gdrive'
7 | user = Column(String, primary_key=True)
8 | credentials = Column(Text, nullable=False)
9 |
10 | def __init__(self, user):
11 | self.user = user
12 |
13 |
14 | GoogleDriveCreds.__table__.create(checkfirst=True)
15 |
16 |
17 | def save_credentials(user, credentials):
18 | saved_credentials = SESSION.query(GoogleDriveCreds).get(user)
19 | if not saved_credentials:
20 | saved_credentials = GoogleDriveCreds(user)
21 |
22 | saved_credentials.credentials = credentials
23 |
24 | SESSION.add(saved_credentials)
25 | SESSION.commit()
26 | return True
27 |
28 |
29 | def get_credentials(user):
30 | try:
31 | saved_credentials = SESSION.query(GoogleDriveCreds).get(user)
32 | creds = None
33 |
34 | if saved_credentials is not None:
35 | creds = saved_credentials.credentials
36 | return creds
37 | finally:
38 | SESSION.close()
39 |
40 |
41 | def clear_credentials(user):
42 | saved_credentials = SESSION.query(GoogleDriveCreds).get(user)
43 | if saved_credentials:
44 | SESSION.delete(saved_credentials)
45 | SESSION.commit()
46 | return True
47 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/keep_read_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 |
6 | from sqlalchemy import Column, String
7 |
8 |
9 | class KRead(BASE):
10 | __tablename__ = "kread"
11 | groupid = Column(String(14), primary_key=True)
12 |
13 | def __init__(self, sender):
14 | self.groupid = str(sender)
15 |
16 |
17 | KRead.__table__.create(checkfirst=True)
18 |
19 |
20 | def is_kread():
21 | try:
22 | return SESSION.query(KRead).all()
23 | except BaseException:
24 | return None
25 | finally:
26 | SESSION.close()
27 |
28 |
29 | def kread(chat):
30 | adder = KRead(str(chat))
31 | SESSION.add(adder)
32 | SESSION.commit()
33 |
34 |
35 | def unkread(chat):
36 | rem = SESSION.query(KRead).get((str(chat)))
37 | if rem:
38 | SESSION.delete(rem)
39 | SESSION.commit()
40 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/locks_sql.py:
--------------------------------------------------------------------------------
1 | from sqlalchemy import Boolean, Column, String
2 |
3 | from userbot.modules.sql_helper import BASE, SESSION
4 |
5 |
6 | class Locks(BASE):
7 | __tablename__ = "locks"
8 | chat_id = Column(String(14), primary_key=True)
9 | # Booleans are for "is this locked", _NOT_ "is this allowed"
10 | bots = Column(Boolean, default=False)
11 | commands = Column(Boolean, default=False)
12 | email = Column(Boolean, default=False)
13 | forward = Column(Boolean, default=False)
14 | url = Column(Boolean, default=False)
15 |
16 | def __init__(self, chat_id):
17 | self.chat_id = str(chat_id) # ensure string
18 | self.bots = False
19 | self.commands = False
20 | self.email = False
21 | self.forward = False
22 | self.url = False
23 |
24 |
25 | Locks.__table__.create(checkfirst=True)
26 |
27 |
28 | def init_locks(chat_id, reset=False):
29 | curr_restr = SESSION.query(Locks).get(str(chat_id))
30 | if reset:
31 | SESSION.delete(curr_restr)
32 | SESSION.flush()
33 | restr = Locks(str(chat_id))
34 | SESSION.add(restr)
35 | SESSION.commit()
36 | return restr
37 |
38 |
39 | def update_lock(chat_id, lock_type, locked):
40 | curr_perm = SESSION.query(Locks).get(str(chat_id))
41 | if not curr_perm:
42 | curr_perm = init_locks(chat_id)
43 | if lock_type == "bots":
44 | curr_perm.bots = locked
45 | elif lock_type == "commands":
46 | curr_perm.commands = locked
47 | elif lock_type == "email":
48 | curr_perm.email = locked
49 | elif lock_type == "forward":
50 | curr_perm.forward = locked
51 | elif lock_type == "url":
52 | curr_perm.url = locked
53 | SESSION.add(curr_perm)
54 | SESSION.commit()
55 |
56 |
57 | def is_locked(chat_id, lock_type):
58 | curr_perm = SESSION.query(Locks).get(str(chat_id))
59 | SESSION.close()
60 | if not curr_perm:
61 | return False
62 | if lock_type == "bots":
63 | return curr_perm.bots
64 | if lock_type == "commands":
65 | return curr_perm.commands
66 | if lock_type == "email":
67 | return curr_perm.email
68 | if lock_type == "forward":
69 | return curr_perm.forward
70 | if lock_type == "url":
71 | return curr_perm.url
72 |
73 |
74 | def get_locks(chat_id):
75 | try:
76 | return SESSION.query(Locks).get(str(chat_id))
77 | finally:
78 | SESSION.close()
79 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/lydia_sql.py:
--------------------------------------------------------------------------------
1 | from sqlalchemy import Column, Numeric, UnicodeText
2 | from userbot.modules.sql_helper import SESSION, BASE
3 |
4 |
5 | class LydiaAI(BASE):
6 | __tablename__ = "lydia_ai"
7 | user_id = Column(Numeric, primary_key=True)
8 | chat_id = Column(Numeric, primary_key=True)
9 | session_id = Column(UnicodeText)
10 | session_expires = Column(Numeric)
11 |
12 | def __init__(
13 | self,
14 | user_id,
15 | chat_id,
16 | session_id,
17 | session_expires
18 | ):
19 | self.user_id = user_id
20 | self.chat_id = chat_id
21 | self.session_id = session_id
22 | self.session_expires = session_expires
23 |
24 |
25 | LydiaAI.__table__.create(checkfirst=True)
26 |
27 |
28 | def get_s(user_id, chat_id):
29 | try:
30 | return SESSION.query(LydiaAI).get((user_id, chat_id))
31 | except BaseException:
32 | return None
33 | finally:
34 | SESSION.close()
35 |
36 |
37 | def get_all_s():
38 | try:
39 | return SESSION.query(LydiaAI).all()
40 | except BaseException:
41 | return None
42 | finally:
43 | SESSION.close()
44 |
45 |
46 | def add_s(
47 | user_id,
48 | chat_id,
49 | session_id,
50 | session_expires
51 | ):
52 | adder = SESSION.query(LydiaAI).get((user_id, chat_id))
53 | if adder:
54 | adder.session_id = session_id
55 | adder.session_expires = session_expires
56 | else:
57 | adder = LydiaAI(
58 | user_id,
59 | chat_id,
60 | session_id,
61 | session_expires
62 | )
63 | SESSION.add(adder)
64 | SESSION.commit()
65 |
66 |
67 | def remove_s(
68 | user_id,
69 | chat_id
70 | ):
71 | note = SESSION.query(LydiaAI).get((user_id, chat_id))
72 | if note:
73 | SESSION.delete(note)
74 | SESSION.commit()
75 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/mute_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise Exception("Hello!")
5 |
6 | from sqlalchemy import Column, String
7 |
8 |
9 | class Mute(BASE):
10 | __tablename__ = "mute"
11 | sender = Column(String(14), primary_key=True)
12 | chat_id = Column(String(14), primary_key=True)
13 |
14 | def __init__(self, sender, chat_id):
15 | self.sender = str(sender)
16 | self.chat_id = str(chat_id)
17 |
18 |
19 | Mute.__table__.create(checkfirst=True)
20 |
21 |
22 | def is_muted(sender, chat_id):
23 | user = SESSION.query(Mute).get((str(sender), str(chat_id)))
24 | if user:
25 | return True
26 | else:
27 | return False
28 |
29 |
30 | def mute(sender, chat_id):
31 | adder = Mute(str(sender), str(chat_id))
32 | SESSION.add(adder)
33 | SESSION.commit()
34 |
35 |
36 | def unmute(sender, chat_id):
37 | rem = SESSION.query(Mute).get((str(sender), str(chat_id)))
38 | if rem:
39 | SESSION.delete(rem)
40 | SESSION.commit()
41 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/no_log_pms_sql.py:
--------------------------------------------------------------------------------
1 | from sqlalchemy import Column, Numeric
2 |
3 | from userbot.modules.sql_helper import BASE, SESSION
4 |
5 |
6 | class NOLogPMs(BASE):
7 | __tablename__ = "no_log_pms"
8 | chat_id = Column(Numeric, primary_key=True)
9 |
10 | def __init__(self, chat_id, reason=""):
11 | self.chat_id = chat_id
12 |
13 |
14 | NOLogPMs.__table__.create(checkfirst=True)
15 |
16 |
17 | def is_approved(chat_id):
18 | try:
19 | return SESSION.query(NOLogPMs).filter(
20 | NOLogPMs.chat_id == chat_id).one()
21 | except BaseException:
22 | return None
23 | finally:
24 | SESSION.close()
25 |
26 |
27 | def approve(chat_id):
28 | adder = NOLogPMs(chat_id)
29 | SESSION.add(adder)
30 | SESSION.commit()
31 |
32 |
33 | def disapprove(chat_id):
34 | rem = SESSION.query(NOLogPMs).get(chat_id)
35 | if rem:
36 | SESSION.delete(rem)
37 | SESSION.commit()
38 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/notes_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 | from sqlalchemy import Column, UnicodeText, Numeric, String
6 |
7 |
8 | class Notes(BASE):
9 | __tablename__ = "notes"
10 | chat_id = Column(String(14), primary_key=True)
11 | keyword = Column(UnicodeText, primary_key=True, nullable=False)
12 | reply = Column(UnicodeText)
13 | f_mesg_id = Column(Numeric)
14 |
15 | def __init__(self, chat_id, keyword, reply, f_mesg_id):
16 | self.chat_id = str(chat_id)
17 | self.keyword = keyword
18 | self.reply = reply
19 | self.f_mesg_id = f_mesg_id
20 |
21 |
22 | Notes.__table__.create(checkfirst=True)
23 |
24 |
25 | def get_note(chat_id, keyword):
26 | try:
27 | return SESSION.query(Notes).get((str(chat_id), keyword))
28 | finally:
29 | SESSION.close()
30 |
31 |
32 | def get_notes(chat_id):
33 | try:
34 | return SESSION.query(Notes).filter(Notes.chat_id == str(chat_id)).all()
35 | finally:
36 | SESSION.close()
37 |
38 |
39 | def add_note(chat_id, keyword, reply, f_mesg_id):
40 | to_check = get_note(chat_id, keyword)
41 | if not to_check:
42 | adder = Notes(str(chat_id), keyword, reply, f_mesg_id)
43 | SESSION.add(adder)
44 | SESSION.commit()
45 | return True
46 | else:
47 | rem = SESSION.query(Notes).get((str(chat_id), keyword))
48 | SESSION.delete(rem)
49 | SESSION.commit()
50 | adder = Notes(str(chat_id), keyword, reply, f_mesg_id)
51 | SESSION.add(adder)
52 | SESSION.commit()
53 | return False
54 |
55 |
56 | def rm_note(chat_id, keyword):
57 | to_check = get_note(chat_id, keyword)
58 | if not to_check:
59 | return False
60 | else:
61 | rem = SESSION.query(Notes).get((str(chat_id), keyword))
62 | SESSION.delete(rem)
63 | SESSION.commit()
64 | return True
65 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/pm_permit_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 | from sqlalchemy import Column, String
6 |
7 |
8 | class PMPermit(BASE):
9 | __tablename__ = "pmpermit"
10 | chat_id = Column(String(14), primary_key=True)
11 |
12 | def __init__(self, chat_id):
13 | self.chat_id = str(chat_id) # ensure string
14 |
15 |
16 | PMPermit.__table__.create(checkfirst=True)
17 |
18 |
19 | def is_approved(chat_id):
20 | try:
21 | return SESSION.query(PMPermit).filter(
22 | PMPermit.chat_id == str(chat_id)).one()
23 | except BaseException:
24 | return None
25 | finally:
26 | SESSION.close()
27 |
28 |
29 | def approve(chat_id):
30 | adder = PMPermit(str(chat_id))
31 | SESSION.add(adder)
32 | SESSION.commit()
33 |
34 |
35 | def dissprove(chat_id):
36 | rem = SESSION.query(PMPermit).get(str(chat_id))
37 | if rem:
38 | SESSION.delete(rem)
39 | SESSION.commit()
40 |
41 |
42 | def get_all_approved():
43 | rem = SESSION.query(PMPermit).all()
44 | SESSION.close()
45 | return rem
46 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/snips_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 |
6 | from sqlalchemy import Column, Numeric, UnicodeText
7 |
8 |
9 | class Snips(BASE):
10 | __tablename__ = "snips"
11 | snip = Column(UnicodeText, primary_key=True)
12 | reply = Column(UnicodeText)
13 | f_mesg_id = Column(Numeric)
14 |
15 | def __init__(self, snip, reply, f_mesg_id):
16 | self.snip = snip
17 | self.reply = reply
18 | self.f_mesg_id = f_mesg_id
19 |
20 |
21 | Snips.__table__.create(checkfirst=True)
22 |
23 |
24 | def get_snip(keyword):
25 | try:
26 | return SESSION.query(Snips).get(keyword)
27 | finally:
28 | SESSION.close()
29 |
30 |
31 | def get_snips():
32 | try:
33 | return SESSION.query(Snips).all()
34 | finally:
35 | SESSION.close()
36 |
37 |
38 | def add_snip(keyword, reply, f_mesg_id):
39 | to_check = get_snip(keyword)
40 | if not to_check:
41 | adder = Snips(keyword, reply, f_mesg_id)
42 | SESSION.add(adder)
43 | SESSION.commit()
44 | return True
45 | else:
46 | rem = SESSION.query(Snips).filter(Snips.snip == keyword)
47 | SESSION.delete(rem)
48 | SESSION.commit()
49 | adder = Snips(keyword, reply, f_mesg_id)
50 | SESSION.add(adder)
51 | SESSION.commit()
52 | return False
53 |
54 |
55 | def remove_snip(keyword):
56 | to_check = get_snip(keyword)
57 | if not to_check:
58 | return False
59 | else:
60 | rem = SESSION.query(Snips).filter(Snips.snip == keyword)
61 | rem.delete()
62 | SESSION.commit()
63 | return True
64 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/spam_mute_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 |
6 | from sqlalchemy import Column, String
7 |
8 |
9 | class Mute(BASE):
10 | __tablename__ = "muted"
11 | chat_id = Column(String(14), primary_key=True)
12 | sender = Column(String(14), primary_key=True)
13 |
14 | def __init__(self, chat_id, sender):
15 | self.chat_id = str(chat_id) # ensure string
16 | self.sender = str(sender)
17 |
18 |
19 | Mute.__table__.create(checkfirst=True)
20 |
21 |
22 | def is_muted(chat_id):
23 | try:
24 | return SESSION.query(Mute).filter(Mute.chat_id == str(chat_id)).all()
25 | except BaseException:
26 | return None
27 | finally:
28 | SESSION.close()
29 |
30 |
31 | def mute(chat_id, sender):
32 | adder = Mute(str(chat_id), str(sender))
33 | SESSION.add(adder)
34 | SESSION.commit()
35 |
36 |
37 | def unmute(chat_id, sender):
38 | rem = SESSION.query(Mute).get(((str(chat_id)), (str(sender))))
39 | if rem:
40 | SESSION.delete(rem)
41 | SESSION.commit()
42 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/tede_chatbot_sql.py:
--------------------------------------------------------------------------------
1 | import threading
2 |
3 | from sqlalchemy import Column, String
4 | from userbot.modules.sql_helper import BASE, SESSION
5 |
6 |
7 | class TedeChatBot(BASE):
8 | __tablename__ = "tede_chatbot"
9 | chat_id = Column(String(14), primary_key=True)
10 |
11 | def __init__(self, chat_id):
12 | self.chat_id = str(chat_id)
13 |
14 |
15 | TedeChatBot.__table__.create(checkfirst=True)
16 |
17 | INSERTION_LOCK = threading.RLock()
18 |
19 |
20 | def is_tede(chat_id):
21 | try:
22 | chat = SESSION.query(TedeChatBot).get(str(chat_id))
23 | return bool(chat)
24 | finally:
25 | SESSION.close()
26 |
27 |
28 | def set_tede(chat_id):
29 | with INSERTION_LOCK:
30 | tedechat = SESSION.query(TedeChatBot).get(str(chat_id))
31 | if not tedechat:
32 | tedechat = TedeChatBot(str(chat_id))
33 | SESSION.add(tedechat)
34 | SESSION.commit()
35 |
36 |
37 | def rem_tede(chat_id):
38 | with INSERTION_LOCK:
39 | tedechat = SESSION.query(TedeChatBot).get(str(chat_id))
40 | if tedechat:
41 | SESSION.delete(tedechat)
42 | SESSION.commit()
43 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/welcome_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 |
6 | from sqlalchemy import BigInteger, Column, Numeric, String, UnicodeText
7 |
8 |
9 | class Welcome(BASE):
10 | __tablename__ = "welcome"
11 | chat_id = Column(String(14), primary_key=True)
12 | previous_welcome = Column(BigInteger)
13 | reply = Column(UnicodeText)
14 | f_mesg_id = Column(Numeric)
15 |
16 | def __init__(self, chat_id, previous_welcome, reply, f_mesg_id):
17 | self.chat_id = str(chat_id)
18 | self.previous_welcome = previous_welcome
19 | self.reply = reply
20 | self.f_mesg_id = f_mesg_id
21 |
22 |
23 | Welcome.__table__.create(checkfirst=True)
24 |
25 |
26 | def get_welcome(chat_id):
27 | try:
28 | return SESSION.query(Welcome).get(str(chat_id))
29 | finally:
30 | SESSION.close()
31 |
32 |
33 | def get_current_welcome_settings(chat_id):
34 | try:
35 | return SESSION.query(Welcome).filter(
36 | Welcome.chat_id == str(chat_id)).one()
37 | except BaseException:
38 | return None
39 | finally:
40 | SESSION.close()
41 |
42 |
43 | def add_welcome_setting(chat_id, previous_welcome, reply, f_mesg_id):
44 | to_check = get_welcome(chat_id)
45 | if not to_check:
46 | adder = Welcome(chat_id, previous_welcome, reply, f_mesg_id)
47 | SESSION.add(adder)
48 | SESSION.commit()
49 | return True
50 | else:
51 | rem = SESSION.query(Welcome).get(str(chat_id))
52 | SESSION.delete(rem)
53 | SESSION.commit()
54 | adder = Welcome(chat_id, previous_welcome, reply, f_mesg_id)
55 | SESSION.commit()
56 | return False
57 |
58 |
59 | def rm_welcome_setting(chat_id):
60 | try:
61 | rem = SESSION.query(Welcome).get(str(chat_id))
62 | if rem:
63 | SESSION.delete(rem)
64 | SESSION.commit()
65 | return True
66 | except BaseException:
67 | return False
68 |
69 |
70 | def update_previous_welcome(chat_id, previous_welcome):
71 | row = SESSION.query(Welcome).get(str(chat_id))
72 | row.previous_welcome = previous_welcome
73 | SESSION.commit()
74 |
--------------------------------------------------------------------------------
/userbot/modules/ss_video.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 Alfiananda P.A
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 |
7 | import asyncio
8 | import os
9 | import time
10 |
11 | from telethon.tl.types import DocumentAttributeFilename
12 |
13 | from userbot import CMD_HELP, bot, CMD_HANDLER as cmd
14 | from userbot.utils import progress, toni_cmd
15 |
16 |
17 | @toni_cmd(pattern=r"ssvideo(?: |$)(.*)")
18 | async def ssvideo(event):
19 | if not event.reply_to_msg_id:
20 | await event.edit("📛 `Balas ke media apa pun..`")
21 | return
22 | reply_message = await event.get_reply_message()
23 | if not reply_message.media:
24 | await event.edit("🎥 `Membalas video..`")
25 | return
26 | try:
27 | frame = int(event.pattern_match.group(1))
28 | if frame > 10:
29 | return await event.edit("`hey..jangan terlalu banyak`")
30 | except BaseException:
31 | return await event.edit("`Silakan masukkan nomor bingkai!`")
32 | if reply_message.photo:
33 | return await event.edit("`Hei..ini adalah gambar!`")
34 | if (
35 | DocumentAttributeFilename(file_name="AnimatedSticker.tgs")
36 | in reply_message.media.document.attributes
37 | ):
38 | return await event.edit("`File tidak didukung..`")
39 | elif (
40 | DocumentAttributeFilename(file_name="sticker.webp")
41 | in reply_message.media.document.attributes
42 | ):
43 | return await event.edit("`File tidak didukung..`")
44 | c_time = time.time()
45 | await event.edit("📂 `Downloading media..`")
46 | ss = await bot.download_media(
47 | reply_message,
48 | "anu.mp4",
49 | progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
50 | progress(d, t, event, c_time, "[DOWNLOAD]")
51 | ),
52 | )
53 | try:
54 | await event.edit("🔍 `Proccessing..`")
55 | command = f"vcsi -g {frame}x{frame} {ss} -o ss.png "
56 | os.system(command)
57 | await event.client.send_file(
58 | event.chat_id,
59 | "ss.png",
60 | reply_to=event.reply_to_msg_id,
61 | )
62 | await event.delete()
63 | os.system("rm -rf *.png")
64 | os.system("rm -rf *.mp4")
65 | except BaseException as e:
66 | os.system("rm -rf *.png")
67 | os.system("rm -rf *.mp4")
68 | return await event.edit(f"{e}")
69 |
70 |
71 | CMD_HELP.update(
72 | {
73 | "ssvideo": f"✘ **Plugin ssvideo** :\
74 | \n\n • **Perintah** : `{cmd}ssvideo` [nomer]\
75 | \n • **Fungsi** : ke ss bingkai video per bingkai."
76 | }
77 | )
78 |
--------------------------------------------------------------------------------
/userbot/modules/stickertext.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 | # Modified by Vckyouuu @VckyouuBitch
7 | # Using By Geez Project GPL-3.0 License
8 |
9 | import io
10 | import textwrap
11 |
12 | from PIL import Image, ImageDraw, ImageFont
13 |
14 | from userbot import CMD_HANDLER as cmd, CMD_HELP
15 | from userbot.utils import toni_cmd
16 |
17 |
18 | @toni_cmd(pattern=r"stick (.*)")
19 | async def stext(event):
20 | sticktext = event.pattern_match.group(1)
21 |
22 | if not sticktext:
23 | await event.edit("`Mohon Maaf, Saya Membutuhkan Text Anda.`")
24 | return
25 |
26 | await event.delete()
27 |
28 | sticktext = textwrap.wrap(sticktext, width=10)
29 | sticktext = "\n".join(sticktext)
30 |
31 | image = Image.new("RGBA", (512, 512), (255, 255, 255, 0))
32 | draw = ImageDraw.Draw(image)
33 | fontsize = 220
34 | font = ImageFont.truetype("userbot/files/RobotoMono-Regular.ttf", size=fontsize)
35 |
36 | while draw.multiline_textsize(sticktext, font=font) > (512, 512):
37 | fontsize -= 3
38 | font = ImageFont.truetype("userbot/files/RobotoMono-Regular.ttf", size=fontsize)
39 |
40 | width, height = draw.multiline_textsize(sticktext, font=font)
41 | draw.multiline_text(
42 | ((512 - width) / 2, (512 - height) / 2), sticktext, font=font, fill="white"
43 | )
44 |
45 | image_stream = io.BytesIO()
46 | image_stream.name = "sticker.webp"
47 | image.save(image_stream, "WebP")
48 | image_stream.seek(0)
49 |
50 | await event.client.send_file(event.chat_id, image_stream)
51 |
52 |
53 | CMD_HELP.update(
54 | {
55 | "stickertext": f"✘ Plugin stickertext :\
56 | \n\n • Perintah : `{cmd}stick` [teks]\
57 | \n • Fungsi : Mengubah Teks/Kata-Kata, Menjadi Stiker Anda."
58 | }
59 | )
60 |
--------------------------------------------------------------------------------
/userbot/modules/surat.py:
--------------------------------------------------------------------------------
1 | from time import sleep
2 |
3 | from userbot import CMD_HANDLER as cmd, CMD_HELP
4 | from userbot.utils import toni_cmd
5 |
6 |
7 | @toni_cmd(pattern="alfatihah(?: |$)(.*)")
8 | async def typewriter(typew):
9 | typew.pattern_match.group(1)
10 | sleep(1)
11 | await typew.edit("**SURAT ALFATIHAH**")
12 | sleep(1)
13 | await typew.edit("**bismillāhir-raḥmānir-raḥīm**")
14 | sleep(1)
15 | await typew.edit("**al-ḥamdu lillāhi rabbil-'ālamīn**")
16 | sleep(1)
17 | await typew.edit("**ar-raḥmānir-raḥīm**")
18 | sleep(1)
19 | await typew.edit("**māliki yaumid-dīn**")
20 | sleep(1)
21 | await typew.edit("**iyyāka na'budu wa iyyāka nasta'īn**")
22 | sleep(1)
23 | await typew.edit("**ihdinaṣ-ṣirāṭal-mustaqīm**")
24 | sleep(1)
25 | await typew.edit(
26 | "**ṣirāṭallażīna an'amta 'alaihim gairil-magḍụbi 'alaihim wa laḍ-ḍāllīn**"
27 | )
28 | sleep(1)
29 | await typew.edit("**Amin..**")
30 |
31 |
32 | # Create by myself @localheart
33 |
34 | CMD_HELP.update(
35 | {
36 | "surat": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}alfatihah`\
37 | \n↳ : Surat Alfatihah."
38 | }
39 | )
40 |
--------------------------------------------------------------------------------
/userbot/modules/tags.py:
--------------------------------------------------------------------------------
1 | # Port By @VckyouuBitch From Geez - Project
2 | # Copyright © Geez - Project
3 | # Credits By Ultroid
4 |
5 | from telethon.tl.types import ChannelParticipantAdmin as admin
6 | from telethon.tl.types import ChannelParticipantCreator as owner
7 | from telethon.tl.types import UserStatusOffline as off
8 | from telethon.tl.types import UserStatusOnline as onn
9 | from telethon.tl.types import UserStatusRecently as rec
10 | from telethon.utils import get_display_name
11 |
12 | from userbot.utils import toni_cmd
13 | from userbot import CMD_HELP, CMD_HANDLER as cmd
14 |
15 |
16 | @toni_cmd(pattern="tag(on|off|all|bots|rec|admins|owner)?(.*)")
17 | async def _(e):
18 | okk = e.text
19 | lll = e.pattern_match.group(2)
20 | users = 0
21 | o = 0
22 | nn = 0
23 | rece = 0
24 | if lll:
25 | xx = f"{lll}"
26 | else:
27 | xx = ""
28 | async for bb in e.client.iter_participants(e.chat_id, 99):
29 | users = users + 1
30 | x = bb.status
31 | y = bb.participant
32 | if isinstance(x, onn):
33 | o = o + 1
34 | if "on" in okk:
35 | xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})"
36 | if isinstance(x, off):
37 | nn = nn + 1
38 | if "off" in okk:
39 | if not (bb.bot or bb.deleted):
40 | xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})"
41 | if isinstance(x, rec):
42 | rece = rece + 1
43 | if "rec" in okk:
44 | if not (bb.bot or bb.deleted):
45 | xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})"
46 | if isinstance(y, owner):
47 | if "admin" or "owner" in okk:
48 | xx += f"\n👑 [{get_display_name(bb)}](tg://user?id={bb.id}) 👑"
49 | if isinstance(y, admin):
50 | if "admin" in okk:
51 | if not bb.deleted:
52 | xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})"
53 | if "all" in okk:
54 | if not (bb.bot or bb.deleted):
55 | xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})"
56 | if "bot" in okk:
57 | if bb.bot:
58 | xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})"
59 | await e.client.send_message(e.chat_id, xx)
60 | await e.delete()
61 |
62 |
63 | CMD_HELP.update(
64 | {
65 | 'tags':
66 | f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tag all`"
67 | "\n• : Tag Top 100 Members of chat."
68 | f"\n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tag admin`"
69 | "\n• : Tag Admins of that chat."
70 | f"\n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tag owner`"
71 | "\n• : Tag Owner of that chat."
72 | f"\n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tag bot`"
73 | "\n• : Tag Bots of that chat."
74 | f"\n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tag rec`"
75 | "\n• : Tag recently Active Members."
76 | f"\n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tag on`"
77 | "\n• : Tag online Members(work only if privacy off)."
78 | f"\n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tag off`"
79 | "\n• : Tag Offline Members(work only if privacy off)."
80 | }
81 | )
82 |
--------------------------------------------------------------------------------
/userbot/modules/tempmail.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 |
3 | from telethon import events
4 | from telethon.errors.rpcerrorlist import YouBlockedUserError
5 |
6 | from userbot import CMD_HANDLER as cmd, CMD_HELP, bot
7 | from userbot.utils import toni_cmd
8 |
9 |
10 | @toni_cmd(pattern=r"tm(?: |$)(.*)")
11 | async def _(event):
12 | chat = "@TempMailBot"
13 | geez = await event.edit("Sedang Memprosess...")
14 | async with bot.conversation(chat) as conv:
15 | try:
16 | response = conv.wait_event(
17 | events.NewMessage(incoming=True, from_users=220112646)
18 | )
19 | await conv.send_message("/start")
20 | await asyncio.sleep(1)
21 | await conv.send_message("Generate New")
22 | response = await response
23 | geezuserbot = (response).reply_markup.rows[2].buttons[0].url
24 | await event.client.send_read_acknowledge(conv.chat_id)
25 | except YouBlockedUserError:
26 | await geez.edit(
27 | "`Mohon Maaf, Silahkan Buka` @TempMailBot `Lalu Tekan Start dan Coba Lagi.`"
28 | )
29 | return
30 | await event.edit(
31 | f"**ROSE TEMPMAIL** ~ `{response.message.message}`\n\n[KLIK DISINI UNTUK VERIFIKASI]({geezuserbot})"
32 | )
33 |
34 |
35 | CMD_HELP.update(
36 | {
37 | "tempmail": f"**✘ Plugin tempmail :\
38 | \n\n • Perintah : `{cmd}tm` \
39 | \n • Fungsi : Mendapatkan Email Gratis Dari Temp Email."
40 | }
41 | )
42 |
--------------------------------------------------------------------------------
/userbot/modules/tiktok.py:
--------------------------------------------------------------------------------
1 | from telethon.errors.rpcerrorlist import YouBlockedUserError
2 |
3 | from userbot import (
4 | CMD_HANDLER as cmd,
5 | CMD_HELP,
6 | bot,
7 | )
8 | from userbot.utils import toni_cmd
9 |
10 |
11 | @toni_cmd(pattern=r"tiktok(?: |$)(.*)")
12 | async def _(event):
13 | if event.fwd_from:
14 | return
15 | d_link = event.pattern_match.group(1)
16 | if ".com" not in d_link:
17 | await event.edit(
18 | "`Mohon Maaf, Saya Membutuhkan Link Video Tiktok Untuk Mendownload Nya`"
19 | )
20 | else:
21 | await event.edit("```Video Sedang Diproses.....```")
22 | chat = "@ttsavebot"
23 | async with bot.conversation(chat) as conv:
24 | try:
25 | msg_start = await conv.send_message("/start")
26 | r = await conv.get_response()
27 | msg = await conv.send_message(d_link)
28 | details = await conv.get_response()
29 | video = await conv.get_response()
30 | """ - don't spam notif - """
31 | await bot.send_read_acknowledge(conv.chat_id)
32 | except YouBlockedUserError:
33 | await event.edit(
34 | "**Kesalahan:** `Mohon Buka Blokir` @ttsavebot `Dan Coba Lagi !`"
35 | )
36 | return
37 | await bot.send_file(event.chat_id, video)
38 | await event.client.delete_messages(
39 | conv.chat_id, [msg_start.id, r.id, msg.id, details.id, video.id]
40 | )
41 | await event.delete()
42 |
43 |
44 | CMD_HELP.update(
45 | {
46 | "tiktok": f"✘ Plugin tiktok :\
47 | \n\n • Perintah : `{cmd}tiktok` [link]\
48 | \n • Fungsi : Download Video Tiktok Tanpa Watermark."
49 | }
50 | )
51 |
--------------------------------------------------------------------------------
/userbot/modules/tiny.py:
--------------------------------------------------------------------------------
1 | # Ported By VCKYOU @VckyouuBitch
2 | # Fixes By Koala @Manusiarakitann
3 |
4 | from PIL import Image
5 | import cv2
6 | import os
7 | from userbot.utils import edit_or_reply, edit_delete, toni_cmd
8 | from userbot import CMD_HANDLER as cmd, CMD_HELP, bot
9 |
10 |
11 | @toni_cmd(pattern="tiny(?: |$)(.*)")
12 | async def _(event):
13 | reply = await event.get_reply_message()
14 | if not (reply and (reply.media)):
15 | await edit_delete(event, "`Mohon Balas Ke Sticker`")
16 | return
17 | xx = await edit_or_reply(event, "`Memproses Tiny....`")
18 | ik = await bot.download_media(reply)
19 | im1 = Image.open("resources/sky_blank.png")
20 | if ik.endswith(".tgs"):
21 | await event.client.download_media(reply, "geez.tgs")
22 | os.system("lottie_convert.py geez.tgs json.json")
23 | json = open("json.json", "r")
24 | jsn = json.read()
25 | json.close()
26 | jsn = jsn.replace("512", "2000")
27 | open("json.json", "w").write(jsn)
28 | os.system("lottie_convert.py json.json geez.tgs")
29 | file = "geez.tgs"
30 | os.remove("json.json")
31 | elif ik.endswith((".gif", ".mp4")):
32 | iik = cv2.VideoCapture(ik)
33 | dani, busy = iik.read()
34 | cv2.imwrite("i.png", busy)
35 | fil = "i.png"
36 | im = Image.open(fil)
37 | z, d = im.size
38 | if z == d:
39 | xxx, yyy = 200, 200
40 | else:
41 | t = z + d
42 | a = z / t
43 | b = d / t
44 | aa = (a * 100) - 50
45 | bb = (b * 100) - 50
46 | xxx = 200 + 5 * aa
47 | yyy = 200 + 5 * bb
48 | k = im.resize((int(xxx), int(yyy)))
49 | k.save("k.png", format="PNG", optimize=True)
50 | im2 = Image.open("k.png")
51 | back_im = im1.copy()
52 | back_im.paste(im2, (150, 0))
53 | back_im.save("o.webp", "WEBP", quality=95)
54 | file = "o.webp"
55 | os.remove(fil)
56 | os.remove("k.png")
57 | else:
58 | im = Image.open(ik)
59 | z, d = im.size
60 | if z == d:
61 | xxx, yyy = 200, 200
62 | else:
63 | t = z + d
64 | a = z / t
65 | b = d / t
66 | aa = (a * 100) - 50
67 | bb = (b * 100) - 50
68 | xxx = 200 + 5 * aa
69 | yyy = 200 + 5 * bb
70 | k = im.resize((int(xxx), int(yyy)))
71 | k.save("k.png", format="PNG", optimize=True)
72 | im2 = Image.open("k.png")
73 | back_im = im1.copy()
74 | back_im.paste(im2, (150, 0))
75 | back_im.save("o.webp", "WEBP", quality=95)
76 | file = "o.webp"
77 | os.remove("k.png")
78 | await event.client.send_file(event.chat_id, file, reply_to=event.reply_to_msg_id)
79 | await xx.delete()
80 | os.remove(file)
81 | os.remove(ik)
82 |
83 |
84 | CMD_HELP.update({
85 | "tiny": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tiny`\
86 | \nUsage : Untuk Memperkecil Sticker."})
87 |
--------------------------------------------------------------------------------
/userbot/modules/tonicbot.py:
--------------------------------------------------------------------------------
1 | from time import sleep
2 |
3 | from userbot import CMD_HELP, CMD_HANDLER as cmd
4 | from userbot.utils import toni_cmd, edit_or_reply
5 |
6 |
7 | @toni_cmd(pattern="sadboy(?: |$)(.*)")
8 | async def typewriter(typew):
9 | typew.pattern_match.group(1)
10 | sleep(2)
11 | sad = await edit_or_reply(typew, "`Pertama-tama kamu cantik`")
12 | sleep(2)
13 | await sad.edit("`Kedua kamu manis`")
14 | sleep(1)
15 | await sad.edit("`Dan yang terakhir adalah kamu bukan jodohku`")
16 |
17 |
18 | # Create by myself @localheart
19 | @toni_cmd(pattern="lahk(?: |$)(.*)")
20 | async def typewriter(typew):
21 | typew.pattern_match.group(1)
22 | lah = await edit_or_reply(typew, "`Lahk, Lo tolol?`")
23 | sleep(1)
24 | await lah.edit("`Apa dongok?`")
25 | sleep(1)
26 | await lah.edit("`Gausah sok keras`")
27 | sleep(1)
28 | await lah.edit("`Gua ga ketrigger sama bocah baru nyemplung!`")
29 |
30 |
31 | @toni_cmd(pattern="wah(?: |$)(.*)")
32 | async def typewriter(typew):
33 | typew.pattern_match.group(1)
34 | wah = await edit_or_reply(typew, "`Wahh, War nya keren bang`")
35 | sleep(2)
36 | await wah.edit("`Tapi, Yang gua liat, kok Kaya lawakan`")
37 | sleep(2)
38 | await wah.edit("`Oh iya, Kan lo badut 🤡`")
39 | sleep(2)
40 | await wah.edit("`Kosa kata pas ngelawak, Jangan di pake war bang`")
41 | sleep(2)
42 | await wah.edit("`Kesannya lo ngasih kita hiburan.`")
43 | sleep(2)
44 | await wah.edit(
45 | "`Kasian badut🤡, Ga di hargain pengunjung, Eh lampiaskan nya ke Tele, Wkwkwk`"
46 | )
47 | sleep(3)
48 | await wah.edit("`Dah sana cabut, Makasih hiburannya, Udah bikin Gua tawa ngakak`")
49 |
50 |
51 | CMD_HELP.update(
52 | {
53 | "tonicubot": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}sadboy`\
54 | \n↳ : Biasalah sadboy hikss\
55 | \n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}wah`\
56 | \n↳ : Ngatain orang war\
57 | \n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}lahk`\
58 | \n↳ : Ngatain orang sok keras.\."
59 | }
60 | )
61 |
--------------------------------------------------------------------------------
/userbot/modules/total_message.py:
--------------------------------------------------------------------------------
1 | from userbot.utils import toni_cmd
2 | from userbot import CMD_HELP, bot, CMD_HANDLER as cmd
3 |
4 |
5 | # Port By @VckyouuBitch From GeezProject
6 | # Untuk Siapapun Yang Hapus Credits Ini, Kamu Anjing:)
7 | @toni_cmd(pattern="tmsg (.*)")
8 | async def _(event):
9 | k = await event.get_reply_message()
10 | if k:
11 | a = await bot.get_messages(event.chat_id, 0, from_user=k.sender_id)
12 | return await event.edit(f"Total Message Dari {u}. Total Chats `{a.total}`")
13 | u = event.pattern_match.group(1)
14 | if not u:
15 | u = "me"
16 | a = await bot.get_messages(event.chat_id, 0, from_user=u)
17 | await event.edit(f"Total Message Dari {u}. Total Chats `{a.total}`")
18 |
19 | CMD_HELP.update(
20 | {
21 | "totalmsg": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tmsg` | `{cmd}tmsg` \
22 | \n↳ : Mengembalikan jumlah pesan total pengguna dalam obrolan saat ini."
23 | }
24 | )
25 |
--------------------------------------------------------------------------------
/userbot/modules/wallpaper.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 Alfiananda P.A
2 | #
3 | # Licensed under the General Public License, Version 3.0;
4 | # you may not use this file except in compliance with the License.
5 | #
6 |
7 | import asyncio
8 | import os
9 | from asyncio.exceptions import TimeoutError
10 |
11 | from telethon.errors.rpcerrorlist import YouBlockedUserError
12 |
13 | from userbot import CMD_HANDLER as cmd, CMD_HELP, bot
14 | from userbot.utils import toni_cmd
15 |
16 |
17 | @toni_cmd(pattern=r"wall(?: |$)(.*)")
18 | async def _(event):
19 | try:
20 | query = event.pattern_match.group(1)
21 | await event.edit("🔍 `Mohon Menunggu, Saya Sedang Mencari Wallpaper.....`")
22 | async with bot.conversation("@SaitamaRobot") as conv:
23 | try:
24 | query1 = await conv.send_message(f"/wall {query}")
25 | asyncio.sleep(3)
26 | r1 = await conv.get_response()
27 | r2 = await conv.get_response()
28 | await bot.send_read_acknowledge(conv.chat_id)
29 | except YouBlockedUserError:
30 | return await event.reply("✖️ `Maaf Tidak Bisa...`")
31 | if r1.text.startswith("No"):
32 | return await event.edit(
33 | f"✖️ `Saya Tidak Menemukan Wallpaper Yang Anda Cari...`"
34 | )
35 | else:
36 | img = await event.client.download_media(r1)
37 | img2 = await event.client.download_media(r2)
38 | await event.edit("✔️ `Sedang Mengunggah Wallpaper....`")
39 | p = await event.client.send_file(
40 | event.chat_id,
41 | img,
42 | force_document=False,
43 | caption="Wallpaper Yang Anda Cari",
44 | reply_to=event.reply_to_msg_id,
45 | )
46 | await event.client.send_file(
47 | event.chat_id,
48 | img2,
49 | force_document=True,
50 | caption=f"{query}",
51 | reply_to=p,
52 | )
53 | await event.client.delete_messages(
54 | conv.chat_id, [r1.id, r2.id, query1.id]
55 | )
56 | await event.delete()
57 | os.system("rm *.png *.jpg")
58 | except TimeoutError:
59 | return await event.edit("✖️ `Saya Tidak Menemukan Wallpaper Yang Anda Cari...`")
60 |
61 |
62 | CMD_HELP.update(
63 | {
64 | "wallpaper": f"**✘ Plugin wallpaper :\
65 | \n\n • Perintah : `{cmd}wall` [query]\
66 | \n • Fungsi : Mencari Wallpaper Keren."
67 | }
68 | )
69 |
--------------------------------------------------------------------------------
/userbot/modules/webupload.py:
--------------------------------------------------------------------------------
1 | # credits: SNAPDRAGON (@s_n_a_p_s)
2 | # originally from xtra-telegram
3 | # ported by @heyworld
4 |
5 | import asyncio
6 | import time
7 |
8 | from userbot import CMD_HANDLER as cmd, CMD_HELP, TEMP_DOWNLOAD_DIRECTORY, bot
9 | from userbot.utils import toni_cmd
10 |
11 |
12 | @toni_cmd(pattern="webupload ?(.+?|) (?:--)(anonfiles|transfer|filebin|anonymousfiles|megaupload|bayfiles)")
13 | async def _(event):
14 | if event.fwd_from:
15 | return
16 | await event.edit("Processing ...")
17 | PROCESS_RUN_TIME = 100
18 | input_str = event.pattern_match.group(1)
19 | selected_transfer = event.pattern_match.group(2)
20 | if input_str:
21 | file_name = input_str
22 | else:
23 | reply = await event.get_reply_message()
24 | file_name = await bot.download_media(reply.media, TEMP_DOWNLOAD_DIRECTORY)
25 | event.message.id
26 | CMD_WEB = {
27 | "anonfiles": 'curl -F "file=@{}" https://anonfiles.com/api/upload',
28 | "transfer": 'curl --upload-file "{}" https://transfer.sh/{os.path.basename(file_name)}',
29 | "filebin": 'curl -X POST --data-binary "@test.png" -H "filename: {}" "https://filebin.net"',
30 | "anonymousfiles": 'curl -F file="@{}" https://api.anonymousfiles.io/',
31 | "megaupload": 'curl -F "file=@{}" https://megaupload.is/api/upload',
32 | "bayfiles": '.exec curl -F "file=@{}" https://bayfiles.com/api/upload',
33 | }
34 | try:
35 | selected_one = CMD_WEB[selected_transfer].format(file_name)
36 | except KeyError:
37 | await event.edit("Invalid selected Transfer")
38 | cmd = selected_one
39 | time.time() + PROCESS_RUN_TIME
40 | process = await asyncio.create_subprocess_shell(
41 | cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
42 | )
43 | stdout, stderr = await process.communicate()
44 | await event.edit(f"{stdout.decode()}")
45 |
46 |
47 | CMD_HELP.update(
48 | {
49 | "webupload": f"\n`{cmd}webupload --`(`anonfiles`|`transfer`|`filebin`|`anonymousfiles`|`megaupload`|`bayfiles`)\
50 | \nUsage: reply `{cmd}webupload --anonfiles` or `{cmd}webupload --filebin` and the file will be uploaded to that website. "
51 | }
52 | )
53 |
--------------------------------------------------------------------------------
/userbot/modules/xgban.py:
--------------------------------------------------------------------------------
1 | from asyncio import sleep
2 | from telethon.tl.types import ChatBannedRights
3 | from telethon.tl.functions.channels import EditBannedRequest
4 | from userbot.utils import edit_or_reply, edit_delete, toni_cmd
5 | from userbot import CMD_HELP, CMD_HANDLER as cmd
6 |
7 |
8 | @toni_cmd(pattern="allban(?: |$)(.*)")
9 | async def testing(event):
10 | nikal = await event.get_chat()
11 | chutiya = await event.client.get_me()
12 | admin = nikal.admin_rights
13 | creator = nikal.creator
14 | if not admin and not creator:
15 | await edit_or_reply(event, "Anda Tidak Mempunyai Hak")
16 | return
17 | await edit_or_reply(event, "Tidak Melakukan Apa-apa")
18 | # Thank for Dark_Cobra
19 | everyone = await event.client.get_participants(event.chat_id)
20 | for user in everyone:
21 | if user.id == chutiya.id:
22 | pass
23 | try:
24 | await event.client(EditBannedRequest(event.chat_id, int(user.id), ChatBannedRights(until_date=None, view_messages=True)))
25 | except Exception as e:
26 | await edit_or_reply(event, str(e))
27 | await sleep(.5)
28 | await edit_delete(event, "Tidak Ada yang Terjadi di sini🙃🙂")
29 |
30 | CMD_HELP.update(
31 | {
32 | "allban": f"**Plugin : **`allban`\
33 | \n\n**Syntax : **`{cmd}allban`\
34 | \n**Function : **ban all members in 1 cmnd"
35 | }
36 | )
37 |
--------------------------------------------------------------------------------
/userbot/resource/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/userbot/resource/__init__.py
--------------------------------------------------------------------------------
/userbot/resource/extras/Tonic.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/userbot/resource/extras/Tonic.jpg
--------------------------------------------------------------------------------
/userbot/resource/extras/__init__.py:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/userbot/resource/session/session.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Ultroid - UserBot
3 | # Copyright (C) 2022 Man-Userbot
4 | #
5 | # This file is a part of < https://github.com/mrismanaziz/Man-Userbot/ >
6 | # PLease read the GNU Affero General Public License in
7 |
8 | clear
9 | sec=3
10 | spinner=(⣻ ⢿ ⡿ ⣟ ⣯ ⣷)
11 | while [ $sec -gt 0 ]; do
12 | echo -ne "\e[33m ${spinner[sec]} Starting dependency installation in $sec seconds...\r"
13 | sleep 1
14 | sec=$(($sec - 1))
15 | done
16 | echo -e "\e[1;32mInstalling Dependencies ---------------------------\e[0m\n"
17 | apt-get update
18 | apt-get upgrade -y
19 | pkg upgrade -y
20 | pkg install python wget -y
21 | wget https://raw.githubusercontent.com/mrismanaziz/Man-Userbot/Man-Userbot/userbot/resources/session/string_session.py
22 | pip install telethon
23 | clear
24 | python3 string_session.py
25 |
--------------------------------------------------------------------------------
/userbot/resource/session/string_session.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # (c) https://t.me/TelethonChat/37677 and SpEcHiDe
3 | #
4 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
5 | # you may not use this file except in compliance with the License.
6 | #
7 |
8 | from telethon.sessions import StringSession
9 | from telethon.sync import TelegramClient
10 |
11 | print(
12 | """Please go-to my.telegram.org
13 | Login using your Telegram account
14 | Click on API Development Tools
15 | Create a new application, by entering the required details
16 | Check your Telegram saved messages section to copy the STRING_SESSION"""
17 | )
18 | API_KEY = int(input("Enter API_KEY here: "))
19 | API_HASH = input("Enter API_HASH here: ")
20 |
21 | with TelegramClient(StringSession(), API_KEY, API_HASH) as client:
22 | print("Check Telegram Save Message Mu Untuk Copy STRING_SESSION ")
23 | session_string = client.session.save()
24 | saved_messages_template = """Grup Support @GeezSharing
25 | STRING_SESSION
: {}
26 | ⚠️ Please be careful before passing this value to third parties""".format(
27 | session_string
28 | )
29 | client.send_message("me", saved_messages_template, parse_mode="html")
30 |
--------------------------------------------------------------------------------
/userbot/storage.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 | import json
5 | from pathlib import Path
6 |
7 | FILE_NAME = "data.json"
8 |
9 |
10 | class Storage:
11 | class _Guard:
12 | def __init__(self, storage):
13 | self._storage = storage
14 |
15 | def __enter__(self):
16 | self._storage._autosave = False
17 |
18 | def __exit__(self, *args):
19 | self._storage._autosave = True
20 | self._storage._save()
21 |
22 | def __init__(self, root):
23 | self._root = Path(root)
24 | self._autosave = True
25 | self._guard = self._Guard(self)
26 | if (self._root / FILE_NAME).is_file():
27 | with open(self._root / FILE_NAME) as file_pointer:
28 | self._data = json.load(file_pointer)
29 | else:
30 | self._data = {}
31 |
32 | def bulk_save(self):
33 | return self._guard
34 |
35 | def __getattr__(self, name):
36 | if name.startswith("_"):
37 | raise ValueError(
38 | "Anda hanya dapat mengakses anggota pribadi yang ada")
39 | return self._data.get(name, None)
40 |
41 | def __setattr__(self, name, value):
42 | if name.startswith("_"):
43 | self.__dict__[name] = value
44 | else:
45 | self._data[name] = value
46 | if self._autosave:
47 | self._save()
48 |
49 | def _save(self):
50 | if not self._root.is_dir():
51 | self._root(parents=True, exist_ok=True)
52 | with open(self._root / FILE_NAME, "w") as file_pointer:
53 | json.dump(self._data, file_pointer)
54 |
--------------------------------------------------------------------------------
/userbot/utils/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 Adek Maulana
2 | #
3 | # SPDX-License-Identifier: GPL-3.0-or-later
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU 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 General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 | from .start import startupmessage
17 | from .format import parse_pre
18 | from . import format as _format
19 | from .chrome import chrome, options
20 | from .decorator import (
21 | asst_cmd,
22 | callback,
23 | toni_cmd,
24 | toni_handler,
25 | chataction,
26 | )
27 | from .google_images_download import googleimagesdownload
28 | from .progress import progress, CancelProcess
29 | from .events import checking, get_user_from_event
30 | from .tools import (
31 | bash,
32 | humanbytes,
33 | reply_id,
34 | time_formatter,
35 | human_to_bytes,
36 | run_cmd, md5,
37 | post_to_telegraph,
38 | take_screen_shot,
39 | runcmd,
40 | edit_delete,
41 | edit_or_reply,
42 | text_set,
43 | media_type,
44 | )
45 | from .utils import (
46 | autobot,
47 | autopilot,
48 | load_module,
49 | remove_plugin,
50 | start_assistant,
51 | create_supergroup,
52 | )
53 |
--------------------------------------------------------------------------------
/userbot/utils/chrome.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 Adek Maulana
2 | #
3 | # SPDX-License-Identifier: GPL-3.0-or-later
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU 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 General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 |
17 |
18 | import os
19 |
20 | from selenium import webdriver
21 | from selenium.webdriver.chrome.options import Options
22 |
23 | from userbot import TEMP_DOWNLOAD_DIRECTORY, GOOGLE_CHROME_BIN, CHROME_DRIVER
24 |
25 |
26 | async def chrome(chrome_options=None):
27 | if chrome_options is None:
28 | chrome_options = await options()
29 | if not os.path.isdir(TEMP_DOWNLOAD_DIRECTORY):
30 | os.mkdir(TEMP_DOWNLOAD_DIRECTORY)
31 | prefs = {'download.default_directory': TEMP_DOWNLOAD_DIRECTORY}
32 | chrome_options.add_experimental_option('prefs', prefs)
33 | return webdriver.Chrome(executable_path=CHROME_DRIVER,
34 | options=chrome_options)
35 |
36 |
37 | async def options():
38 | chrome_options = Options()
39 | chrome_options.binary_location = GOOGLE_CHROME_BIN
40 | chrome_options.add_argument("--headless")
41 | chrome_options.add_argument("--window-size=1920x1080")
42 | chrome_options.add_argument("--disable-dev-shm-usage")
43 | chrome_options.add_argument("--no-sandbox")
44 | chrome_options.add_argument("--disable-gpu")
45 | return chrome_options
46 |
--------------------------------------------------------------------------------
/userbot/utils/converter/__init__.py:
--------------------------------------------------------------------------------
1 | from os import listdir, mkdir
2 |
3 | if "raw_files" not in listdir():
4 | mkdir("raw_files")
5 |
6 | from .converter import convert
7 |
--------------------------------------------------------------------------------
/userbot/utils/converter/converter.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 | from os import path
3 |
4 | from userbot.utils.exceptions import FFmpegReturnCodeError
5 |
6 |
7 | async def convert(file_path: str) -> str:
8 | out = path.join("raw_files", path.basename(file_path + ".raw"))
9 | if path.isfile(out):
10 | return out
11 | proc = await asyncio.create_subprocess_shell(
12 | cmd=(
13 | "ffmpeg "
14 | "-y -i "
15 | f"{file_path} "
16 | "-f s16le "
17 | "-ac 1 "
18 | "-ar 48000 "
19 | "-acodec pcm_s16le "
20 | f"{out}"
21 | ),
22 | stdin=asyncio.subprocess.PIPE,
23 | stderr=asyncio.subprocess.PIPE,
24 | )
25 | await proc.communicate()
26 | if proc.returncode != 0:
27 | raise FFmpegReturnCodeError("FFmpeg did not return 0")
28 | return out
29 |
--------------------------------------------------------------------------------
/userbot/utils/exceptions.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 Adek Maulana
2 | #
3 | # SPDX-License-Identifier: GPL-3.0-or-later
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU 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 General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 |
17 | class CancelProcess(Exception):
18 | """Cancel Process"""
19 |
--------------------------------------------------------------------------------
/userbot/utils/format.py:
--------------------------------------------------------------------------------
1 | import re
2 |
3 | import requests
4 | from telethon.tl.types import MessageEntityPre
5 | from telethon.utils import add_surrogate
6 |
7 | async def paste_message(text, pastetype="p", extension=None, markdown=True):
8 | if markdown:
9 | text = md_to_text(text)
10 | response = await pastetext(text, pastetype, extension)
11 | if "url" in response:
12 | return response["url"]
13 | return "Error while pasting text to site"
14 |
15 | def md_to_text(md):
16 | html = markdown(md)
17 | soup = BeautifulSoup(html, features="html.parser")
18 | return soup.get_text()
19 |
20 | def paste_text(text):
21 | asciich = ["**", "`", "__"]
22 | for i in asciich:
23 | text = re.sub(rf"\{i}", "", text)
24 | try:
25 | nekokey = (
26 | requests.post(
27 | "https://nekobin.com/api/documents",
28 | json={
29 | "content": text}) .json() .get("result") .get("key"))
30 | link = f"https://nekobin.com/{nekokey}"
31 | except Exception:
32 | url = "https://del.dog/documents"
33 | r = requests.post(url, data=text).json()
34 | link = f"https://del.dog/{r['key']}"
35 | if r["isUrl"]:
36 | link = f"https://del.dog/v/{r['key']}"
37 | return link
38 |
39 |
40 | def mentionuser(name, userid):
41 | return f"[{name}](tg://user?id={userid})"
42 |
43 |
44 | def htmlmentionuser(name, userid):
45 | return f"{name}"
46 |
47 |
48 | # kanged from uniborg @spechide
49 | # https://github.com/SpEcHiDe/UniBorg/blob/d8b852ee9c29315a53fb27055e54df90d0197f0b/uniborg/utils.py#L250
50 |
51 |
52 | def reformattext(text):
53 | return text.replace(
54 | "~",
55 | "").replace(
56 | "_",
57 | "").replace(
58 | "*",
59 | "").replace(
60 | "`",
61 | "")
62 |
63 |
64 | def replacetext(text):
65 | return (
66 | text.replace(
67 | '"',
68 | "",
69 | )
70 | .replace(
71 | "\\r",
72 | "",
73 | )
74 | .replace(
75 | "\\n",
76 | "",
77 | )
78 | .replace(
79 | "\\",
80 | "",
81 | )
82 | )
83 |
84 |
85 | def parse_pre(text):
86 | text = text.strip()
87 | return (
88 | text, [
89 | MessageEntityPre(
90 | offset=0, length=len(
91 | add_surrogate(text)), language="")], )
92 |
--------------------------------------------------------------------------------
/userbot/utils/logger.py:
--------------------------------------------------------------------------------
1 | import logging
2 |
3 | logging.basicConfig(
4 | format="[%(name)s] - [%(levelname)s] - %(message)s",
5 | level=logging.INFO,
6 | )
7 |
--------------------------------------------------------------------------------
/userbot/utils/queues/__init__.py:
--------------------------------------------------------------------------------
1 | from .queues import add_to_queue, clear_queue, get_queue, pop_an_item
2 |
--------------------------------------------------------------------------------
/userbot/utils/queues/queues.py:
--------------------------------------------------------------------------------
1 | QUEUE = {}
2 |
3 |
4 | def add_to_queue(chat_id, songname, link, ref, type, quality):
5 | if chat_id in QUEUE:
6 | chat_queue = QUEUE[chat_id]
7 | chat_queue.append([songname, link, ref, type, quality])
8 | return int(len(chat_queue) - 1)
9 | QUEUE[chat_id] = [[songname, link, ref, type, quality]]
10 |
11 |
12 | def get_queue(chat_id):
13 | if chat_id in QUEUE:
14 | return QUEUE[chat_id]
15 | return 0
16 |
17 |
18 | def pop_an_item(chat_id):
19 | if chat_id not in QUEUE:
20 | return 0
21 |
22 | chat_queue = QUEUE[chat_id]
23 | chat_queue.pop(0)
24 | return 1
25 |
26 |
27 | def clear_queue(chat_id: int):
28 | if chat_id not in QUEUE:
29 | return 0
30 |
31 | QUEUE.pop(chat_id)
32 | return 1
33 |
--------------------------------------------------------------------------------
/userbot/utils/start.py:
--------------------------------------------------------------------------------
1 | from telethon import Button
2 |
3 | from userbot import BOTLOG, BOTLOG_CHATID, LOGS, tgbot
4 |
5 |
6 |
7 |
8 | async def startupmessage():
9 | """
10 | Start up message in telegram logger group
11 | """
12 | try:
13 | if BOTLOG:
14 | await tgbot.send_file(
15 | BOTLOG_CHATID,
16 | "https://telegra.ph/file/33193e0075fc37c000379.jpg",
17 | caption="🌹 **Tonic UserBot Has Been Actived**!!\n━━━━━━━━━━━━━━━\n➠ **Userbot Version** - 5.0@master\n━━━━━━━━━━━━━━━\n➠ **Powered By:** @PrimeSupportChannel ",
18 | buttons=[(Button.url("ꜱᴜᴘᴘᴏʀᴛ", "https://t.me/PrimeSupportGroup"),)],
19 | )
20 | except Exception as e:
21 | LOGS.error(e)
22 | return None
23 |
--------------------------------------------------------------------------------
/userbot/utils/styles/GeezFont.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Toni880/Toni-Userbot/e56391d1f9a08999520780cb9fb43155b505919f/userbot/utils/styles/GeezFont.otf
--------------------------------------------------------------------------------
/userbot/utils/thumbnail.py:
--------------------------------------------------------------------------------
1 | import os
2 | import random
3 |
4 | import aiofiles
5 | import aiohttp
6 | from PIL import Image, ImageDraw, ImageFont
7 |
8 | themes = ["rrc", "hejo", "black"]
9 |
10 |
11 | def changeImageSize(maxWidth, maxHeight, image):
12 | widthRatio = maxWidth / image.size[0]
13 | heightRatio = maxHeight / image.size[1]
14 | newWidth = int(widthRatio * image.size[0])
15 | newHeight = int(heightRatio * image.size[1])
16 | newImage = image.resize((newWidth, newHeight))
17 | return newImage
18 |
19 |
20 | async def gen_thumb(thumbnail, title, userid, ctitle):
21 | async with aiohttp.ClientSession() as session:
22 | async with session.get(thumbnail) as resp:
23 | if resp.status == 200:
24 | f = await aiofiles.open(
25 | f"resources/thumb{userid}.png", mode="wb"
26 | )
27 | await f.write(await resp.read())
28 | await f.close()
29 | theme = random.choice(themes)
30 | image1 = Image.open(f"resources/thumb{userid}.png")
31 | image2 = Image.open(f"resources/{theme}.png")
32 | image3 = changeImageSize(1280, 720, image1)
33 | image4 = changeImageSize(1280, 720, image2)
34 | image5 = image3.convert("RGBA")
35 | image6 = image4.convert("RGBA")
36 | Image.alpha_composite(image5, image6).save(f"resources/temp{userid}.png")
37 | img = Image.open(f"resources/temp{userid}.png")
38 | draw = ImageDraw.Draw(img)
39 | font = ImageFont.truetype("resources/Roboto-Light.ttf", 52)
40 | font2 = ImageFont.truetype("resources/Roboto-Medium.ttf", 76)
41 | draw.text((27, 538), f"Playing on {ctitle[:15]}...", (0, 0, 0), font=font)
42 | draw.text((27, 612), f"{title[:20]}...", (0, 0, 0), font=font2)
43 | img.save(f"resources/final{userid}.png")
44 | os.remove(f"resources/temp{userid}.png")
45 | os.remove(f"resources/thumb{userid}.png")
46 | final = f"resources/final{userid}.png"
47 | return final
48 |
--------------------------------------------------------------------------------
/varshelper.txt:
--------------------------------------------------------------------------------
1 | # Telegram App KEY and HASH this vars are important
2 | API_KEY =
3 | API_HASH =
4 |
5 |
6 | # Userbot Session String this var is important
7 | STRING_SESSION =
8 |
9 | # Logging channel/group ID configuration. this var is important
10 | BOTLOG_CHATID =
11 |
12 | # Userbot logging feature switch.
13 | BOTLOG = True or False
14 | LOGSPAMMER = True or False
15 |
16 | # Bleep Blop, this is a bot ;)
17 | PM_AUTO_BAN = True or False
18 |
19 | # Heroku Credentials for updater. this vars are important
20 | HEROKU_MEMEZ = True or False
21 | HEROKU_APP_NAME =
22 | HEROKU_API_KEY =
23 |
24 | # Github Credentials for updater and Gitupload. this vars are important
25 | GIT_REPO_NAME =
26 | GITHUB_ACCESS_TOKEN =
27 | Get GitHub access token from: https: // github.com / settings / tokens
28 | Click on generate new token
29 | Enable this permissions: https: // telegra.ph / file / 0262c512e2b82fcd0260a.jpg
30 |
31 | # Custom (forked) repo URL for updater. this vars are important
32 | UPSTREAM_REPO_URL = https: // github.com / mkaraniya / OpenUserBot.git
33 | REPO_URL = https: // github.com / mkaraniya / OpenUserBot.git
34 | REPO_LINK = https: // github.com / mkaraniya / OpenUserBot.git
35 |
36 | # Console verbose logging
37 | CONSOLE_LOGGER_VERBOSE = False
38 |
39 | # SQL Database URI
40 | DB_URI = no need to change this value
41 |
42 | # OCR API key
43 | OCR_SPACE_API_KEY =
44 |
45 | # remove.bg API key
46 | REM_BG_API_KEY =
47 |
48 | # Chrome Driver and Headless Google Chrome Binaries
49 | CHROME_DRIVER = no need to change this value
50 | GOOGLE_CHROME_BIN = no need to change this value
51 |
52 | # OpenWeatherMap API Key
53 | OPEN_WEATHER_MAP_APPID =
54 | WEATHER_DEFCITY =
55 |
56 | # Lydia API
57 | LYDIA_API_KEY =
58 |
59 | # set blacklist_chats where you do not want userbot's features
60 | UB_BLACK_LIST_CHAT = no need to change this value
61 |
62 | # Anti Spambot Config
63 | ANTI_SPAMBOT = True or False
64 | ANTI_SPAMBOT_SHOUT = True or False
65 |
66 | # Youtube API key
67 | YOUTUBE_API_KEY =
68 |
69 | # Default .alive name
70 | ALIVE_NAME = any name
71 |
72 | # Time & Date - Country and Time Zone
73 | COUNTRY =
74 | TZ_NUMBER =
75 |
76 | # Clean Welcome
77 | CLEAN_WELCOME = True or False
78 |
79 | # Last.fm Module
80 | BIO_PREFIX = any txt
81 | DEFAULT_BIO = any txt
82 |
83 | LASTFM_API =
84 | LASTFM_SECRET =
85 | LASTFM_USERNAME =
86 | LASTFM_PASSWORD_PLAIN =
87 | LASTFM_PASS =
88 |
89 |
90 | # Google Drive Module
91 | G_DRIVE_CLIENT_ID =
92 | G_DRIVE_CLIENT_SECRET =
93 | G_DRIVE_AUTH_TOKEN_DATA =
94 | G_DRIVE_FOLDER_ID =
95 | G_DRIVE_DATA
96 | TYPE .remixhelp AND CHECK GDRIVE TUTORIAL
97 | YOU ONLY NEED TWO GDRIVE VARS AS SHOWN IN THE PICTURE https: // prnt.sc / sguzo2
98 | TEMP_DOWNLOAD_DIRECTORY = no need to change this value
99 |
100 | # Genius lyrics get this value from https://genius.com/developers both has
101 | # same values
102 | GENIUS_API_TOKEN =
103 | # Genius lyrics get this value from https://genius.com/developers both has
104 | # same values
105 | GENIUS =
106 |
--------------------------------------------------------------------------------