package main import ( "os" ) // a description of type chatProcedure struct { init func(*openIDSessionData) //house keeping clean func(*openIDSessionData) //house keeping start func(*openIDSessionData, InWechatMsg) //for first message serve func(*openIDSessionData, InWechatMsg) //for all subsequent message summary func(*openIDSessionData) //after all message has been done intro func(*openIDSessionData) //initial text/video/voice introduction } //AllProc all procedure that we implemented var AllProc = map[string]chatProcedure{} func initAllProc() { AllProc["Dummy"] = procDummy //Simple Echo Proc AllProc["Echo"] = procEcho //Get Basic UserInfo AllProc["GetUserBasicInfo"] = procGetBasicUserInfo } func getProcedurePath(openID, ProcedureName string) (path string) { path = procedureDir + string(os.PathSeparator) + ProcedureName + string(os.PathSeparator) + openID + ".json" ensurePathExist(path) return }