botanswer
AnisB 3 years ago
commit c067798ec1

1
.gitignore vendored

@ -1 +1,2 @@
logs/*
hodlhodl-bot

@ -5,12 +5,14 @@ Client :
- jid: "bot@xmpp.sp4ke.xyz"
- pass: "***REMOVED***" #Password in a config file yay
Contacts : "chakib@xmpp.sp4ke.xyz;vicious@xmpp.sp4ke.xyz"
Recipient : "chakib@xmpp.sp4ke.xyz"
Hodlhodl :
- testapiendpoint : "https://hhtestnet.com/api/v1"
- apikey : "***REMOVED***"
- testapiendpoint : "https://hodlhodl.com/api/v1"
- apikey: "***REMOVED***"
#- testapiendpoint : "https://hhtestnet.com/api/v1"
#- apikey : "***REMOVED***"
LogStanzas:
- logger_on: "true"
- logfile_path: "./logs"
- logfile_path: "./logs"

@ -1,7 +1,7 @@
# Dockerfile References: https://docs.docker.com/engine/reference/builder/
# Start from the latest golang base image
FROM golang:latest
FROM golang:1.13
# Add Maintainer Info
LABEL maintainer="Anis Benz"
@ -37,4 +37,4 @@ VOLUME [${LOG_DIR}]
RUN go build -o main .
# Command to run the executable
CMD ["./main"]
CMD ["./main"]

@ -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

Loading…
Cancel
Save