예제 #1
0
파일: loader.go 프로젝트: wan-qy/gotgbot
func LoadModules(tg *telegram.Telegram, config map[string]interface{}) (types.CommandMap, types.Command) {
	modules := parseModules(config["modules"].(map[string]interface{}))
	ret := make(types.CommandMap)
	def := types.Command{}

	// Help
	if d := help.Setup(tg, config, modules, &ret); d.Processor != nil {
		def = d
	}

	// Misc
	if d := misc.Setup(tg, config, modules, &ret); d.Processor != nil {
		def = d
	}

	// Scholar
	if d := scholar.Setup(tg, config, modules, &ret); d.Processor != nil {
		def = d
	}

	// Chinese
	if d := chinese.Setup(tg, config, modules, &ret); d.Processor != nil {
		def = d
	}

	// Script
	if d := script.Setup(tg, config, modules, &ret); d.Processor != nil {
		def = d
	}

	return ret, def
}
예제 #2
0
파일: loader.go 프로젝트: PeterCxy/gotgbot
func LoadModules(tg *telegram.Telegram, config map[string]interface{}) (types.CommandMap, types.Command) {
	modules := parseModules(config["modules"].(map[string]interface{}))
	ret := make(types.CommandMap)
	def := types.Command{}

	// Help
	if d := help.Setup(tg, config, modules, &ret); d.Processor != nil {
		def = d
	}

	// Misc
	if d := misc.Setup(tg, config, modules, &ret); d.Processor != nil {
		def = d
	}

	// Scholar
	if d := scholar.Setup(tg, config, modules, &ret); d.Processor != nil {
		def = d
	}

	// Chinese
	if d := chinese.Setup(tg, config, modules, &ret); d.Processor != nil {
		def = d
	}

	// Script
	if d := script.Setup(tg, config, modules, &ret); d.Processor != nil {
		def = d
	}

	// Pictures
	if d := pictures.Setup(tg, config, modules, &ret); d.Processor != nil {
		def = d
	}

	// Barcode
	if d := barcode.Setup(tg, config, modules, &ret); d.Processor != nil {
		def = d
	}

	// Blackgun
	if d := blackgun.Setup(tg, config, modules, &ret); d.Processor != nil {
		def = d
	}

	// Load Channels
	gank.Init(tg, modules, config)

	return ret, def
}