hellabot.go
func (bot *Bot) SASLAuthenticate(user, pass string) {
	bot.Debug("Beginning SASL Authentication")
	bot.Send("CAP REQ :sasl")
	bot.SetNick(bot.Nick)
	bot.sendUserCommand(bot.Nick, bot.Nick, "8")

	bot.WaitFor(func(mes *Message) bool {
		return strings.TrimSpace(mes.Content) == "sasl" && len(mes.Params) > 1 && mes.Params[1] == "ACK"
	})
	bot.Debug("Recieved SASL ACK")
	bot.Send("AUTHENTICATE PLAIN")

	bot.WaitFor(func(mes *Message) bool {
		return mes.Command == "AUTHENTICATE" && len(mes.Params) == 1 && mes.Params[0] == "+"
	})

	bot.Debug("Got auth message!")

	out := bytes.Join([][]byte{[]byte(user), []byte(user), []byte(pass)}, []byte{0})
	encpass := base64.StdEncoding.EncodeToString(out)
	bot.Send("AUTHENTICATE " + encpass)
	bot.Send("AUTHENTICATE +")
	bot.Send("CAP END")
}
func (bot *Bot) SASLAuthenticate(user, pass string) {
	bot.Debug("Beginning SASL Authentication")
	bot.Send("CAP REQ :sasl")
	bot.SetNick(bot.Nick)
	bot.sendUserCommand(bot.Nick, bot.Nick, "8")

	bot.WaitFor(func(mes *Message) bool {
		return strings.TrimSpace(mes.Content) == "sasl" && len(mes.Params) > 1 && mes.Params[1] == "ACK"
	})
	bot.Debug("Recieved SASL ACK")
	bot.Send("AUTHENTICATE PLAIN")

	bot.WaitFor(func(mes *Message) bool {
		return mes.Command == "AUTHENTICATE" && len(mes.Params) == 1 && mes.Params[0] == "+"
	})

	bot.Debug("Got auth message!")

	out := bytes.Join([][]byte{[]byte(user), []byte(user), []byte(pass)}, []byte{0})
	encpass := base64.StdEncoding.EncodeToString(out)
	bot.Send("AUTHENTICATE " + encpass)
	bot.Send("AUTHENTICATE +")
	bot.Send("CAP END")
}
func ( bot * Bot ) SASLAuthenticate ( user , pass string ) { bot . Debug ( " " ) bot . Send ( " " ) bot . SetNick ( bot . Nick ) bot . sendUserCommand ( bot . Nick , bot . Nick , " " ) bot . WaitFor ( func ( mes * Message ) bool { return strings . TrimSpace ( mes . Content ) == " " && len ( mes . Params ) > 1 && mes . Params [ 1 ] == " " } ) bot . Debug ( " " ) bot . Send ( " " ) bot . WaitFor ( func ( mes * Message ) bool { return mes . Command == " " && len ( mes . Params ) == 1 && mes . Params [ 0 ] == " " } ) bot . Debug ( " " ) out := bytes . Join ( [ ] [ ] byte { [ ] byte ( user ) , [ ] byte ( user ) , [ ] byte ( pass ) } , [ ] byte { 0 } ) encpass := base64 . StdEncoding . EncodeToString ( out ) bot . Send ( " " + encpass ) bot . Send ( " " ) bot . Send ( " " ) }
// SASLAuthenticate performs SASL authentication
// ref: https://github.com/atheme/charybdis/blob/master/doc/sasl.txt
SASLAuthenticate performs SASL authentication ref : https : // github . com / atheme / charybdis / blob / master / doc / sasl . txt