|
|
|
@ -1,7 +1,3 @@
|
|
|
|
|
// test account (avicious.406+test@gmail.com) API key
|
|
|
|
|
// eZbV6TDcl2qUmtEAMLllN8qOHeb1hQiS8sVEoG2OmfqLym4UqihiFL83xgM2SLGPtz8HS2DeX45sk89B
|
|
|
|
|
// test offer id: https://hhtestnet.com/offers/F8W2srPJK2JKwYdh
|
|
|
|
|
// TODO: unmarshal json (encoding/json)
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
@ -117,12 +113,6 @@ func (*HelpCmd) Help(args []string) (string) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (*HelloCmd) Run(args []string) (string, error) {
|
|
|
|
|
/*for _, result := range args {
|
|
|
|
|
if result == "help" {
|
|
|
|
|
return "help of hello", nil
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
return "Hi, My name is Skynet 1.0. \n How can I help you ? ", nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -149,8 +139,6 @@ func handleCommand(command Command, args []string) string {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
//body:= strings.NewReader(' -X POST -H "Authorization: Bearer ***REMOVED***" -H "Content-Type: application/json"`)
|
|
|
|
|
|
|
|
|
|
// ============================================================
|
|
|
|
|
// Parse the flag with the config directory path as argument
|
|
|
|
|
flag.String("c", defaultConfigFilePath, "Provide a path to the directory that contains the configuration"+
|
|
|
|
@ -242,7 +230,6 @@ func answerMessage(s xmpp.Sender, p stanza.Packet) {
|
|
|
|
|
}
|
|
|
|
|
_, _ = fmt.Fprintf(os.Stdout, "Body = %s - from = %s\n", msg.Body, msg.From)
|
|
|
|
|
|
|
|
|
|
//answersArray := []string{"Test", "Help", "Time"}
|
|
|
|
|
if len(msg.Body) > 0 && msg.Body[0:1] == commandSymbol {
|
|
|
|
|
fmt.Println("keep the message", msg.Body)
|
|
|
|
|
receivedCmd := strings.Replace(strings.Fields(msg.Body)[0], "/", "", -1)
|
|
|
|
@ -269,24 +256,6 @@ func answerMessage(s xmpp.Sender, p stanza.Packet) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//switch {
|
|
|
|
|
//case strings.Contains(strings.ToLower(msg.Body), "test"):
|
|
|
|
|
//answer := "succesful test"
|
|
|
|
|
//reply := stanza.Message{Attrs: stanza.Attrs{To: msg.From}, Body: answer}
|
|
|
|
|
//fmt.Println("ANSEWERING.....")
|
|
|
|
|
//s.Send(reply)
|
|
|
|
|
|
|
|
|
|
//case strings.Contains(strings.ToLower(msg.Body), "help"):
|
|
|
|
|
//answer := strings.Join(answersArray, ", ")
|
|
|
|
|
//reply := stanza.Message{Attrs: stanza.Attrs{To: msg.From}, Body: "here is the list of commands : " + answer}
|
|
|
|
|
//s.Send(reply)
|
|
|
|
|
|
|
|
|
|
//case strings.Contains(strings.ToLower(msg.Body), "time"):
|
|
|
|
|
//answer := time.Now().String()
|
|
|
|
|
//reply := stanza.Message{Attrs: stanza.Attrs{To: msg.From}, Body: answer}
|
|
|
|
|
//s.Send(reply)
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func hodlNotifications(client xmpp.Sender, config *config, notifications chan string) {
|
|
|
|
@ -355,7 +324,6 @@ func gethdlNotif(APIKey string, APIEndPoint string) string {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
defer resp.Body.Close()
|
|
|
|
|
//fmt.Println("no notif empty string")
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|