當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Conn.Kick方法代碼示例

本文整理匯總了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)
}
開發者ID:raylu,項目名稱:rbot,代碼行數:19,代碼來源:cmd-op.go

示例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)
}
開發者ID:raylu,項目名稱:rbot,代碼行數:21,代碼來源:cmd-op.go

示例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)
}
開發者ID:thevermi,項目名稱:rbot,代碼行數:37,代碼來源:cmd-op.go


注:本文中的github.com/fluffle/goirc/client.Conn.Kick方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。