shizuku

package
v0.0.0-...-3c2666d Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InitAppInfo  []*AppInfo     // 初始化时应用信息列表
	InitTaskInfo []*AppTaskInfo // 初始化时任务列表
)

Functions

func New

func New()

New 新建 SHIZUKU Robot

func NewApp

func NewApp(i *AppInfo)

NewApp 新建应用

func NewTask

func NewTask(i *AppTaskInfo)

NewApp 新建定时任务

Types

type AppInfo

type AppInfo struct {
	Name        string   // Name 应用名称
	DisplayName string   // DisplayName 应用显示名称
	Keys        []string // Keys 应用关键字
	Expand      Expand   // Expand 扩展
	Pointer     Apper    // Pointer 应用实例 指针
}

AppInfo 应用信息

type AppJober

type AppJober interface {
	OnJobCall(qm *QQMsg, sz *SHIZUKU) (rm *Message, err error)
}

AppJober 应用事务接口

type AppTaskInfo

type AppTaskInfo struct {
	Name    string   // 任务名称
	Spec    string   // 执行时间
	QQID    uint64   // 任务目标
	Pointer AppTaskr // 应用实例
}

AppTaskInfo 应用任务信息

type AppTaskr

type AppTaskr interface {
	OnTaskCall(sz *SHIZUKU) (rm *Message, err error)
}

AppTaskr 应用任务接口

type Apper

type Apper interface {
	OnCall(qm *QQMsg, sz *SHIZUKU) (rm *Message, err error)
}

Apper 应用接口

type Chain

type Chain struct {
	Type string // 类型:text、image、at
	Text string // text
	URL  string // image
	QQ   uint64 // at
}

Chain 消息链

type Expand

type Expand []struct {
	Name        string   // 扩展名称
	DisplayName string   // 扩展显示名称
	Keys        []string // 扩展关键字
	Limit       []string // 扩展值限制
	Require     bool     // 是否必须
	Default     string   // 默认值
}

Expand 扩展

type Idol

type Idol struct {
	ID         string   // 主键
	Name       string   // 角色名
	SeiyuuName string   // 声优名
	Key        []string // 关键字
	Twitter    twitter  // Twitter 相关
}

Idol 偶像

type Message

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

Message 返回的 QQ 消息

func NewAudio

func NewAudio(p string) *Message

NewAudio 新建音频消息结构体

func NewImage

func NewImage(p string) *Message

NewImage 新建图片消息结构体

func NewJSON

func NewJSON(s string) *Message

NewJSON 新建 JSON 卡片消息结构体

func NewMsg

func NewMsg() *Message

NewMsg 新建消息结构体

func NewText

func NewText(t string) *Message

NewText 新建文本消息结构体

func (*Message) AddAudio

func (m *Message) AddAudio(p string) *Message

AddAudio 添加音频

func (*Message) AddImage

func (m *Message) AddImage(p string) *Message

AddImage 添加图片

func (*Message) AddJSON

func (m *Message) AddJSON(s string) *Message

AddJSON 添加 JSON 卡片

func (*Message) AddText

func (m *Message) AddText(t string) *Message

AddText 添加文本

func (*Message) To

func (m *Message) To(i uint64) *Message

To 发送的目标

type QQMsg

type QQMsg struct {
	Type  *Idol             // 偶像
	Chain []Chain           // 消息链
	Call  map[string]string // 参数
	Group struct {
		ID   uint64 // 群号
		Name string // 群名
	} // 群相关
	User struct {
		ID   uint64 // QQ号
		Name string // QQ名
	} // 用户相关
}

QQMsg 接收的 QQ 消息

type Rina

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

Rina Rina QQ 客户端

func (Rina) SendGroupMsg

func (r Rina) SendGroupMsg(m *Message)

SendGroupMsg 发送群消息

type SHIZUKU

type SHIZUKU struct {
	QQID uint64         // QQID QQ 号
	Rina *Rina          // Rina QQ 客户端
	Job  map[uint64]job // Job 事务列表
	Conf configs.App    // Conf 应用配置信息
	// contains filtered or unexported fields
}

SHIZUKU SHIZUKU Robot

func (*SHIZUKU) CloseJob

func (s *SHIZUKU) CloseJob(u uint64)

CloseJob 关闭一个事务

func (SHIZUKU) FuzzyGetIdol

func (s SHIZUKU) FuzzyGetIdol(n string) *Idol

FuzzyGetIdol 模糊匹配偶像

func (*SHIZUKU) OpenJob

func (s *SHIZUKU) OpenJob(u uint64, p AppJober)

OpenJob 开启一个事务

Jump to

Keyboard shortcuts

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