Ignore messages with "None" for the content
This commit is contained in:
parent
a9c0ad06ec
commit
5da2c725f1
1 changed files with 20 additions and 19 deletions
|
|
@ -69,27 +69,28 @@ def listen_for_notifications(host="signal-cli", port=7583):
|
|||
source = envelope["source"]
|
||||
if "dataMessage" in envelope:
|
||||
msg = envelope["dataMessage"]["message"] # there are non-message messages, like read receipts
|
||||
if "groupInfo" in envelope["dataMessage"]:
|
||||
group_id = envelope["dataMessage"]["groupInfo"]["groupId"]
|
||||
if group_id not in SIGNAL_GROUP_ALLOWLIST:
|
||||
print(f"GROUP RECV DENIED ({source}): {envelope}")
|
||||
break
|
||||
print(f"GROUP ({group_id}/{source}): {msg}")
|
||||
params = { "recipient": group_id, "groupId": group_id }
|
||||
else:
|
||||
if source not in SIGNAL_USER_ALLOWLIST:
|
||||
print(f"RECV DENIED ({source}): {envelope}")
|
||||
break
|
||||
if msg is not None:
|
||||
if "groupInfo" in envelope["dataMessage"]:
|
||||
group_id = envelope["dataMessage"]["groupInfo"]["groupId"]
|
||||
if group_id not in SIGNAL_GROUP_ALLOWLIST:
|
||||
print(f"GROUP RECV DENIED ({source}): {envelope}")
|
||||
break
|
||||
print(f"GROUP ({group_id}/{source}): {msg}")
|
||||
params = { "recipient": group_id, "groupId": group_id }
|
||||
else:
|
||||
if source not in SIGNAL_USER_ALLOWLIST:
|
||||
print(f"RECV DENIED ({source}): {envelope}")
|
||||
break
|
||||
|
||||
print(f"RECV ({source}): {msg}")
|
||||
params = { "recipient": source }
|
||||
print(f"RECV ({source}): {msg}")
|
||||
params = { "recipient": source }
|
||||
|
||||
params["message"] = process_message(msg)
|
||||
print("PARAMS:",params)
|
||||
result = send_json_rpc(
|
||||
method="send",
|
||||
params=params
|
||||
)
|
||||
params["message"] = process_message(msg)
|
||||
print("PARAMS:",params)
|
||||
result = send_json_rpc(
|
||||
method="send",
|
||||
params=params
|
||||
)
|
||||
except json.JSONDecodeError:
|
||||
print("Invalid JSON:", line)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue