summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.go4
-rw-r--r--env.sh5
-rw-r--r--main.go6
3 files changed, 13 insertions, 2 deletions
diff --git a/config.go b/config.go
index 04caaf0..6f7d6b5 100644
--- a/config.go
+++ b/config.go
@@ -30,4 +30,8 @@ func checkConfig() {
if check == "" {
log.Fatal("Env WEB2IRC_IRC_SERVER_PORT not found.")
}
+ check = os.Getenv("WEB2IRC_IRC_JOIN")
+ if check == "" {
+ log.Println("Env WEB2IRC_JOIN not found. We will not join on start up.")
+ }
}
diff --git a/env.sh b/env.sh
index 301f2eb..f9e7369 100644
--- a/env.sh
+++ b/env.sh
@@ -1,6 +1,7 @@
export WEB2IRC_HTTP_IP=127.0.0.1
export WEB2IRC_HTTP_PORT=8000
-export WEB2IRC_IRC_NICK=bot
-export WEB2IRC_IRC_REAL_NAME=bot
+export WEB2IRC_IRC_NICK=buildbot
+export WEB2IRC_IRC_REAL_NAME=buildbot
export WEB2IRC_IRC_SERVER=irc.iamfabulous.de
export WEB2IRC_IRC_SERVER_PORT=6667
+export WEB2IRC_IRC_JOIN=build
diff --git a/main.go b/main.go
index bd3552a..df8cd25 100644
--- a/main.go
+++ b/main.go
@@ -17,6 +17,12 @@ func main() {
if err != nil {
log.Fatal(err)
}
+ con.AddCallback("001", func(e *irc.Event) {
+ if fjoin := os.Getenv("WEB2IRC_IRC_JOIN"); fjoin != "" {
+ con.Join("#" + fjoin)
+ }
+ })
+
r := mux.NewRouter()
r.HandleFunc("/", IndexHandler)
r.HandleFunc("/webhook", WebhookHandler).Methods("POST")