@@ -12,26 +12,26 @@ function getNextStreamDate(input, services) {
12
12
13
13
const { allDay, name, start, childEvent } = nextStreamDay ;
14
14
const isHappening = start . isBefore ( moment ( ) ) ;
15
- const startTime = start . fromNow ( ) ;
16
- const link = services . schedule . link ( ) ;
17
15
let scheduleOutput = '' ;
18
16
19
- if ( isHappening ) {
20
- scheduleOutput = allDay
21
- ? `${ name } , an all-day event, is scheduled today. ${ link } `
22
- : `${ name } is currently happening! It started ${ startTime } . ${ link } ` ;
23
-
24
- if ( allDay && childEvent ) {
17
+ if ( isHappening && allDay ) {
18
+ scheduleOutput = `${ name } , an all-day event, is scheduled today.` ;
19
+ if ( childEvent ) {
25
20
const childEventIsHappening = moment ( childEvent . start ) . isBefore ( moment ( ) ) ;
21
+
26
22
// prettier-ignore
27
- scheduleOutput = childEventIsHappening
28
- ? `${ name } , an all-day event, is scheduled today. ${ childEvent . name } is currently happening! It started ${ childEvent . start . fromNow ( ) } . ${ link } `
29
- : `${ name } , an all-day event, is scheduled today. Coming up ${ childEvent . start . fromNow ( ) } is ${ childEvent . name } . ${ link } ` ;
23
+ scheduleOutput + = childEventIsHappening
24
+ ? ` ${ childEvent . name } is currently happening! It started ${ childEvent . start . fromNow ( ) } .`
25
+ : ` Coming up ${ childEvent . start . fromNow ( ) } is ${ childEvent . name } .` ;
30
26
}
27
+ } else if ( isHappening ) {
28
+ scheduleOutput = `${ name } is currently happening! It started ${ start . fromNow ( ) } .` ;
31
29
} else {
32
- scheduleOutput = `${ name } is the next scheduled event. It starts ${ startTime } . ${ link } ` ;
30
+ scheduleOutput = `${ name } is the next scheduled event. It starts ${ start . fromNow ( ) } . ` ;
33
31
}
34
32
33
+ scheduleOutput += ` ${ services . schedule . link ( ) } ` ;
34
+
35
35
return new CommandOutput ( null , scheduleOutput ) ;
36
36
} )
37
37
. catch ( ( err ) => new CommandOutput ( err , "Oops. Something didn't work. Check the logs." ) ) ;
0 commit comments