Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
madboy482 authored Feb 15, 2021
1 parent c50f593 commit b6d6ec2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions SaitamaRobot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import telegram.ext as tg
from telethon import TelegramClient
from redis import StrictRedis

StartTime = time.time()

Expand Down Expand Up @@ -87,6 +88,7 @@
SUPPORT_CHAT = os.environ.get('SUPPORT_CHAT', None)
SPAMWATCH_SUPPORT_CHAT = os.environ.get('SPAMWATCH_SUPPORT_CHAT', None)
SPAMWATCH_API = os.environ.get('SPAMWATCH_API', None)
REDIS_URL = os.environ.get('REDIS_URL', None)

try:
BL_CHATS = set(int(x) for x in os.environ.get('BL_CHATS', "").split())
Expand Down Expand Up @@ -181,6 +183,14 @@
DEMONS = list(DEMONS)
TIGERS = list(TIGERS)

REDIS = StrictRedis.from_url(REDIS_URL,decode_responses=True)
try:
REDIS.ping()
LOGGER.info("Your redis server is now alive!")
except BaseException:
raise Exception("Your redis server is not alive, please check again...")


# Load at end to ensure all prev variables have been set
from SaitamaRobot.modules.helper_funcs.handlers import (CustomCommandHandler,
CustomMessageHandler,
Expand Down

0 comments on commit b6d6ec2

Please sign in to comment.