Skip to content

Commit 05ee0d0

Browse files
committed
TASK: Optimize config import
1 parent 722031f commit 05ee0d0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

main.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from telegram.inline.inlinekeyboardbutton import InlineKeyboardButton
1212
from telegram.inline.inlinekeyboardmarkup import InlineKeyboardMarkup
1313

14-
from config import BOT_TOKEN, USE_WEBHOOK, WEBHOOK_PORT, WEBHOOK_URL, CERTPATH
14+
import config
1515
from database.db_wrapper import DBwrapper
1616
from database.statistics import get_user_stats
1717
from game.blackJackGame import BlackJackGame
@@ -34,11 +34,11 @@
3434
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO,
3535
handlers=[logfile_handler])
3636

37-
if not re.match(r"[0-9]+:[a-zA-Z0-9\-_]+", BOT_TOKEN):
37+
if not re.match(r"[0-9]+:[a-zA-Z0-9\-_]+", config.BOT_TOKEN):
3838
logging.error("Bot token not correct - please check.")
3939
exit(1)
4040

41-
updater = Updater(token=BOT_TOKEN, use_context=True)
41+
updater = Updater(token=config.BOT_TOKEN, use_context=True)
4242
dispatcher = updater.dispatcher
4343

4444
game_handler = GameHandler().get_instance()
@@ -481,9 +481,9 @@ def restart(update, context):
481481

482482
dispatcher.add_error_handler(error_callback)
483483

484-
if USE_WEBHOOK:
485-
updater.start_webhook(listen="127.0.0.1", port=WEBHOOK_PORT, url_path=BOT_TOKEN, cert=CERTPATH, webhook_url=WEBHOOK_URL)
486-
updater.bot.set_webhook(WEBHOOK_URL)
484+
if config.USE_WEBHOOK:
485+
updater.start_webhook(listen="127.0.0.1", port=config.WEBHOOK_PORT, url_path=config.BOT_TOKEN, cert=config.CERTPATH, webhook_url=config.WEBHOOK_URL)
486+
updater.bot.set_webhook(config.WEBHOOK_URL)
487487
logger.info("Started webhook server!")
488488
else:
489489
updater.start_polling()

0 commit comments

Comments
 (0)