model

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeMessage = "message"
	EventTypeNotice  = "notice"
	EventTypeRequest = "request"
)
View Source
const (
	MessageTypeText     = "text"
	MessageTypeAt       = "at"
	MessageTypeAudio    = "audio"
	MessageTypeImage    = "image"
	MessageTypeFile     = "file"
	MessageTypeLocation = "location"
	MessageTypeVideo    = "video"
	MessageTypeLink     = "link"
	MessageTypeContact  = "contact"
	MessageTypeGroup    = "group"
	MessageTypeRich     = "rich"
	MessageTypeAction   = "action"
	MessageTypeScript   = "script"
)
View Source
const (
	MessageScriptOfJavascript = "javascript"
	MessageScriptOfFlowscript = "flowscript"
	MessageScriptOfUndefined  = "undefined"
)
View Source
const (
	PlatformSlack    = "slack"
	PlatformTelegram = "telegram"
	PlatformDiscord  = "discord"
)

Variables

This section is empty.

Functions

func GenerateMessageUUID

func GenerateMessageUUID() (string, error)

GenerateMessageID generates a random ID for a message

func IsMessageOfAction

func IsMessageOfAction(text string) bool

func IsMessageOfScript

func IsMessageOfScript(text string) bool

func MessageScriptKind

func MessageScriptKind(text string) string

Types

type Event

type Event struct {
	ID      int
	UUID    string
	Type    string
	Time    time.Time
	Context EventContext `gorm:"-"`
	Data    EventData    `gorm:"-"`
	Event   string       `json:"event"`
}

FIXME

func (*Event) AfterFind

func (e *Event) AfterFind(tx *gorm.DB) (err error)

func (*Event) BeforeCreate

func (e *Event) BeforeCreate(tx *gorm.DB) (err error)

type EventContext

type EventContext struct {
	Platform   string `json:"platform"`
	Via        string `json:"via"`
	Type       string `json:"type"`
	UserID     string `json:"user_id"`
	UserTID    string `json:"user_tid"`
	GroupID    string `json:"group_id"`
	GroupTID   string `json:"group_tid"`
	DiscussID  string `json:"discuss_id"`
	DiscussTID string `json:"discuss_tid"`
	Extra      interface{}
}

type EventData

type EventData struct {
	Type              string      `json:"type"`
	Message           Message     `json:"message"`
	SenderID          string      `json:"sender_id"`
	SenderTID         string      `json:"sender_tid"`
	SenderName        string      `json:"sender_name"`
	SenderRemarkName  string      `json:"sender_remark_name"`
	Sender            string      `json:"sender"`
	GroupID           string      `json:"group_id"`
	GroupTID          string      `json:"group_tid"`
	GroupName         string      `json:"group_name"`
	GroupRemarkName   string      `json:"group_remark_name"`
	Group             string      `json:"group"`
	DiscussID         string      `json:"discuss_id"`
	DiscussTID        string      `json:"discuss_tid"`
	DiscussName       string      `json:"discuss_name"`
	DiscussRemarkName string      `json:"discuss_remark_name"`
	Discuss           string      `json:"discuss"`
	SenderRole        string      `json:"sender_role"`
	Extra             interface{} `json:"extra"`
}

type Message

type Message struct {
	Type string      `json:"type"`
	Text string      `json:"text"`
	Data interface{} `json:"data"`
}

type MessageAction

type MessageAction struct {
	Action string
	Cron   string
}

type MessageAt

type MessageAt struct {
	UserID         string
	UserTID        string
	UserName       string
	UserRemarkName string
	User           interface{}
}

type MessageAudio

type MessageAudio struct {
	Url     string
	Path    string
	Data    string
	MediaID string
}

type MessageContact

type MessageContact struct {
	UserID   string
	UserTID  string
	UserName string
}

type MessageFile

type MessageFile struct {
	Url     string
	Path    string
	Data    string
	MediaID string
}

type MessageGroup

type MessageGroup struct {
	GroupID   string
	GroupTID  string
	GroupName string
}

type MessageImage

type MessageImage struct {
	Url     string
	Path    string
	Data    string
	MediaID string
}
type MessageLink struct {
	Url     string
	Title   string
	Content string
	Image   string
}

type MessageLocation

type MessageLocation struct {
	Latitude    float64
	Longitude   float64
	Description string
}

type MessageRich

type MessageRich struct {
	Url         string
	Description string
}

type MessageScript

type MessageScript struct {
	Type string
	Code string
}

type MessageVideo

type MessageVideo struct {
	Url     string
	Path    string
	Data    string
	MediaID string
}

type Page

type Page struct {
	ID      int
	UUID    string
	Title   string
	Content string
	Time    time.Time
}

type Subscribe

type Subscribe struct {
	ID          int
	Source      string
	IsSubscribe bool
}

Jump to

Keyboard shortcuts

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