message

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegsiterParserElement added in v0.0.5

func RegsiterParserElement(parser MessageElementParser)

func Stringify

func Stringify([]MessageElement) (string, error)

Types

type Message

type Message struct {
	Id       string                   `json:"id"`
	Content  string                   `json:"content"`
	Channel  *channel.Channel         `json:"channel,omitempty"`
	Guild    *guild.Guild             `json:"guild,omitempty"`
	Member   *guildmember.GuildMember `json:"member,omitempty"`
	User     *user.User               `json:"user,omitempty"`
	CreateAt int64                    `json:"create_at,omitempty"`
	UpdateAt int64                    `json:"update_at,omitempty"`
}

func (*Message) Decode

func (m *Message) Decode(elements []MessageElement) error

func (*Message) Encode

func (m *Message) Encode() ([]MessageElement, error)

type MessageElement

type MessageElement interface {
	Tag() string
	Stringify() string
	Alias() []string
}

func Parse

func Parse(source string) ([]MessageElement, error)

type MessageElementA

type MessageElementA struct {
	Href string
	// contains filtered or unexported fields
}

func (MessageElementA) Alias

func (e MessageElementA) Alias() []string

func (*MessageElementA) Parse added in v0.0.5

func (e *MessageElementA) Parse(n *html.Node) (MessageElement, error)

func (*MessageElementA) Stringify

func (e *MessageElementA) Stringify() string

func (*MessageElementA) Tag

func (e *MessageElementA) Tag() string

type MessageElementAt

type MessageElementAt struct {
	Id   string
	Name string //	收发	目标用户的名称
	Role string //	收发	目标角色
	Type string //	收发	特殊操作,例如 all 表示 @全体成员,here 表示 @在线成员
	// contains filtered or unexported fields
}

func (MessageElementAt) Alias

func (e MessageElementAt) Alias() []string

func (*MessageElementAt) Parse added in v0.0.5

func (e *MessageElementAt) Parse(n *html.Node) (MessageElement, error)

func (*MessageElementAt) Stringify

func (e *MessageElementAt) Stringify() string

func (*MessageElementAt) Tag

func (e *MessageElementAt) Tag() string

type MessageElementAudio

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

func (MessageElementAudio) Alias

func (e MessageElementAudio) Alias() []string

func (*MessageElementAudio) Parse added in v0.0.5

func (*MessageElementAudio) Stringify

func (e *MessageElementAudio) Stringify() string

func (*MessageElementAudio) Tag

func (e *MessageElementAudio) Tag() string

type MessageElementAuthor

type MessageElementAuthor struct {
	Id     string
	Name   string
	Avatar string
	// contains filtered or unexported fields
}

func (MessageElementAuthor) Alias

func (e MessageElementAuthor) Alias() []string

func (*MessageElementAuthor) Parse added in v0.0.5

func (*MessageElementAuthor) Stringify

func (e *MessageElementAuthor) Stringify() string

func (*MessageElementAuthor) Tag

func (e *MessageElementAuthor) Tag() string

type MessageElementButton

type MessageElementButton struct {

	//	id	string?	发	按钮的 ID
	//
	// type	string?	发	按钮的类型
	// href	string?	发	按钮的链接
	// text	string?	发	待输入文本
	// theme	string?	发	按钮的样式
	Id    string
	Type  string
	Href  string
	Text  string
	Theme string
	// contains filtered or unexported fields
}

func (MessageElementButton) Alias

func (e MessageElementButton) Alias() []string

func (*MessageElementButton) Parse added in v0.0.5

func (*MessageElementButton) Stringify

func (e *MessageElementButton) Stringify() string

func (*MessageElementButton) Tag

func (e *MessageElementButton) Tag() string

type MessageElementCode

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

func (MessageElementCode) Alias

func (e MessageElementCode) Alias() []string

func (*MessageElementCode) Parse added in v0.0.5

func (*MessageElementCode) Stringify

func (e *MessageElementCode) Stringify() string

func (*MessageElementCode) Tag

func (e *MessageElementCode) Tag() string

type MessageElementDel

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

func (*MessageElementDel) Alias

func (e *MessageElementDel) Alias() []string

func (*MessageElementDel) Parse added in v0.0.5

func (*MessageElementDel) Stringify

func (e *MessageElementDel) Stringify() string

func (*MessageElementDel) Tag

func (e *MessageElementDel) Tag() string

type MessageElementEm

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

func (*MessageElementEm) Alias

func (e *MessageElementEm) Alias() []string

func (*MessageElementEm) Parse added in v0.0.5

func (e *MessageElementEm) Parse(n *html.Node) (MessageElement, error)

func (*MessageElementEm) Stringify

func (e *MessageElementEm) Stringify() string

func (*MessageElementEm) Tag

func (e *MessageElementEm) Tag() string

type MessageElementFile

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

func (MessageElementFile) Alias

func (e MessageElementFile) Alias() []string

func (*MessageElementFile) Parse added in v0.0.5

func (*MessageElementFile) Stringify

func (e *MessageElementFile) Stringify() string

func (*MessageElementFile) Tag

func (e *MessageElementFile) Tag() string

type MessageElementImg

type MessageElementImg struct {
	Width  uint32
	Height uint32
	// contains filtered or unexported fields
}

func (MessageElementImg) Alias

func (e MessageElementImg) Alias() []string

func (*MessageElementImg) Parse added in v0.0.5

func (*MessageElementImg) Stringify

func (e *MessageElementImg) Stringify() string

func (*MessageElementImg) Tag

func (e *MessageElementImg) Tag() string

type MessageElementIns

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

func (*MessageElementIns) Alias

func (e *MessageElementIns) Alias() []string

func (*MessageElementIns) Parse added in v0.0.5

func (*MessageElementIns) Stringify

func (e *MessageElementIns) Stringify() string

func (*MessageElementIns) Tag

func (e *MessageElementIns) Tag() string

type MessageElementMessage

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

func (MessageElementMessage) Alias

func (e MessageElementMessage) Alias() []string

func (*MessageElementMessage) Parse added in v0.0.5

func (*MessageElementMessage) Stringify

func (e *MessageElementMessage) Stringify() string

func (*MessageElementMessage) Tag

func (e *MessageElementMessage) Tag() string

type MessageElementParser added in v0.0.5

type MessageElementParser interface {
	Tag() string
	Alias() []string
	Parse(n *html.Node) (MessageElement, error)
}

type MessageElementQuote

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

func (MessageElementQuote) Alias

func (e MessageElementQuote) Alias() []string

func (*MessageElementQuote) Parse added in v0.0.5

func (*MessageElementQuote) Stringify

func (e *MessageElementQuote) Stringify() string

func (*MessageElementQuote) Tag

func (e *MessageElementQuote) Tag() string

type MessageElementSharp

type MessageElementSharp struct {
	Id   string //收发	目标频道的 ID
	Name string //收发	目标频道的名称
	// contains filtered or unexported fields
}

func (MessageElementSharp) Alias

func (e MessageElementSharp) Alias() []string

func (*MessageElementSharp) Parse added in v0.0.5

func (*MessageElementSharp) Stringify

func (e *MessageElementSharp) Stringify() string

func (*MessageElementSharp) Tag

func (e *MessageElementSharp) Tag() string

type MessageElementSpl

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

func (MessageElementSpl) Alias

func (e MessageElementSpl) Alias() []string

func (*MessageElementSpl) Parse added in v0.0.5

func (*MessageElementSpl) Stringify

func (e *MessageElementSpl) Stringify() string

func (*MessageElementSpl) Tag

func (e *MessageElementSpl) Tag() string

type MessageElementStrong

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

func (*MessageElementStrong) Alias

func (e *MessageElementStrong) Alias() []string

func (*MessageElementStrong) Parse added in v0.0.5

func (*MessageElementStrong) Stringify

func (e *MessageElementStrong) Stringify() string

func (*MessageElementStrong) Tag

func (e *MessageElementStrong) Tag() string

type MessageElementSub

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

func (MessageElementSub) Alias

func (e MessageElementSub) Alias() []string

func (*MessageElementSub) Parse added in v0.0.5

func (*MessageElementSub) Stringify

func (e *MessageElementSub) Stringify() string

func (*MessageElementSub) Tag

func (e *MessageElementSub) Tag() string

type MessageElementSup

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

func (MessageElementSup) Alias

func (e MessageElementSup) Alias() []string

func (*MessageElementSup) Parse added in v0.0.5

func (*MessageElementSup) Stringify

func (e *MessageElementSup) Stringify() string

func (*MessageElementSup) Tag

func (e *MessageElementSup) Tag() string

type MessageElementText

type MessageElementText struct {
	Content string
	// contains filtered or unexported fields
}

func (MessageElementText) Alias

func (e MessageElementText) Alias() []string

func (*MessageElementText) Parse added in v0.0.5

func (*MessageElementText) Stringify

func (e *MessageElementText) Stringify() string

func (*MessageElementText) Tag

func (e *MessageElementText) Tag() string

type MessageElementVedio

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

func (MessageElementVedio) Alias

func (e MessageElementVedio) Alias() []string

func (*MessageElementVedio) Parse added in v0.0.5

func (*MessageElementVedio) Stringify

func (e *MessageElementVedio) Stringify() string

func (*MessageElementVedio) Tag

func (e *MessageElementVedio) Tag() string

type MessageElmentBr

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

func (MessageElmentBr) Alias

func (e MessageElmentBr) Alias() []string

func (*MessageElmentBr) Parse added in v0.0.5

func (e *MessageElmentBr) Parse(n *html.Node) (MessageElement, error)

func (*MessageElmentBr) Stringify

func (e *MessageElmentBr) Stringify() string

func (*MessageElmentBr) Tag

func (e *MessageElmentBr) Tag() string

type MessageElmentP

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

func (MessageElmentP) Alias

func (e MessageElmentP) Alias() []string

func (*MessageElmentP) Parse added in v0.0.5

func (e *MessageElmentP) Parse(n *html.Node) (MessageElement, error)

func (*MessageElmentP) Stringify

func (e *MessageElmentP) Stringify() string

func (*MessageElmentP) Tag

func (e *MessageElmentP) Tag() string

type MessageList

type MessageList struct {
	Data []Message `json:"data"`
	Next string    `json:"next,omitempty"`
}

Jump to

Keyboard shortcuts

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