Add config.py functionality to load api_id, api_hash and bot_token
This commit is contained in:
parent
b16691895f
commit
636abbd606
|
@ -2,3 +2,5 @@
|
||||||
*.session-journal
|
*.session-journal
|
||||||
downalods/*
|
downalods/*
|
||||||
output/*
|
output/*
|
||||||
|
config.py
|
||||||
|
__pycache__
|
|
@ -6,6 +6,6 @@ RUN apk add --no-cache --virtual temporary python3-dev py3-pip gcc libc-dev && p
|
||||||
WORKDIR /2pdf
|
WORKDIR /2pdf
|
||||||
|
|
||||||
COPY main.py /2pdf/
|
COPY main.py /2pdf/
|
||||||
COPY 2pdf.session /2pdf/
|
COPY config.py /2pdf/
|
||||||
|
|
||||||
CMD ["python", "main.py"]
|
CMD ["python", "main.py"]
|
|
@ -7,6 +7,8 @@ The unoserver dependency is entirely optional - however it improves theoretical
|
||||||
```console
|
```console
|
||||||
git clone https://git.darkn.space/neko/tg2pdf.git
|
git clone https://git.darkn.space/neko/tg2pdf.git
|
||||||
cd tg2pdf
|
cd tg2pdf
|
||||||
|
cp config.py.example config.py
|
||||||
|
nano config.py
|
||||||
podman build -t tg2pdf .
|
podman build -t tg2pdf .
|
||||||
podman run --name tg2pdf -d tg2pdf:latest
|
podman run --name tg2pdf -d tg2pdf:latest
|
||||||
```
|
```
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
API_ID = ""
|
||||||
|
API_HASH = ""
|
||||||
|
BOT_TOKEN = ""
|
19
main.py
19
main.py
|
@ -6,16 +6,15 @@ from pathlib import Path
|
||||||
import shutil
|
import shutil
|
||||||
import time
|
import time
|
||||||
|
|
||||||
# api_id =
|
import config # import settings from config.py
|
||||||
#api_hash = ""
|
api_id = config.API_ID
|
||||||
#bot_token = ""
|
api_hash = config.API_HASH
|
||||||
# app = Client(
|
bot_token = config.BOT_TOKEN
|
||||||
# "2pdf",
|
app = Client(
|
||||||
# api_id=api_id, api_hash=api_hash,
|
"2pdf",
|
||||||
# bot_token=bot_token
|
api_id=api_id, api_hash=api_hash,
|
||||||
# )
|
bot_token=bot_token
|
||||||
|
)
|
||||||
app = Client("2pdf")
|
|
||||||
|
|
||||||
def validDocument(mime_type):
|
def validDocument(mime_type):
|
||||||
valid_mime_types = [
|
valid_mime_types = [
|
||||||
|
|
Loading…
Reference in New Issue