├── .github
└── workflows
│ └── pythonapp.yml
├── .gitignore
├── .pre-commit-config.yaml
├── CODE_OF_CONDUCT
├── Dockerfile
├── LICENSE
├── Procfile.txt
├── README.md
├── app.json
├── bot.sh
├── docs
├── _config.yml
└── index.md
├── heroku.yml
├── localsetup.md
├── requirements.txt
├── resources
├── AUGUSTUS.TTF
├── Aerospace.ttf
├── Fizilion.png
├── IMG_20201109_130207_262.jpg
├── MagmaWave_Caps.otf
├── MutantAcademyStyle.ttf
├── alive.jpg
├── batmfo__.ttf
├── bruh.mp3
├── build.txt
├── cosmic.jpg
├── curved.png
├── impact.ttf
├── orbitron-medium.otf
└── pro.ogg
├── sample_config.env
├── session_gen.sh
├── string_session.py
├── userbot
├── __init__.py
├── __main__.py
├── events.py
├── modules
│ ├── Rekognize.py
│ ├── __init__.py
│ ├── admin.py
│ ├── afk.py
│ ├── android.py
│ ├── anime.py
│ ├── anti_spambot.py
│ ├── archive.py
│ ├── aria.py
│ ├── blacklist.py
│ ├── channel_download.py
│ ├── chat.py
│ ├── chatinfo.py
│ ├── clone.py
│ ├── covid.py
│ ├── create.py
│ ├── deepfryer.py
│ ├── direct_links.py
│ ├── dogbin.py
│ ├── evaluators.py
│ ├── fban.py
│ ├── figlet.py
│ ├── filemanager.py
│ ├── filesummary.py
│ ├── filter.py
│ ├── font.py
│ ├── fstat.py
│ ├── gban.py
│ ├── gdrive.py
│ ├── github.py
│ ├── hack.py
│ ├── hash.py
│ ├── help.py
│ ├── heroku.py
│ ├── hyperlink.py
│ ├── imgmemes.py
│ ├── invite.py
│ ├── kill.py
│ ├── link_shortner.py
│ ├── locks.py
│ ├── log_tagging.py
│ ├── lyrics.py
│ ├── mega.py
│ ├── memes.py
│ ├── memify.py
│ ├── mention.py
│ ├── misc.py
│ ├── multimemes.py
│ ├── mystats.py
│ ├── notes.py
│ ├── ocr.py
│ ├── pdf.py
│ ├── pics.py
│ ├── pmpermit.py
│ ├── profile.py
│ ├── profilepicscrapper.py
│ ├── purge.py
│ ├── qrcode.py
│ ├── remove_bg.py
│ ├── reverse.py
│ ├── scrapers.py
│ ├── screencapture.py
│ ├── sed.py
│ ├── shazam.py
│ ├── shift.py
│ ├── snips.py
│ ├── spam.py
│ ├── special.py
│ ├── spotifynow.py
│ ├── sql_helper
│ │ ├── .DS_Store
│ │ ├── __init__.py
│ │ ├── blacklist_sql.py
│ │ ├── fban_sql.py
│ │ ├── filter_sql.py
│ │ ├── gban_sql_helper.py
│ │ ├── globals.py
│ │ ├── gmute_sql.py
│ │ ├── google_drive_sql.py
│ │ ├── keep_read_sql.py
│ │ ├── lydia_sql.py
│ │ ├── mute_sql.py
│ │ ├── notes_sql.py
│ │ ├── pm_permit_sql.py
│ │ ├── snips_sql.py
│ │ ├── spam_mute_sql.py
│ │ └── welcome_sql.py
│ ├── stats.py
│ ├── stickers.py
│ ├── sticklet.py
│ ├── stt.py
│ ├── system_stats.py
│ ├── telegraph.py
│ ├── time.py
│ ├── transfer.py
│ ├── unsplash_walls.py
│ ├── updater.py
│ ├── upload_download.py
│ ├── weather.py
│ ├── webupload.py
│ ├── welcomes.py
│ ├── whois.py
│ └── www.py
├── storage.py
└── utils
│ ├── FastTelethon.py
│ ├── __init__.py
│ ├── chrome.py
│ ├── duckduckgoscraper.py
│ ├── exceptions.py
│ ├── format.py
│ ├── google_images_download.py
│ ├── progress.py
│ ├── styles
│ ├── ProductSans-BoldItalic.ttf
│ └── ProductSans-Light.ttf
│ └── tools.py
└── windows_startup_script.py
/.github/workflows/pythonapp.yml:
--------------------------------------------------------------------------------
1 | name: FailedChecker
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | build:
7 |
8 | runs-on: ubuntu-latest
9 | container: ghcr.io/skylab-devs/cosmic:squashed
10 |
11 | steps:
12 | - uses: actions/checkout@v1
13 | - name: Install dependencies
14 | run: |
15 | python -m pip install --upgrade pip
16 | pip install flake8 flake8-print flake8-quotes
17 | - name: Check for showstoppers
18 | run: |
19 | # stop the build if there are Python syntax errors
20 | flake8 . --count --select=E999 --show-source --statistics
21 |
22 | shellcheck:
23 |
24 | runs-on: ubuntu-latest
25 |
26 | steps:
27 | - uses: actions/checkout@v1
28 | - name: Check for install script errors
29 | uses: ludeeus/action-shellcheck@0.1.0
30 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | config.env
2 | __pycache__/*
3 | userbot.db
4 | userbot.session
5 | userbot.session-journal
6 | userbot/__pycache__/*
7 | userbot/modules/__pycache__/*
8 | userbot/modules/sql_helper/__pycache__/*
9 | .progress
10 | .vscode/*
11 | bin/*
12 | venv
13 | *.pyc
14 |
--------------------------------------------------------------------------------
/.pre-commit-config.yaml:
--------------------------------------------------------------------------------
1 | repos:
2 | - repo: https://github.com/pre-commit/pre-commit-hooks
3 | rev: v3.4.0
4 | hooks:
5 | - id: check-ast
6 | - id: check-merge-conflict
7 | - id: check-yaml
8 | - id: check-json
9 | - id: check-case-conflict
10 | - id: end-of-file-fixer
11 | - id: mixed-line-ending
12 | - id: requirements-txt-fixer
13 | - id: trailing-whitespace
14 |
15 | - repo: https://github.com/asottile/pyupgrade
16 | rev: v2.10.1
17 | hooks:
18 | - id: pyupgrade
19 | args: [--py39-plus]
20 |
21 | - repo: https://github.com/asottile/reorder_python_imports
22 | rev: v2.5.0
23 | hooks:
24 | - id: reorder-python-imports
25 |
26 | - repo: https://github.com/myint/autoflake
27 | rev: v1.4
28 | hooks:
29 | - id: autoflake
30 | args:
31 | [
32 | "--in-place",
33 | "--ignore-init-module-imports",
34 | "--remove-unused-variables",
35 | "--remove-all-unused-imports",
36 | "--expand-star-imports",
37 | ]
38 |
39 | - repo: https://github.com/asottile/add-trailing-comma
40 | rev: v2.1.0
41 | hooks:
42 | - id: add-trailing-comma
43 |
44 | - repo: https://github.com/pycqa/isort
45 | rev: 5.7.0
46 | hooks:
47 | - id: isort
48 | args: ["--profile", "black", "--filter-files"]
49 |
50 | - repo: "https://github.com/psf/black"
51 | rev: 20.8b1
52 | hooks:
53 | - id: black
54 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT:
--------------------------------------------------------------------------------
1 | # Code of Conduct
2 |
3 | All participants of RaphielGang are expected to abide by our Code of Conduct,
4 | both online and during in-person events that are hosted and/or associated with RaphielGang.
5 |
6 |
7 | ### The Pledge
8 |
9 | In the interest of fostering an open and welcoming environment, we pledge to make participation
10 | in our project and our community a harassment-free experience for everyone, regardless of age,
11 | body size, disability, ethnicity, gender identity and expression, level of experience,
12 | nationality, personal appearance, race, religion, or sexual identity and orientation.
13 |
14 |
15 | ### The Standards
16 |
17 | Examples of behaviour that contributes to creating a positive environment include:
18 |
19 | * **Be welcoming**: We strive to be a community that welcomes and supports people of all backgrounds and identities. This includes, but is not limited to members of any race, ethnicity, culture, national origin, colour, immigration status, social and economic class, educational level, sex, sexual orientation, gender identity and expression, age, size, family status, political belief, religion, and mental and physical ability.
20 | * **Be considerate**: Your work will be used by other people, and you in turn will depend on the work of others. Any decision you take will affect users and colleagues, and you should take those consequences into account when making decisions. Remember that we're a world-wide community, so you might not be communicating in someone else's primary language.
21 | * **Be respectful**: Not all of us will agree all the time, but disagreement is no excuse for poor behavior and poor manners. We might all experience some frustration now and then, but we cannot allow that frustration to turn into a personal attack. It’s important to remember that a community where people feel uncomfortable or threatened is not a productive one.
22 | * **Gracefully accepting constructive criticism**: Not everyone are perfect, you can get some critism of your works from us, but it's not means that we don't accepting your contribution, we just want you to fixing it and making it better.
23 | * **Referring to people by their preferred pronouns/words**, but we do not have standardized gender-neutral pronouns/words, so your milleage may vary.
24 | * **Do not attack somebody because you have a different opinion** All opinions are accepted as long as they are reasonable, and everyone have right to shouting their opinion.
25 | * **Just chill :D**
26 | * **Don't forget, nobody is perfect, mistakes can be made**
27 | * **Equality is not a privilege, it's a rule!**
28 |
29 | ### Examples of unacceptable behaviour by participants include:
30 |
31 | * **Trolling, insulting/derogatory comments, public or private harassment**
32 | * **Publishing others' private information (Doxing)** such as a physical or electronic address, without explicit permission
33 | * **Not being respectful to reasonable communication boundaries** such as 'leave me alone,' 'go away,' or 'Fuck off.'
34 | * **The usage of sexualised language or imagery and unwelcome sexual attention or advances**
35 | * **Demonstrating the graphics or any other content you know may be considered disturbing**
36 | * **Assuming or promoting any kind of inequality** including but not limited to: age, body size, disability, ethnicity, gender identity and expression, nationality and race, personal appearance, religion, or sexual identity and orientation
37 | * **Drug promotion of any kind**
38 | * **Attacking personal tastes**
39 | * **Other conduct which you know could reasonably be considered inappropriate in a professional setting**
40 |
41 |
42 | ### Enforcement
43 |
44 | Violations of the Code of Conduct may be reported by sending an email to [raphielscape@outlook.com](mailto:raphielscape@outlook.com).
45 | All reports will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances.
46 | Further details of specific enforcement policies may be posted separately.
47 |
48 | We hold the right and responsibility to remove comments or other contributions that
49 | are not aligned to this Code of Conduct, or to ban temporarily or permanently any members
50 | for other behaviours that they deem inappropriate, threatening, offensive, or harmful.
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ghcr.io/skylab-devs/cosmic:squashed
2 | RUN mkdir /cosmos && chmod 777 /cosmos && git clone https://github.com/SkyLab-Devs/CosmicUserbot -b starfire /cosmos
3 | WORKDIR /cosmos
4 | CMD ["bash","bot.sh"]
5 |
--------------------------------------------------------------------------------
/Procfile.txt:
--------------------------------------------------------------------------------
1 | build:
2 | docker:
3 | worker: Dockerfile
4 | run:
5 | worker: bash bot.sh
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | # Cosmic Userbot
8 |
9 | [](https://github.com/SkyLab-Devs/CosmicUserbot/actions "build")
10 |
11 | 
12 |
13 | [](https://www.python.org/)
14 |
15 | ## Disclaimer
16 | ```
17 | #include
18 | /**
19 | Your Telegram account may get banned.
20 | I am not responsible for any improper use of this bot
21 | This bot is intended for the purpose of having fun with memes,
22 | as well as efficiently managing groups.
23 | You ended up spamming groups, getting reported left and right,
24 | and you ended up in a Finale Battle with Telegram and at the end
25 | Telegram Team deleted your account?
26 | And after that, then you pointed your fingers at us
27 | for getting your acoount deleted?
28 | I will be rolling on the floor laughing at you.
29 | /**
30 | ```
31 |
32 | ## Generate String Session
33 |
34 | ### Run on repl.it
35 | [](https://session.frost2k5.repl.run)
36 |
37 | ### Run on your terminal
38 | ```
39 | curl -L https://git.io/Jyiwj > session_gen.sh && bash session_gen.sh
40 | ```
41 |
42 | ## How To Host?
43 |
44 | ### Deploy on Heroku [RIP]
45 | Make sure you have an account of heroku and follow all the steps required.
46 |
47 | 
48 |
49 | ### Deploy on Local
50 |
51 | Checkout the guide: Here
52 |
53 | ## Groups and Support
54 |
55 | For discussion, bug reporting, and help, you can join [Cosmic Userbot](https://t.me/CosmicUserbotChat) support group.
56 | For further guide you can read this [Guide](https://frost2k5.games/ProjectFizilion).
57 |
58 |
59 | ## Credits
60 |
61 | Thanks:
62 | * [RaphielGang](https://github.com/RaphielGang) - Telegram-Paperplane
63 | * [AvinashReddy3108](https://github.com/AvinashReddy3108) - PaperplaneExtended
64 | * [kandnub](https://github.com/kandnub) - TG-UserBot
65 | * [AdekMaulana](https://github.com/adekmaulana) - ProjectBish
66 | * [Mr.Miss](https://github.com/keselekpermen69) - Userbutt
67 | * [GengKapak](https://github.com/GengKapak) - DCLXVI
68 | * [Mkaraniya](https://github.com/mkaraniya) & [Dev73](https://github.com/Devp73) - OpenUserBot
69 | * [MoveAngel](https://github.com/MoveAngel) - One4U
70 |
71 | and many more people who aren't mentioned here, but may be found in [Contributors](https://github.com/SkyLab-Devs/CosmicUserbot/graphs/contributors).
72 |
73 | ## License
74 |
75 | This userbot licensed on [Raphielscape Public License](https://github.com/PrajjuS/ProjectFizilion/blob/demon/LICENSE) - Version 1.d, February 2020
76 |
77 | Graphics Copyrighted By [ElytrA8](https://t.me/ElytrA8) © 2021
78 |
--------------------------------------------------------------------------------
/bot.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | aria2c --enable-rpc=true --check-certificate=false --daemon=true
4 | python3 -m userbot
5 |
--------------------------------------------------------------------------------
/docs/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-hacker
2 |
--------------------------------------------------------------------------------
/heroku.yml:
--------------------------------------------------------------------------------
1 | build:
2 | docker:
3 | worker: Dockerfile
4 | run:
5 | worker: bash bot.sh
6 |
--------------------------------------------------------------------------------
/localsetup.md:
--------------------------------------------------------------------------------
1 |
2 | # Here's a guide to setup this userbot on a server
3 |
4 | In no means is this guide optimized or the only way for setup, I just run it this way
5 |
6 | ## Update packages and install needed ones
7 |
8 | ```sh
9 | sudo apt update && sudo apt upgrade && sudo apt -y install gnupg2 wget vim git gcc python3-dev build-essential python3-venv libpq-dev psycopg2-binary
10 | curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
11 | sudo apt update && sudo apt upgrade && sudo apt -y install npm nodejs
12 | ```
13 |
14 | ## Install pm2 to manage the app and to run in background
15 |
16 | ```sh
17 | npm install pm2@latest -g
18 | ```
19 |
20 |
21 |
22 | If the above commang gives an error
23 |
24 |
25 | ```sh
26 | sudo mkdir /usr/local/lib/node_modules
27 | sudo chown -R $USER /usr/local/lib/node_modules
28 | ```
29 |
30 |
31 |
32 |
33 | ### Setup pm2 to run at startup
34 |
35 | ```sh
36 | pm2 startup
37 | ```
38 |
39 | ### then run the line that it says to run
40 |
41 | ## Setup Postgresql 14
42 |
43 | ```sh
44 | sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
45 | wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
46 | sudo apt -y update
47 | sudo apt -y install postgresql-14
48 | ```
49 |
50 | ## Setup postgres user, replace $PGUSER with a username u want for postgres
51 |
52 | ```sh
53 | sudo su - postgres
54 |
55 | createuser -P -s -e $PGUSER
56 | ```
57 |
58 | Then enter a pass when prompted and remeber it
59 |
60 |
61 |
62 |
63 |
64 | If it shows that the pass starts with SCRAM then do the following
65 |
66 |
67 | ### Edit the postgresql.conf and switch to md5 password_encryption
68 |
69 | Look for Authentication section then password_encryption and set it to md5 (it was scram-sha-256) and uncomment the line if commented
70 |
71 | ```sh
72 | sudo vim /etc/postgresql/13/master/postgresql.conf
73 | ```
74 |
75 | ### Edit the pg_hba.conf and switch the authentication to md5
76 |
77 | Look for the scram and replace them by md5
78 |
79 | ```sh
80 | sudo vim /etc/postgresql/13/master/pg_hba.conf
81 | ```
82 |
83 | ### Then change the user password
84 |
85 | ```sh
86 | psql
87 | ALTER USER $PGUSER WITH PASSWORD 'NEW_PASSWORD_HERE';
88 | ctrl + d
89 | ```
90 |
91 |
92 |
93 |
94 | ## Create a database for the userbot
95 |
96 | ```sh
97 | createdb -O $PGUSER cosmic
98 | ```
99 |
100 | database url will be `postgresql://$PGUSER:$PASS@localhost:5432/cosmic`
101 |
102 | replace `$PASS` and `$PGUSER` with the ones you chose
103 |
104 | ### then switch back to your user (press ctrl + d)
105 |
106 | ## Setup the bot
107 |
108 | ### Clone the repo and copy the sample config
109 |
110 | ```sh
111 | cd && git clone https://github.com/ItsLuuke/ProjectcosmiclionFork.git && cd ProjectFizilionFork
112 | cp sample_config.env config.env
113 | ```
114 |
115 | now edit the config (vim config.env or nano config.env) and add the vars
116 |
117 | ### Install the requirements
118 |
119 | ```sh
120 | python3 -m venv venv
121 | source venv/bin/activate
122 | python3 -m pip install -r requirements.txt
123 | deactivate
124 | ```
125 |
126 | ### Add a start script for ease of use
127 |
128 | ```sh
129 | cat > run.sh << EOF
130 | #!/bin/bash
131 | source venv/bin/activate
132 | bash bot.sh
133 | EOF
134 | sudo chmod +x run.sh
135 | ```
136 |
137 | ## Test start the bot first and see if everything is fine
138 |
139 | ```sh
140 | ./run.sh
141 | ```
142 |
143 | ### If there is error and the bot didnt start correctly, then fix then before continuing to the next step
144 |
145 | #
146 |
147 | ## If the bot starts fine then finish the pm2 setup
148 |
149 | Start the bot with pm2
150 |
151 | ```sh
152 | pm2 start run.sh --name cosmic
153 | ```
154 |
155 | ### to make the bot start automatically on startup
156 |
157 | ```sh
158 | pm2 save
159 | ```
160 |
161 | ### to stop/start or restart or check logs
162 |
163 | ```sh
164 | pm2 start cosmic
165 | pm2 stop cosmic
166 | pm2 restart cosmic
167 | pm2 logs cosmic --lines 100 #or how many lines to check
168 | ```
169 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | aiohttp[speedups]
2 | aria2p
3 | asyncurban
4 | bs4
5 | cowpy
6 | lottie
7 | covid
8 | colour
9 | duckduckgo_search
10 | distro
11 | emoji==1.7.0
12 | gitpython
13 | glitch_this
14 | google-api-python-client
15 | google-auth-httplib2
16 | google-auth-oauthlib
17 | googletrans
18 | google_images_download
19 | gpytranslate
20 | gTTS
21 | gTTS-token
22 | hachoir
23 | heroku3
24 | html_telegraph_poster
25 | humanize
26 | jikanpy
27 | lxml
28 | lyricsgenius
29 | markdown
30 | pendulum
31 | psutil
32 | psycopg2
33 | pybase64
34 | pyfiglet
35 | pylast
36 | pySmartDL
37 | python-barcode
38 | python-dotenv
39 | pytz
40 | prettytable
41 | qrcode
42 | requests>=2.26.0
43 | speedtest-cli>=2.1.3
44 | sqlalchemy==1.3.23
45 | telethon==1.24.0
46 | telegraph
47 | wikipedia==1.4.0
48 | PyGithub==1.55
49 | google_trans_new==1.1.9
50 | wget==3.2
51 | validators==0.18.2
52 | aiofiles
53 | patool
54 |
--------------------------------------------------------------------------------
/resources/AUGUSTUS.TTF:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SkyLab-Devs/CosmicUserbot/caa06558067df6ca097fc6983893116c08f14d44/resources/AUGUSTUS.TTF
--------------------------------------------------------------------------------
/resources/Aerospace.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SkyLab-Devs/CosmicUserbot/caa06558067df6ca097fc6983893116c08f14d44/resources/Aerospace.ttf
--------------------------------------------------------------------------------
/resources/Fizilion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SkyLab-Devs/CosmicUserbot/caa06558067df6ca097fc6983893116c08f14d44/resources/Fizilion.png
--------------------------------------------------------------------------------
/resources/IMG_20201109_130207_262.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SkyLab-Devs/CosmicUserbot/caa06558067df6ca097fc6983893116c08f14d44/resources/IMG_20201109_130207_262.jpg
--------------------------------------------------------------------------------
/resources/MagmaWave_Caps.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SkyLab-Devs/CosmicUserbot/caa06558067df6ca097fc6983893116c08f14d44/resources/MagmaWave_Caps.otf
--------------------------------------------------------------------------------
/resources/MutantAcademyStyle.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SkyLab-Devs/CosmicUserbot/caa06558067df6ca097fc6983893116c08f14d44/resources/MutantAcademyStyle.ttf
--------------------------------------------------------------------------------
/resources/alive.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SkyLab-Devs/CosmicUserbot/caa06558067df6ca097fc6983893116c08f14d44/resources/alive.jpg
--------------------------------------------------------------------------------
/resources/batmfo__.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SkyLab-Devs/CosmicUserbot/caa06558067df6ca097fc6983893116c08f14d44/resources/batmfo__.ttf
--------------------------------------------------------------------------------
/resources/bruh.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SkyLab-Devs/CosmicUserbot/caa06558067df6ca097fc6983893116c08f14d44/resources/bruh.mp3
--------------------------------------------------------------------------------
/resources/build.txt:
--------------------------------------------------------------------------------
1 | 1
2 | 2
3 | 3
4 |
--------------------------------------------------------------------------------
/resources/cosmic.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SkyLab-Devs/CosmicUserbot/caa06558067df6ca097fc6983893116c08f14d44/resources/cosmic.jpg
--------------------------------------------------------------------------------
/resources/curved.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SkyLab-Devs/CosmicUserbot/caa06558067df6ca097fc6983893116c08f14d44/resources/curved.png
--------------------------------------------------------------------------------
/resources/impact.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SkyLab-Devs/CosmicUserbot/caa06558067df6ca097fc6983893116c08f14d44/resources/impact.ttf
--------------------------------------------------------------------------------
/resources/orbitron-medium.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SkyLab-Devs/CosmicUserbot/caa06558067df6ca097fc6983893116c08f14d44/resources/orbitron-medium.otf
--------------------------------------------------------------------------------
/resources/pro.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SkyLab-Devs/CosmicUserbot/caa06558067df6ca097fc6983893116c08f14d44/resources/pro.ogg
--------------------------------------------------------------------------------
/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 | # OpenWeather Map API Key for .weather command
9 | # Get from https://openweathermap.org/
10 | OPEN_WEATHER_MAP_APPID = ""
11 | WEATHER_DEFCITY = ""
12 | WEATHER_DEFLANG = ""
13 |
14 | # Location of ChromeDriver for .carbon module
15 | # Example for Linux Machines : "/usr/bin/chromedriver"
16 | CHROME_DRIVER = ""
17 |
18 | # Get this value by running python3 string_session.py locally
19 | STRING_SESSION = ""
20 |
21 | # Headless GoogleChrome location for .carbon module
22 | # Example for Linux Machines : "/usr/bin/chromium-browser"
23 | GOOGLE_CHROME_BIN = ""
24 |
25 | # OCR Space API Key for .ocr command
26 | # Get from https://ocr.space/ocrapi
27 | OCR_SPACE_API_KEY = ""
28 |
29 | # remove.bg API Key for .rbg command
30 | # Get from https://www.remove.bg/api
31 | REM_BG_API_KEY = ""
32 |
33 | # ChatID for the Log group
34 | # Add a Hypen or a Negative Sign before ID
35 | # This is a integer, Please don't use Strings
36 | BOTLOG_CHATID = # this is an integer, please don't use quotes.
37 |
38 | # Incase you want to turn off logging, put this to false
39 | BOTLOG = False
40 |
41 | # Set this to True if you want the error logs to be stored in
42 | # the userbot log, rather than spamming other chats with it.
43 | # Note that this requires a valid BOTLOG_CHATID to be set.
44 | LOGSPAMMER = False
45 |
46 | # Set this to True in case you want the to log messages in which you are mentioned in bot log group.
47 | # It requires a valid LOG_TAGGING_CHATID to be set.
48 | LOG_TAGGING = False
49 | LOG_TAGGING_CHATID = # this is an integer, please don't use quotes.
50 |
51 | # If you need Verbosity on the Logging
52 | CONSOLE_LOGGER_VERBOSE = False
53 |
54 | # PM Auto-Ban Feature Switch
55 | PM_AUTO_BAN = False
56 |
57 | # Custom Default name for .alive
58 | ALIVE_NAME = ""
59 |
60 | # Logo for Alive, put direct url to image
61 | ALIVE_LOGO = ""
62 |
63 | # Custom alive message
64 | ALIVE_MESSAGE = ""
65 |
66 | # Your Database URL
67 | # Example: 'postgres://userbot:userbot@localhost:5432/userbot'
68 | DATABASE_URL = ""
69 |
70 | # YouTube Data API Key for .yt command
71 | # Get from https://console.cloud.google.com
72 | YOUTUBE_API_KEY = ""
73 |
74 | # Country and Time Zone setup for
75 | # .time and .date modules
76 | COUNTRY = ""
77 | TZ_NUMBER = # this is an integer, please don't use quotes.
78 |
79 | # Google Drive Credentials
80 | # for .gdrive module.
81 | # Get from https://console.cloud.google.com
82 | G_DRIVE_CLIENT_ID = ""
83 | G_DRIVE_CLIENT_SECRET = ""
84 | G_DRIVE_AUTH_TOKEN_DATA = ""
85 | TEMP_DOWNLOAD_DIRECTORY = ""
86 |
87 | # Google drive index url, Example: https://tdrive.derpsakura.workers.dev/0:/ (shall end with '/')
88 | GDRIVE_INDEX_URL = ""
89 |
90 | # Mega Credentials
91 | # For .megaput command.
92 | # Make account from https://mega.nz/
93 | MEGA_EMAIL = ""
94 | MEGA_PASSWORD = ""
95 |
96 | # You have to have your own unique two values for API_KEY and API_SECRET
97 | # Obtain yours from https://www.last.fm/api/account/create for Last.fm
98 | LASTFM_API = ""
99 | LASTFM_SECRET = ""
100 | LASTFM_USERNAME = "Your last.fm username"
101 | LASTFM_PASSWORD = "Your last.fm password"
102 |
103 | # Bot will add before song name. For last.fm module.
104 | # Example: GitHub: MacTavishAO : Skillet - Feel Invincible
105 | BIO_PREFIX = ""
106 |
107 | # default bio message
108 | DEFAULT_BIO = ""
109 |
110 | # FOR Lydia Access
111 | LYDIA_API_KEY = ""
112 | LYDIA_ANTI-PM = ""
113 |
114 |
115 | # Report or kick some known spammer bots after
116 | # they joins
117 | ANTI_SPAMBOT = False
118 | ANTI_SPAMBOT_SHOUT = False
119 |
120 | # Wolfram ID
121 | # Get an API KEY from products.wolframalpha.com/api/
122 | WOLFRAM_ID=""
123 |
124 | #Mongo DB Url
125 | MONGO_DB_URI=""
126 |
--------------------------------------------------------------------------------
/session_gen.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | clear
4 |
5 | # Colors
6 | RED="\033[1;31m" # For errors / warnings
7 | GREEN="\033[1;32m" # For info
8 | YELLOW="\033[1;33m" # For info
9 | BLUE="\033[1;36m" # For info again XD
10 | NC="\033[0m" # reset color
11 |
12 | absent=""
13 | echo -e "${GREEN} Checking for requirements${NC}\n"
14 | check(){
15 | sleep 0.15
16 | pkg=$1
17 | command -v $pkg &>/dev/null;stat=$?
18 | if [ "$stat" -ne "0" ]; then
19 | absent+="$pkg "
20 | fi
21 |
22 | }
23 |
24 | instl(){
25 | sleep 0.2
26 | echo -e "${RED} Requirements: $absent not found, trying to install"
27 | sleep 0.2
28 | if [ -e /data/data/com.termux/files/usr/bin/termux-info ]; then
29 | echo -e "${GREEN} Detected Termux! Installing requirements for termux ${NC}"
30 | apt update
31 | pkg install python -y
32 | echo -e "${YELLOW} \n\nInstalled requirements Successfully ${NC}"
33 | elif [ -e /usr/bin/apt ]; then
34 | echo -e "${GREEN} Detected Debian based distro! Trying to install requirements ${NC}"
35 | sudo apt update
36 | sudo apt install python3 python3-pip -y
37 | else
38 | echo -e "${YELLOW} \n\nUnknown System Detected... Please install \n $1 \n for your distro \nA quick google search will help if you don't know how to \n\n ${NC}"
39 | sleep 3
40 | fi
41 | }
42 |
43 | check "pip3"
44 | check "python3"
45 |
46 | if [ "$absent" == "" ]; then
47 | echo -e "${BLUE} Requirements Already Installed, Continuing! ${NC}"
48 | else
49 | instl $absent
50 | fi
51 |
52 | sleep 0.5
53 | echo -e "${YELLOW} Checking for telethon ${NC}\n"
54 | pip3 list --disable-pip-version-check | grep Telethon &>/dev/null ;tc=$?
55 | if [ "$tc" != 0 ]; then
56 | pip3 install telethon
57 | else
58 | echo -e "${GREEN} Telethon Already Installed, continuing... ${NC}"
59 | fi
60 | echo -e "${GREEN} Done! ${NC}\n\n"
61 |
62 | sleep 0.3
63 | echo -e "${Blue} Downloading string session generator script ${NC}"
64 | curl https://raw.githubusercontent.com/FrosT2k5/ProjectFizilion/demon/string_session.py > string_session.py
65 | echo -e "${GREEN} Done! ${NC}\n\n"
66 |
67 | sleep 2
68 | echo -e "Running string_session.py!\nIn case you have issues in generating string session now,\nYou can run the string_session.py here again to regenrate session.\nThe one-liner command is: \n\n"
69 | $(sleep 1.5)
70 | echo -e "${RED}python3 $(pwd)/string_session.py${NC}\n\n"
71 | $(sleep 0.5)
72 | echo -e "If you feel lazy :p\n"
73 |
74 | python3 string_session.py
75 |
--------------------------------------------------------------------------------
/string_session.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8-*-
3 | #
4 | # (c) https://t.me/TelethonChat/37677 and SpEcHiDe
5 | #
6 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
7 | # you may not use this file except in compliance with the License.
8 | #
9 |
10 | from telethon.sync import TelegramClient
11 | from telethon.sessions import StringSession
12 |
13 | print("""Please go-to my.telegram.org
14 | Login using your Telegram account
15 | Click on API Development Tools
16 | Create a new application, by entering the required details
17 | Check your Telegram saved messages section to copy the STRING_SESSION""")
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 your Telegram Saved Messages to copy the STRING_SESSION value")
23 | session_string = client.session.save()
24 | saved_messages_template = """Support: @ProjectFizilion
25 |
26 | STRING_SESSION
: {}
27 |
28 | ⚠️ Please be carefull to pass this value to third parties""".format(session_string)
29 | client.send_message("me", saved_messages_template, parse_mode="html")
30 |
--------------------------------------------------------------------------------
/userbot/__main__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.; Licensed under the Raphielscape Public License, Version 1.d (the "License"); you may not use this file except in compliance with the License.
2 |
3 | """ Userbot start point """
4 |
5 | from importlib import import_module
6 | from sys import argv
7 | from asyncio import sleep
8 | from telethon.errors.rpcerrorlist import PhoneNumberInvalidError
9 | from userbot import LOGS, bot, HEROKU_APP_NAME, BOTLOG, BOTLOG_CHATID, ALIVE_NAME, USERBOT_VERSION, HEROKU_API_KEY, repo_lenk
10 | from userbot.modules import ALL_MODULES
11 | from telethon import __version__, version
12 | from platform import python_version, uname
13 |
14 | INVALID_PH = '\nERROR: The Phone No. entered is INVALID' \
15 | '\n Tip: Use Country Code along with number.' \
16 | '\n or check your phone number and try again !'
17 |
18 | try:
19 | bot.start()
20 | except PhoneNumberInvalidError:
21 | print(INVALID_PH)
22 | exit(1)
23 |
24 | for module_name in ALL_MODULES:
25 | imported_module = import_module("userbot.modules." + module_name)
26 |
27 | LOGS.info(f"You are running Cosmic Userbot on {repo_lenk}")
28 |
29 | DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else uname().node
30 | output = (
31 | "` =============================== `\n"
32 | f"`Cosmic UB is Up and Running.... `\n"
33 | f"`=============================== `\n"
34 | f"•`Telethon : v{version.__version__} `\n"
35 | f"•`Python : v{python_version()} `\n"
36 | f"•`User : {DEFAULTUSER} `\n"
37 | f"•`Cosmic : {USERBOT_VERSION} `\n"
38 | )
39 |
40 | async def start():
41 | if BOTLOG:
42 | try:
43 | await bot.send_message(
44 | BOTLOG_CHATID, output
45 | )
46 | except:
47 | None
48 | else:
49 | pass
50 | bot.loop.run_until_complete(start())
51 |
52 | LOGS.info(
53 | "Congratulations, your userbot is now running !! Test it by typing .alive / .on in any chat."
54 | "If you need assistance, head to https://t.me/CosmicUserbotChat")
55 | bot.run_until_disconnected()
56 |
--------------------------------------------------------------------------------
/userbot/modules/Rekognize.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.; Licensed under the Raphielscape Public License, Version 1.d (the "License"); you may not use this file except in compliance with the License.; ported by arshsisodiya from catuserbot
2 |
3 | """ image Rekognition module. """
4 |
5 | import asyncio
6 | from asyncio.exceptions import TimeoutError
7 | from telethon import events
8 | from telethon.errors.rpcerrorlist import YouBlockedUserError
9 | from userbot import CMD_HELP
10 | from userbot.events import register
11 |
12 | @register(outgoing=True, pattern=r"^\.r(eco|ecognize)(?: |$)(.*)")
13 | async def _(event):
14 | "To recognize a image."
15 | if not event.reply_to_msg_id:
16 | return await event.edit("Reply to any user's media message.")
17 | reply_message = await event.get_reply_message()
18 | if not reply_message.media:
19 | return await event.edit(event, "reply to media file")
20 | chat = "@Rekognition_Bot"
21 | if reply_message.sender.bot:
22 | return await event.edit(event, "Reply to actual users message.")
23 | await event.edit("recognizeing this media")
24 | async with event.client.conversation(chat) as conv:
25 | try:
26 | response = conv.wait_event(
27 | events.NewMessage(incoming=True, from_users=461083923)
28 | )
29 | await event.client.forward_messages(chat, reply_message)
30 | response = await response
31 | except YouBlockedUserError:
32 | await event.edit("unblock @Rekognition_Bot and try again")
33 | return
34 | if response.text.startswith("See next message."):
35 | response = conv.wait_event(
36 | events.NewMessage(incoming=True, from_users=461083923)
37 | )
38 | response = await response
39 | msg = response.message.message
40 | await event.edit(msg)
41 | else:
42 | await event.edit("sorry, I couldnt find it")
43 | await event.client.send_read_acknowledge(conv.chat_id)
44 |
45 |
46 |
47 | CMD_HELP.update(
48 | {"recognize": ">`.recognize` \ `.reco` " "\nUsage: Get information about an image using AWS Rekognition. Find out information including detected labels, faces. text and moderation tags."}
49 | )
50 |
--------------------------------------------------------------------------------
/userbot/modules/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.; Licensed under the Raphielscape Public License, Version 1.d (the "License"); you may not use this file except in compliance with the License.
2 |
3 | """ Init file which loads all of the modules. """
4 | from userbot import LOGS
5 |
6 |
7 | def __list_all_modules():
8 | import glob
9 | from os.path import basename, dirname, isfile
10 |
11 | mod_paths = glob.glob(dirname(__file__) + "/*.py")
12 | all_modules = [
13 | basename(f)[:-3]
14 | for f in mod_paths
15 | if isfile(f) and f.endswith(".py") and not f.endswith("__init__.py")
16 | ]
17 | return all_modules
18 |
19 |
20 | ALL_MODULES = sorted(__list_all_modules())
21 | LOGS.info("Modules to load: %s", str(ALL_MODULES))
22 | __all__ = ALL_MODULES + ["ALL_MODULES"]
23 |
--------------------------------------------------------------------------------
/userbot/modules/blacklist.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.; Licensed under the Raphielscape Public License, Version 1.d (the "License"); you may not use this file except in compliance with the License.; Port From UniBorg to UserBot by keselekpermen69
2 |
3 | """ a module for blacklisting specific keywords. """
4 |
5 | import io
6 | import re
7 |
8 | import userbot.modules.sql_helper.blacklist_sql as sql
9 | from userbot import CMD_HELP
10 | from userbot.events import register
11 |
12 |
13 | @register(incoming=True, disable_edited=True, disable_errors=True)
14 | async def on_new_message(event):
15 | # TODO: exempt admins from locks
16 | name = event.raw_text
17 | snips = sql.get_chat_blacklist(event.chat_id)
18 | for snip in snips:
19 | pattern = r"( |^|[^\w])" + re.escape(snip) + r"( |$|[^\w])"
20 | if re.search(pattern, name, flags=re.IGNORECASE):
21 | try:
22 | await event.delete()
23 | except Exception:
24 | await event.reply("I do not have DELETE permission in this chat")
25 | sql.rm_from_blacklist(event.chat_id, snip.lower())
26 | break
27 |
28 |
29 | @register(outgoing=True, pattern="^.addbl(?: |$)(.*)")
30 | async def on_add_black_list(addbl):
31 | text = addbl.pattern_match.group(1)
32 | to_blacklist = list(
33 | set(trigger.strip() for trigger in text.split("\n") if trigger.strip())
34 | )
35 | for trigger in to_blacklist:
36 | sql.add_to_blacklist(addbl.chat_id, trigger.lower())
37 | await addbl.edit(
38 | "Added {} triggers to the blacklist in the current chat".format(
39 | len(to_blacklist)
40 | )
41 | )
42 |
43 |
44 | @register(outgoing=True, pattern="^.listbl(?: |$)(.*)")
45 | async def on_view_blacklist(listbl):
46 | all_blacklisted = sql.get_chat_blacklist(listbl.chat_id)
47 | OUT_STR = "Blacklists in the Current Chat:\n"
48 | if len(all_blacklisted) > 0:
49 | for trigger in all_blacklisted:
50 | OUT_STR += f"`{trigger}`\n"
51 | else:
52 | OUT_STR = "No BlackLists. Start Saving using `.addbl`"
53 | if len(OUT_STR) > 4096:
54 | with io.BytesIO(str.encode(OUT_STR)) as out_file:
55 | out_file.name = "blacklist.text"
56 | await listbl.client.send_file(
57 | listbl.chat_id,
58 | out_file,
59 | force_document=True,
60 | allow_cache=False,
61 | caption="BlackLists in the Current Chat",
62 | reply_to=listbl,
63 | )
64 | await listbl.delete()
65 | else:
66 | await listbl.edit(OUT_STR)
67 |
68 |
69 | @register(outgoing=True, pattern="^.rmbl(?: |$)(.*)")
70 | async def on_delete_blacklist(rmbl):
71 | text = rmbl.pattern_match.group(1)
72 | to_unblacklist = list(
73 | set(trigger.strip() for trigger in text.split("\n") if trigger.strip())
74 | )
75 | successful = 0
76 | for trigger in to_unblacklist:
77 | if sql.rm_from_blacklist(rmbl.chat_id, trigger.lower()):
78 | successful += 1
79 | await rmbl.edit(f"Removed {successful} / {len(to_unblacklist)} from the blacklist")
80 |
81 |
82 | CMD_HELP.update(
83 | {
84 | "blacklist": ".listbl\
85 | \nUsage: Lists all active userbot blacklist in a chat.\
86 | \n\n.addbl \
87 | \nUsage: Saves the message to the 'blacklist keyword'.\
88 | \nThe bot will delete to the message whenever 'blacklist keyword' is mentioned.\
89 | \n\n.rmbl \
90 | \nUsage: Stops the specified blacklist.\
91 | \n btw you need permissions **Delete Messages** of admin."
92 | }
93 | )
94 |
--------------------------------------------------------------------------------
/userbot/modules/channel_download.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.; Licensed under the Raphielscape Public License, Version 1.d (the "License"); you may not use this file except in compliance with the License.#Modified by @arshsisodiya #thanks to @Zero_cool7870 #https://github.com/arshsisodiya
2 |
3 | """ a module for downloading files from channel. """
4 |
5 | import os
6 | import subprocess
7 | from userbot import CMD_HELP, TEMP_DOWNLOAD_DIRECTORY
8 | from userbot.events import register
9 | from userbot.utils import media_type
10 |
11 | @register(outgoing=True, pattern=r"^.getc(?: |$)([\s\S]*)")
12 | async def get_media(event):
13 | chname = event.pattern_match.group(1)
14 | limit = int(chname.split(" ")[0])
15 | channel_username = str(chname.split(" ")[1])
16 | tempdir = os.path.join(TEMP_DOWNLOAD_DIRECTORY, channel_username)
17 | try:
18 | os.makedirs(tempdir)
19 | except BaseException:
20 | pass
21 | event = await event.edit(f"`Downloading Media From {channel_username} Channel from last {limit} messages.`")
22 | msgs = await event.client.get_messages(channel_username, limit=int(limit))
23 | i = 0
24 | for msg in msgs:
25 | mediatype = media_type(msg)
26 | if mediatype is not None:
27 | await event.client.download_media(msg, tempdir)
28 | i += 1
29 | await event.edit(
30 | f"Downloading Media From {channel_username} Channel.\n **DOWNLOADED : **`{i}`"
31 | )
32 | ps = subprocess.Popen(("ls", tempdir), stdout=subprocess.PIPE)
33 | output = subprocess.check_output(("wc", "-l"), stdin=ps.stdout)
34 | ps.wait()
35 | output = str(output)
36 | output = output.replace("b'", " ")
37 | output = output.replace("\\n'", " ")
38 | await event.edit(
39 | f"Successfully downloaded {output} number of media files from {channel_username} to `{tempdir}`"
40 | )
41 |
42 |
43 | @register(outgoing=True, pattern=r"^.geta(?: |$)([\s\S]*)")
44 | async def get_media(event):
45 | channel_username = event.pattern_match.group(1)
46 | tempdir = os.path.join(TEMP_DOWNLOAD_DIRECTORY, channel_username)
47 | try:
48 | os.makedirs(tempdir)
49 | except BaseException:
50 | pass
51 | event = await event.edit(f"`Downloading All Media From `{channel_username}` Channel.`")
52 | msgs = await event.client.get_messages(channel_username, limit=3000)
53 | i = 0
54 | for msg in msgs:
55 | mediatype = media_type(msg)
56 | if mediatype is not None:
57 | await event.client.download_media(msg, tempdir)
58 | i += 1
59 | await event.edit(
60 | f"Downloading Media From `{channel_username}` Channel.\n **DOWNLOADED : **`{i}`"
61 | )
62 | ps = subprocess.Popen(("ls", tempdir), stdout=subprocess.PIPE)
63 | output = subprocess.check_output(("wc", "-l"), stdin=ps.stdout)
64 | ps.wait()
65 | output = str(output)
66 | output = output.replace("b'", "")
67 | output = output.replace("\\n'", "")
68 | await event.edit(
69 | f"Successfully downloaded {output} number of media files from {channel_username} to `{tempdir}`"
70 | )
71 |
72 | CMD_HELP.update({
73 | "channeldownload":
74 | ".geta "
75 | "\nUsage: will get all media from channel/group, tho there is limit of 3000 there to prevent API limits.."
76 | "\n\n.getc "
77 | "\nUsage: download media only from given number of last messages."
78 | "\n\n Use .gd to upload downloaded files to your google drive."
79 |
80 | })
81 |
--------------------------------------------------------------------------------
/userbot/modules/clone.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.; Licensed under the Raphielscape Public License, Version 1.d (the "License"); you may not use this file except in compliance with the License. ;
2 |
3 | """ a module for Stealing identification. """
4 |
5 | from telethon.tl.functions.account import UpdateProfileRequest
6 | from telethon.tl.functions.photos import UploadProfilePhotoRequest, DeletePhotosRequest
7 | from telethon.tl.functions.users import GetFullUserRequest
8 | from telethon.tl.types import InputPhoto
9 | from userbot.events import register
10 | from userbot import CMD_HELP, STORAGE, LOGS, bot
11 |
12 | if not hasattr(STORAGE, "userObj"):
13 | STORAGE.userObj = False
14 |
15 |
16 | @register(outgoing=True, pattern=r"\.clone ?(.*)")
17 | async def clone(event):
18 | if event.fwd_from:
19 | return
20 | inputArgs = event.pattern_match.group(1)
21 | if "-r" in inputArgs:
22 | await event.edit("`Reverting to my true identity..`")
23 | if not STORAGE.userObj:
24 | return await event.edit("`You need to clone a profile before reverting!`")
25 | await updateProfile(STORAGE.userObj, reset=True)
26 | await event.edit("`Feels good to be back.`")
27 | return
28 | elif "-d" in inputArgs:
29 | STORAGE.userObj = False
30 | await event.edit("`The profile backup has been nuked.`")
31 | return
32 | if not STORAGE.userObj:
33 | STORAGE.userObj = await event.client(GetFullUserRequest(event.from_id))
34 | LOGS.info(STORAGE.userObj)
35 | userObj = await getUserObj(event)
36 | await event.edit("`Stealing this random person's identity..`")
37 | await updateProfile(userObj)
38 | await event.edit("`I am you and you are me.`")
39 |
40 |
41 | async def updateProfile(userObj, reset=False):
42 | firstName = "Deleted Account" if userObj.user.first_name is None else userObj.user.first_name
43 | lastName = "" if userObj.user.last_name is None else userObj.user.last_name
44 | userAbout = userObj.about if userObj.about is not None else ""
45 | userAbout = "" if len(userAbout) > 70 else userAbout
46 | if reset:
47 | userPfps = await bot.get_profile_photos('me')
48 | userPfp = userPfps[0]
49 | await bot(DeletePhotosRequest(
50 | id=[InputPhoto(
51 | id=userPfp.id,
52 | access_hash=userPfp.access_hash,
53 | file_reference=userPfp.file_reference
54 | )]))
55 | else:
56 | try:
57 | userPfp = userObj.profile_photo
58 | pfpImage = await bot.download_media(userPfp)
59 | await bot(UploadProfilePhotoRequest(await bot.upload_file(pfpImage)))
60 | except BaseException:
61 | pass
62 | await bot(UpdateProfileRequest(
63 | about=userAbout, first_name=firstName, last_name=lastName
64 | ))
65 |
66 |
67 | async def getUserObj(event):
68 | if event.reply_to_msg_id:
69 | replyMessage = await event.get_reply_message()
70 | if replyMessage.forward:
71 | userObj = await event.client(
72 | GetFullUserRequest(replyMessage.forward.from_id or replyMessage.forward.channel_id
73 | )
74 | )
75 | return userObj
76 | else:
77 | userObj = await event.client(
78 | GetFullUserRequest(replyMessage.from_id)
79 | )
80 | return userObj
81 |
82 |
83 | CMD_HELP.update({"clone": "\
84 | `.clone` (as a reply to a message of a user)\
85 | \nUsage: Steals the user's identity.\
86 | \n\n`.clone -r/-reset`\
87 | \nUsage: Revert back to your true identity.\
88 | \n\n`.clone -d/-del`\
89 | \nUsage: Delete your profile's backup on your own risk.\
90 | "})
91 |
--------------------------------------------------------------------------------
/userbot/modules/covid.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.; Licensed under the Raphielscape Public License, Version 1.d (the "License"); you may not use this file except in compliance with the License.; Port by @moveangel
2 |
3 | """ a module for gathering covid patients info. """
4 |
5 | from covid import Covid
6 |
7 | from userbot import CMD_HELP
8 | from userbot.events import register
9 |
10 |
11 | @register(outgoing=True, pattern="^.covid (.*)")
12 | async def corona(event):
13 | await event.edit("`Processing...`")
14 | country = event.pattern_match.group(1)
15 | covid = Covid(source="worldometers")
16 | try:
17 | country_data = covid.get_status_by_country_name(country)
18 | output_text = (
19 | f"`Confirmed : {format_integer(country_data['confirmed'])}`\n"
20 | + f"`Active : {format_integer(country_data['active'])}`\n"
21 | + f"`Deaths : {format_integer(country_data['deaths'])}`\n"
22 | + f"`Recovered : {format_integer(country_data['recovered'])}`\n\n"
23 | + f"`New Cases : {format_integer(country_data['new_cases'])}`\n"
24 | + f"`New Deaths : {format_integer(country_data['new_deaths'])}`\n"
25 | + f"`Critical : {format_integer(country_data['critical'])}`\n"
26 | + f"`Total Tests : {format_integer(country_data['total_tests'])}`\n\n"
27 | + f"Data provided by [Worldometer](https://www.worldometers.info/coronavirus/country/{country})"
28 | )
29 | await event.edit(f"Corona Virus Info in {country}:\n\n{output_text}")
30 | except ValueError:
31 | await event.edit(
32 | f"No information found for: {country}!\nCheck your spelling and try again."
33 | )
34 |
35 |
36 | def format_integer(number, thousand_separator="."):
37 | def reverse(string):
38 | string = "".join(reversed(string))
39 | return string
40 |
41 | s = reverse(str(number))
42 | count = 0
43 | result = ""
44 | for char in s:
45 | count = count + 1
46 | if count % 3 == 0:
47 | if len(s) == count:
48 | result = char + result
49 | else:
50 | result = thousand_separator + char + result
51 | else:
52 | result = char + result
53 | return result
54 |
55 |
56 | CMD_HELP.update(
57 | {
58 | "covid": ".covid "
59 | "\nUsage: Get an information about data covid-19 in your country.\n"
60 | }
61 | )
62 |
--------------------------------------------------------------------------------
/userbot/modules/create.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.; Licensed under the Raphielscape Public License, Version 1.d (the "License"); you may not use this file except in compliance with the License. ;(c) Spechide - UniBorg ;# Port From UniBorg to UserBot by @afdulfauzan
2 |
3 | """ a module for creating groups or channels. """
4 |
5 | from telethon.tl import functions
6 |
7 | from userbot import CMD_HELP
8 | from userbot.events import register
9 |
10 |
11 | @register(outgoing=True, pattern="^.create (b|g|c)(?: |$)(.*)")
12 | async def telegraphs(grop):
13 | """ For .create command, Creating New Group & Channel """
14 | if not grop.text[0].isalpha() and grop.text[0] not in ("/", "#", "@", "!"):
15 | if grop.fwd_from:
16 | return
17 | type_of_group = grop.pattern_match.group(1)
18 | group_name = grop.pattern_match.group(2)
19 | if type_of_group == "b":
20 | try:
21 | result = await grop.client(
22 | functions.messages.CreateChatRequest( # pylint:disable=E0602
23 | users=["@userbotindobot"],
24 | # Not enough users (to create a chat, for example)
25 | # Telegram, no longer allows creating a chat with
26 | # ourselves
27 | title=group_name,
28 | )
29 | )
30 | created_chat_id = result.chats[0].id
31 | result = await grop.client(
32 | functions.messages.ExportChatInviteRequest(
33 | peer=created_chat_id,
34 | )
35 | )
36 | await grop.edit(
37 | "Your {} Group Created Successfully. Click [{}]({}) to join".format(
38 | group_name, group_name, result.link
39 | )
40 | )
41 | except Exception as e: # pylint:disable=C0103,W0703
42 | await grop.edit(str(e))
43 | elif type_of_group == "g" or type_of_group == "c":
44 | try:
45 | r = await grop.client(
46 | functions.channels.CreateChannelRequest( # pylint:disable=E0602
47 | title=group_name,
48 | about="Welcome to this Channel",
49 | megagroup=False if type_of_group == "c" else True,
50 | )
51 | )
52 | created_chat_id = r.chats[0].id
53 | result = await grop.client(
54 | functions.messages.ExportChatInviteRequest(
55 | peer=created_chat_id,
56 | )
57 | )
58 | await grop.edit(
59 | "Your {} Group/Channel Created Successfully. Click [{}]({}) to join".format(
60 | group_name, group_name, result.link
61 | )
62 | )
63 | except Exception as e: # pylint:disable=C0103,W0703
64 | await grop.edit(str(e))
65 |
66 |
67 | CMD_HELP.update(
68 | {
69 | "create": "\
70 | Create\
71 | \nUsage: Create Channel, Group & Group With Bot.\
72 | \n\n.create g \
73 | \nUsage: Create a Private Group.\
74 | \n\n.create b \
75 | \nUsage: Create a Group with Bot.\
76 | \n\n.create c \
77 | \nUsage: Create a Channel.\
78 | "
79 | }
80 | )
81 |
--------------------------------------------------------------------------------
/userbot/modules/deepfryer.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.; Licensed under the Raphielscape Public License, Version 1.d (the "License"); you may not use this file except in compliance with the License.
2 |
3 | """ a module for meme like image deepfryer. """
4 | import os
5 | from asyncio.exceptions import TimeoutError
6 |
7 | from telethon.errors.rpcerrorlist import YouBlockedUserError
8 |
9 | from userbot import CMD_HELP, TEMP_DOWNLOAD_DIRECTORY, bot
10 | from userbot.events import register
11 |
12 |
13 | @register(outgoing=True, pattern=r"^\.df(:? |$)([1-8])?")
14 | async def _(fry):
15 | await fry.edit("`Sending information...`")
16 | level = fry.pattern_match.group(2)
17 | if fry.fwd_from:
18 | return
19 | if not fry.reply_to_msg_id:
20 | await fry.edit("`Reply to any user message photo...`")
21 | return
22 | reply_message = await fry.get_reply_message()
23 | if not reply_message.media:
24 | await fry.edit("`No image found to fry...`")
25 | return
26 | if reply_message.sender.bot:
27 | await fry.edit("`Reply to actual user...`")
28 | return
29 | chat = "@image_deepfrybot"
30 | message_id_to_reply = fry.message.reply_to_msg_id
31 | try:
32 | async with fry.client.conversation(chat) as conv:
33 | try:
34 | msg = await conv.send_message(reply_message)
35 | if level:
36 | m = f"/deepfry {level}"
37 | msg_level = await conv.send_message(m, reply_to=msg.id)
38 | r = await conv.get_response()
39 | response = await conv.get_response()
40 | """ - don't spam notif - """
41 | await bot.send_read_acknowledge(conv.chat_id)
42 | except YouBlockedUserError:
43 | await fry.reply("`Please unblock` @image_deepfrybot`...`")
44 | return
45 | if response.text.startswith("Forward"):
46 | await fry.edit("`Please disable your forward privacy setting...`")
47 | else:
48 | downloaded_file_name = await fry.client.download_media(
49 | response.media, TEMP_DOWNLOAD_DIRECTORY
50 | )
51 | await fry.client.send_file(
52 | fry.chat_id,
53 | downloaded_file_name,
54 | force_document=False,
55 | reply_to=message_id_to_reply,
56 | )
57 | """ - cleanup chat after completed - """
58 | try:
59 | msg_level
60 | except NameError:
61 | await fry.client.delete_messages(
62 | conv.chat_id, [msg.id, response.id]
63 | )
64 | else:
65 | await fry.client.delete_messages(
66 | conv.chat_id, [msg.id, response.id, r.id, msg_level.id]
67 | )
68 | except TimeoutError:
69 | return await fry.edit("**Error:** @image_deepfrybot **is not responding.**")
70 | await fry.delete()
71 | return os.remove(downloaded_file_name)
72 |
73 |
74 | CMD_HELP.update(
75 | {
76 | "deepfry": ">`.df` or >`.df [level(1-8)]`"
77 | "\nUsage: deepfry image/sticker from the reply."
78 | "\n@image_deepfrybot"
79 | }
80 | )
81 |
--------------------------------------------------------------------------------
/userbot/modules/dogbin.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.; Licensed under the Raphielscape Public License, Version 1.d (the "License"); you may not use this file except in compliance with the License.
2 |
3 | """ Userbot module containing commands for interacting with dogbin(https://del.dog). """
4 |
5 | import os
6 |
7 | from requests import exceptions, get, post
8 |
9 | from userbot import BOTLOG, BOTLOG_CHATID, CMD_HELP, TEMP_DOWNLOAD_DIRECTORY
10 | from userbot.events import register
11 |
12 | DOGBIN_URL = "https://pasty.lus.pm/"
13 |
14 |
15 | @register(outgoing=True, pattern=r"^.paste(?: |$)([\s\S]*)")
16 | async def paste(pstl):
17 | """ For .paste command, pastes the text directly to dogbin. """
18 | dogbin_final_url = ""
19 | match = pstl.pattern_match.group(1).strip()
20 | reply_id = pstl.reply_to_msg_id
21 |
22 | if not match and not reply_id:
23 | await pstl.edit("`Elon Musk said I cannot paste void.`")
24 | return
25 |
26 | if match:
27 | message = match
28 | elif reply_id:
29 | message = await pstl.get_reply_message()
30 | if message.media:
31 | downloaded_file_name = await pstl.client.download_media(
32 | message,
33 | TEMP_DOWNLOAD_DIRECTORY,
34 | )
35 | m_list = None
36 | with open(downloaded_file_name, "rb") as fd:
37 | m_list = fd.readlines()
38 | message = ""
39 | for m in m_list:
40 | message += m.decode("UTF-8")
41 | os.remove(downloaded_file_name)
42 | else:
43 | message = message.message
44 |
45 | # Pasty
46 | await pstl.edit("`Pasting text . . .`")
47 | dta={"content":message}
48 | resp = post(DOGBIN_URL + "api/v2/pastes", json=dta)
49 |
50 | if resp.status_code in (200,201):
51 | response = resp.json()
52 | key = response["id"]
53 | dogbin_final_url = DOGBIN_URL + key
54 | print(response)
55 | reply_text = (
56 | "`Pasted successfully!`\n\n"
57 | f"[Pasty URL]({dogbin_final_url})\n"
58 | f"[Pasty RAW URL]({dogbin_final_url+'/raw'})"
59 | )
60 | if BOTLOG:
61 | await pstl.client.send_message(
62 | BOTLOG_CHATID,
63 | f"Paste query was executed successfully\
64 | \nPasty ID: `{key}`\
65 | \nPasty Modification Token: `{response['modificationToken']}`\
66 | \n\nModification Token can be used to edit your pasty paste, so do not share it with anyone"
67 | )
68 | else:
69 | reply_text = "`Failed to reach Pasty`"
70 |
71 | await pstl.edit(reply_text)
72 |
73 | CMD_HELP.update(
74 | {
75 | "paste": ".paste \
76 | \nUsage: Create a paste or a shortened url using pasty (https://pasty.lus.pm//)"
77 | }
78 | )
79 |
--------------------------------------------------------------------------------
/userbot/modules/figlet.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.; Licensed under the Raphielscape Public License, Version 1.d (the "License"); you may not use this file except in compliance with the License. ;Port to UserBot by @MoveAngel
2 |
3 | """ a figlet based module for userbot. """
4 |
5 | import pyfiglet
6 |
7 | from userbot import CMD_HELP
8 | from userbot.events import register
9 |
10 |
11 | @register(outgoing=True, pattern=r"^\.figlet(?: |$)(.*)")
12 | async def figlet(fg):
13 | if fg.fwd_from:
14 | return
15 | CMD_FIG = {
16 | "SLANT": "slant",
17 | "3D": "3-d",
18 | "5LINE": "5lineoblique",
19 | "ALPHA": "alphabet",
20 | "BANNER": "banner3-D",
21 | "DOH": "doh",
22 | "ISO": "isometric1",
23 | "LETTER": "letters",
24 | "ALLIG": "alligator",
25 | "DOTM": "dotmatrix",
26 | "BUBBLE": "bubble",
27 | "BULB": "bulbhead",
28 | "DIGI": "digital",
29 | }
30 | ip = fg.pattern_match.group(1)
31 | input_str = ip.upper()
32 | if "." in input_str:
33 | text, cmd = input_str.split(".", maxsplit=1)
34 | elif input_str is not None:
35 | cmd = None
36 | text = input_str
37 | else:
38 | await fg.edit("`Please add some text to figlet`")
39 | return
40 | if cmd is not None:
41 | try:
42 | font = CMD_FIG[cmd]
43 | except KeyError:
44 | await fg.edit("`Invalid selected font.`")
45 | return
46 | result = pyfiglet.figlet_format(text, font=font)
47 | else:
48 | result = pyfiglet.figlet_format(text)
49 | await fg.edit("`{}`".format(result))
50 |
51 | CMD_HELP.update(
52 | {
53 | "figlet": ".figlet"
54 | "\nUsage: Enhance ur text to strip line with anvil."
55 | "\n\nExample: `.figlet .