Get channel from env
This commit is contained in:
parent
c838efbf27
commit
14c3b9bcf9
15
main.go
15
main.go
@ -16,10 +16,10 @@ import (
|
||||
irc "github.com/thoj/go-ircevent"
|
||||
)
|
||||
|
||||
const channel = "#ctf"
|
||||
var channel = "#ctf"
|
||||
|
||||
const (
|
||||
pattern = "(?i)\\b(cat|gato|miau|meow|garfield|lolcat)[s|z]{0,1}\\b"
|
||||
pattern = "(?i)\\b(cat|gato|miau|meow|garfield|lolcat|кот|кошк)[s|z]{0,1}\\b"
|
||||
nyastat = "nyastat"
|
||||
msgPrefix = "I love cats! Here's a fact: %s ^_^"
|
||||
gifPrefix = "Meow! Here's a gif: %s ^_^"
|
||||
@ -103,10 +103,6 @@ func main() {
|
||||
e.Connection.Privmsg(channel, `Now with gifs! ^_^`)
|
||||
})
|
||||
|
||||
irccon.AddCallback("MODE", func(e *irc.Event) {
|
||||
log.Println(e.Message())
|
||||
})
|
||||
|
||||
irccon.AddCallback("PRIVMSG", func(e *irc.Event) {
|
||||
log.Printf("Message from %s received: %s", e.Nick, e.Message())
|
||||
s.addUser(e.Nick)
|
||||
@ -194,3 +190,10 @@ func catFacts(con *irc.Connection) (string, error) {
|
||||
con.Privmsg(channel, fmt.Sprintf(msgPrefix, data.Fact))
|
||||
return fmt.Sprintf(msgPrefix, data.Fact), nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
ch := os.Getenv("CTF2021CHANNEL")
|
||||
if ch != "" {
|
||||
channel = ch
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user