import threading
import bot


def application(environ, start_response):
    status = "200 OK"

    response = (
        "QOTD Discord Bot is running."
    ).encode("utf-8")

    headers = [
        ("Content-Type", "text/plain"),
        ("Content-Length", str(len(response)))
    ]

    start_response(status, headers)

    return [response]


def start_bot():
    bot.start_bot()


threading.Thread(
    target=start_bot,
    daemon=True
).start()
