You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
931 B
Go

package live_logic
import "dcg/pkg/cmd"
type (
LogicOption func(logic LiveLogic)
)
func WithGameType(gameType string) LogicOption {
return func(logic LiveLogic) {
logic.SetGameType(gameType)
}
}
func WithPreDanmakuHandler(handler PreDanmakuHandlerFunc) LogicOption {
return func(logic LiveLogic) {
logic.SetPreDanmakuHandler(handler)
}
}
func WithCmdParser(parser *cmd.Parser) LogicOption {
return func(logic LiveLogic) {
logic.SetCmdParser(parser)
}
}
func WithGiftHandler(handler GiftHandler) LogicOption {
return func(logic LiveLogic) {
logic.RegisterGiftHandler(handler)
}
}
func WithNobilityHandler(handler NobilityHandlerFunc) LogicOption {
return func(logic LiveLogic) {
logic.RegisterNobilityHandler(handler)
}
}
func WithCmdHandler(handler CMDHandlerFunc, prefix string, alias ...string) LogicOption {
return func(logic LiveLogic) {
logic.RegisterCMDHandler(handler, prefix, alias...)
}
}