func Init(mod *modules.Module) { mod.AddIrcMessageHandler("join on ok", func(event *irc.Message) { if event.Command == "001" { channels := mod.GetConfig().GetStringSlice("autojoin.channels") for _, chn := range channels { event.Server.Join(chn) } } }, nil) }
func UpdateInit(mod *modules.Module) { owner := &modules.OwnerPermission{} mod.AddResponse(updatereg, func(r *modules.Response) { r.Respond("okey, " + r.Nick + "!") err, errRecover := update.New().FromUrl(mod.GetConfig().UpdateUrl) if err != nil { r.Respondf("Update failed: %v", err) if errRecover != nil { log.Errorf("Failed to recover bad update: %v!", errRecover) log.Fatalf("Program exectuable may be missing!") } return } log.Info("Update done!") r.Respond("update done!") //restart syscall.Kill(syscall.Getpid(), syscall.SIGUSR2) }, owner) }