Fix workflows & apps sending to channel, slack you're inconsistent in a bad way.

This commit is contained in:
Firepup Sixfifty 2024-12-14 23:00:03 -06:00
parent d9ec6e5a3f
commit 49a4a4f780
Signed by: Firepup650
SSH key fingerprint: SHA256:cb8sEJwc0kQJ6/nMUhscWRe35itf0NFMdSKl3v4qt48

12
main.py
View file

@ -107,6 +107,18 @@ if __name__ == "__main__":
"[INFO] Building messages, this might take a little bit..."
)
for i in range(len(messages)):
if not messages[i].get("user") and messages[i].get(
"username"
): # Workflows don't have a userid, obviously
messages[i][
"user"
] = f'{messages[i].get("username")}|WORKFLOW'
if not messages[i].get("user") and messages[i].get(
"subtype"
): # Apps sending to channel also don't...
messages[i]["user"] = messages[i]["root"][
"user"
] # This is probably technically wrong, but I don't care.
label = f'[{messages[i]["ts"]}] <@{messages[i]["user"]}>: {messages[i]["text"]}'
for user in userMappings:
label = label.replace(user, userMappings[user])