message

package
v0.0.0-...-ea7d51e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GroupHandler = "group"
	UserHandler  = "personal"
)

Variables

View Source
var (
	GroupChatType = CardChatType("group")
	UserChatType  = CardChatType("personal")
)

Functions

func SendHelperCard

func SendHelperCard(actions ...Action) string

func SendStartCard

func SendStartCard() string

SendStartCard

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

Execute run server

func (BaseAction) Helper

func (b BaseAction) Helper() []string

Helper help message

type CardChatType

type CardChatType string

type CardKind

type CardKind string

type EmptyAction

type EmptyAction struct {
	BaseAction
}

func (EmptyAction) Execute

type HelpAction

type HelpAction struct {
	BaseAction
}

func (*HelpAction) Execute

func (*HelpAction) Helper

func (*HelpAction) Helper() []string

type Message

type Message struct {
	Sender      *larkim.EventSender
	HandlerType string
	MsgType     string
	MsgId       *string
	ChatId      *string
	QParsed     string
	FileKey     string
	ImageKey    string
	ImageKeys   []string // post 消息图片组
	SessionId   *string
	Mention     []*larkim.MentionEvent
}

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

func (m *MessageHandle) SendMessage(
	ctx context.Context,
	content string,
	msgType string,
	message *Message,
) error

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

type VersionAction

type VersionAction struct {
	BaseAction
}

func (*VersionAction) Execute

func (*VersionAction) Helper

func (*VersionAction) Helper() []string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL