Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
nandydark committed Jul 5, 2021
1 parent 48efecc commit 716e859
Show file tree
Hide file tree
Showing 11 changed files with 356 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Aptfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pv
tree
mediainfo
p7zip-full
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM Thundergang/thunderuserbot:latest

RUN git clone https://github.com/Thundergang/thunderuserbot.git /root/userbot
WORKDIR /root/thunderbot

# Installing the requirements
RUN pip3 install -U -r requirements.txt
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && apt install -y ./google-chrome-stable_current_amd64.deb && rm google-chrome-stable_current_amd64.deb
RUN wget https://chromedriver.storage.googleapis.com/88.0.4324.96/chromedriver_linux64.zip && unzip chromedriver_linux64.zip && chmod +x chromedriver && mv -f chromedriver /usr/bin/ && rm chromedriver_linux64.zip
RUN mkdir /root/thunderbot/bin/
ENV PATH="/home/userbot/bin:$PATH"

CMD ["bash","./Extras/startup.sh"]
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
worker: bash start
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

## © By Team #ThunderGᴀɴɢ™
<img src="https://telegra.ph/file/d8debedf797a5c00a7844.png" alt="THUNDER USERBOT">

## For any query or want to know how it works join our Channel and Support Group

<a href="https://t.me/thunderuserbot"><img src="https://img.shields.io/badge/Join-Telegram%20Channel-red.svg?logo=Telegram"></a>
<a href="https://t.me/thunderuserbotchat"><img src="https://img.shields.io/badge/Join-Telegram%20Group-blue.svg?logo=telegram"></a>

## Credits
- [NandyDark](https://github.com/nandydark)
- [Whole Thundergang Team](https://github.com/Thundergang)
151 changes: 151 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"name": "ThunderUserbot - By Thundergang",
"description": "Best telegram Userbot, Made with love",
"logo": "https://telegra.ph/file/23cb9122f7b3c34567ef0.jpg",
"keywords": [
"thunderuserbot",
"modular",
"productivity"
],
"repository": "https://github.com/Thundergang/thunderuserbot/",
"website": "https://thundergang.gitbook.io/thunderuserbot/",
"success_url": "https://t.me/thunderuserbot",
"env": {
"ALIVE_NAME": {
"description": "Your telegram username without @",
"value": ""
},
"APP_ID": {
"description": "Get this value from my.telegram.org! Please do not steal",
"value": ""
},
"API_HASH": {
"description": "Get this value from my.telegram.org! Please do not steal",
"value": ""
},
"STRING_SESSION": {
"description": "Get this value from string generator by Thundergang.",
"value": ""
},
"TG_BOT_USER_NAME_BF_HER": {
"description": "Needed for inline buttons maker. Make a bot at http://telegram.dog/BotFather and get the username of your bot with @",
"value": ""
},
"TG_BOT_TOKEN_BF_HER": {
"description": "Needed for inline buttons maker. Make a bot at http://telegram.dog/BotFather and get the token of your bot.Worth it. Get it.",
"value": ""
},
"CMD_HNDLR": {
"description": "Don't put anything, leave it as it is",
"value": "",
"required": false
},
"ENV": {
"description": "Setting this to ANYTHING will enable heroku.",
"value": "ANYTHING",
"required": false
},
"HEROKU_API_KEY": {
"description": "Required for updating the bot, Get it from https://dashboard.heroku.com/account",
"value": "",
"required": true
},
"SUDO_USERS": {
"description": "Only fill this when thundergang or support users says otherwise leave it as it is. ",
"value": "",
"required": false
},
"PRIVATE_GROUP_ID": {
"description": "Make a private group and add rose bot (@MissRose_bot) there and make him admin, then for getting group id put /id command note than and put here and below",
"value": "",
"required": true
},
"PLUGIN_CHANNEL": {
"description": "Put same value as PRIVATE_GROUP_ID",
"value": "",
"required": true
},
"CUSTOM_PMPERMIT": {
"description": "Leave this as it is! Don't edit or change",
"value": "Do not spam here !!, otherwise you will be blocked automatically."
},
"MAX_SPAM": {
"description": "No. of messages one can send in your PM before being approved. By default, it is setted to 3.",
"value": "3",
"required": false
},
"CHROME_BIN": {
"description": "Leave as such, Google Chrome (or) Chromium binary location for selenium based modules.",
"value": "/app/.apt/usr/bin/google-chrome",
"required": false
},
"CHROME_DRIVER": {
"description": "Leave as such, ChromeDriver location for selenium based modules",
"value": "/app/.chromedriver/bin/chromedriver",
"required": false
},
"OCR_SPACE_API_KEY": {
"description": "Required for OCR functionality. Get from https://ocr.space/ocrapi(Not Mandatory)",
"value": "",
"required": false
},
"REM_BG_API_KEY": {
"description": "Required for Removing image background functionality. Get from https://www.remove.bg/ (Not Mandatory)",
"value": "",
"required": false
},
"ALIVE_PIC": {
"description": "telegra.ph link to the image you want as your alive pic, (Don't change it)",
"value": "https://telegra.ph/file/d8debedf797a5c00a7844.png",
"required": false
},
"PMPERMIT_PIC": {
"description": "telegra.ph link to the image you want as pmpermit pic, leave blank for default (Don't change it)",
"value": "https://telegra.ph/file/d8debedf797a5c00a7844.png",
"required": false
},
"HEROKU_APP_NAME": {
"description": "YOUR app name ",
"value": "",
"required": true
},
"TEMP_DOWNLOAD_DIRECTORY": {
"description": "Where downloaded files will go.",
"value": "./thunderbot/DOWNLOADS/",
"required": false
},
"TZ": {
"description": "Required for Correct Time on autopic/get time. Know your timezone from http://www.timezoneconverter.com/cgi-bin/findzone.tzc",
"value": "Asia/Kolkata",
"required": false
},
"UPSTREAM_REPO": {
"description": "Don't change it!! Leave it as it is",
"value": "thunderversiontwo",
"required": true
}
},
"addons": [{
"plan": "heroku-postgresql",
"options": {
"version": "12"
}
}],
"buildpacks": [{
"url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest"
},{
"url":"https://github.com/heroku/heroku-buildpack-google-chrome"
},{
"url":"https://github.com/nandydark/heroku-buildpack-neofetch.git"
},{
"url":"https://github.com/heroku/heroku-buildpack-chromedriver"
},{
"url": "https://github.com/opendoor-labs/heroku-buildpack-p7zip"
},{
"url": "https://github.com/heroku/heroku-buildpack-apt.git"
},{
"url": "https://github.com/chrismytton/heroku-buildpack-jq"
},{
"url": "heroku/python"
}]
}
5 changes: 5 additions & 0 deletions heroku.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build:
docker:
worker: Dockerfile
run:
worker: python3 -m thunderbot
1 change: 1 addition & 0 deletions nandydark/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

52 changes: 52 additions & 0 deletions nandydark/updater.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import asyncio
import difflib
import shlex
from typing import Tuple
import sys

# If any requirements are changed or added then install that requirements too..
async def lines_differnce(file1, file2):
with open(file1) as f1:
lines1 = f1.readlines()
lines1 = [line.rstrip("\n") for line in lines1]
with open(file2) as f2:
lines2 = f2.readlines()
lines2 = [line.rstrip("\n") for line in lines2]
diff = difflib.unified_diff(
lines1, lines2, fromfile=file1, tofile=file2, lineterm="", n=0
)
lines = list(diff)[2:]
added = [line[1:] for line in lines if line[0] == "+"]
removed = [line[1:] for line in lines if line[0] == "-"]
additions = [i for i in added if i not in removed]
removedt = [i for i in removed if i not in added]
return additions, removedt


async def runcmd(cmd: str) -> Tuple[str, str, int, int]:
args = shlex.split(cmd)
process = await asyncio.create_subprocess_exec(
*args, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
)
stdout, stderr = await process.communicate()
return (
stdout.decode("utf-8", "replace").strip(),
stderr.decode("utf-8", "replace").strip(),
process.returncode,
process.pid,
)


async def update_requirements(main , test):
a, r = await lines_differnce(main, test)
try:
for i in a:
await runcmd(f"pip install {i}")
print(f"Successfully installed {i}")
except Exception as e:
print(f"Error while installing requirements {str(e)}")


loop = asyncio.get_event_loop()
loop.run_until_complete(update_requirements(sys.argv[1] , sys.argv[2]))
loop.close()
64 changes: 64 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Pillow>=5.3.0
PyGithub
aiofiles
aiohttp
anime_downloader
async_generator
asyncurban
beautifulsoup4
bs4
bwb==3.0.0
cfscrape
coffeehouse
covid
cowpy
cryptg
dnspython
emoji
gTTS-token>=1.1.3
gTTS>=2.0.1
geopy
gitpython
google-api-python-client==1.8.0
google-auth-oauthlib
google_images_download>=2.7.1
googletrans==3.1.0a0
gsearch
hachoir
heroku3
httplib2<=0.19.0
humanize
lxml
lyricsgenius
oauth2client
psycopg2-binary
pySmartDL
pybase64>=0.4.0
pyfiglet
pylast
pymongo
python-barcode
python-dotenv
python-magic
pytube
pytz
qrcode
regex
requests>=2.18.4
search-engine-parser>=0.4.2
selenium
spamwatch
speedtest-cli>=2.0.2
sqlalchemy==1.3.23
telegraph
telethon>=1.17
tswift
urbandict
validators
wheel
wikipedia>=1.4.0
youtube-dl>=2021.1.8
youtube-search-python>=1.3.2
youtube-search>=1.1.1
pygments
chromedriver-py==88.0.4324.96
1 change: 1 addition & 0 deletions runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-3.9.2
52 changes: 52 additions & 0 deletions start
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash


_get_repolink () {
local regex
regex='(https?)://github.com/.+/.+'
if [[ $UPSTREAM_REPO == "thunderversiontwo" ]]
then
echo "aHR0cHM6Ly9naXRodWIuY29tL1RodW5kZXJnYW5nL3RodW5kZXJ1c2VyYm90L2FyY2hpdmUvbWFzdGVyLnppcA==" | base64 -d
elif [[ $UPSTREAM_REPO =~ $regex ]]
then
if [[ $UPSTREAM_REPO_BRANCH ]]
then
echo "${UPSTREAM_REPO}/archive/${UPSTREAM_REPO_BRANCH}.zip"
else
echo "${UPSTREAM_REPO}/archive/master.zip"
fi
else
echo "Something Went Wrong.. Please Get Help From @thunderuserbotchat "
fi
}


_set_bot () {
local zipfilepath
zipfilepath="thunderuserbot.zip"
wget -q $(_get_repolink) -O "$zipfilepath"
THUNDERPATH=$(zipinfo -1 "$zipfilepath" | grep -v "/.");
unzip -qq "$zipfilepath"
rm -rf "$zipfilepath"
sleep 5
cd $THUNDERPATH
python3 ../nandydark/updater.py ../requirements.txt requirements.txt
echo "
████████ ██  ██ ██  ██ ███  ██ ██████  ███████ ██████ 
   ██    ██  ██ ██  ██ ████  ██ ██   ██ ██      ██   ██ 
██  ███████ ██  ██ ██ ██  ██ ██  ██ █████  ██████  
██  ██   ██ ██  ██ ██  ██ ██ ██  ██ ██     ██   ██ 
██  ██  ██  ██████  ██   ████ ██████  ███████ ██  ██ 
"

echo "
██  ██ ███████ ███████ ██████  ██████  ██████  ████████ 
██  ██ ██      ██      ██   ██ ██   ██ ██    ██    ██    
██  ██ ███████ █████  ██████  ██████  ██  ██  ██ 
██  ██      ██ ██     ██   ██ ██   ██ ██  ██  ██ 
 ██████  ███████ ███████ ██  ██ ██████   ██████   ██ 
"
python3 -m thunderbot
}

_set_bot

0 comments on commit 716e859

Please sign in to comment.