Use separate slack channel for inventory messages

This commit is contained in:
2023-11-14 05:45:17 +02:00
parent a4b92f8008
commit 24bc46e098
4 changed files with 17 additions and 5 deletions

View File

@@ -93,11 +93,15 @@ def flatten(d, parent_key='', sep='.'):
items.append((new_key, v))
return dict(items)
def spam(msg):
def spam(msg, channel="doorboy"):
if devenv:
print(msg)
print(f"{channel}: {msg}")
else:
url = const.SLACK_DOORLOG_CALLBACK
urls = {
"doorboy": const.SLACK_DOORLOG_CALLBACK,
"inventory": const.SLACK_INVENTORY_CALLBACK
}
url = urls.get(channel, const.SLACK_DOORLOG_CALLBACK)
requests.post(url, json={"text": msg })
def build_query(base_query, fields=[], sort_fields={}):