本文整理匯總了Golang中github.com/fluffle/goirc/client.Conn.Kick方法的典型用法代碼示例。如果您正苦於以下問題:Golang Conn.Kick方法的具體用法?Golang Conn.Kick怎麽用?Golang Conn.Kick使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/fluffle/goirc/client.Conn
的用法示例。
在下文中一共展示了Conn.Kick方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: kick
func kick(conn *irc.Conn, nick *irc.Nick, args, target string) {
channel, args := parseAccess(conn, nick, target, args, "oh")
if channel == "" || args == "" {
return
}
split := strings.SplitN(args, " ", 2)
if n := conn.GetNick(split[0]); n == nil || (split[0] != nick.Nick &&
(!hasAccess(conn, nick, channel, "o") && hasAccess(conn, n, channel, "oh"))) {
// if we only have h, we can't kick people with o or h
return
}
reason := "(" + nick.Nick + ")"
if len(split) == 2 {
reason += " " + split[1]
}
conn.Kick(channel, split[0], reason)
}
示例2: kickban
func kickban(conn *irc.Conn, nick *irc.Nick, args, target string) {
channel, args := parseAccess(conn, nick, target, args, "oh")
if channel == "" || args == "" {
return
}
split := strings.SplitN(args, " ", 2)
n := conn.GetNick(split[0])
if n == nil || (split[0] != nick.Nick &&
(!hasAccess(conn, nick, channel, "o") && hasAccess(conn, n, channel, "oh"))) {
return
}
conn.Mode(channel, "+b *!*@"+n.Host)
reason := "(" + nick.Nick + ")"
if len(split) == 2 {
reason += " " + split[1]
}
conn.Kick(channel, split[0], reason)
}
示例3: tempban
func tempban(conn *irc.Conn, nick *irc.Nick, args, target string) {
channel, args := parseAccess(conn, nick, target, args, "oh")
if channel == "" || args == "" {
return
}
ch := conn.GetChannel(channel)
if ch == nil {
say(conn, target, "%s: Unable to get channel information about %s", nick.Nick, channel)
return
}
args = strings.TrimSpace(args)
split := strings.SplitN(args, " ", 3)
dur, err := strconv.Atoi64(split[1])
if dur < 5 {
dur = 5
split[1] = "5"
}
if err != nil {
say(conn, channel, "Format: !tb <nick> <minutes> <reason>")
return
}
n := conn.GetNick(split[0])
if n == nil || (split[0] != nick.Nick &&
(!hasAccess(conn, nick, channel, "o") && hasAccess(conn, n, channel, "oh"))) {
return
}
conn.Mode(channel, "+b *!*@"+n.Host)
reason := "(" + nick.Nick + ")"
if len(split) == 3 {
reason += " " + split[2]
}
reason += " (" + split[1] + " min.)"
conn.Kick(channel, split[0], reason)
expiry := time.Seconds() + dur*60
banLogAdd("*!*@"+n.Host, split[0], reason, channel, expiry)
}