This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
[string] $dtAPIKey = $ENV:DONETICKAPIKEY
|
[string] $dtAPIKey = $ENV:DONETICKAPIKEY
|
||||||
[string] $appriseWebhookURL = $ENV:APPRISEWEBHOOKURL
|
[string] $appriseWebhookURL = $ENV:APPRISEWEBHOOKURL
|
||||||
[string] $appriseWebhookTag = $ENV:APPRISEWEBHOOKTAG
|
[string] $appriseWebhookTag = $ENV:APPRISEWEBHOOKTAG
|
||||||
|
[int[]] $notificationTimes = $ENV:NOTIFICATIONTIMES | Sort-Object
|
||||||
|
|
||||||
|
|
||||||
function Send-Notification
|
function Send-Notification
|
||||||
@@ -50,6 +51,7 @@ function Get-Chores
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while ($true) {
|
||||||
$today = (Get-Date "23:59:59")
|
$today = (Get-Date "23:59:59")
|
||||||
$chores = Get-Chores
|
$chores = Get-Chores
|
||||||
|
|
||||||
@@ -101,3 +103,19 @@ if ($todaysTasks.Count -ne 0)
|
|||||||
}
|
}
|
||||||
Send-Notification -title "TODAY'S TASKS" -content $content
|
Send-Notification -title "TODAY'S TASKS" -content $content
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Write-Host "Finding next notification time..."
|
||||||
|
foreach($time in $notificationTimes)
|
||||||
|
{
|
||||||
|
$now = Get-Date
|
||||||
|
$diff = $now.Hour - $time
|
||||||
|
if ($diff -lt 0) # next notification time
|
||||||
|
{
|
||||||
|
Write-Host "Next notification time is $time`:00"
|
||||||
|
$sleepTime = ($diff * -1) * 60
|
||||||
|
Write-Host "Sleeping for $sleepTime seconds"
|
||||||
|
Start-Sleep -Seconds $sleepTime
|
||||||
|
continue # leave loop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,3 +10,4 @@ services:
|
|||||||
- DONETICKAPIKEY=adminpass # donetick API key
|
- DONETICKAPIKEY=adminpass # donetick API key
|
||||||
- APPRISEWEBHOOKURL=https://apprisehost/notify/config # apprise notification url
|
- APPRISEWEBHOOKURL=https://apprisehost/notify/config # apprise notification url
|
||||||
- APPRISEWEBHOOKTAG=all # apprise notification tag
|
- APPRISEWEBHOOKTAG=all # apprise notification tag
|
||||||
|
- NOTIFICATIONTIMES=8,12,17 # hours when notifications will be sent
|
||||||
Reference in New Issue
Block a user