summaryrefslogtreecommitdiff
path: root/help.go
diff options
context:
space:
mode:
Diffstat (limited to 'help.go')
-rw-r--r--help.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/help.go b/help.go
new file mode 100644
index 0000000..22fa60e
--- /dev/null
+++ b/help.go
@@ -0,0 +1,29 @@
+package main
+
+import (
+ "fmt"
+ "sort"
+
+ irc "github.com/fluffle/goirc/client"
+)
+
+type Help struct{ Command }
+
+func (_ Help) Handle(conn *irc.Conn, line *irc.Line) {
+ var msg []string
+ for k, v := range commands {
+ msg = append(msg, fmt.Sprintf("%-8s%v", k, v))
+ }
+ sort.Sort(sort.StringSlice(msg))
+ for _, s := range msg {
+ conn.Privmsg(line.Nick, s)
+ }
+}
+
+func init() {
+ Register("help", &Help{
+ Command{
+ Help: "This help",
+ },
+ })
+}