From 55fc5cc16facf6427f6c27313b6dba9c6e1b5188 Mon Sep 17 00:00:00 2001 From: Migatu Date: Tue, 9 Apr 2024 01:06:03 +0200 Subject: [PATCH] FIx att 4 --- bot.py | 8 +++++++- communication_subroutine.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index 1075378..1784ee1 100644 --- a/bot.py +++ b/bot.py @@ -44,6 +44,8 @@ import yt_dlp from spotify_dl import spotify from spotify_dl import youtube as youtube_download +import communication_subroutine + COMM_Q = Queue() Music_Config = TypedDict( "Music_Config", @@ -2218,7 +2220,11 @@ if __name__ == "__main__": logger.info("Starting discord bot") threads = [] threads.append(threading.Thread(target=client.run, args=(TOKEN,))) - + communication_subroutine.comm_subroutine() + for worker in threads: + worker.start() + for worker in threads: + worker.join() # widok - generuje się 5 stron po 4 linki # odśwież - zamienić na "dalej" - zaciąga kolejne 20 rezultatów diff --git a/communication_subroutine.py b/communication_subroutine.py index 846c000..9285988 100644 --- a/communication_subroutine.py +++ b/communication_subroutine.py @@ -51,7 +51,7 @@ def waitress_run(_logger): _logger.info("Attempt waitress") serve(app, host=HOST_ADDRESS, port=PORT_ADDRESS) -if __name__ == "__main__": +def comm_subroutine(): logger = logging.getLogger('conjurer_musician') logger.setLevel(logging.DEBUG) logger.info("Started")