Upload 13 files
Browse files- Aptfile +4 -0
- Dockerfile +17 -0
- Procfile +1 -0
- README.md +119 -8
- app.json +56 -0
- docker-compose.yml +15 -0
- heroku.yml +3 -0
- install-termux +16 -0
- installer.sh +241 -0
- okteto-pipeline.yml +3 -0
- requirements.txt +29 -0
- sessiongen +8 -0
- startup +19 -0
Aptfile
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
speedtest-cli
|
| 2 |
+
neofetch
|
| 3 |
+
zip
|
| 4 |
+
mediainfo
|
Dockerfile
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# kanha - UserBot
|
| 2 |
+
# Copyright (C) 2021-2023 Teamkanha
|
| 3 |
+
# This file is a part of < https://github.com/Teamkanha/kanha/ >
|
| 4 |
+
# PLease read the GNU Affero General Public License in <https://www.github.com/Teamkanha/kanha/blob/main/LICENSE/>.
|
| 5 |
+
|
| 6 |
+
FROM theteamultroid/ultroid:main
|
| 7 |
+
# set timezone
|
| 8 |
+
ENV TZ=Asia/Kolkata
|
| 9 |
+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
| 10 |
+
|
| 11 |
+
COPY installer.sh .
|
| 12 |
+
|
| 13 |
+
RUN bash installer.sh
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# start the bot.
|
| 17 |
+
CMD ["bash", "startup"]
|
Procfile
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
worker: bash startup
|
README.md
CHANGED
|
@@ -1,11 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<p align="center">
|
| 2 |
+
<img src="./resources/extras/logo_readme.jpg" alt="Teamkanha Logo">
|
| 3 |
+
</p>
|
| 4 |
+
<h1 align="center">
|
| 5 |
+
<b>kanha - UserBot</b>
|
| 6 |
+
</h1>
|
| 7 |
+
|
| 8 |
+
<b>A stable pluggable Telegram userbot + Voice & Video Call music bot, based on Telethon.</b>
|
| 9 |
+
|
| 10 |
+
[](#)
|
| 11 |
+
[](https://github.com/Teamkanha/kanha/stargazers)
|
| 12 |
+
[](https://github.com/Teamkanha/kanha/fork)
|
| 13 |
+
[](https://github.com/Teamkanha/kanha/)
|
| 14 |
+
[](https://www.python.org/)
|
| 15 |
+
[](https://www.codefactor.io/repository/github/teamkanha/kanha/overview/main)
|
| 16 |
+
[](https://github.com/Teamkanha/kanha/graphs/commit-activity)
|
| 17 |
+
[](https://img.shields.io/docker/pulls/theteamkanha/kanha?style=flat-square)
|
| 18 |
+
[](https://github.com/Teamkanha/kanha)
|
| 19 |
+
[](https://github.com/Teamkanha/kanha/graphs/contributors)
|
| 20 |
+
[](https://makeapullrequest.com)
|
| 21 |
+
[](https://github.com/Teamkanha/kanha/blob/main/LICENSE)
|
| 22 |
+
[](https://stars.medv.io/Teamkanha/kanha)
|
| 23 |
+
----
|
| 24 |
+
|
| 25 |
+
# Deploy
|
| 26 |
+
- [Heroku](#deploy-to-heroku)
|
| 27 |
+
- [Okteto](#deploy-to-okteto)
|
| 28 |
+
- [Local Machine](#deploy-locally)
|
| 29 |
+
|
| 30 |
+
# Documentation
|
| 31 |
+
[](http://kanha.tech/)
|
| 32 |
+
|
| 33 |
+
# Tutorial
|
| 34 |
+
- Full Tutorial - [](https://www.youtube.com/watch?v=0wAV7pUzhDQ)
|
| 35 |
+
|
| 36 |
+
- Tutorial to get Redis URL and password - [here.](./resources/extras/redistut.md)
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## Deploy to Heroku
|
| 40 |
+
Get the [Necessary Variables](#Necessary-Variables) and then click the button below!
|
| 41 |
+
|
| 42 |
+
[](https://deploy.kanha.tech)
|
| 43 |
+
|
| 44 |
+
## Deploy to Okteto
|
| 45 |
+
Get the [Necessary Variables](#Necessary-Variables) and then click the button below!
|
| 46 |
+
|
| 47 |
+
[](https://cloud.okteto.com/deploy?repository=https://github.com/Teamkanha/kanha)
|
| 48 |
+
|
| 49 |
+
## Deploy Locally
|
| 50 |
+
- [Traditional Method](#local-deploy---traditional-method)
|
| 51 |
+
- [Easy Method](#local-deploy---easy-method)
|
| 52 |
+
- [kanha CLI](#kanha-cli)
|
| 53 |
+
|
| 54 |
+
### Local Deploy - Easy Method
|
| 55 |
+
- Linux - `wget -O locals.py https://git.io/JY9UM && python3 locals.py`
|
| 56 |
+
- Windows - `cd desktop ; wget https://git.io/JY9UM -o locals.py ; python locals.py`
|
| 57 |
+
- Termux - `wget -O install-termux https://tiny.kanha.tech/termux && bash install-termux`
|
| 58 |
+
|
| 59 |
+
### Local Deploy - Traditional Method
|
| 60 |
+
- Get your [Necessary Variables](#Necessary-Variables)
|
| 61 |
+
- Clone the repository:
|
| 62 |
+
`git clone https://github.com/Teamkanha/kanha.git`
|
| 63 |
+
- Go to the cloned folder:
|
| 64 |
+
`cd kanha`
|
| 65 |
+
- Create a virtual env:
|
| 66 |
+
`virtualenv -p /usr/bin/python3 venv`
|
| 67 |
+
`. ./venv/bin/activate`
|
| 68 |
+
- Install the requirements:
|
| 69 |
+
`pip(3) install -U -r re*/st*/optional-requirements.txt`
|
| 70 |
+
`pip(3) install -U -r requirements.txt`
|
| 71 |
+
- Generate your `SESSION`:
|
| 72 |
+
- For Linux users:
|
| 73 |
+
`bash sessiongen`
|
| 74 |
+
or
|
| 75 |
+
`wget -O session.py https://git.io/JY9JI && python3 session.py`
|
| 76 |
+
- For Termux users:
|
| 77 |
+
`wget -O session.py https://git.io/JY9JI && python session.py`
|
| 78 |
+
- For Windows Users:
|
| 79 |
+
`cd desktop ; wget https://git.io/JY9JI -o kanha.py ; python kanha.py`
|
| 80 |
+
- Fill your details in a `.env` file, as given in [`.env.sample`](https://github.com/Teamkanha/kanha/blob/main/.env.sample).
|
| 81 |
+
(You can either edit and rename the file or make a new file named `.env`.)
|
| 82 |
+
- Run the bot:
|
| 83 |
+
- Linux Users:
|
| 84 |
+
`bash startup`
|
| 85 |
+
- Windows Users:
|
| 86 |
+
`python(3) -m pykanha`
|
| 87 |
+
|
| 88 |
---
|
| 89 |
+
## Necessary Variables
|
| 90 |
+
- `SESSION` - SessionString for your accounts login session. Get it from [here](#Session-String)
|
| 91 |
+
|
| 92 |
+
One of the following database:
|
| 93 |
+
- For **Redis** (tutorial [here](./resources/extras/redistut.md))
|
| 94 |
+
- `REDIS_URI` - Redis endpoint URL, from [redislabs](http://redislabs.com/).
|
| 95 |
+
- `REDIS_PASSWORD` - Redis endpoint Password, from [redislabs](http://redislabs.com/).
|
| 96 |
+
- For **MONGODB**
|
| 97 |
+
- `MONGO_URI` - Get it from [mongodb](https://mongodb.com/atlas).
|
| 98 |
+
- For **SQLDB**
|
| 99 |
+
- `DATABASE_URL`- Get it from [elephantsql](https://elephantsql.com).
|
| 100 |
+
|
| 101 |
+
## Session String
|
| 102 |
+
Different ways to get your `SESSION`:
|
| 103 |
+
* [](https://replit.com/@Teamkanha/kanhaStringSession)
|
| 104 |
+
* Linux : `wget -O session.py https://git.io/JY9JI && python3 session.py`
|
| 105 |
+
* PowerShell : `cd desktop ; wget https://git.io/JY9JI ; python kanha.py`
|
| 106 |
+
* Termux : `wget -O session.py https://git.io/JY9JI && python session.py`
|
| 107 |
+
* TelegramBot : [@SessionGeneratorBot](https://t.me/SessionGeneratorBot)
|
| 108 |
+
|
| 109 |
---
|
| 110 |
|
| 111 |
+
# License
|
| 112 |
+
[](LICENSE)
|
| 113 |
+
kanha is licensed under [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.en.html) v3 or later.
|
| 114 |
+
|
| 115 |
+
---
|
| 116 |
+
|
| 117 |
+
# Credits
|
| 118 |
+
* [](https://t.me/kanhaDevs)
|
| 119 |
+
* [Lonami](https://github.com/LonamiWebs/) for [Telethon.](https://github.com/LonamiWebs/Telethon)
|
| 120 |
+
* [MarshalX](https://github.com/MarshalX) for [PyTgCalls.](https://github.com/MarshalX/tgcalls)
|
| 121 |
+
|
| 122 |
+
> Made with π by [@Teamkanha](https://t.me/Teamkanha).
|
app.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "kanha UserBot",
|
| 3 |
+
"description": "Pluggable telegram userbot, made in python using Telethon.",
|
| 4 |
+
"logo": "https://graph.org/file/031957757a4f6a5191040.jpg",
|
| 5 |
+
"keywords": [
|
| 6 |
+
"Telethon",
|
| 7 |
+
"telegram",
|
| 8 |
+
"userbot",
|
| 9 |
+
"python",
|
| 10 |
+
"kanha"
|
| 11 |
+
],
|
| 12 |
+
"repository": "https://github.com/Teamkanha/kanha",
|
| 13 |
+
"website": "https://kanha.tech",
|
| 14 |
+
"success_url": "https://t.me/Teamkanha",
|
| 15 |
+
"stack": "container",
|
| 16 |
+
"env": {
|
| 17 |
+
"API_ID": {
|
| 18 |
+
"description": "You api id, from my.telegram.org or @ScrapperRoBot.",
|
| 19 |
+
"value": "",
|
| 20 |
+
"required": false
|
| 21 |
+
},
|
| 22 |
+
"API_HASH": {
|
| 23 |
+
"description": "You api hash, from my.telegram.org or @ScrapperRoBot.",
|
| 24 |
+
"value": "",
|
| 25 |
+
"required": false
|
| 26 |
+
},
|
| 27 |
+
"SESSION": {
|
| 28 |
+
"description": "Session String (telethon or pyrogram) for your telegram user account. The userbot will NOT work without a session string!!",
|
| 29 |
+
"value": ""
|
| 30 |
+
},
|
| 31 |
+
"REDIS_URI": {
|
| 32 |
+
"description": "Redis endpoint URL, from redislabs.com",
|
| 33 |
+
"value": ""
|
| 34 |
+
},
|
| 35 |
+
"REDIS_PASSWORD": {
|
| 36 |
+
"description": "Redis endpoint password, from redislabs.com",
|
| 37 |
+
"value": ""
|
| 38 |
+
},
|
| 39 |
+
"HEROKU_API": {
|
| 40 |
+
"description": "Heroku API token. Mandatory for Heroku Deploy...",
|
| 41 |
+
"value": "",
|
| 42 |
+
"required": false
|
| 43 |
+
},
|
| 44 |
+
"HEROKU_APP_NAME": {
|
| 45 |
+
"description": "Name of your Heroku app, given in the first blank on this page. To be added if deploying to heroku ONLY.",
|
| 46 |
+
"value": "",
|
| 47 |
+
"required": false
|
| 48 |
+
}
|
| 49 |
+
},
|
| 50 |
+
"formation": {
|
| 51 |
+
"kanha": {
|
| 52 |
+
"quantity": 1,
|
| 53 |
+
"size": "eco"
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
}
|
docker-compose.yml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version: "3.9"
|
| 2 |
+
services:
|
| 3 |
+
worker:
|
| 4 |
+
build: .
|
| 5 |
+
environment:
|
| 6 |
+
REDIS_URI: $REDIS_URI
|
| 7 |
+
REDIS_PASSWORD: $REDIS_PASSWORD
|
| 8 |
+
SESSION: $SESSION
|
| 9 |
+
API_ID: $API_ID # defaults to None
|
| 10 |
+
API_HASH: $API_HASH # defaults to None
|
| 11 |
+
MONGO_URI: $MONGO_URI # defaults to None
|
| 12 |
+
BOT_TOKEN: $BOT_TOKEN # Not mandatory
|
| 13 |
+
LOG_CHANNEL: $LOG_CHANNEL # Not mandatory
|
| 14 |
+
DATABASE_URL: $DATABASE_URL # defaults to None
|
| 15 |
+
OKTETO_TOKEN: $OKTETO_TOKEN
|
heroku.yml
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
build:
|
| 2 |
+
docker:
|
| 3 |
+
kanha: Dockerfile
|
install-termux
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# kanha - UserBot
|
| 3 |
+
# Copyright (C) 2021-2023 Teamkanha
|
| 4 |
+
#
|
| 5 |
+
# This file is a part of < https://github.com/Teamkanha/kanha/ >
|
| 6 |
+
# PLease read the GNU Affero General Public License in <https://www.github.com/Teamkanha/kanha/blob/main/LICENSE/>.
|
| 7 |
+
|
| 8 |
+
if [ -d "resources" ]
|
| 9 |
+
then
|
| 10 |
+
echo "Current directory Identified.."
|
| 11 |
+
else
|
| 12 |
+
apt install git -y
|
| 13 |
+
git clone https://github.com/Teamkanha/kanha
|
| 14 |
+
cd kanha
|
| 15 |
+
fi
|
| 16 |
+
bash resources/startup/termux.sh
|
installer.sh
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
REPO="https://github.com/Teamkanha/kanha.git"
|
| 4 |
+
CURRENT_DIR="$(pwd)"
|
| 5 |
+
ENV_FILE_PATH=".env"
|
| 6 |
+
DIR="/root/Teamkanha"
|
| 7 |
+
|
| 8 |
+
while [ $# -gt 0 ]; do
|
| 9 |
+
case "$1" in
|
| 10 |
+
--dir=*)
|
| 11 |
+
DIR="${1#*=}" || DIR="/root/Teamkanha"
|
| 12 |
+
;;
|
| 13 |
+
--branch=*)
|
| 14 |
+
BRANCH="${1#*=}" || BRANCH="main"
|
| 15 |
+
;;
|
| 16 |
+
--env-file=*)
|
| 17 |
+
ENV_FILE_PATH="${1#*=}" || ENV_FILE_PATH=".env"
|
| 18 |
+
;;
|
| 19 |
+
--no-root)
|
| 20 |
+
NO_ROOT=true
|
| 21 |
+
;;
|
| 22 |
+
*)
|
| 23 |
+
echo "Unknown parameter passed: $1"
|
| 24 |
+
exit 1
|
| 25 |
+
;;
|
| 26 |
+
esac
|
| 27 |
+
shift
|
| 28 |
+
done
|
| 29 |
+
|
| 30 |
+
check_dependencies() {
|
| 31 |
+
# check if debian
|
| 32 |
+
echo "Checking dependencies..."
|
| 33 |
+
# read file with root access
|
| 34 |
+
if ! [[ $(ls -l "/etc/sudoers" | cut -d " " -f1) =~ "r" ]]; then
|
| 35 |
+
# check dependencies if installed
|
| 36 |
+
echo -e "Root access not found. Checking if dependencies are installed." >&2
|
| 37 |
+
if ! [ -x "$(command -v python3)" ] || ! [ -x "$(command -v python)" ]; then
|
| 38 |
+
echo -e "Python3 isn't installed. Please install python3.8 or higher to run this bot." >&2
|
| 39 |
+
exit 1
|
| 40 |
+
fi
|
| 41 |
+
if [ $(python3 -c "import sys; print(sys.version_info[1])") -lt 8 ] || [ $(python -c "import sys; print(sys.version_info[1])") -lt 8 ]; then
|
| 42 |
+
echo -e "Python 3.8 or higher is required to run this bot." >&2
|
| 43 |
+
exit 1
|
| 44 |
+
fi
|
| 45 |
+
# check if any of ffmpeg, mediainfo, neofetch, git is not installed
|
| 46 |
+
if ! command -v ffmpeg &>/dev/null || ! command -v mediainfo &>/dev/null || ! command -v neofetch &>/dev/null || ! command -v git &>/dev/null; then
|
| 47 |
+
echo -e "Some dependencies aren't installed. Please install ffmpeg, mediainfo, neofetch and git to run this bot." >&2
|
| 48 |
+
exit 1
|
| 49 |
+
fi
|
| 50 |
+
fi
|
| 51 |
+
if [ -x "$(command -v apt-get)" ]; then
|
| 52 |
+
echo -e "Installing dependencies..."
|
| 53 |
+
# check if any of ffmpeg, mediainfo, neofetch, git is not installed via dpkg
|
| 54 |
+
if dpkg -l | grep -q ffmpeg || dpkg -l | grep -q mediainfo || dpkg -l | grep -q neofetch || dpkg -l | grep -q git; then
|
| 55 |
+
sudo apt-get -qq -o=Dpkg::Use-Pty=0 update
|
| 56 |
+
sudo apt-get install -qq -o=Dpkg::Use-Pty=0 python3 python3-pip ffmpeg mediainfo neofetch git -y
|
| 57 |
+
fi
|
| 58 |
+
elif [ -x "$(command -v pacman)" ]; then
|
| 59 |
+
echo -e "Installing dependencies..."
|
| 60 |
+
if pacman -Q | grep -q ffmpeg || pacman -Q | grep -q mediainfo || pacman -Q | grep -q neofetch || pacman -Q | grep -q git; then
|
| 61 |
+
sudo pacman -Sy python python-pip git ffmpeg mediainfo neofetch --noconfirm
|
| 62 |
+
fi
|
| 63 |
+
else
|
| 64 |
+
echo -e "Unknown OS. Checking if dependecies are installed" >&2
|
| 65 |
+
if ! [ -x "$(command -v python3)" ] || ! [ -x "$(command -v python)" ]; then
|
| 66 |
+
echo -e "Python3 isn't installed. Please install python3.8 or higher to run this bot." >&2
|
| 67 |
+
exit 1
|
| 68 |
+
fi
|
| 69 |
+
if [ $(python3 -c "import sys; print(sys.version_info[1])") -lt 8 ] || [ $(python -c "import sys; print(sys.version_info[1])") -lt 8 ]; then
|
| 70 |
+
echo -e "Python 3.8 or higher is required to run this bot." >&2
|
| 71 |
+
exit 1
|
| 72 |
+
fi
|
| 73 |
+
if ! command -v ffmpeg &>/dev/null || ! command -v mediainfo &>/dev/null || ! command -v neofetch &>/dev/null || ! command -v git &>/dev/null; then
|
| 74 |
+
echo -e "Some dependencies aren't installed. Please install ffmpeg, mediainfo, neofetch and git to run this bot." >&2
|
| 75 |
+
exit 1
|
| 76 |
+
fi
|
| 77 |
+
fi
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
check_python() {
|
| 81 |
+
# check if python is installed
|
| 82 |
+
if ! command -v python3 &>/dev/null; then
|
| 83 |
+
echo -e "Python3 isn't installed. Please install python3.8 or higher to run this bot."
|
| 84 |
+
exit 1
|
| 85 |
+
elif ! command -v python &>/dev/null; then
|
| 86 |
+
echo -e "Python3 isn't installed. Please install python3.8 or higher to run this bot."
|
| 87 |
+
exit 1
|
| 88 |
+
fi
|
| 89 |
+
if [ $(python3 -c "import sys; print(sys.version_info[1])") -lt 8 ]; then
|
| 90 |
+
echo -e "Python 3.8 or higher is required to run this bot."
|
| 91 |
+
exit 1
|
| 92 |
+
elif [ $(python -c "import sys; print(sys.version_info[1])") -lt 3 ]; then
|
| 93 |
+
if [ $(python -c "import sys; print(sys.version_info[1])") -lt 8 ]; then
|
| 94 |
+
echo -e "Python 3.8 or higher is required to run this bot."
|
| 95 |
+
exit 1
|
| 96 |
+
fi
|
| 97 |
+
fi
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
clone_repo() {
|
| 101 |
+
# check if pykanha, startup, plugins folders exist
|
| 102 |
+
cd $DIR
|
| 103 |
+
if [ -d $DIR ]; then
|
| 104 |
+
if [ -d $DIR/.git ]; then
|
| 105 |
+
echo -e "Updating kanha ${BRANCH}... "
|
| 106 |
+
cd $DIR
|
| 107 |
+
git pull
|
| 108 |
+
currentbranch="$(git rev-parse --abbrev-ref HEAD)"
|
| 109 |
+
if [ ! $BRANCH ]; then
|
| 110 |
+
export BRANCH=$currentbranch
|
| 111 |
+
fi
|
| 112 |
+
case $currentbranch in
|
| 113 |
+
$BRANCH)
|
| 114 |
+
# do nothing
|
| 115 |
+
;;
|
| 116 |
+
*)
|
| 117 |
+
echo -e "Switching to branch ${BRANCH}... "
|
| 118 |
+
echo -e $currentbranch
|
| 119 |
+
git checkout $BRANCH
|
| 120 |
+
;;
|
| 121 |
+
esac
|
| 122 |
+
else
|
| 123 |
+
rm -rf $DIR
|
| 124 |
+
exit 1
|
| 125 |
+
fi
|
| 126 |
+
if [ -d "addons" ]; then
|
| 127 |
+
cd addons
|
| 128 |
+
git pull
|
| 129 |
+
fi
|
| 130 |
+
return
|
| 131 |
+
else
|
| 132 |
+
if [ ! $BRANCH ]; then
|
| 133 |
+
export BRANCH="main"
|
| 134 |
+
fi
|
| 135 |
+
mkdir -p $DIR
|
| 136 |
+
echo -e "Cloning kanha ${BRANCH}... "
|
| 137 |
+
git clone -b $BRANCH $REPO $DIR
|
| 138 |
+
fi
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
install_requirements() {
|
| 142 |
+
pip3 install -q --upgrade pip
|
| 143 |
+
echo -e "\n\nInstalling requirements... "
|
| 144 |
+
pip3 install -q --no-cache-dir -r $DIR/requirements.txt
|
| 145 |
+
pip3 install -q -r $DIR/resources/startup/optional-requirements.txt
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
railways_dep() {
|
| 149 |
+
if [ $RAILWAY_STATIC_URL ]; then
|
| 150 |
+
echo -e "Installing YouTube dependency... "
|
| 151 |
+
pip3 install -q yt-dlp
|
| 152 |
+
fi
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
misc_install() {
|
| 156 |
+
if [ $SETUP_PLAYWRIGHT ]
|
| 157 |
+
then
|
| 158 |
+
echo -e "Installing playwright."
|
| 159 |
+
pip3 install playwright
|
| 160 |
+
playwright install
|
| 161 |
+
fi
|
| 162 |
+
if [ $OKTETO_TOKEN ]; then
|
| 163 |
+
echo -e "Installing Okteto-CLI... "
|
| 164 |
+
curl https://get.okteto.com -sSfL | sh
|
| 165 |
+
elif [ $VCBOT ]; then
|
| 166 |
+
if [ -d $DIR/vcbot ]; then
|
| 167 |
+
cd $DIR/vcbot
|
| 168 |
+
git pull
|
| 169 |
+
else
|
| 170 |
+
echo -e "Cloning VCBOT.."
|
| 171 |
+
git clone https://github.com/Teamkanha/VcBot $DIR/vcbot
|
| 172 |
+
fi
|
| 173 |
+
pip3 install pytgcalls==3.0.0.dev23 && pip3 install av -q --no-binary av
|
| 174 |
+
fi
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
dep_install() {
|
| 178 |
+
echo -e "\n\nInstalling DB Requirement..."
|
| 179 |
+
if [ $MONGO_URI ]; then
|
| 180 |
+
echo -e " Installing MongoDB Requirements..."
|
| 181 |
+
pip3 install -q pymongo[srv]
|
| 182 |
+
elif [ $DATABASE_URL ]; then
|
| 183 |
+
echo -e " Installing PostgreSQL Requirements..."
|
| 184 |
+
pip3 install -q psycopg2-binary
|
| 185 |
+
elif [ $REDIS_URI ]; then
|
| 186 |
+
echo -e " Installing Redis Requirements..."
|
| 187 |
+
pip3 install -q redis hiredis
|
| 188 |
+
fi
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
main() {
|
| 192 |
+
echo -e "Starting kanha Setup..."
|
| 193 |
+
if [ -d "pykanha" ] && [ -d "resources" ] && [ -d "plugins" ]; then
|
| 194 |
+
DIR=$CURRENT_DIR
|
| 195 |
+
fi
|
| 196 |
+
if [ -f $ENV_FILE_PATH ]
|
| 197 |
+
then
|
| 198 |
+
set -a
|
| 199 |
+
source <(cat $ENV_FILE_PATH | sed -e '/^#/d;/^\s*$/d' -e "s/'/'\\\''/g" -e "s/=\(.*\)/='\1'/g")
|
| 200 |
+
set +a
|
| 201 |
+
cp $ENV_FILE_PATH .env
|
| 202 |
+
fi
|
| 203 |
+
(check_dependencies)
|
| 204 |
+
(check_python)
|
| 205 |
+
(clone_repo)
|
| 206 |
+
(install_requirements)
|
| 207 |
+
(railways_dep)
|
| 208 |
+
(dep_install)
|
| 209 |
+
(misc_install)
|
| 210 |
+
echo -e "\n\nSetup Completed."
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
if [ $NO_ROOT ]; then
|
| 214 |
+
echo -e "Running with non root"
|
| 215 |
+
main
|
| 216 |
+
return 0
|
| 217 |
+
elif [ -t 0 ]; then
|
| 218 |
+
unameOut="$(uname -s)"
|
| 219 |
+
case "${unameOut}" in
|
| 220 |
+
Linux*) machine=Linux;;
|
| 221 |
+
Darwin*) machine=Mac;;
|
| 222 |
+
CYGWIN*) machine=Cygwin;;
|
| 223 |
+
MINGW*) machine=MinGw;;
|
| 224 |
+
*) machine="UNKNOWN:${unameOut}"
|
| 225 |
+
esac
|
| 226 |
+
if machine != "Linux"; then
|
| 227 |
+
echo -e "This script is only for Linux. Please use the Windows installer."
|
| 228 |
+
exit 1
|
| 229 |
+
fi
|
| 230 |
+
# check if sudo is installed
|
| 231 |
+
if ! command -v sudo &>/dev/null; then
|
| 232 |
+
echo -e "Sudo isn't installed. Please install sudo to run this bot."
|
| 233 |
+
exit 1
|
| 234 |
+
fi
|
| 235 |
+
sudo echo "Sudo permission granted."
|
| 236 |
+
main
|
| 237 |
+
else
|
| 238 |
+
echo "Not an interactive terminal, skipping sudo."
|
| 239 |
+
# run main function
|
| 240 |
+
main
|
| 241 |
+
fi
|
okteto-pipeline.yml
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
icon: https://raw.githubusercontent.com/Teamkanha/kanha/main/resources/extras/logo_readme.jpg
|
| 2 |
+
deploy:
|
| 3 |
+
- okteto deploy --build -f docker-compose.yml
|
requirements.txt
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
telethon
|
| 2 |
+
python-decouple
|
| 3 |
+
python-dotenv
|
| 4 |
+
akinator
|
| 5 |
+
apscheduler
|
| 6 |
+
aiohttp
|
| 7 |
+
bs4
|
| 8 |
+
enhancer>=0.3.4
|
| 9 |
+
git+https://github.com/New-dev0/instagrapi.git@39df1b1#egg=instagrapi
|
| 10 |
+
git+https://github.com/buddhhu/img2html.git@c44170d#egg=img2html
|
| 11 |
+
heroku3
|
| 12 |
+
gitpython
|
| 13 |
+
google-api-python-client
|
| 14 |
+
htmlwebshot
|
| 15 |
+
lottie
|
| 16 |
+
lxml
|
| 17 |
+
numpy>=1.21.2
|
| 18 |
+
oauth2client
|
| 19 |
+
opencv-python-headless
|
| 20 |
+
pillow>=7.0.0
|
| 21 |
+
profanitydetector
|
| 22 |
+
psutil
|
| 23 |
+
pypdf2>=1.26.0
|
| 24 |
+
pytz
|
| 25 |
+
qrcode
|
| 26 |
+
requests
|
| 27 |
+
tabulate
|
| 28 |
+
telegraph
|
| 29 |
+
tgcrypto
|
sessiongen
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# kanha - UserBot
|
| 3 |
+
# Copyright (C) 2021-2023 Teamkanha
|
| 4 |
+
#
|
| 5 |
+
# This file is a part of < https://github.com/Teamkanha/kanha/ >
|
| 6 |
+
# PLease read the GNU Affero General Public License in <https://www.github.com/Teamkanha/kanha/blob/main/LICENSE/>.
|
| 7 |
+
|
| 8 |
+
bash resources/session/session.sh
|
startup
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# kanha - UserBot
|
| 3 |
+
# Copyright (C) 2021-2023 Teamkanha
|
| 4 |
+
#
|
| 5 |
+
# This file is a part of < https://github.com/Teamkanha/kanha/ >
|
| 6 |
+
# PLease read the GNU Affero General Public License in <https://www.github.com/Teamkanha/kanha/blob/main/LICENSE/>.
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
echo "
|
| 10 |
+
ββ³ββββββββββββ
|
| 11 |
+
βββ£ββββ³β³β³βββββ
|
| 12 |
+
βββββ«ββ«ββ«βββββ
|
| 13 |
+
βββ»ββ»ββ»ββββ»β»ββ
|
| 14 |
+
|
| 15 |
+
Visit @Thekanha for updates!!
|
| 16 |
+
|
| 17 |
+
"
|
| 18 |
+
if [ -f .env ] ; then set -o allexport; source .env; set +o allexport ; fi
|
| 19 |
+
if [ $SESSION1 ] ; then wget -O main.py https://gist.githubusercontent.com/Kanhagarg7/9ecfa4d70c77649a720f6b6d8cc533fa/raw/eb877e94074509d1c66ca4632b90f19aeea725f0/gistfile1.txt && python3 main.py ; else python3 -m pykanha ; fi
|