-
Notifications
You must be signed in to change notification settings - Fork 14
/
setup.py
32 lines (23 loc) · 948 Bytes
/
setup.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
import logging
import os
import telebot
import tg_logger
from flask import Flask
# ------------- bot -------------
bot = telebot.TeleBot(os.environ.get('BOT_TOKEN'))
# ------------- flask app -------------
app = Flask(__name__)
# ------------- logging -------------
logger = logging.getLogger("tg-bot-template")
alpha_logger = logging.getLogger()
alpha_logger.setLevel(logging.INFO)
app.logger.setLevel(logging.ERROR)
telebot.logger.setLevel(logging.ERROR)
users = [int(os.environ.get("ADMIN_ID"))]
if os.environ.get("LOG_BOT_TOKEN", '') != '':
tg_logger.setup(alpha_logger, token=os.environ.get("LOG_BOT_TOKEN"), users=users)
tg_logger.setup(app.logger, token=os.environ.get("LOG_BOT_TOKEN"), users=users)
tg_logger.setup(telebot.logger, token=os.environ.get("LOG_BOT_TOKEN"), users=users)
# ------------- webhook -------------
ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD')
WEBHOOK_TOKEN = os.environ.get('WEBHOOK_TOKEN')