Documentation ¶
Index ¶
- Variables
- func AtMessageEventHandler(api openapi.OpenAPI) event.ATMessageEventHandler
- func FormatCommandArgumentInfo(index int, info HandlerInfo) string
- func FormatCommandHelpArgumentMessage(command, content string, commandInfos []HandlerInfo) string
- func FormatHelpInfo(index int, info HandlerInfo) string
- func FormatIncorrectCommandArgumentMessage(commandInfos []HandlerInfo) string
- func FormatListAllServiceInfoMessage() string
- func FormatListHelpInfoMessage(command string, commandInfos []HandlerInfo) string
- func FormatNotMatchedCommandMessage(command, content string) string
- func FormatServiceInfo(index int, service string) string
- func Serve()
- type Client
- type Context
- type HandlerInfo
- type HandlerMatcher
- type MessageHandleFunction
- type MustHandleFunction
- type OptionalHandleFunction
- func HelpCommandReplyHandler() OptionalHandleFunction
- func IncorrectCommandReplyHandler() OptionalHandleFunction
- func ListAllCommandReplyHandler() OptionalHandleFunction
- func ListCommandReplyHandler() OptionalHandleFunction
- func NotFoundCommandAfterIncorrectCommandCheckReplyHandler() OptionalHandleFunction
- func NotMatchedCommandReplyHandler() OptionalHandleFunction
- type Payload
- type SystemConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NotMatchedCommandMessageTemplate = "很抱歉,没有找到这个命令,这个命令可能不存在或者仍在测试中,命令:%s,参数:%s" IncorrectCommandArgumentMessageTemplate = "很抱歉,您的命令输入有误,您使用的命令可能是:\n%s" CommandHelpArgumentMessageTemplate = "功能%s,参数%s的命令使用提示如下:\n%s" CommandArgumentInfoTemplate = "%d. %s: %s\n描述:%s\n\n使用示例:\n%s\n" ListHelpInfoMessageTemplate = "功能%s的命令如下:\n%s" HelpInfoTemplate = "%d. %s: %s" ListAllServiceInfoTemplate = "所有功能如下:\n%s" ServiceInfoTemplate = "%d. %s" )
Functions ¶
func AtMessageEventHandler ¶
func AtMessageEventHandler(api openapi.OpenAPI) event.ATMessageEventHandler
func FormatCommandArgumentInfo ¶
func FormatCommandArgumentInfo(index int, info HandlerInfo) string
func FormatCommandHelpArgumentMessage ¶
func FormatCommandHelpArgumentMessage(command, content string, commandInfos []HandlerInfo) string
func FormatHelpInfo ¶
func FormatHelpInfo(index int, info HandlerInfo) string
func FormatIncorrectCommandArgumentMessage ¶
func FormatIncorrectCommandArgumentMessage(commandInfos []HandlerInfo) string
func FormatListAllServiceInfoMessage ¶
func FormatListAllServiceInfoMessage() string
func FormatListHelpInfoMessage ¶
func FormatListHelpInfoMessage(command string, commandInfos []HandlerInfo) string
func FormatServiceInfo ¶
Types ¶
type Client ¶
type Context ¶
type Context interface { GetContext() context.Context SetContext(ctx context.Context) GetApi() Client GetPayload() Payload Next() Abort() IsAborted() bool }
func NewContext ¶
func NewContext(ctx context.Context, api openapi.OpenAPI, payload Payload, functions []MustHandleFunction, handlers []OptionalHandleFunction) Context
type HandlerInfo ¶
type HandlerMatcher ¶
type HandlerMatcher interface { MatchHandlers(command string, content string) (mustHandlers []MustHandleFunction, optionalHandlers []OptionalHandleFunction) SetDefaultHandlerFunctions(mustHandlers []MustHandleFunction, optionalHandlers []OptionalHandleFunction) RegisterCommand(commandKey, commandName, commandDescription, commandExample string, contentFilter func(string) bool, mustHandlers []MustHandleFunction, optionalHandlers []OptionalHandleFunction) ListCommands(commandKey string) (commandInfoMap map[string]HandlerInfo) ListAllCommands() (commands []string) GetHelpInfo(commandKey, commandContent string) (commandInfo []HandlerInfo) }
func DefaultMatcher ¶
func DefaultMatcher() HandlerMatcher
func NewHandlerMatcher ¶
func NewHandlerMatcher() HandlerMatcher
type MessageHandleFunction ¶
type MessageHandleFunction func(ctx Context)
MessageHandleFunction 消息处理函数
type MustHandleFunction ¶
type MustHandleFunction MessageHandleFunction
MustHandleFunction 必须被处理的消息处理函数
type OptionalHandleFunction ¶
type OptionalHandleFunction MessageHandleFunction
OptionalHandleFunction 可以不被处理的消息处理函数
func HelpCommandReplyHandler ¶
func HelpCommandReplyHandler() OptionalHandleFunction
func IncorrectCommandReplyHandler ¶
func IncorrectCommandReplyHandler() OptionalHandleFunction
func ListAllCommandReplyHandler ¶
func ListAllCommandReplyHandler() OptionalHandleFunction
func ListCommandReplyHandler ¶
func ListCommandReplyHandler() OptionalHandleFunction
func NotFoundCommandAfterIncorrectCommandCheckReplyHandler ¶
func NotFoundCommandAfterIncorrectCommandCheckReplyHandler() OptionalHandleFunction
func NotMatchedCommandReplyHandler ¶
func NotMatchedCommandReplyHandler() OptionalHandleFunction
Source Files ¶
Click to show internal directories.
Click to hide internal directories.