Don't send welcome message if envvar is empty
This commit is contained in:
parent
14c3b9bcf9
commit
19950face6
25
main.go
25
main.go
@ -17,6 +17,7 @@ import (
|
||||
)
|
||||
|
||||
var channel = "#ctf"
|
||||
var sendWelcome = ""
|
||||
|
||||
const (
|
||||
pattern = "(?i)\\b(cat|gato|miau|meow|garfield|lolcat|кот|кошк)[s|z]{0,1}\\b"
|
||||
@ -95,12 +96,14 @@ func main() {
|
||||
|
||||
e.Connection.Privmsg("nickserv", "identify "+os.Getenv("CTF2021PASS"))
|
||||
|
||||
e.Connection.Join(channel)
|
||||
e.Connection.Privmsg(channel, `I'm a cat bot!`)
|
||||
e.Connection.Privmsg(channel, `Inspired from https://github.com/go-chat-bot/plugins/blob/master/catfacts/catfacts.go`)
|
||||
e.Connection.Privmsg(channel, `Try cat /etc/passwd :p`)
|
||||
e.Connection.Privmsg(channel, `Source code and issue tracker: https://gitea.difrex.ru/CTF2021/irc_bot`)
|
||||
e.Connection.Privmsg(channel, `Now with gifs! ^_^`)
|
||||
if sendWelcome != "" {
|
||||
e.Connection.Join(channel)
|
||||
e.Connection.Privmsg(channel, `I'm a cat bot!`)
|
||||
e.Connection.Privmsg(channel, `Inspired from https://github.com/go-chat-bot/plugins/blob/master/catfacts/catfacts.go`)
|
||||
e.Connection.Privmsg(channel, `Try cat /etc/passwd :p`)
|
||||
e.Connection.Privmsg(channel, `Source code and issue tracker: https://gitea.difrex.ru/CTF2021/irc_bot`)
|
||||
e.Connection.Privmsg(channel, `Now with gifs! ^_^`)
|
||||
}
|
||||
})
|
||||
|
||||
irccon.AddCallback("PRIVMSG", func(e *irc.Event) {
|
||||
@ -118,10 +121,10 @@ func main() {
|
||||
}
|
||||
|
||||
func doCommand(command string, e *irc.Event, s *stats) {
|
||||
if ok := statCommand(command); ok {
|
||||
s.printStats(e)
|
||||
return
|
||||
}
|
||||
// if ok := statCommand(command); ok {
|
||||
// s.printStats(e)
|
||||
// return
|
||||
// }
|
||||
|
||||
if ok := checkCommad(command, e.Connection); !ok {
|
||||
return
|
||||
@ -196,4 +199,6 @@ func init() {
|
||||
if ch != "" {
|
||||
channel = ch
|
||||
}
|
||||
|
||||
sendWelcome = os.Getenv("CTF2021WC")
|
||||
}
|
||||
|
Reference in New Issue
Block a user