forked from MrMissx/Telegram_Forwarder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
38 lines (27 loc) · 886 Bytes
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import logging
import json
from os import getenv, path
from dotenv import load_dotenv
from telegram.ext import ApplicationBuilder
from forwarder.utils import get_source
load_dotenv(".env")
logging.basicConfig(
format="[ %(asctime)s: %(levelname)-8s ] %(name)-20s - %(message)s",
level=logging.INFO,
)
LOGGER = logging.getLogger(__name__)
# load json file
config_name = "chat_list.json"
if not path.isfile(config_name):
LOGGER.error("No chat_list.json config file found! Exiting...")
exit(1)
with open(config_name, "r") as data:
CONFIG = json.load(data)
SOURCE_CHAT = get_source(CONFIG)
BOT_TOKEN = getenv("BOT_TOKEN")
if not BOT_TOKEN:
LOGGER.error("No BOT_TOKEN token provided!")
exit(1)
OWNER_ID = int(getenv("OWNER_ID", "0"))
REMOVE_TAG = getenv("REMOVE_TAG", "False") in {"true", "True", 1}
bot = ApplicationBuilder().token(BOT_TOKEN).build()