From 42ced13208bb67dd99f399dbd1c5345728b41da4 Mon Sep 17 00:00:00 2001 From: Benny Morrison Date: Sat, 16 Mar 2019 00:52:07 -0400 Subject: added !join function --- main.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 82ca0fe..cb73673 100644 --- a/main.go +++ b/main.go @@ -12,6 +12,8 @@ import ( ) func main() { + // OWNER NICK + owner := "ahriman" // CLIENT CONFIG client := girc.New(girc.Config{ Server: "irc.tilde.chat", @@ -38,7 +40,7 @@ func main() { // check if the command was issued by a specific person before dying // i had to delve into girc/commands.go to find e.Source.Name - if strings.HasPrefix(e.Last(), "die, devil bird!") && e.Source.Name == "ahriman" { + if strings.HasPrefix(e.Last(), "die, devil bird!") && e.Source.Name == owner { c.Cmd.Reply(e, "SQUAWWWWWK!!") time.Sleep(100 * time.Millisecond) c.Close() @@ -49,6 +51,12 @@ func main() { c.Cmd.Reply(e, "Creator: ~a h r i m a n~ :: I'm the assistance bot for tilde.institute. Commands: !hello") return } + // when requested by owner, join channel specified + if strings.HasPrefix(e.Last(), "!join") && e.Source.Name == owner { + c.Cmd.Reply(e, "Right away, cap'n!") + time.sleep(100 * time.Millisecond) + c.Cmd.Join(e.Params[0]) + } // respond with uptime / load if strings.HasPrefix(e.Last(), "!uptime") { uptime := exec.Command("uptime") -- cgit 1.4.1-2-gfad0