Exemplo n.º 1
0
// 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},
		})
	}
}
Exemplo n.º 2
0
// 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)
		}
	}
}