Example #1
0
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
}
Example #2
0
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
}