Documentation ¶
Index ¶
- Constants
- Variables
- func SendHelperCard(actions ...Action) string
- func SendStartCard() string
- type Action
- type ActionInfo
- type BaseAction
- type CardChatType
- type CardKind
- type EmptyAction
- type HelpAction
- type Message
- type MessageHandle
- func (m *MessageHandle) RegisterAction(action Action) MessageHandleInterface
- func (m *MessageHandle) RegisterActions(actions ...Action) MessageHandleInterface
- func (m *MessageHandle) RegisterRoute(path string, g gin.IRouter)
- func (m *MessageHandle) Reply(ctx context.Context, messageId string, message string, msgType string) error
- func (m *MessageHandle) ReplyJudgeMessage(ctx context.Context, content string, msgType string, message *Message) error
- func (m *MessageHandle) SendMessage(ctx context.Context, content string, msgType string, message *Message) error
- type MessageHandleInterface
- type MessageHandleOptions
- type StartAction
- type VersionAction
Constants ¶
View Source
const ( GroupHandler = "group" UserHandler = "personal" )
Variables ¶
View Source
var ( GroupChatType = CardChatType("group") UserChatType = CardChatType("personal") )
Functions ¶
func SendHelperCard ¶
Types ¶
type Action ¶
type Action interface { Helper() []string Execute(a *ActionInfo, m MessageHandleInterface) bool }
type ActionInfo ¶
type ActionInfo struct { Handler MessageHandleInterface Ctx *context.Context Info *Message }
type BaseAction ¶
type BaseAction struct{}
func (BaseAction) Execute ¶
func (b BaseAction) Execute(a *ActionInfo, m MessageHandleInterface) bool
Execute run server
type CardChatType ¶
type CardChatType string
type EmptyAction ¶
type EmptyAction struct {
BaseAction
}
func (EmptyAction) Execute ¶
func (EmptyAction) Execute(a *ActionInfo, m MessageHandleInterface) bool
type HelpAction ¶
type HelpAction struct {
BaseAction
}
func (*HelpAction) Execute ¶
func (*HelpAction) Execute(a *ActionInfo, m MessageHandleInterface) bool
func (*HelpAction) Helper ¶
func (*HelpAction) Helper() []string
type MessageHandle ¶
type MessageHandle struct { EncryptKey *atomic.String VerificationToken *atomic.String // contains filtered or unexported fields }
func (*MessageHandle) RegisterAction ¶
func (m *MessageHandle) RegisterAction(action Action) MessageHandleInterface
func (*MessageHandle) RegisterActions ¶
func (m *MessageHandle) RegisterActions(actions ...Action) MessageHandleInterface
func (*MessageHandle) RegisterRoute ¶
func (m *MessageHandle) RegisterRoute(path string, g gin.IRouter)
func (*MessageHandle) Reply ¶
func (m *MessageHandle) Reply(ctx context.Context, messageId string, message string, msgType string) error
Reply reply user send message
func (*MessageHandle) ReplyJudgeMessage ¶
func (m *MessageHandle) ReplyJudgeMessage( ctx context.Context, content string, msgType string, message *Message, ) error
ReplyJudgeMessage
func (*MessageHandle) SendMessage ¶
type MessageHandleInterface ¶
type MessageHandleInterface interface { RegisterRoute(path string, g gin.IRouter) RegisterAction(action Action) MessageHandleInterface RegisterActions(actions ...Action) MessageHandleInterface Reply(ctx context.Context, messageId string, message string, msgType string) error ReplyJudgeMessage(ctx context.Context, content string, msgType string, message *Message) error SendMessage(ctx context.Context, content string, msgType string, message *Message) error }
func NewMessageHandler ¶
func NewMessageHandler(cli *lark.Client, opts ...MessageHandleOptions) MessageHandleInterface
type MessageHandleOptions ¶
type MessageHandleOptions func(m *MessageHandle)
func WithEncryptKey ¶
func WithEncryptKey(encrypt string) MessageHandleOptions
func WithVerificationToken ¶
func WithVerificationToken(token string) MessageHandleOptions
WithVerificationToken
type StartAction ¶
type StartAction struct {
BaseAction
}
StartAction /start
func (*StartAction) Execute ¶
func (*StartAction) Execute(a *ActionInfo, m MessageHandleInterface) bool
type VersionAction ¶
type VersionAction struct {
BaseAction
}
func (*VersionAction) Execute ¶
func (*VersionAction) Execute(a *ActionInfo, m MessageHandleInterface) bool
func (*VersionAction) Helper ¶
func (*VersionAction) Helper() []string
Click to show internal directories.
Click to hide internal directories.