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


Golang Conn.Join方法代碼示例

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


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

示例1: connected

func connected(conn *irc.Conn, line *irc.Line) {
	println("Connected!")
	conn.Pass(config.Password)
	conn.Join(config.Channel)
	conn.Privmsg(config.Channel, "¡Saludos!")
	constantlyReadTwitter(conn)
}
開發者ID:sadasant,項目名稱:Go,代碼行數:7,代碼來源:VEbot.go

示例2: bot_connected

func bot_connected(irc *client.Conn, line *client.Line) {
	bot := getState(irc)
	for _, c := range bot.channels {
		bot.l.Info("Joining %s on startup.\n", c)
		irc.Join(c)
	}
}
開發者ID:b33f,項目名稱:sp0rkle,代碼行數:7,代碼來源:handlers.go

示例3: AutoJoin

func AutoJoin(conn *irc.Conn, channel string) {
	autoJoinLock.Lock()
	defer autoJoinLock.Unlock()
	if autoJoinChannels[channel] {
		return
	}
	autoJoinChannels[channel] = true
	conn.AddHandler("CONNECTED", func(c *irc.Conn, l *irc.Line) {
		conn.Join(channel)
	})
}
開發者ID:broady,項目名稱:gobby,代碼行數:11,代碼來源:util.go

示例4: autojoin

func autojoin(conn *irc.Conn) {
	for _, s := range sections {
		split := strings.SplitN(s, " ", 2)
		if len(split) == 2 && split[0] == conn.Network {
			// found a channel
			if readConfBool(s, "autojoin") {
				fmt.Printf("Joining %s on %s\n", split[1], conn.Network)
				conn.Join(split[1])
			}
		}
	}
	go BanManager(conn)
}
開發者ID:thevermi,項目名稱:rbot,代碼行數:13,代碼來源:rbot.go

示例5: ui

func ui(con *irc.Conn, in chan string) {
	curr_chan := ""

	for input := range in {
		if input[0] == '/' {
			// is a command
			var cmd string
			cmdend := strings.Index(input, " ")
			if cmdend > 0 {
				cmd = input[:cmdend]
			} else {
				cmd = input
			}

			switch cmd {
			case "/join":
				if len(input) > cmdend {
					channel := input[cmdend+1:]
					if channel[0] != '#' {
						channel = "#" + channel
					}
					curr_chan = channel
					con.Join(channel)
				} else {
					fmt.Println("Please specify the channel")
				}
			case "/quit":
				fmt.Println("Bye!")
				con.Quit()
			case "/goto":
				curr_chan = input[cmdend+1:]
			case "/list":
				break
			case "/nick":
				if cmdend > 0 {
					con.Nick(input[cmdend+1:])
				} else {
					fmt.Println("Too few arguments")
				}
			default:
				fmt.Println("Unknown command")
			}
			fmt.Printf("\n%s: ", curr_chan)
		} else {
			con.Privmsg(curr_chan, input)
			fmt.Printf("%s: ", curr_chan)
		}
	}
	fmt.Println("Closing connection. kthxbai!")
	con.Quit()
}
開發者ID:sternenseemann,項目名稱:rumpelkiste,代碼行數:51,代碼來源:gopherchat.go

示例6: handleInvite

func handleInvite(conn *irc.Conn, line *irc.Line) {
	if line.Args[0] != conn.Me.Nick {
		return
	}

	user := line.Src[strings.Index(line.Src, "!")+1:]
	if user[0] == '~' {
		user = user[1:]
	}

	owner, _ := auth.String(conn.Network, "owner")
	if user == owner {
		conn.Join(line.Args[1])
	}
}
開發者ID:thevermi,項目名稱:rbot,代碼行數:15,代碼來源:handler.go

示例7: onInvite

func onInvite(irc *client.Conn, line *client.Line) {
	who, channel := line.Args[0], line.Args[1]
	log.Println(line.Nick, "invited bot to", channel)
	if who == irc.Me.Nick {
		// some IRCds only allow operators to INVITE, and on registered channels normally only identified users are operators
		// check anyway, since there are some corner cases where that doesn't happen
		if checkIdentified(irc, line.Nick) {
			log.Println("Accepting invite to", channel)
			irc.Join(channel)
		} else {
			irc.Notice(line.Nick, "you must be identified to invite")
			log.Println("Ignoring invite, user is not identified")
		}
	}
}
開發者ID:nbyouri,項目名稱:go-lastfm-bot,代碼行數:15,代碼來源:bot.go

示例8: Connect

func (s InBandSource) Connect(c *irc.Conn) (err error) {
	if c.Connected {
		return nil
	}

	c.AddHandler(irc.CONNECTED, func(c *irc.Conn, line *irc.Line) {
		c.Join(s.Host().Channel)
	})

	if err := c.Connect(s.Host().Server); err != nil {
		return err
	}

	return nil
}
開發者ID:sumanvyj,項目名稱:packrat,代碼行數:15,代碼來源:inband_source.go

示例9: autojoin

func autojoin(conn *irc.Conn) {
	for _, s := range sections {
		split := strings.SplitN(s, " ", 2)
		if len(split) == 2 && split[0] == conn.Network {
			// found a channel
			if readConfBool(s, "autojoin") {
				fmt.Printf("Joining %s on %s\n", split[1], conn.Network)
				conn.Join(split[1])
			}

			if annstream, _ := conf.Bool(s, "stream"); annstream {
				announceJustinTv(conn, split[1])
			}
		}
	}
}
開發者ID:raylu,項目名稱:rbot,代碼行數:16,代碼來源:rbot.go

示例10: setupClient

func setupClient(c *irc.Conn, chConnected chan bool) {
	c.AddHandler(irc.CONNECTED, func(conn *irc.Conn, line *irc.Line) {
		chConnected <- true
	})
	c.AddHandler(irc.DISCONNECTED, func(conn *irc.Conn, line *irc.Line) {
		chConnected <- false
	})
	c.AddHandler("PRIVMSG", func(conn *irc.Conn, line *irc.Line) {
		if len(line.Args) < 2 || !strings.HasPrefix(line.Args[1], "!") {
			return
		}
		to := line.Args[0]
		sender := to
		if to == c.Me.Nick {
			// TODO: check if sender is in main chan, else return
			log.Println("Got ! via PM from " + line.Src)
			sender = line.Src // replies go via PM too.
		} else {
			log.Println("Got ! via chan: " + line.Args[0] + " from " + line.Src)
		}
		log.Println(line.Args)
		switch line.Args[0] {
		case "!join":
			if len(line.Args) == 2 {
				c.Join(line.Args[1])
			} else if len(line.Args) == 3 {
				c.Join(line.Args[1] + " " + line.Args[2])
			} else {
				c.Privmsg(sender, "Usage: !join #chan  or  !join #chan key")
			}
		case "!part":
			if len(line.Args) == 2 {
				c.Part(line.Args[1])
			} else {
				c.Privmsg(sender, "Usage: !part #chan")
			}
		default:
			c.Privmsg(sender, "Invalid command: "+strings.Join(line.Args[1:], " "))
			return
		}
	})

}
開發者ID:RJ,項目名稱:gocat,代碼行數:43,代碼來源:gocat.go

示例11: onConnected

func (p *IRCPlug) onConnected(c *client.Conn, l *client.Line) {
	for _, ch := range p.config.Channels {
		c.Join(ch)
	}
}
開發者ID:lime-tech,項目名稱:go-chat-relay,代碼行數:5,代碼來源:irc.go

示例12: postConnect

func postConnect(conn *irc.Conn, line *irc.Line) {
	conn.Join(channel)
}
開發者ID:cmende,項目名稱:gmb0t,代碼行數:3,代碼來源:irc.go

示例13: connect

func (ei *EndpointIRC) connect(c *irc.Conn, l *irc.Line) {
	for _, channel := range ei.Config.Channels {
		c.Join(channel)
	}
}
開發者ID:andyleap,項目名稱:srvbot,代碼行數:5,代碼來源:endpoint_irc.go

示例14: onConnect

func (i *IRC) onConnect(conn *client.Conn, line *client.Line) {
	for _, c := range i.channels {
		conn.Join(c)
	}
}
開發者ID:iopred,項目名稱:bruxism,代碼行數:5,代碼來源:irc.go


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