mirror of
https://github.com/idanoo/NZCovidBot
synced 2025-07-01 11:12:15 +00:00
Update README.md, Add comments
This commit is contained in:
parent
a884ed7f46
commit
c79f5e7e7e
3 changed files with 10 additions and 0 deletions
|
@ -1,6 +1,10 @@
|
|||
# NZCovidBot
|
||||
Pull data from Github and parse new locations and fire them off to any configured endpoints
|
||||
|
||||
### About
|
||||
After the twitterbot @nzcovidlocs shut down, I decided to try a different approach, instead of scraping MoH's website, lets parse the raw data!
|
||||
https://github.com/minhealthnz/nz-covid-data/tree/main/locations-of-interest/august-2021
|
||||
|
||||
## Config
|
||||
Copy .env.example to .env and fill in the blanks.
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ var commitHash string
|
|||
// Location to store tmp data
|
||||
var tmpDirectory = "./tmp"
|
||||
|
||||
// loadRepo Load repo into gitRepo var
|
||||
func loadRepo(repository string) {
|
||||
r, err := git.PlainOpen(tmpDirectory + "/repo")
|
||||
if err != nil {
|
||||
|
@ -35,6 +36,7 @@ func loadRepo(repository string) {
|
|||
gitRepo = r
|
||||
}
|
||||
|
||||
// cloneRepo Clone git repo
|
||||
func cloneRepo(repository string) *git.Repository {
|
||||
if _, err := os.Stat(tmpDirectory); os.IsNotExist(err) {
|
||||
err = os.Mkdir(tmpDirectory, 0755)
|
||||
|
@ -160,6 +162,9 @@ func checkForUpdates() {
|
|||
}
|
||||
}
|
||||
|
||||
// Store current hash for future comparisons
|
||||
setCommitHash(head.Hash().String())
|
||||
|
||||
// SEND IT o/---->
|
||||
postTheUpdates()
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ func Lesgoooo() {
|
|||
}
|
||||
|
||||
func postTheUpdates() {
|
||||
// Lets reshuffle our structured data a bit (Exposure Date ASC)
|
||||
orderRowDataByDate()
|
||||
|
||||
// Twitter
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue