go-bot/workers/newworker.go

21 lines
473 B
Go

package workers
import "fmt"
func NewWorker(parms []string, uid, gid, role, mid, rawMsg string) Worker {
fmt.Println("NewWorker:", parms)
switch parms[0] {
case "ping":
return &Ping{
StdAns: NewStdAns(parms, uid, gid, role, mid, rawMsg),
}
// 在这里添加其他 worker 的 case
case "pkg":
return &Pkg{
StdAns: NewStdAns(parms, uid, gid, role, mid, rawMsg),
}
default:
return &Emm{
StdAns: NewStdAns(parms, uid, gid, role, mid, rawMsg)}
}
}