func main() { conf, err := rbot.ReadConfig(config) if err != nil { panic(err) } bot := rbot.NewBot(rain.Version(), conf) setup.Default(bot) bot.DefaultConnect() // Logs privmsgs from connected channels bot.AddListener("PRIVMSG", func(msg *irc.Message) { fmt.Println(msg.Trailing) }) reason, err := bot.WaitForQuit() if err != nil { fmt.Printf("Quit Error: %s\n", reason) os.Exit(1) } fmt.Printf("Quit: %s\n", reason) }
func main() { if len(os.Args) < 2 { program := strings.TrimSuffix(filepath.Base(os.Args[0]), ".exe") fmt.Println("Usage: " + program + " config.json") os.Exit(1) } rconf, err := rbot.ReadConfig(os.Args[1]) if err != nil { fmt.Println(err) os.Exit(1) } bot := rbot.NewBot(rain.Version(), rconf) setup.Default(bot) bot.EnableModules() bot.DefaultConnectWithMsg("Connecting...", "Done") reason, err := bot.WaitForQuit() if err != nil { fmt.Printf("Quit Error: %s\n", reason) os.Exit(1) } fmt.Printf("Quit: %s\n", reason) }