about summary refs log tree commit diff stats
path: root/main.go
diff options
context:
space:
mode:
authorBenny Morrison <benmorrison@ttm.sh>2019-03-16 00:03:09 -0400
committerBenny Morrison <benmorrison@ttm.sh>2019-03-16 00:03:09 -0400
commit32a5ae65d4de5c7c36452911d407f68f5d041f97 (patch)
tree29166a5252005da11207f9ab7da8c7d892f9fb5b /main.go
parent1e58a1db4dec643015bef14280e56e622197abf3 (diff)
downloadgoofbot-32a5ae65d4de5c7c36452911d407f68f5d041f97.tar.gz
added comments
Diffstat (limited to 'main.go')
-rw-r--r--main.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/main.go b/main.go
index a2a25ff..72c0c9f 100644
--- a/main.go
+++ b/main.go
@@ -10,6 +10,7 @@ import (
 )
 
 func main() {
+	// CLIENT CONFIG
 	client := girc.New(girc.Config{
 		Server: "irc.tilde.chat",
 		Port:   6697,
@@ -20,28 +21,28 @@ func main() {
 		SSL:    true,
 	})
 
-	//TODO: handle PING/PONG events
-	//i'm shooting in the dark with this handler
-	//client.Handlers.Add(girc.PING, func(i girc.PING, c *girc.Client)) {
-	//    c.Cmd.Pong(i)
-	//}
-
+	// specify the channel to join on startup
+	// for multiple channels: ("#goofbot", "#goofbot2", "#goofbot3")
 	client.Handlers.Add(girc.CONNECTED, func(c *girc.Client, e girc.Event) {
 		c.Cmd.Join("#goofbot")
 	})
 
+	// basic command-response handler
 	client.Handlers.Add(girc.PRIVMSG, func(c *girc.Client, e girc.Event) {
 		if strings.HasPrefix(e.Last(), "!hello") {
 			c.Cmd.ReplyTo(e, "henlo good fren!!")
 			return
 		}
 
+		// 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" {
 			c.Cmd.Reply(e, "SQUAWWWWWK!!")
 			time.Sleep(100 * time.Millisecond)
 			c.Close()
 			return
 		}
+		//another basic command/response. required information for the tildeverse
 		if strings.HasPrefix(e.Last(), "!botlist") {
 			c.Cmd.Reply(e, "Creator: ~a h r i m a n~ :: I'm the assistance bot for tilde.institute. Commands: !hello")
 			return
@@ -53,6 +54,7 @@ func main() {
 		//
 	})
 
+	// if err is not nothing, eg, if there's an error
 	if err := client.Connect(); err != nil {
 		log.Fatalf("an error occurred while attempting to connect to %s: %s", client.Server(), err)
 	}