-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
89 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package antam | ||
|
||
import ( | ||
"fmt" | ||
"gobot/pkg" | ||
) | ||
|
||
/* | ||
Scouting | ||
Run every day at specified times. | ||
*/ | ||
func Scouting(now bool) { | ||
// Helper function to log and send price | ||
sendGoldPriceAt := func(timeStr string, immediate bool) { | ||
execute := func() { | ||
pkg.LogWithTimestamp(fmt.Sprintf("Scouting Antam at %s", timeStr)) | ||
price, err := getGoldPricesFromHTML() | ||
if err != nil { | ||
pkg.LogWithTimestamp(fmt.Sprintf("Error fetching gold prices at %s: %v", timeStr, err)) | ||
return | ||
} | ||
SendPrice(*price) | ||
} | ||
|
||
if immediate { | ||
execute() | ||
} else { | ||
pkg.EverydayAtThisHour(execute, timeStr) | ||
} | ||
} | ||
|
||
if now { | ||
pkg.LogWithTimestamp("Running scouting logic immediately") | ||
sendGoldPriceAt("now", true) | ||
} else { | ||
pkg.LogWithTimestamp("Scheduling scouting antam price") | ||
sendGoldPriceAt("10:05", false) | ||
sendGoldPriceAt("15:05", false) | ||
sendGoldPriceAt("16:30", false) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ func main() { | |
|
||
warta.Scouting(false) | ||
|
||
antam.Scouting(false) | ||
|
||
go summarizer.Run() | ||
go antam.Run() | ||
|
||
|