1
0
Fork 0

Add link to etherscan in block notifications

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2021-01-26 07:46:04 +01:00
parent 1f621be8be
commit 79397e2eb6
No known key found for this signature in database
GPG key ID: FF42D23B580C89F7
3 changed files with 6 additions and 4 deletions

View file

@ -16,6 +16,7 @@ class LastBlock:
self._exchange_rate = exchange_rate
self._currency = currency
block = self.get_last_block()
self.hash = block.hash
self.number = block.number
self.time = block.time
self.raw_reward = block.total_rewards

View file

@ -48,7 +48,7 @@ def watch_block(config, disable_notifications, last_block=None, exchange_rate=No
if not disable_notifications and config.get('telegram'):
logger.debug('sending block notification to telegram')
variables = {'number': block.number, 'time': block.time, 'reward': block.reward,
variables = {'hash': block.hash, 'number': block.number, 'time': block.time, 'reward': block.reward,
'reward_fiat': block.reward_fiat, 'round_time': block.round_time, 'luck': block.luck}
payload = telegram.create_block_payload(chat_id=config['telegram']['chat_id'], message_variables=variables)
try:
@ -56,7 +56,7 @@ def watch_block(config, disable_notifications, last_block=None, exchange_rate=No
logger.info('block notification sent to telegram')
except HTTPError as err:
logger.error('failed to send notification to telegram')
logger.debug(str(err))
logger.exception(err)
return block

View file

@ -1,6 +1,7 @@
*⛏️ New block {{number}}*
*⛏️ New block*
*Date/Time*: {{time}}
*Number*: [{{number}}](https://etherscan.io/block/{{hash}})
*Reward*: {{reward}} {% if reward_fiat != 'None' %}\({{reward_fiat}}\){% endif %}
*Date/Time*: {{time}}
*Round time*: {{round_time}}
*Luck*: {{luck}}