mirror of https://github.com/fluffle/goirc
Add !ops command to highlight all ops
This commit is contained in:
parent
d38619843f
commit
83fc245eec
20
cmd-op.go
20
cmd-op.go
|
@ -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] + "!")
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue