mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
Added SMS and bot name config variables.
This commit is contained in:
@@ -5,7 +5,15 @@ import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
type SMSContacts struct {
|
||||
Name string
|
||||
Number string
|
||||
Enabled bool
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Name string
|
||||
SMSContacts []SMSContacts
|
||||
Exchanges []Exchanges
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
{
|
||||
"Name": "Skynet",
|
||||
"SMSContacts" : [
|
||||
{
|
||||
"Name": "Bob",
|
||||
"Number": "12345",
|
||||
"Enabled": false
|
||||
}
|
||||
],
|
||||
"Exchanges": [
|
||||
{
|
||||
"Name": "Bitfinex",
|
||||
|
||||
18
main.go
18
main.go
@@ -29,7 +29,6 @@ type Bot struct {
|
||||
var bot Bot
|
||||
|
||||
func main() {
|
||||
log.Println("Bot started")
|
||||
log.Println("Loading config file config.json..")
|
||||
|
||||
err := errors.New("")
|
||||
@@ -41,6 +40,7 @@ func main() {
|
||||
}
|
||||
|
||||
log.Println("Config file loaded.")
|
||||
log.Printf("Bot '%s' started.\n", bot.config.Name)
|
||||
|
||||
enabledExchanges := 0
|
||||
for _, exch := range bot.config.Exchanges {
|
||||
@@ -54,6 +54,22 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
smsSupport := false
|
||||
smsContacts := 0
|
||||
|
||||
for _, sms := range bot.config.SMSContacts {
|
||||
if sms.Enabled {
|
||||
smsSupport = true
|
||||
smsContacts++
|
||||
}
|
||||
}
|
||||
|
||||
if smsSupport {
|
||||
log.Printf("SMS support enabled. Number of SMS contacts %d.\n", smsContacts)
|
||||
} else {
|
||||
log.Println("SMS support disabled.")
|
||||
}
|
||||
|
||||
log.Printf("Available Exchanges: %d. Enabled Exchanges: %d.\n", len(bot.config.Exchanges), enabledExchanges)
|
||||
log.Println("Bot Exchange support:")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user