Skip to content

Commit f5e77a1

Browse files
committed
added .env support
1 parent aeb9a9e commit f5e77a1

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Telegram bot to stream videos in telegram voicechat for both groups and channels
6565
git clone https://github.com/subinps/VCPlayerBot
6666
cd VCPlayerBot
6767
pip3 install -r requirements.txt
68-
# <Create Variables appropriately>
68+
# <Create Variables appropriately (.env [optional])>
6969
python3 main.py
7070
```
7171

config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
try:
1818
import os
1919
import heroku3
20+
from dotenv import load_dotenv
2021
from ast import literal_eval as is_enabled
2122
from pytgcalls.types.input_stream.quality import (
2223
HighQualityVideo,
@@ -38,6 +39,7 @@
3839

3940
class Config:
4041
#Telegram API Stuffs
42+
load_dotenv() # load enviroment variables from .env file
4143
ADMIN = os.environ.get("ADMINS", '')
4244
SUDO = [int(admin) for admin in (ADMIN).split()] # Exclusive for heroku vars configuration.
4345
ADMINS = [int(admin) for admin in (ADMIN).split()] #group admins will be appended to this list.

env.sample

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
API_ID = 12345
2+
API_HASH = 0123456789abcdef0123456789abcdef
3+
BOT_TOKEN = 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
4+
SESSION_STRING = ABC-DEF1234ghIkl-zyx57W2v1u123ew11_ABC-DEF1234ghIkl-zyx57W2v1u123ew11
5+
CHAT = -10012345678
6+
ADMINS = "1234567890 9876543210"

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ pillow
1111
motor
1212
dnspython
1313
pytz
14-
apscheduler
14+
apscheduler
15+
python-dotenv

0 commit comments

Comments
 (0)