|
|
|
@ -25,7 +25,7 @@ const (
|
|
|
|
|
//TestAPIEndpoint = "https://hhtestnet.com/api/v1"
|
|
|
|
|
//APIkey = "***REMOVED***"
|
|
|
|
|
HodlHodlCheckTimer = 5 * time.Second
|
|
|
|
|
commandSymbol = "/"
|
|
|
|
|
commandSymbol = "/"
|
|
|
|
|
|
|
|
|
|
// Config
|
|
|
|
|
infoFormat = "====== "
|
|
|
|
@ -77,14 +77,14 @@ type Notification struct {
|
|
|
|
|
type config struct {
|
|
|
|
|
Server map[string]string `mapstructure:"server"`
|
|
|
|
|
Client map[string]string `mapstructure:"client"`
|
|
|
|
|
Contacts string `string:"contact"`
|
|
|
|
|
Recipient string `string:"recipient"`
|
|
|
|
|
Hodlhodl map[string]string `mapstructure:"hodlhodl"`
|
|
|
|
|
LogStanzas map[string]string `mapstructure:"logstanzas"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Command interface {
|
|
|
|
|
Run(args []string) (string, error)
|
|
|
|
|
Help(args []string) (string)
|
|
|
|
|
Help(args []string) string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DefaultCmd struct {
|
|
|
|
@ -100,7 +100,7 @@ func (*DefaultCmd) Run(args []string) (string, error) {
|
|
|
|
|
return "Type help to get available commands", nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (*DefaultCmd) Help(args []string) (string) {
|
|
|
|
|
func (*DefaultCmd) Help(args []string) string {
|
|
|
|
|
return "Help of Default"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -108,7 +108,7 @@ func (*HelpCmd) Run(args []string) (string, error) {
|
|
|
|
|
return "this is help", nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (*HelpCmd) Help(args []string) (string) {
|
|
|
|
|
func (*HelpCmd) Help(args []string) string {
|
|
|
|
|
return "this is help of help"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -116,7 +116,7 @@ func (*HelloCmd) Run(args []string) (string, error) {
|
|
|
|
|
return "Hi, My name is Skynet 1.0. \n How can I help you ? ", nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (*HelloCmd) Help(args []string) (string) {
|
|
|
|
|
func (*HelloCmd) Help(args []string) string {
|
|
|
|
|
return "Help of Hello"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -276,7 +276,7 @@ func hodlNotifications(client xmpp.Sender, config *config, notifications chan st
|
|
|
|
|
|
|
|
|
|
fmt.Println("sending notification through xmpp")
|
|
|
|
|
|
|
|
|
|
reply := stanza.Message{Attrs: stanza.Attrs{To: currentContact, Type: stanza.MessageTypeChat}, Body: notif}
|
|
|
|
|
reply := stanza.Message{Attrs: stanza.Attrs{To: recipient, Type: stanza.MessageTypeChat}, Body: notif}
|
|
|
|
|
if logger != nil {
|
|
|
|
|
raw, _ := xml.Marshal(reply)
|
|
|
|
|
logger.Println(string(raw))
|
|
|
|
@ -348,7 +348,7 @@ func readConfig() *config {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check if we have contacts to message
|
|
|
|
|
if len(strings.TrimSpace(config.Contacts)) == 0 {
|
|
|
|
|
if len(strings.TrimSpace(config.Recipient)) == 0 {
|
|
|
|
|
log.Panicln("You appear to have no contacts to message !")
|
|
|
|
|
}
|
|
|
|
|
// Check logging
|
|
|
|
|