Skip to content

Commit

Permalink
send slack message only when slack token exists
Browse files Browse the repository at this point in the history
  • Loading branch information
area363 committed Mar 15, 2024
1 parent de4b823 commit f5d1af5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scripts/app/test_internal_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ async def process_block(blocks):
# Increment the offset for the next query
offset += current_limit

# The URL you want to send the data to
url = f'https://planetariumhq.slack.com/services/hooks/slackbot?token={config.slack_token}&channel=%23{config.slack_channel}'
data = f"[9C-INFRA] Finished testing `{network}` network from `#{original_offset}` to `#{tip_index}`."
headers = {'Content-Type': 'text/plain'}
response = requests.post(url, data=data, headers=headers)
if hasattr(config, 'slack_token') and config.slack_token:
url = f'https://planetariumhq.slack.com/services/hooks/slackbot?token={config.slack_token}&channel=%23{config.slack_channel}'
data = f"[9C-INFRA] Finished testing `{network}` network from `#{original_offset}` to `#{tip_index}`."
headers = {'Content-Type': 'text/plain'}
response = requests.post(url, data=data, headers=headers)

0 comments on commit f5d1af5

Please sign in to comment.