From 9b575219ca9aed786dd7e8210fad33eff423f532 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Mon, 21 Jun 2021 17:28:00 +0100 Subject: [PATCH] use main --- app.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app.py b/app.py index d4e41a3..5612b33 100644 --- a/app.py +++ b/app.py @@ -38,12 +38,6 @@ load_dotenv() # load env vars from .env file token = getenv("TOKEN") - -if not token: - print("Could not load environmental variables. Make sure TOKEN is set in .env") - exit(0) - - bot = discum.Client(token=token, log=False) ######################################## @@ -154,5 +148,15 @@ def on_message(resp): check_urls(urls) -print("Initialized.") -bot.gateway.run(auto_reconnect=True) +def main(): + if not token: + print("Could not load environmental variables. Make sure TOKEN is set in .env") + exit(0) + + print("Initialized.") + + bot.gateway.run(auto_reconnect=True) + +if __name__ == "__main__": + main() +