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.
38 lines
783 B
Go
38 lines
783 B
Go
2 years ago
|
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 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...)
|
||
|
}
|
||
|
}
|