diff --git a/Dockerfile b/Dockerfile index c1bfe0a..cb4451c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,9 @@ -# Use an official Python runtime as a parent image -FROM python:3.7-slim +FROM python:3.9-slim -# Set the working directory to /app WORKDIR /app -# Copy the current directory contents into the container at /app COPY . /app -# Install any needed packages specified in requirements.txt RUN pip install --trusted-host pypi.python.org -r /app/requirements.txt -# Define environment variable -ENV TOKEN X -# Run app.py when the container launches CMD ["python", "-u", "SlashBot.py"] \ No newline at end of file diff --git a/SlashBot.py b/SlashBot.py index 3d56f60..4ef9b8f 100644 --- a/SlashBot.py +++ b/SlashBot.py @@ -13,12 +13,11 @@ escaping = ('\\ ', '\\ ') markdownEscape = lambda s: s.replace("_", "\\_").replace("*", "\\*").replace("[", "\\[").replace("`", "\\`") # Docker env -if os.environ.get('TOKEN') and os.environ['TOKEN'] != 'X': - Token = os.environ['TOKEN'] -else: +Token = os.environ.get('TOKEN') +if not Token: raise Exception('no token') -if os.environ.get('PROXY') and os.environ['PROXY'] != 'X': +if os.environ.get('PROXY'): telegram_proxy = os.environ['PROXY'] requests_proxies = {'all': os.environ['PROXY']} else: