Fix send message logic and tweak context queries for private messages
This commit is contained in:
@@ -30,7 +30,25 @@ def construct_query(index, net, channel, src, num, size, type=None, nicks=None):
|
||||
if {"match": {"channel": channel}} in extra_must:
|
||||
extra_must.remove({"match": {"channel": channel}})
|
||||
extra_should2 = []
|
||||
extra_must.append({"match": {"type": "znc"}})
|
||||
# Type is one of msg or notice
|
||||
#extra_should.append({"match": {"mtype": "msg"}})
|
||||
#extra_should.append({"match": {"mtype": "notice"}})
|
||||
extra_should.append({"match": {"type": "znc"}})
|
||||
extra_should.append({"match": {"type": "self"}})
|
||||
|
||||
extra_should2.append({"match": {"type": "znc"}})
|
||||
#extra_should2.append({"match": {"channel": channel}})
|
||||
elif type == "auth":
|
||||
if {"match": {"channel": channel}} in extra_must:
|
||||
extra_must.remove({"match": {"channel": channel}})
|
||||
extra_should2 = []
|
||||
extra_should2.append({"match": {"nick": channel}})
|
||||
#extra_should2.append({"match": {"mtype": "msg"}})
|
||||
#extra_should2.append({"match": {"mtype": "notice"}})
|
||||
|
||||
extra_should.append({"match": {"type": "query"}})
|
||||
extra_should2.append({"match": {"type": "self"}})
|
||||
extra_should.append({"match": {"nick": channel}})
|
||||
else:
|
||||
for ctype in types:
|
||||
extra_should.append({"match": {"mtype": ctype}})
|
||||
|
||||
@@ -196,6 +196,7 @@ def send_irc_message(net, num, channel, msg, nick=None):
|
||||
payload = {"msg": msg, "channel": channel}
|
||||
if nick:
|
||||
payload["nick"] = nick
|
||||
print("SEND", payload)
|
||||
messaged = threshold_request(url, payload, method="PUT")
|
||||
return messaged
|
||||
|
||||
@@ -250,3 +251,10 @@ def irc_check_auth(data):
|
||||
payload = data
|
||||
updated = threshold_request(url, payload, method="POST")
|
||||
return updated
|
||||
|
||||
|
||||
def get_irc_sinst(net):
|
||||
url = f"irc/sinst/{net}"
|
||||
payload = {}
|
||||
authentity = threshold_request(url, payload, method="GET")
|
||||
return authentity
|
||||
|
||||
Reference in New Issue
Block a user