An IRC framework in Go aimed for ease of use and flexibility.
./ezbot_linux
go get -v github.com/godwhoa/ezbot
cd $GOPATH/src/github.com/godwhoa/ezbot
go run main.go
package main
import(
"github.com/godwhoa/ezbot/ezbot"
)
type Echo struct {
ezbot.Command
}
func NewEcho(nick string) *Echo {
echo := new(Echo)
echo.Pattern = "^" + nick + "!$" // regex for the command
return echo
}
// Runs when it matches with the regex
func (e *Echo) Execute(user string, msg string, args []string) {
e.SChan <- user + "!"
}
// Other methods like OnJoin, OnLeave, OnMsg are also available
// Note: you can leave them out if you wish to
// Also see commands dir. for examples and go read thru ezbot/command.go
func main(){
// create a bot
bot := ezbot.New()
// Init command
echo := NewEcho("ezbot")
// Add commands
bot.Add(echo)
// Connects and spins-off a read/write loop
bot.Connect(ezbot.Config{Nick:"ezbot",Addr:"chat.freenode.net:6667",Channel:"##ezirc"})
}
Add more commandsFix url regexHandle TLS serversConfig fileHandle nick collisionBetter naming of types, variables etc.- Add tests