dingtalkbot

package module
v0.0.0-...-2faf220 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 23 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

type Chain struct {
	// contains filtered or unexported fields
}

Chain multi handler module

func ModuleChain

func ModuleChain() *Chain

func (*Chain) Handle

func (c *Chain) Handle(handler HandlerFunc) *Chain

func (*Chain) Use

func (c *Chain) Use(middleware HandlerFunc) *Chain

type ChatChain

type ChatChain struct {
	// contains filtered or unexported fields
}

ChatChain check prefix as command handler module

func ModuleChatChain

func ModuleChatChain() *ChatChain

func (*ChatChain) Default

func (c *ChatChain) Default(handler HandlerFunc) *ChatChain

func (*ChatChain) Handle

func (c *ChatChain) Handle(command string, handler HandlerFunc) *ChatChain

func (*ChatChain) Use

func (c *ChatChain) Use(middleware HandlerFunc) *ChatChain

type ChatMessage

type ChatMessage *chatbot.BotCallbackDataModel

type Client

type Client struct {
	*Messenger
	// contains filtered or unexported fields
}

func NewClient

func NewClient(id, secret string) (client *Client, err error)

func (*Client) AutoReconnect

func (c *Client) AutoReconnect() *Client

func (*Client) Debug

func (c *Client) Debug(debug bool) *Client

func (*Client) Register

func (c *Client) Register(messageType MessageType, module Module) *Client

func (*Client) Start

func (c *Client) Start() error

func (*Client) Stop

func (c *Client) Stop() error

type Context

type Context struct {
	*Message

	Client *Client

	Next func()
	// contains filtered or unexported fields
}

func (*Context) Abort

func (c *Context) Abort()

func (*Context) AbortWithError

func (c *Context) AbortWithError(err error)

func (*Context) Args

func (c *Context) Args() []string

func (*Context) Logger

func (c *Context) Logger() *log.Logger

type DingTalkMessage

type DingTalkMessage struct {
	MsgKey         string            `json:"msgKey" mapstructure:"msgKey"`
	MsgParam       map[string]string `json:"msgParam" mapstructure:"msgParam"`
	ConversationId string            `json:"openConversationId" mapstructure:"openConversationId"`
	// contains filtered or unexported fields
}

func (DingTalkMessage) MarshalJSON

func (msg DingTalkMessage) MarshalJSON() ([]byte, error)

func (*DingTalkMessage) OpenConversationId

func (msg *DingTalkMessage) OpenConversationId() string

type EventMessage

type EventMessage *(struct {
	Header *event.EventHeader
	// contains filtered or unexported fields
})

type HandlerFunc

type HandlerFunc func(*Context)

type Message

type Message struct {
	Type MessageType
	// contains filtered or unexported fields
}

func (*Message) Chat

func (m *Message) Chat() ChatMessage

func (*Message) Event

func (m *Message) Event() EventMessage

type MessageType

type MessageType string
const (
	TypeChat  MessageType = "Chat"
	TypeEvent MessageType = "Event"
)

type Messenger

type Messenger struct {
	// contains filtered or unexported fields
}

func (*Messenger) Send

func (m *Messenger) Send(msg Sendable)

func (*Messenger) SendMarkdownMessage

func (m *Messenger) SendMarkdownMessage(conversationId, title, text string)

func (*Messenger) SendTextMessage

func (m *Messenger) SendTextMessage(conversationId, text string)

type Module

type Module interface {
	// contains filtered or unexported methods
}

type RWMap

type RWMap[T comparable, R any] struct {
	// contains filtered or unexported fields
}

func NewRWMap

func NewRWMap[T comparable, R any]() *RWMap[T, R]

func NewRWValueMap

func NewRWValueMap[T comparable]() *RWMap[T, *Value]

func (*RWMap[T, R]) Delete

func (rw *RWMap[T, R]) Delete(key T)

func (*RWMap[T, R]) Each

func (rw *RWMap[T, R]) Each(f func(T, R) bool)

func (*RWMap[T, R]) Get

func (rw *RWMap[T, R]) Get(key T) (R, bool)

func (RWMap[T, R]) MarshalJSON

func (rw RWMap[T, R]) MarshalJSON() ([]byte, error)

func (*RWMap[T, R]) MustGet

func (rw *RWMap[T, R]) MustGet(key T) R

func (*RWMap[T, R]) Put

func (rw *RWMap[T, R]) Put(key T, value R)

func (*RWMap[T, R]) Size

func (rw *RWMap[T, R]) Size() int

func (*RWMap[T, R]) UnmarshalJSON

func (rw *RWMap[T, R]) UnmarshalJSON(bytes []byte) error

type Sendable

type Sendable interface {
	json.Marshaler
	OpenConversationId() string
}

type Simple

type Simple struct {
	// contains filtered or unexported fields
}

Simple only one handler module

func ModuleSimple

func ModuleSimple() *Simple

func (*Simple) Handle

func (s *Simple) Handle(handler HandlerFunc) *Simple

type Value

type Value struct {
	// contains filtered or unexported fields
}

func NewValue

func NewValue(value any) *Value

func (Value) MarshalJSON

func (v Value) MarshalJSON() ([]byte, error)

func (*Value) UnmarshalJSON

func (v *Value) UnmarshalJSON(bytes []byte) error

Jump to

Keyboard shortcuts

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