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


Golang Conn.Topic方法代碼示例

本文整理匯總了Golang中github.com/fluffle/goirc/client.Conn.Topic方法的典型用法代碼示例。如果您正苦於以下問題:Golang Conn.Topic方法的具體用法?Golang Conn.Topic怎麽用?Golang Conn.Topic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/fluffle/goirc/client.Conn的用法示例。


在下文中一共展示了Conn.Topic方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: topic

func topic(conn *irc.Conn, nick *irc.Nick, args, target string) {
	channel, args := parseAccess(conn, nick, target, args, "t")
	if channel == "" {
		return
	}
	section := conn.Network + " " + channel
	if args != "" {
		updateConf(section, "basetopic", args)
		conn.Topic(channel, args)
	} else {
		basetopic, _ := conf.String(section, "basetopic")
		say(conn, nick.Nick, "Basetopic: %s", basetopic)
	}
}
開發者ID:raylu,項目名稱:rbot,代碼行數:14,代碼來源:cmd-op.go

示例2: setTopic

func setTopic(conn *irc.Conn, channel string) {
	defer func() {
		if r := recover(); r != nil {
			log.Printf("most likely coding error: %v", r)
		}
	}()

	topic := conn.StateTracker().GetChannel(channel).Topic
	newtopic := insertNextEvent(topic)
	newtopic = advanceDates(newtopic)

	if topic == newtopic {
		return
	}

	log.Printf("%s OLD TOPIC: %s", channel, topic)
	log.Printf("%s NEW TOPIC: %s", channel, newtopic)

	conn.Topic(channel, newtopic)
}
開發者ID:breunigs,項目名稱:frank,代碼行數:20,代碼來源:topicchanger.go

示例3: appendtopic

func appendtopic(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
	}

	section := conn.Network + " " + channel
	basetopic, _ := conf.String(section, "basetopic")
	if basetopic == "" || !strings.HasPrefix(strings.TrimLeft(c.Topic, " "), basetopic) {
		basetopic = c.Topic
		say(conn, nick.Nick, "New basetopic: %s", basetopic)
		updateConf(section, "basetopic", basetopic)
	}
	conn.Topic(channel, basetopic+args)
}
開發者ID:raylu,項目名稱:rbot,代碼行數:20,代碼來源:cmd-op.go


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