Discord Messages
Our messaging system is relying on Discord Webhooks and Embeds. Through every message, the script is sending the following information :
if (self.alert == "test"):
webhook = os.getenv('WEBHOOK_TESTING')
if (self.event_name in ["Transfer"]):
title = "Test Transfer event detected"
content = '<@user-id>' #or <@&role-id>
fields = [{"name": 'Block Number :',
"value": str(f'[{tx["blockNumber"]}](https://etherscan.io/block/{tx["blockNumber"]})'),
"inline": False},
{"name": 'Transfer :', "value": str(formatCurrency(
value / fetchers.getDecimals(self.web3, tx["address"]))) + ' ' + str(
fetchers.getSymbol(self.web3, tx["address"])), "inline": False},
{"name": 'From :',
"value": str(f'[{from_address}](https://etherscan.io/address/{from_address})'),
"inline": False},
{"name": 'To :',
"value": str(f'[{to_address}](https://etherscan.io/address/{to_address})'),
"inline": False},
{"name": 'Transaction :', "value": str(
f'[{tx["transactionHash"]}](https://etherscan.io/tx/{tx["transactionHash"]})'),
"inline": False}]
image = "https://url-to-your-image.jpg"
color = colors.dark_orange
send = True
if send:
sendWebhook(webhook, title, fields, content, image, color)
- content : is the body of the message, we use it to tag specific roles or users would the content of the alert be particularly relevant for them ;
- title : title of the embed content
- fields : those are the different fields available in the embed such as 'amount', 'price', etc.
- color : the tile can be given a color, depending on the content priority
- image : in some cases we add embed content from Dune Analytics to have a trend overview while receiving the alerts
The outcome of the above is a Discord message sent instantly to the corresponding Discord Webhook/Channel, including an embed content, indicators calculated from state variables or contract events, a picture, a color code and optionally a Discord Role tagging :

Last modified 11mo ago