예제 #1
0
파일: irc.go 프로젝트: MDCox/spectator
// joinRooms() joins any irc channel that is included in the `rooms` slice.
func joinRooms(conn *irc.Conn, rooms []string) {
	for _, room := range rooms {
		time.Sleep(time.Second * 2)
		conn.Encode(&irc.Message{
			Command: irc.JOIN,
			Params:  []string{room},
		})
	}
}
예제 #2
0
파일: irc.go 프로젝트: MDCox/spectator
// identify() sends the USER and NICK commands to identify upon conenction.
func identify(conn *irc.Conn) {
	var messages []*irc.Message
	messages = append(messages, &irc.Message{
		Command:  irc.USER,
		Params:   []string{"testin", "0", "*"},
		Trailing: "testin",
	})
	messages = append(messages, &irc.Message{
		Command: irc.NICK,
		Params:  []string{"testin"},
	})
	for _, msg := range messages {
		err := conn.Encode(msg)
		if err != nil {
			fmt.Printf("Err: %s \n%s\n", err, msg)
		}
	}
}