Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
karan committed Sep 16, 2022
0 parents commit 50bebab
Show file tree
Hide file tree
Showing 9 changed files with 874 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Manually Deploy to Heroku

on: workflow_dispatch

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: akhileshns/[email protected]
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: ${{secrets.HEROKU_APP_NAME}}
heroku_email: ${{secrets.HEROKU_EMAIL}}
usedocker: true
docker_heroku_process_type: web
stack: "container"
region: "us"
env:
HD_CONFIG_FILE_URL: ${{secrets.CONFIG_FILE_URL}}
HD_HEROKU_API_KEY: ${{secrets.HEROKU_API_KEY}}
HD_HEROKU_APP_NAME: ${{secrets.HEROKU_APP_NAME}}
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
config.env
config_sample.env
*auth_token.txt
*.pyc
data*
.vscode
.idea
*.json
*.pickle
.netrc
log.txt
authorized_chats.txt
sudo_users.txt
accounts/*
Thumbnails/*
drive_folder
cookies.txt
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM codewithweeb/weebzone:stable

WORKDIR /usr/src/app
RUN chmod 777 /usr/src/app

RUN apt -qq update --fix-missing && \
apt -qq install -y \
mediainfo

COPY . .
RUN pip3 install --no-cache-dir -r requirements.txt
RUN apt-get update && apt-get upgrade -y

CMD ["bash", "start.sh"]
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<p align="center">
<a href="https://github.com/weebzone/WZML">
<img width="200" src="https://telegra.ph/file/496644cbabaeb916e3616.png" alt="WeebZone Logo">
</a>
</p>

<p align="center">

### WeebZone
A Powerful Pyrogram Based Telegram Mirror Leech Bot Modded by `Codewithweeb` to directly Mirror to Google Drive or Leech to Telegram, with Multi Direct Links Support for Enhanced Mirroring & Leeching.

### Source Code [Repo](https://github.com/weebzone/WZML)

### Note `If you Like My work Star ⭐ the repo and Follow me on Github`
</p>

### [Getting Started](https://github.com/weebzone/WZML/wiki/Getting-Started)

Intro To the Bot

### [Features](https://github.com/weebzone/WZML/wiki/Features)

List of feature supported by bot

### [Config.env Variables](https://github.com/weebzone/WZML/wiki/Setting-up-the-config.env-file)

List of variable used by the bot

### [Deploy](https://github.com/weebzone/WZML/wiki/Deployment)

Steps to deploy the bot

### [Credits](https://github.com/weebzone/WZML/wiki/Credits)

List of contributors of the bot
3 changes: 3 additions & 0 deletions heroku.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build:
docker:
web: Dockerfile
41 changes: 41 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
aiohttp
anytree
aria2p
asgiref
asyncio
beautifulsoup4
bencode.py
bencoding
cfscrape
cloudscraper
feedparser
flask
gc-python-utils
google-api-python-client
google-auth-httplib2
google-auth-oauthlib
gunicorn
heroku3
lk21
lxml
megasdkrestclient
mediainfo
pillow
psutil
psycopg2-binary
pybase64
pyrogram
python-dotenv
python-magic
python-telegram-bot
qbittorrent-api
requests
speedtest-cli
selenium
telegraph
tenacity
tgCrypto
urllib3
xattr
yt-dlp
waybackpy
1 change: 1 addition & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python3 update.py && python3 -m bot
67 changes: 67 additions & 0 deletions update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
from logging import FileHandler, StreamHandler, INFO, basicConfig, error as log_error, info as log_info
from os import path as ospath, environ, execl as osexecl
from subprocess import run as srun
from requests import get as rget
from dotenv import load_dotenv
from sys import executable

if ospath.exists('log.txt'):
with open('log.txt', 'r+') as f:
f.truncate(0)

basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=[FileHandler('log.txt'), StreamHandler()],
level=INFO)

CONFIG_FILE_URL = environ.get('CONFIG_FILE_URL')
try:
if len(CONFIG_FILE_URL) == 0:
raise TypeError
try:
res = rget(CONFIG_FILE_URL)
if res.status_code == 200:
with open('config.env', 'wb+') as f:
f.write(res.content)
else:
log_error(f"Failed to download config.env {res.status_code}")
except Exception as e:
log_error(f"CONFIG_FILE_URL: {e}")
except:
pass

load_dotenv('config.env', override=True)

UPSTREAM_REPO = environ.get('UPSTREAM_REPO')
UPSTREAM_BRANCH = environ.get('UPSTREAM_BRANCH')
try:
if len(UPSTREAM_REPO) == 0:
raise TypeError
except:
UPSTREAM_REPO = "https://github.com/weebzone/WZML"
try:
if len(UPSTREAM_BRANCH) == 0:
raise TypeError
except:
UPSTREAM_BRANCH = 'update'

if ospath.exists('.git'):
srun(["rm", "-rf", ".git"])

update = srun([f"git init -q \
&& git config --global user.email [email protected] \
&& git config --global user.name Karan \
&& git add . \
&& git commit -sm update -q \
&& git remote add origin {UPSTREAM_REPO} \
&& git fetch origin -q \
&& git reset --hard origin/{UPSTREAM_BRANCH} -q"], shell=True)

if update.returncode == 0:
log_info('Successfully updated with latest commit from UPSTREAM_REPO')
log_info(f'Upstream Repo: {UPSTREAM_REPO}')
log_info(f'Upstream Branch: {UPSTREAM_BRANCH}')
else:
log_error('Something went wrong while updating, check UPSTREAM_REPO if valid or not!')
log_info(f'Entered Upstream Repo: {UPSTREAM_REPO}')
log_info(f'Entered Upstream Branch: {UPSTREAM_BRANCH}')

0 comments on commit 50bebab

Please sign in to comment.