diff --git a/bot.py b/bot.py index 4f21cf5..1dd91d4 100644 --- a/bot.py +++ b/bot.py @@ -44,10 +44,8 @@ import yt_dlp from spotify_dl import spotify from spotify_dl import youtube as youtube_download -import communication_subroutine +from communication_subroutine import comm_subroutine, IN_COMM_Q, OUT_COMM_Q -OUT_COMM_Q = Queue() -IN_COMM_Q = Queue() Music_Config = TypedDict( "Music_Config", @@ -685,7 +683,7 @@ async def check_data_q(): channel = client.get_channel(1062047367337095268) try: data = IN_COMM_Q.get(block=False) - await channel.send("O. A tak będzie wyglądało coś ciekawego w przyszłości: {data}") + await channel.send(f"O. A tak będzie wyglądało coś ciekawego w przyszłości: {data}") except Empty: pass @@ -2229,7 +2227,7 @@ if __name__ == "__main__": logger.info("Starting discord bot") threads = [] threads.append(threading.Thread(target=client.run, args=(TOKEN,))) - #threads.append(threading.Thread(target=communication_subroutine.comm_subroutine, args=(OUT_COMM_Q,IN_COMM_Q))) + #threads.append(threading.Thread(target=comm_subroutine, args=(OUT_COMM_Q,IN_COMM_Q))) for worker in threads: worker.start() for worker in threads: diff --git a/communication_subroutine.py b/communication_subroutine.py index c254ee3..0e56c47 100644 --- a/communication_subroutine.py +++ b/communication_subroutine.py @@ -1,13 +1,14 @@ import logging import threading import json - +from queue import Queue from flask import Flask, jsonify, request from waitress import serve -from bot import IN_COMM_Q, OUT_COMM_Q HOST_ADDRESS = "192.168.1.191" PORT_ADDRESS = 5000 +OUT_COMM_Q = Queue() +IN_COMM_Q = Queue() app = Flask(__name__)