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")
}
// SASLAuthenticate performs SASL authentication
// ref: https://github.com/atheme/charybdis/blob/master/doc/sasl.txt