mirror of
https://github.com/fluffle/goirc
synced 2025-06-16 03:33:19 +00:00
Add !ops command to highlight all ops
This commit is contained in:
parent
d38619843f
commit
83fc245eec
2 changed files with 21 additions and 0 deletions
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, "")
|
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,
|
"topic": topic,
|
||||||
"appendtopic": appendtopic,
|
"appendtopic": appendtopic,
|
||||||
"part": part,
|
"part": part,
|
||||||
|
"ops": highlightOps,
|
||||||
|
|
||||||
// google
|
// google
|
||||||
"tr": translate,
|
"tr": translate,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue