本文整理匯總了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)
}
示例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)
}
}
示例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)
})
}
示例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)
}
示例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()
}
示例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])
}
}
示例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")
}
}
}
示例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
}
示例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])
}
}
}
}
示例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
}
})
}
示例11: onConnected
func (p *IRCPlug) onConnected(c *client.Conn, l *client.Line) {
for _, ch := range p.config.Channels {
c.Join(ch)
}
}
示例12: postConnect
func postConnect(conn *irc.Conn, line *irc.Line) {
conn.Join(channel)
}
示例13: connect
func (ei *EndpointIRC) connect(c *irc.Conn, l *irc.Line) {
for _, channel := range ei.Config.Channels {
c.Join(channel)
}
}
示例14: onConnect
func (i *IRC) onConnect(conn *client.Conn, line *client.Line) {
for _, c := range i.channels {
conn.Join(c)
}
}