|
|
|
@ -28,7 +28,7 @@ const (
|
|
|
|
|
// APIEndpoint = "https://hodlhodl.com/api/v1"
|
|
|
|
|
//TestAPIEndpoint = "https://hhtestnet.com/api/v1"
|
|
|
|
|
//APIkey = "***REMOVED***"
|
|
|
|
|
JobSchedulerInterval = 60 * time.Second
|
|
|
|
|
HodlHodlCheckTimer = 5 * time.Second
|
|
|
|
|
|
|
|
|
|
// Config
|
|
|
|
|
infoFormat = "====== "
|
|
|
|
@ -97,7 +97,6 @@ type HelloCmd struct {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type HelpCmd struct {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (*DefaultCmd) Run(args []string) (string, error) {
|
|
|
|
@ -117,7 +116,6 @@ func (*HelpCmd) Help(args []string) (string, error) {
|
|
|
|
|
return "this is help of help", nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (*HelloCmd) Run(args []string) (string, error) {
|
|
|
|
|
/*for _, result := range args {
|
|
|
|
|
if result == "help" {
|
|
|
|
@ -223,15 +221,16 @@ func startClient(config *config) {
|
|
|
|
|
fmt.Println("Client is running")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
timer := time.NewTicker(5 * time.Second)
|
|
|
|
|
timer := time.NewTicker(HodlHodlCheckTimer)
|
|
|
|
|
notifications := make(chan string, 100)
|
|
|
|
|
|
|
|
|
|
go hodlNotifications(client, config, notifications)
|
|
|
|
|
|
|
|
|
|
fmt.Println("checking notifs every ", HodlHodlCheckTimer)
|
|
|
|
|
for {
|
|
|
|
|
select {
|
|
|
|
|
case <-timer.C:
|
|
|
|
|
fmt.Println("checking notifs...")
|
|
|
|
|
//fmt.Println("checking notifs...")
|
|
|
|
|
notifications <- gethdlNotif(config.Hodlhodl[APIKey], config.Hodlhodl[APIEndPoint])
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -262,7 +261,7 @@ func answerMessage(s xmpp.Sender, p stanza.Packet) {
|
|
|
|
|
for regCommandName, regCommand := range Commands {
|
|
|
|
|
|
|
|
|
|
var result string
|
|
|
|
|
if receivedCmd == "#" + regCommandName {
|
|
|
|
|
if receivedCmd == "/"+regCommandName {
|
|
|
|
|
result = handleCommand(regCommand, args)
|
|
|
|
|
} /*else {
|
|
|
|
|
result = handleCommand(Commands["default"], args)
|
|
|
|
|