-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmessageBuilder.js
More file actions
47 lines (36 loc) · 1.4 KB
/
Copy pathmessageBuilder.js
File metadata and controls
47 lines (36 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const {divider, header, textAndImage} = require('./messageBlocks')
function bodyText(durationInMillis, estimatedDurationInMillis) {
const progressPorcentage = durationInMillis/ estimatedDurationInMillis;
const roundPorcentage = Math.floor(progressPorcentage*100);
const blackSquares = Math.floor(progressPorcentage*10);
const progressBar = '⬛'.repeat(blackSquares)+'⬜'.repeat(10-blackSquares);
const durationInSeconds = durationInMillis*1000;
const estimatedDurationInSeconds = estimatedDurationInMillis *1000;
const text ="batatinha";
//const text = `*progress* \n ${progressBar} *${roundPorcentage}* \n` +
// `${durationInSeconds}s of `
//console.log(textAndImage)
return text;
}
function batatinha(){
return "asdf"
}
async function buildMessage(pipelines){
message = [];
pipelines.forEach(pipeline=> {
//pipeline = pipelines[0];
const {fullDisplayName, weatherScore, latestRun} = pipeline;
const {durationInMillis, estimatedDurationInMillis, state, changeSet} = latestRun|| {};
//const text = bodyText(durationInMillis, estimatedDurationInMillis);
//console.log(text)
//console.log(text)
message = [...message,
header(fullDisplayName),
textAndImage('bodyText', "https://s3-media3.fl.yelpcdn.com/bphoto/c7ed05m9lC2EmA3Aruue7A/o.jpg", "altTextForImage"),
divider(),
];
//console.log(message);
})
return message;
}
module.exports = { buildMessage };