mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-18 07:42:09 +00:00
Work on communication
Testing only FIx test
This commit is contained in:
@@ -685,7 +685,8 @@ async def check_data_q():
|
|||||||
channel = client.get_channel(1062047367337095268)
|
channel = client.get_channel(1062047367337095268)
|
||||||
try:
|
try:
|
||||||
data = IN_COMM_Q.get(block=False)
|
data = IN_COMM_Q.get(block=False)
|
||||||
await channel.send(f"O. A tak będzie wyglądało coś ciekawego w przyszłości: {data}")
|
if data.finished:
|
||||||
|
await channel.send(f"O. A tak będzie wyglądało coś ciekawego w przyszłości: {data}")
|
||||||
except Empty:
|
except Empty:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -2110,7 +2111,10 @@ class DoSearchView(discord.ui.View):
|
|||||||
)
|
)
|
||||||
async def wyszukaj_linki_do_dokumentow(ctx):
|
async def wyszukaj_linki_do_dokumentow(ctx):
|
||||||
query = ctx.message.content
|
query = ctx.message.content
|
||||||
query_uuid = uuid.uuid4()
|
#TODO: TESTING ONLY!!
|
||||||
|
#query_uuid = uuid.uuid4()
|
||||||
|
query_uuid = uuid.UUID('{12345678-1234-5678-1234-567812345678}')
|
||||||
|
|
||||||
# query_uuid = "test"
|
# query_uuid = "test"
|
||||||
# 3 wyslij Librariana
|
# 3 wyslij Librariana
|
||||||
json_query = {"UUID": str(query_uuid), "query": str(query)[30:], "page": 1}
|
json_query = {"UUID": str(query_uuid), "query": str(query)[30:], "page": 1}
|
||||||
|
|||||||
@@ -14,18 +14,18 @@ app = Flask(__name__)
|
|||||||
|
|
||||||
@app.route("/conjurer", methods=["POST"])
|
@app.route("/conjurer", methods=["POST"])
|
||||||
def answer_external_command():
|
def answer_external_command():
|
||||||
|
app.logger.info(request)
|
||||||
record = json.loads(request.data)
|
record = json.loads(request.data)
|
||||||
app.logger.info(record)
|
app.logger.info(record)
|
||||||
app.logger.info("DATA RECEIVED")
|
app.logger.info("DATA RECEIVED")
|
||||||
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
q_data = internal_q.get(block=False)
|
q_data = internal_q.get(block=False)
|
||||||
except Empty:
|
except Empty:
|
||||||
break
|
break
|
||||||
if q_data.uuid in record:
|
if q_data.uuid in record:
|
||||||
pass
|
q_data.stop = True
|
||||||
|
IN_COMM_Q.put(q_data)
|
||||||
|
|
||||||
return jsonify("SUCCESS")
|
return jsonify("SUCCESS")
|
||||||
|
|
||||||
@@ -56,7 +56,6 @@ def scan_queue(_logger):
|
|||||||
data = OUT_COMM_Q.get()
|
data = OUT_COMM_Q.get()
|
||||||
_logger.info(data)
|
_logger.info(data)
|
||||||
internal_q.put(data)
|
internal_q.put(data)
|
||||||
query_list.append(data)
|
|
||||||
|
|
||||||
def comm_subroutine(logger):
|
def comm_subroutine(logger):
|
||||||
#logger.setLevel(logging.DEBUG)
|
#logger.setLevel(logging.DEBUG)
|
||||||
|
|||||||
Reference in New Issue
Block a user