onebot

package
v0.0.0-...-42ad345 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB   *gorm.DB
	Bots = make([]*Onebot, 0)
)

Functions

This section is empty.

Types

type ActionParams

type ActionParams struct {
	GroupID     int       `json:"group_id"`
	Message     []Message `json:"message"`
	AutoEscape  bool      `json:"auto_escape"`
	MessageType string    `json:"message_type"`
	MessageID   int       `json:"message_id"`
	ID          string    `json:"id"`
	UserID      int64     `json:"user_id"`
	Times       int       `json:"times"`
	Duration    int       `json:"duration"`
	Enable      bool      `json:"enable"`
	Card        string    `json:"card"`
	GroupName   string    `json:"group_name"`
	IsDismiss   bool      `json:"is_dismiss"`
	Flag        string    `json:"flag"`
	Approve     bool      `json:"approve"`
	Remark      string    `json:"remark"`
	Nickname    string    `json:"nickname"`
}

type ActionRequest

type ActionRequest struct {
	Action string       `json:"action"`
	Params ActionParams `json:"params"`
}

type BotFriendMessage

type BotFriendMessage struct {
	MessageID int64     `json:"message_id"`
	UserID    int64     `json:"user_id"`
	Message   []Message `json:"message"`
	Time      int64     `json:"time"`
}

type Friend

type Friend struct {
	Id        int64
	AccountID int64
	Nickname  string
	UID       int64
	Remark    string
	Deleted   bool
}

type FriendList

type FriendList struct {
	Status  string `json:"status"`
	Retcode int    `json:"retcode"`
	Data    []struct {
		UserID   int64  `json:"user_id"`
		Nickname string `json:"nickname"`
		Remark   string `json:"remark"`
	} `json:"data"`
}

type FriendMessage

type FriendMessage struct {
	ID          uint
	MessageID   int64
	FriendID    int64
	MessageTS   int64
	SelfMessage bool
	ReadMark    bool
	Hide        bool
	Revoke      bool
}

type FriendSubMessage

type FriendSubMessage struct {
	ID              uint
	FriendMessageID uint
	IsText          bool
	Message         string
}

type Heartbeat

type Heartbeat struct {
	Interval      int    `json:"interval"`
	MetaEventType string `json:"meta_event_type"`
	Time          int    `json:"time"`
	SelfID        int    `json:"self_id"`
	PostType      string `json:"post_type"`
}

type Lifecycle

type Lifecycle struct {
	SubType       string `json:"sub_type"`
	MetaEventType string `json:"meta_event_type"`
	Time          int    `json:"time"`
	SelfID        int64  `json:"self_id"`
	PostType      string `json:"post_type"`
}

type Message

type Message struct {
	Type string      `json:"type"`
	Data MessageData `json:"data"`
}

type MessageData

type MessageData struct {
	Text     string `json:"text"`
	File     string `json:"file"`
	Filename string `json:"filename"`
	URL      string `json:"url"`
	Summary  string `json:"summary"`
	SubType  int    `json:"subType"`
}

type MessageResponse

type MessageResponse struct {
	Status  string `json:"status"`
	Retcode int    `json:"retcode"`
	Data    struct {
		MessageID int64   `json:"message_id"`
		Time      float64 `json:"time"`
	} `json:"data"`
	Message string `json:"message"`
}

type Onebot

type Onebot struct {
	UserID     int64
	SrvID      uint
	AccountID  int64
	UID        int64
	Username   string
	AccountTag string
	IP         string
	Port       int

	Running bool

	FriendMessage chan struct{}
	// contains filtered or unexported fields
}

func NewOnebot

func NewOnebot(username string, accountTag string, ip string, port int) *Onebot

func (*Onebot) Avaliable

func (bot *Onebot) Avaliable() bool

func (*Onebot) GetFriendList

func (bot *Onebot) GetFriendList() ([]Friend, error)

func (*Onebot) Register

func (bot *Onebot) Register()

func (*Onebot) Run

func (ws *Onebot) Run()

func (*Onebot) SendToFriend

func (bot *Onebot) SendToFriend(friendID int64, messages []Message) (int64, error)

func (*Onebot) Shutdown

func (bot *Onebot) Shutdown() error

type WebsocketData

type WebsocketData struct {
	PostType      string `json:"post_type"`
	MetaEventType string `json:"meta_event_type"`
	MessageType   string `json:"message_type"`
	SubType       string `json:"sub_type"`
}

Jump to

Keyboard shortcuts

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