Verified Commit eba32d5c authored by Mroik's avatar Mroik
Browse files

Small fixes

parent f889c5fc
FROM python:3.9.7-slim
COPY requirements.txt /
RUN pip install -r requirements.txt
RUN mkdir bits-tgbot
COPY . /bits-tgbot/
WORKDIR /bits-tgbot
RUN pip install -r requirements.txt
ENTRYPOINT ["python", "main.py"]
......@@ -9,6 +9,8 @@ TG_KEY = environ.get("BITS_TG_KEY", default="")
ADMIN_CHANNELS_FULL = [] # Channels that are allowed to change HQ's status
ADMIN_CHANNELS_PRIV = [] # Channels that are allowed to change HQ's status
DEBUG = environ.get("DEBUG", default=None)
for chan in environ.get("BITS_TG_GROUPS_FULL", default="").split(":"):
ADMIN_CHANNELS_FULL.append(chan)
for chan in environ.get("BITS_TG_GROUPS_PRIV", default="").split(":"):
......
......@@ -7,13 +7,15 @@ from config import (
PORT,
USERNAME,
PASSWORD,
DEBUG,
)
LOGGER = logging.getLogger(__name__)
def main():
logging.basicConfig(level=logging.DEBUG) # Uncomment for DUBUG
if DEBUG:
logging.basicConfig(level=logging.DEBUG)
mt.bot = Bot(SERVER, PORT)
mt.bot.start(USERNAME, PASSWORD)
......
......@@ -25,7 +25,6 @@ def on_message(client, userdata, msg):
payload = json.loads(msg.payload.decode("utf-8"))
if msg.topic != "sede/status":
return
return
if payload["status"] == OPEN:
for id_ in where_am_i:
updater.bot.send_message(id_, "🟢🟢 Il POuL è aperto! 🟢🟢")
......
......@@ -50,9 +50,11 @@ def check_debounce():
def set_open(update: Update, context: CallbackContext):
set_status(True, update, context)
def set_closed(update: Update, context: CallbackContext):
set_status(False, update, context)
def set_status(status: bool, update: Update, context: CallbackContext):
LOGGER.debug(f"Trying to set status to {status}")
if check_debounce():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment