message

package
v0.0.0-...-9415ce5 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractLocalTempFile

func ExtractLocalTempFile(path string) (string, string, error)

ExtractLocalTempFile 按路径提取临时文件,路径可以是 http/base64/本地路径

func ImageRewrite

func ImageRewrite(longText string, solve func(text string) string) string

func SealCodeToCqCode

func SealCodeToCqCode(text string) string

Types

type AtElement

type AtElement struct {
	Target string `jsbind:"target"`
}

func (*AtElement) Type

func (t *AtElement) Type() ElementType

type CQCommand

type CQCommand struct {
	Type      string
	Args      map[string]string
	Overwrite string
}

func (*CQCommand) Compile

func (c *CQCommand) Compile() string

type ElementType

type ElementType int
const (
	Text   ElementType = iota // 文本
	At                        // 艾特
	File                      // 文件
	Image                     // 图片
	TTS                       // 文字转语音
	Reply                     // 回复
	Record                    // 语音
	Face                      // 表情
)

type FaceElement

type FaceElement struct {
	FaceID string `jsbind:"faceID"`
}

func (*FaceElement) Type

func (f *FaceElement) Type() ElementType

type FileElement

type FileElement struct {
	ContentType string
	Stream      io.Reader
	File        string
	URL         string
}

func FilepathToFileElement

func FilepathToFileElement(fp string) (*FileElement, error)

func (*FileElement) Type

func (l *FileElement) Type() ElementType

type IMessageElement

type IMessageElement interface {
	Type() ElementType
}

func CQToText

func CQToText(t string, d map[string]string) IMessageElement

func ConvertStringMessage

func ConvertStringMessage(raw string) (r []IMessageElement)

type ImageElement

type ImageElement struct {
	File *FileElement
	URL  string
}

func (*ImageElement) Type

func (l *ImageElement) Type() ElementType

type RecordElement

type RecordElement struct {
	File *FileElement
}

func (*RecordElement) Type

func (r *RecordElement) Type() ElementType

type ReplyElement

type ReplyElement struct {
	ReplySeq string            `jsbind:"replySeq"` // 回复的目标消息ID
	Sender   string            `jsbind:"sender"`   // 回复的目标消息发送者ID
	GroupID  string            `jsbind:"groupID"`  // 回复群聊消息时的群号
	Elements []IMessageElement `jsbind:"elements"` // 回复的消息内容
}

func (*ReplyElement) Type

func (t *ReplyElement) Type() ElementType

type TTSElement

type TTSElement struct {
	Content string
}

func (*TTSElement) Type

func (t *TTSElement) Type() ElementType

type TextElement

type TextElement struct {
	Content string `jsbind:"content"`
}

func (*TextElement) Type

func (t *TextElement) Type() ElementType

Jump to

Keyboard shortcuts

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