A little bit of verbosity

This commit is contained in:
Firepup Sixfifty 2024-09-11 07:50:42 -05:00
parent 65717b9ad9
commit 80050e3e40
Signed by: Firepup650
SSH key fingerprint: SHA256:cb8sEJwc0kQJ6/nMUhscWRe35itf0NFMdSKl3v4qt48

13
main.py
View file

@ -52,20 +52,21 @@ except ImportError:
users_list.extend(data["members"]) users_list.extend(data["members"])
pages += 1 pages += 1
print( print(
f"[INFO] Pages of users loaded: {pages} (Estimated user count: {len(pages) * 1000}" f"[INFO] Pages of users loaded: {pages} (Estimated user count: {pages}000)"
) )
del pages del pages
print("[INFO] Building user mappings now, this shouldn't take long...") print("[INFO] Building user mappings now, this shouldn't take long...")
#print(users_list[38])
for ( for (
user user
) in ( ) in (
users_list users_list
): # Map user ID mentions to user name mentions, it's nicer when printing messages for thread selection. ): # Map user ID mentions to user name mentions, it's nicer when printing messages for thread selection.
userMappings[f"<@{user['id']}>"] = ( userMappings[f"<@{user['id']}>"] = (
f"<@{user['profile']['display_name_normalized']}>" f"<@{user['profile']['display_name_normalized']}|{user['id']}>"
if user["profile"]["display_name_normalized"] if user["profile"]["display_name_normalized"]
else ( # User is missing a display name for some reason, fallback to real names else ( # User is missing a display name for some reason, fallback to real names
f"<@{user['profile']['real_name_normalized']}>" f"<@{user['profile']['real_name_normalized']}|{user['id']}>"
if user["profile"]["real_name_normalized"] if user["profile"]["real_name_normalized"]
else f"<@{user['id']}>" # User is missing a real name too... Fallback to ID else f"<@{user['id']}>" # User is missing a real name too... Fallback to ID
) )
@ -90,7 +91,7 @@ if __name__ == "__main__":
ts = None ts = None
if thread: if thread:
hasID = ( hasID = (
input("Do you have the TS ID? (y|N))").lower().startswith("y") input("Do you have the TS ID? (y|N)").lower().startswith("y")
) )
if not hasID: if not hasID:
try: try:
@ -150,8 +151,8 @@ if __name__ == "__main__":
"\\n", "\n" "\\n", "\n"
) )
try: try:
client.chat_postMessage(channel=chan, text=msg) ts = client.chat_postMessage(channel=chan, text=msg)['ts']
print("[INFO] Message sent (to the channel)!") print(f"[INFO] Message sent (to the channel)! (TS ID: {ts}")
except Exception as E: except Exception as E:
print("[WARN] Exception:") print("[WARN] Exception:")
for line in format_exc().split("\n")[:-1]: for line in format_exc().split("\n")[:-1]: