hellabot.go
func NewBot(host, nick string, options ...func(*Bot)) (*Bot, error) {
	// Defaults are set here
	bot := Bot{
		Incoming:      make(chan *Message, 16),
		outgoing:      make(chan string, 16),
		started:       time.Now(),
		unixastr:      fmt.Sprintf("@%s-%s/bot", host, nick),
		Host:          host,
		Nick:          nick,
		ThrottleDelay: 200 * time.Millisecond,
		PingTimeout:   300 * time.Second,
		HijackSession: false,
		SSL:           false,
		SASL:          false,
		Channels:      []string{"#test"},
		Password:      "",
	}
	for _, option := range options {
		option(&bot)
	}
	// Discard logs by default
	bot.Logger = log.New("id", logext.RandId(8), "host", bot.Host, "nick", log.Lazy{bot.getNick})

	bot.Logger.SetHandler(log.DiscardHandler())
	bot.AddTrigger(pingPong)
	bot.AddTrigger(joinChannels)
	return &bot, nil
}
func NewBot(host, nick string, options ...func(*Bot)) (*Bot, error) {
	// Defaults are set here
	bot := Bot{
		Incoming:      make(chan *Message, 16),
		outgoing:      make(chan string, 16),
		started:       time.Now(),
		unixastr:      fmt.Sprintf("@%s-%s/bot", host, nick),
		Host:          host,
		Nick:          nick,
		ThrottleDelay: 200 * time.Millisecond,
		PingTimeout:   300 * time.Second,
		HijackSession: false,
		SSL:           false,
		SASL:          false,
		Channels:      []string{"#test"},
		Password:      "",
	}
	for _, option := range options {
		option(&bot)
	}
	// Discard logs by default
	bot.Logger = log.New("id", logext.RandId(8), "host", bot.Host, "nick", log.Lazy{bot.getNick})

	bot.Logger.SetHandler(log.DiscardHandler())
	bot.AddTrigger(pingPong)
	bot.AddTrigger(joinChannels)
	return &bot, nil
}
func NewBot ( host , nick string , options ... func ( * Bot ) ) ( * Bot , error ) { // Defaults are set here bot := Bot { Incoming : make ( chan * Message , 16 ) , outgoing : make ( chan string , 16 ) , started : time . Now ( ) , unixastr : fmt . Sprintf ( " " , host , nick ) , Host : host , Nick : nick , ThrottleDelay : 200 * time . Millisecond , PingTimeout : 300 * time . Second , HijackSession : false , SSL : false , SASL : false , Channels : [ ] string { " " } , Password : " " , } for _ , option := range options { option ( & bot ) } // Discard logs by default bot . Logger = log . New ( " " , logext . RandId ( 8 ) , " " , bot . Host , " " , log . Lazy { bot . getNick } ) bot . Logger . SetHandler ( log . DiscardHandler ( ) ) bot . AddTrigger ( pingPong ) bot . AddTrigger ( joinChannels ) return & bot , nil }
// NewBot creates a new instance of Bot
NewBot creates a new instance of Bot