Exemple #1
0
func init() {
	_, file, _, _ := runtime.Caller(0)
	base := filepath.Base(file)
	ext := filepath.Ext(base)
	var err error

	Module, err = module.New(fmt.Sprintf("data%[1]cconfs%[1]c%v.toml",
		filepath.Separator, base[:len(base)-len(ext)]))
	if err != nil {
		panic(err)
	}

	registerCommands()
}
Exemple #2
0
func init() {
	_, file, _, _ := runtime.Caller(0)
	base := filepath.Base(file)
	ext := filepath.Ext(base)
	var err error

	Module, err = module.New(fmt.Sprintf("data%[1]cconfs%[1]c%v.toml",
		filepath.Separator, base[:len(base)-len(ext)]))
	if err != nil {
		panic(err)
	}

	Module.Preconnect = func() error {
		go preConnect()

		return nil
	}

	Module.Disconnect = func() error {
		quit <- true

		return nil
	}

	Module.Register(module.E_PRIVMSG, ".zen", func(line *irc.Line) {
		var zen string

		select {
		case zen = <-zenChan:
		case <-time.After(time.Second * 10):
			zen = "Timeout while waiting for zen"
		}

		Module.Logger.Infoln(fmt.Sprintf("%s - %s", line.Target(), zen))
		Module.Conn.Privmsg(line.Target(), zen)
	})
}