Add !ops command to highlight all ops

This commit is contained in:
raylu 2011-04-10 03:32:32 -04:00
parent d38619843f
commit 83fc245eec
2 changed files with 21 additions and 0 deletions

View File

@ -252,3 +252,23 @@ func part(conn *irc.Conn, nick *irc.Nick, args, target string) {
conn.Part(channel, "")
}
}
func highlightOps(conn *irc.Conn, nick *irc.Nick, args, target string) {
channel, args := parseAccess(conn, nick, target, args, "t")
if channel == "" {
return
}
c := conn.GetChannel(channel)
if c == nil {
say(conn, target, "Error while getting channel information for %s", channel)
return
}
var highlights string
for onick, privs := range c.Nicks {
if privs.Op && onick.Nick != nick.Nick {
highlights += onick.Nick + ", "
}
}
say(conn, channel, highlights[:len(highlights)-2] + "!")
}

View File

@ -41,6 +41,7 @@ var commands = map [string]func(*irc.Conn, *irc.Nick, string, string) {
"topic": topic,
"appendtopic": appendtopic,
"part": part,
"ops": highlightOps,
// google
"tr": translate,