Skip to content

Commit

Permalink
Merge pull request #46 from turbofart/latest
Browse files Browse the repository at this point in the history
Moved link formatting to the variable declaration.
  • Loading branch information
co8 authored Feb 24, 2022
2 parents f296a60 + fb496e3 commit 307277a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions hds.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def poc_receipts_v1(activity):
valid_text = "πŸ’© Invalid"
time = nice_date(activity["time"])

txn_link = helium_explorer_tx + activity["hash"]
txn_link = f'[πŸ”Ž](<{helium_explorer_tx}{activity["hash"]}>)'

witnesses = {}
wit_count = 0
Expand All @@ -521,7 +521,7 @@ def poc_receipts_v1(activity):
# challenge accepted
if "challenger" in activity and activity["challenger"] == config["hotspot"]:
output_message.append(
f"🏁 ...Challenged Beaconer, {wit_text} `{time}` [πŸ”Ž](<{txn_link}>)"
f"🏁 ...Challenged Beaconer, {wit_text} `{time}` {txn_link}"
)

# beacon sent
Expand All @@ -540,7 +540,7 @@ def poc_receipts_v1(activity):
if valid_wit_count == len(witnesses):
valid_wit_count = "All"
msg += f", {valid_wit_count} Valid"
msg += f" `{time}` [πŸ”Ž](<{txn_link}>)"
msg += f" `{time}` {txn_link}"

output_message.append(msg)

Expand Down Expand Up @@ -570,14 +570,14 @@ def poc_receipts_v1(activity):
witness_info += f", {vw} Valid"

output_message.append(
f"{valid_text} Witness{witness_info} `{time}` [πŸ”Ž](<{txn_link}>)"
f"{valid_text} Witness{witness_info} `{time}` {txn_link}"
)

# other
else:
ac_type = activity["type"]
output_message.append(
f"🏁 poc_receipts_v1 - {ac_type.upper()} `{time}` [πŸ”Ž](<{txn_link}>)"
f"🏁 poc_receipts_v1 - {ac_type.upper()} `{time}` {txn_link}"
)


Expand All @@ -603,28 +603,28 @@ def loop_activities():
# activity time
time = nice_date(activity["time"])

txn_link = helium_explorer_tx + activity["hash"]
txn_link = f'[πŸ”Ž](<{helium_explorer_tx}{activity["hash"]}>)'

# reward
if activity["type"] == "rewards_v2":
for reward in activity["rewards"]:
rew = reward_short_name(reward["type"])
amt = nice_hnt_amount_or_seconds(reward["amount"])
output_message.append(
f"πŸͺ Reward πŸ₯“{amt}, {rew} `{time}` [πŸ”Ž](<{txn_link}>)"
f"πŸͺ Reward πŸ₯“{amt}, {rew} `{time}` {txn_link}"
)
# transferred data
elif activity["type"] == "state_channel_close_v1":
for summary in activity["state_channel"]["summaries"]:
packet_plural = "s" if summary["num_packets"] != 1 else ""
output_message.append(
f"πŸš› Transferred {summary['num_packets']} Packet{packet_plural} ({summary['num_dcs']} DC) `{time}` [πŸ”Ž](<{txn_link}>)"
f"πŸš› Transferred {summary['num_packets']} Packet{packet_plural} ({summary['num_dcs']} DC) `{time}` {txn_link}"
)

# ...challenge accepted
elif activity["type"] == "poc_request_v1":
output_message.append(
f"🎲 Created Challenge... `{time}` [πŸ”Ž](<{txn_link}>)"
f"🎲 Created Challenge... `{time}` {txn_link}"
)

# beacon sent, valid witness, invalid witness
Expand All @@ -635,7 +635,7 @@ def loop_activities():
else:
other_type = activity["type"]
output_message.append(
f"πŸš€ {other_type.upper()} `{time}` [πŸ”Ž](<{txn_link}>)"
f"πŸš€ {other_type.upper()} `{time}` {txn_link}"
)


Expand Down

0 comments on commit 307277a

Please sign in to comment.