satori

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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentEscape

func ContentEscape(text string) string

func ContentUnescape

func ContentUnescape(str string) string

Types

type Argv

type Argv struct {
	Name      string
	Arguments []interface{}
	Options   map[string]interface{}
}

type Button

type Button struct {
	ID string
}

type Channel

type Channel struct {
	ID       string      `json:"id"`
	Type     ChannelType `json:"type"`
	Name     string      `json:"name"`
	ParentID string      `json:"parent_id" gorm:"null"`
}

type ChannelType

type ChannelType int
const (
	TextChannelType ChannelType = iota
	VoiceChannelType
	CategoryChannelType
	DirectChannelType
)

type Command

type Command struct {
	Name        string
	Description map[string]string
	Arguments   []CommandDeclaration
	Options     []CommandDeclaration
	Children    []Command
}

type CommandDeclaration

type CommandDeclaration struct {
	Name        string
	Description map[string]string
	Type        string
	Required    bool
}

type Dict

type Dict map[string]interface{}

type Element

type Element struct {
	// KElement bool      `json:"kElement"`
	Type     string     `json:"type"`
	Attrs    Dict       `json:"attrs"`
	Children []*Element `json:"children"`
}

func ElementParse

func ElementParse(text string) *Element

func FromCQCode

func FromCQCode(text string) *Element

func (*Element) ToCQCode

func (el *Element) ToCQCode() string

func (*Element) ToString

func (el *Element) ToString() string

func (*Element) Traverse

func (el *Element) Traverse(fn func(el *Element))

func (*Element) Traverse2

func (el *Element) Traverse2(fn, fn2 func(el *Element))

type Event

type Event struct {
	ID        any          `json:"id"`
	Type      EventName    `json:"type"`
	SelfID    string       `json:"selfID"`
	Platform  string       `json:"platform"`
	Timestamp uint64       `json:"timestamp"`
	Argv      *Argv        `json:"argv"`
	Channel   *Channel     `json:"channel"`
	Guild     *Guild       `json:"guild"`
	Login     *Login       `json:"login"`
	Member    *GuildMember `json:"member"`
	Message   *Message     `json:"message"`
	Operator  *User        `json:"operator"`
	Role      *GuildRole   `json:"role"`
	User      *User        `json:"user"`
	Button    *Button      `json:"button"`
}

type EventName

type EventName string
const (
	EventGenresAdded          EventName = "genres-added"
	EventGenresDeleted        EventName = "genres-deleted"
	EventMessage              EventName = "message"
	EventMessageCreated       EventName = "message-created"
	EventMessageDeleted       EventName = "message-deleted"
	EventMessageUpdated       EventName = "message-updated"
	EventMessagePinned        EventName = "message-pinned"
	EventMessageUnpinned      EventName = "message-unpinned"
	EventInteractionCommand   EventName = "interaction/command"
	EventReactionAdded        EventName = "reaction-added"
	EventReactionDeleted      EventName = "reaction-deleted"
	EventReactionDeletedOne   EventName = "reaction-deleted/one"
	EventReactionDeletedAll   EventName = "reaction-deleted/all"
	EventReactionDeletedEmoji EventName = "reaction-deleted/emoji"
	EventSend                 EventName = "send"
	EventFriendRequest        EventName = "friend-request"
	EventGuildRequest         EventName = "guild-request"
	EventGuildMemberRequest   EventName = "guild-member-request"
)

type GatewayBody

type GatewayBody struct {
	Event    Event
	Ping     struct{}
	Pong     struct{}
	Identify struct {
		Token    string
		Sequence int
	}
	Ready struct {
		Logins []Login
	}
}

type GatewayPayloadStructure

type GatewayPayloadStructure struct {
	Op   Opcode      `json:"op"`
	Body interface{} `json:"body"`
}

type GatewayPayloadStructure2

type GatewayPayloadStructure2 struct {
	Op   *Opcode     `json:"op"`
	Body interface{} `json:"body"`
}

type Guild

type Guild struct {
	ID     string
	Name   string
	Avatar string
}

type GuildMember

type GuildMember struct {
	User     *User    `json:"user"`
	Name     string   `json:"name"` // 指用户名吗?
	Nick     string   `json:"nick"`
	Avatar   string   `json:"avatar"`
	Title    string   `json:"title"`
	Roles    []string `json:"roles"`
	JoinedAt uint64   `json:"joined_at"`
}

type GuildRole

type GuildRole struct {
	ID          string
	Name        string
	Color       int
	Position    int
	Permissions int64
	Hoist       bool
	Mentionable bool
}

type Login

type Login struct {
	User     *User
	Platform string
	SelfID   string
	Status   Status
}

type Message

type Message struct {
	ID        string       `json:"id"`
	MessageID string       // Deprecated
	Channel   *Channel     `json:"channel"`
	Guild     *Guild       `json:"guild"`
	User      *User        `json:"user"`
	Member    *GuildMember `json:"member"`
	Content   string       `json:"content"`
	Elements  []*Element   `json:"elements"`
	Timestamp int64        `json:"timestamp"`
	Quote     *Message     `json:"quote"`
	CreatedAt int64        `json:"createdAt"`
	UpdatedAt int64        `json:"updatedAt"`
}

type Opcode

type Opcode int
const (
	OpEvent Opcode = iota
	OpPing
	OpPong
	OpIdentify
	OpReady
)

type ReadyState

type ReadyState int
const (
	WebSocketConnecting ReadyState = iota
	WebSocketOpen
	WebSocketClosing
	WebSocketClosed
)

type ScApiMsgPayload

type ScApiMsgPayload struct {
	Api  string `json:"api"`
	Echo string `json:"echo"`
	Data any    `json:"data"`
}

type Status

type Status int
const (
	StatusOffline Status = iota
	StatusOnline
	StatusConnect
	StatusDisconnect
	StatusReconnect
)

type User

type User struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	Nick          string `json:"nick"`
	UserID        string // Deprecated
	Username      string // Deprecated
	Nickname      string // Deprecated
	Avatar        string `json:"avatar"`
	Discriminator string `json:"discriminator"`
	IsBot         bool   `json:"is_bot"`
}

type WebSocket

type WebSocket struct {
	Connecting int
	Open       int
	Closing    int
	Closed     int
	ReadyState ReadyState
}

Jump to

Keyboard shortcuts

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