Update rbot for the new goirc layout

This commit is contained in:
raylu 2010-12-18 18:45:02 -08:00
parent 3a86d53dde
commit 0d4322e854
7 changed files with 16 additions and 16 deletions

View File

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"os" "os"
"strings" "strings"
"irc" irc "github.com/fluffle/goirc/client"
"github.com/kless/goconfig/config" "github.com/kless/goconfig/config"
) )

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
"irc" irc "github.com/fluffle/goirc/client"
"strings" "strings"
) )

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
"irc" irc "github.com/fluffle/goirc/client"
) )
func nick(conn *irc.Conn, nick *irc.Nick, args, target string) { func nick(conn *irc.Conn, nick *irc.Nick, args, target string) {

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
"irc" irc "github.com/fluffle/goirc/client"
"fmt" "fmt"
"strings" "strings"
"os" "os"

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
"irc" irc "github.com/fluffle/goirc/client"
"strings" "strings"
) )

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
"irc" irc "github.com/fluffle/goirc/client"
"fmt" "fmt"
"strings" "strings"
"http" "http"
@ -56,23 +56,23 @@ func handlePrivmsg(conn *irc.Conn, line *irc.Line) {
target := line.Args[0] target := line.Args[0]
if isChannel(target) { if isChannel(target) {
// message to a channel // message to a channel
if start := strings.Index(line.Text, "youtube.com/watch?v="); start > -1 { if start := strings.Index(line.Args[1], "youtube.com/watch?v="); start > -1 {
video := line.Text[start+20:] video := line.Args[1][start+20:]
if end := strings.IndexAny(video, " &#"); end > -1 { if end := strings.IndexAny(video, " &#"); end > -1 {
video = video[0:end] video = video[0:end]
} }
youtube(conn, nick, video, target) youtube(conn, nick, video, target)
} else { } else {
command(conn, nick, line.Text, target) command(conn, nick, line.Args[1], target)
} }
} else if target == conn.Me.Nick { } else if target == conn.Me.Nick {
// message to us // message to us
command(conn, nick, line.Text, line.Nick) command(conn, nick, line.Args[1], line.Nick)
} }
} }
func handleMode(conn *irc.Conn, line *irc.Line) { func handleMode(conn *irc.Conn, line *irc.Line) {
if line.Args[0] == conn.Me.Nick && line.Text == "+r" { if line.Args[0] == conn.Me.Nick && line.Args[1] == "+r" {
autojoin(conn) autojoin(conn)
} }
} }
@ -83,7 +83,7 @@ func handleJoin(conn *irc.Conn, line *irc.Line) {
return return
} }
channel := conn.GetChannel(line.Text) channel := conn.GetChannel(line.Args[1])
if channel == nil || !channel.Modes.Moderated { if channel == nil || !channel.Modes.Moderated {
return return
} }
@ -96,8 +96,8 @@ func handleJoin(conn *irc.Conn, line *irc.Line) {
if nick == nil { if nick == nil {
return return
} }
if hasAccess(conn, nick, line.Text, "v") { if hasAccess(conn, nick, line.Args[1], "v") {
conn.Mode(line.Text, "+v " + line.Nick) conn.Mode(line.Args[1], "+v " + line.Nick)
} }
} }
@ -113,7 +113,7 @@ func handleInvite(conn *irc.Conn, line *irc.Line) {
owner, _ := auth.String(conn.Network, "owner") owner, _ := auth.String(conn.Network, "owner")
if user == owner { if user == owner {
conn.Join(line.Text) conn.Join(line.Args[1])
} }
} }

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
"irc" irc "github.com/fluffle/goirc/client"
"fmt" "fmt"
"os" "os"
"strings" "strings"