Listen to the RegisterVolunteer event on the blockchain and post a message on Discord with this announcement:
Tentative volunteer registered: <USERNAME>, <ETHEREUM_ADDRESS>. Ancestor: <ANCESTOR_USERNAME>, <ANCESTOR_ADDRESS>.
Tx: https://rinkeby.etherscan.io/tx/<TRANSACTION_HASH>
Add event watcher, similar to watching for new registered tasks:
|
function watchTasks (web3, thelaurel, lastBlock, callback, milliseconds) { |
|
console.log('---- monitor watchTasks'); |
|
return watchEvent(web3, thelaurel, 'RegisterTask', lastBlock, callback, milliseconds); |
|
} |
and
|
const unsubscribeTasks = await watchTasks(web3, thelaurel, lastBlock, async (taskEvent) => { |
, for building the data used in the message.
The actual message is formed in the bot.js file, similar to
|
function onTaskEvent (task) { |
|
const etherscanlink = `https://rinkeby.etherscan.io/tx/` + task.transactionHash; |
|
|
|
let msg_discord = `**Task registered by ${task.organizerData} - ${displayLaurelAmount(task.task.amount)} ${task.laurel}** |
|
${task.gitHubIssue ? 'Url: ' + displayIssue(task.gitHubIssue) : 'ID: ' + task.taskid} |
|
Tx: <${etherscanlink}> |
|
` |
|
const msg_twitter = `Task registered by ${task.organizerData} - ${displayLaurelAmount(task.task.amount)} ${task.laurel} |
|
Tx: ${etherscanlink} |
|
${task.gitHubIssue ? 'Url: ' + displayIssueTwitter(task.gitHubIssue) : task.taskid} |
|
` |
|
msg_discord = task.gitHubIssue ? (msg_discord + `Claim Url: <${LINK_CLAIM}&issue=${task.gitHubIssue.number}>`) : msg_discord; |
|
console.log('-----onTaskEvent', msg_discord); |
|
return postMessage(msg_discord, msg_twitter); |
|
} |
Listen to the
RegisterVolunteerevent on the blockchain and post a message on Discord with this announcement:Add event watcher, similar to watching for new registered tasks:
monitoring-bot/src/watch.js
Lines 30 to 33 in 06b6481
and
monitoring-bot/src/watch.js
Line 49 in 06b6481
The actual message is formed in the bot.js file, similar to
monitoring-bot/bot.js
Lines 149 to 163 in 06b6481