Documentation
¶
Index ¶
- Constants
- func NewCQCardImage(file string, minWidth, minHeight, maxWidth, maxHeight int64, ...) (*CQCode, *CQCodeError)
- func NewCQForwardNode(id int64, name string, uin int64, content, seq any) (*CQCode, *CQCodeError)
- func NewCQImage(file, type_ string, subType int, cache bool, id int64, c int) (*CQCode, *CQCodeError)
- func NewCQMusic(type_ string, id int64, url, audio, title, content, image string) (*CQCode, *CQCodeError)
- func NewCQRecord(file string, magic, cache, proxy bool, timeout int) (*CQCode, *CQCodeError)
- func NewCQShare(url, title, content, image string) (*CQCode, *CQCodeError)
- type ApiReq
- type App
- type CQAt
- type CQCode
- func (cq *CQCode) CQData() []CQDataValue
- func (cq *CQCode) CQType() string
- func (cq *CQCode) Decode(s string)
- func (cq *CQCode) Get(k string) any
- func (cq *CQCode) GetBool(k string) bool
- func (cq *CQCode) GetFloat64(k string) float64
- func (cq *CQCode) GetInt(k string) int
- func (cq *CQCode) GetInt64(k string) int64
- func (cq *CQCode) GetString(k string) string
- func (cq *CQCode) MarshalJSON() ([]byte, error)
- func (cq *CQCode) String() string
- func (cq *CQCode) UnmarshalJSON(b []byte) error
- type CQCodeError
- type CQCodeInterface
- type CQDataValue
- type CQFace
- type CQForward
- type CQImage
- type CQRecord
- type CQRecv
- func (cqr CQRecv) GetAllCQCode() []CQCodeInterface
- func (cqr CQRecv) GetCQCodeByType(t string) []CQCodeInterface
- func (cqr CQRecv) GetCQFace() []*CQFace
- func (cqr CQRecv) GetCQForward() *CQForward
- func (cqr CQRecv) GetCQImage() []*CQImage
- func (cqr CQRecv) GetCQRecord() *CQRecord
- func (cqr CQRecv) GetCQRedBag() *CQRedBag
- func (cqr CQRecv) GetCQReply() *CQReply
- func (cqr CQRecv) GetCQShare() *CQShare
- func (cqr CQRecv) GetCQVideo() *CQVideo
- func (cqr CQRecv) GetText() string
- type CQRedBag
- type CQReply
- type CQSend
- func (cqs *CQSend) AddCQAt(qq ...int64) *CQSend
- func (cqs *CQSend) AddCQCardImage(file string) *CQSend
- func (cqs *CQSend) AddCQCode(cq *CQCode) *CQSend
- func (cqs *CQSend) AddCQCustomForwardMsg(name string, qq int64, content, seq any) *CQSend
- func (cqs *CQSend) AddCQFace(faceId ...int) *CQSend
- func (cqs *CQSend) AddCQForwardMsg(id ...int64) *CQSend
- func (cqs *CQSend) AddCQMusic(type_ string, id int64) *CQSend
- func (cqs *CQSend) AddCQMusicCustom(url, audio, title, content, image string) *CQSend
- func (cqs *CQSend) AddCQPoke(qq int64) *CQSend
- func (cqs *CQSend) AddCQRecord(file string) *CQSend
- func (cqs *CQSend) AddCQReply(id int64) *CQSend
- func (cqs *CQSend) AddCQShare(url, title, content, image string) *CQSend
- func (cqs *CQSend) AddCQTTS(text string) *CQSend
- func (cqs *CQSend) AddCQVideo(file, cover string) *CQSend
- func (cqs *CQSend) AddImage(file string) *CQSend
- func (cqs *CQSend) AddText(text ...string) *CQSend
- type CQShare
- type CQText
- type CQVideo
- type Context
- type MessageHandle
- func (c *MessageHandle) GetGroupNo() int64
- func (c *MessageHandle) GetMessage() string
- func (c *MessageHandle) GetMessageId() int64
- func (c *MessageHandle) GetSender() int64
- func (c *MessageHandle) IsGroup() bool
- func (c *MessageHandle) Reply(ss ...string)
- func (c *MessageHandle) SendToGroup(groupId int64)
- func (c *MessageHandle) SendToPrivate(userId int64)
- type PluginFilterFunc
- type PluginFunc
- type PluginGroup
- type PluginGroupOption
- type PluginOption
- type RecvNormalMsg
- type ReplyMessage
- type RespGroupForwardMsg
- type RespGroupForwardMsgNode
- type RespGroupMsg
- type RespPrivateForwardMsg
- type RespPrivateMsg
Constants ¶
const ( CQScopePrivate = 0b1 // 私聊 CQScopeGroup = CQScopePrivate << 1 // 群聊 CQScopeAll = CQScopePrivate | CQScopeGroup // 允许所有的消息空间 )
const ( CQMusicTypeQQ = "qq" // qq音乐 CQMusicType163 = "163" // 网易云音乐 CQMusicTypeXM = "xm" // 虾米音乐 CQMusicTypeCustom = "custom" // 自定义 )
CQMusic的 type 可选参数
const ( CQImageTypeFlash = "flash" // 动图 CQImageTypeShow = "show" // 秀图 )
CQImage的 type 可选参数
const ( CQImageSubTypeNormal = iota // 正常图片 CQImageSubTypeEmoji // 表情包, 在客户端会被分类到表情包图片并缩放显示 CQImageSubTypeHot // 热图 CQImageSubTypeDou // 斗图 CQImageSubTypeZhi // 智图? CQImageSubTypeTie // 贴图 CQImageSubTypeSelf // 自拍 CQImageSubTypeTieAd // 贴图广告? CQImageSubTypeUnknown // 有待测试 CQImageSubTypeHotSearch // 热搜图 )
CQImage的 subType 可选参数
const ( CQImageIDNormal = 40000 // 普通 CQImageIDPhantom = 40001 // 幻影 CQImageIDShake = 40002 // 抖动 CQImageIDBirth = 40003 // 生日 CQImageIDLove = 40004 // 爱你 CQImageIDSeek = 40005 // 征友 )
CQImage的ID可选参数
const ( CQGiftTypeWink = iota // 甜 Wink CQGiftTypeCola // 肥宅快乐水 CQGiftTypeLuckyBracelet // 幸运手链 CQGiftTypeCappuccino // 卡布奇诺 CQGiftTypeCatWatch // 猫咪手表 CQGiftTypeGlove // 绒绒手套 CQGiftTypeRainbowCandy // 彩虹糖果 CQGiftTypeStrong // 坚强 CQGiftTypeConfession // 告白话筒 CQGiftTypeHoldHand // 牵你的手 CQGiftTypeCuteCat // 可爱猫咪 CQGiftTypeMysteriousMask // 神秘面具 CQGiftTypeBusy // 我超忙的 CQGiftTypeLoveMask // 爱心口罩 )
Variables ¶
This section is empty.
Functions ¶
func NewCQCardImage ¶
func NewCQCardImage(file string, minWidth, minHeight, maxWidth, maxHeight int64, source, icon string) (*CQCode, *CQCodeError)
NewCQCardImage 新建一个装逼大图的CQ码 file 和 image 的 file 字段对齐,支持情况也想通 minWidth, minHeight, maxWidth, maxHeight 为图片的最小宽高和最大宽高, 0 为默认 source 可选,表示分享来源名称 icon 可选,表示分享来源图标url,支持 http://, https://
func NewCQForwardNode ¶
NewCQForwardNode 新建一个转发消息
func NewCQImage ¶
func NewCQImage(file, type_ string, subType int, cache bool, id int64, c int) (*CQCode, *CQCodeError)
NewCQImage 新建一个图片的CQ码 file 为图片文件名,支持 http://,https://,file://,base64:// 格式 type_ 为图片类型,支持 flash,show, 不填则为普通图片 subType 为图片子类型,只出现在群聊中 cache 为是否使用缓存 id 特效ID c 下载线程数
func NewCQMusic ¶
func NewCQMusic(type_ string, id int64, url, audio, title, content, image string) (*CQCode, *CQCodeError)
NewCQMusic 新建一个音乐的CQ码 type 为音乐类型,支持 qq,163,xm 以及自定义 custom id 为音乐id,只在 type 为 qq,163,xm 有效 其他参数只在 type 为 custom 有效 url 为点击后跳转目标 URL audio 为音乐 URL title 为音乐标题 content 可选 为音乐简介 image 可选 为音乐封面图片 URL CQMusic 没有接收,只有发送
func NewCQRecord ¶
func NewCQRecord(file string, magic, cache, proxy bool, timeout int) (*CQCode, *CQCodeError)
NewCQRecord 新建一个语音消息 file 为语音文件路径,支持网络路径,base64,file://协议 magic 为是否为变声 cache, proxy, timeout 只有在 file 为网络路径时有效
func NewCQShare ¶
func NewCQShare(url, title, content, image string) (*CQCode, *CQCodeError)
NewCQShare 新建一个分享链接的CQ码 url 分享链接 title 标题 content 可选,内容描述 image 可选,图片url链接
Types ¶
type ApiReq ¶
type ApiReq struct { Action string `json:"action"` Params interface{} `json:"params"` }
ApiReq 向 cqhttp 接口发送消息的消息体格式
type App ¶
type App struct { }
func (*App) GetPluginLoader ¶
func (a *App) GetPluginLoader() *PluginGroup
type CQCode ¶
type CQCode struct { Type string Data []CQDataValue }
func NewCQVideo ¶
NewCQVideo 新建一个视频的CQ码 file 为视频文件路径,支持网络路径,base64,file://协议 cover 如果传入该参数,则必须保证图片为jpg格式,由于这里不会实际获取图片文件,所以不会检查图片格式,go-cqhttp 将会检查文件格式是否合法
func (*CQCode) CQData ¶
func (cq *CQCode) CQData() []CQDataValue
func (*CQCode) GetFloat64 ¶
func (*CQCode) MarshalJSON ¶
func (*CQCode) UnmarshalJSON ¶
UnmarshalJSON 不会用到,需不要实现该方法
type CQCodeError ¶
type CQCodeError struct {
// contains filtered or unexported fields
}
func (*CQCodeError) CQType ¶
func (e *CQCodeError) CQType() string
func (*CQCodeError) Error ¶
func (e *CQCodeError) Error() string
type CQCodeInterface ¶
type CQCodeInterface interface { CQType() string CQData() []CQDataValue Get(string) any String() string // contains filtered or unexported methods }
type CQDataValue ¶
type CQRecv ¶
type CQRecv struct {
// contains filtered or unexported fields
}
CQRecv 接收的CQ码消息 从收到的消息中解析出CQ码和纯文本消息
func (CQRecv) GetAllCQCode ¶
func (cqr CQRecv) GetAllCQCode() []CQCodeInterface
func (CQRecv) GetCQCodeByType ¶
func (cqr CQRecv) GetCQCodeByType(t string) []CQCodeInterface
func (CQRecv) GetCQRecord ¶
GetCQRecord 获取语音消息 因为qq单条消息只可能发送一条语音,所以接受时也只可能接收到一条,所以只返回单个
func (CQRecv) GetCQVideo ¶
GetCQVideo 获取视频消息 因为qq单条消息只可能发送一条视频,所以接受时也只可能接收到一条,所以只返回单个
type CQSend ¶
type CQSend struct {
// contains filtered or unexported fields
}
func (*CQSend) AddCQCardImage ¶
AddCQCardImage 发送装逼大图
func (*CQSend) AddCQCustomForwardMsg ¶
AddCQCustomForwardMsg 转发消息-自定义内容
func (*CQSend) AddCQForwardMsg ¶
AddCQForwardMsg 转发消息
func (*CQSend) AddCQMusic ¶
AddCQMusic 发送音乐分享
func (*CQSend) AddCQMusicCustom ¶
AddCQMusicCustom 发送自定义音乐分享
func (*CQSend) AddCQRecord ¶
AddCQRecord 发送语音消息 file 语音文件路径,支持 http://,https://,base64://,file://协议
func (*CQSend) AddCQShare ¶
AddCQShare 发送分享链接
func (*CQSend) AddCQVideo ¶
AddCQVideo 发送短视频消息 file 视频文件路径,支持 http://,https://,base64://,file://协议 cover 封面文件路径,支持 http://,https://,base64://,file://协议,图片必须是jpg格式
type Context ¶
type Context struct {
*MessageHandle
}
type MessageHandle ¶
func (*MessageHandle) GetMessageId ¶
func (c *MessageHandle) GetMessageId() int64
func (*MessageHandle) Reply ¶
func (c *MessageHandle) Reply(ss ...string)
Reply 发送消息,默认向消息来源发送,如群,私聊
func (*MessageHandle) SendToGroup ¶
func (c *MessageHandle) SendToGroup(groupId int64)
SendToGroup 向指定群聊发送消息
func (*MessageHandle) SendToPrivate ¶
func (c *MessageHandle) SendToPrivate(userId int64)
SendToPrivate 向指定私聊发送消息
type PluginFilterFunc ¶
type PluginFunc ¶
type PluginFunc func(*Context) //
type PluginGroup ¶
type PluginGroup struct {
// contains filtered or unexported fields
}
func (*PluginGroup) BindPlugin ¶
func (pg *PluginGroup) BindPlugin(f PluginFunc, opt *PluginOption) *PluginGroup
BindPlugin 为组绑定插件
func (*PluginGroup) GetErrors ¶
func (pg *PluginGroup) GetErrors() []error
func (*PluginGroup) Group ¶
func (pg *PluginGroup) Group(name string, opt *PluginGroupOption) *PluginGroup
Group 插件组
func (*PluginGroup) SetOption ¶
func (pg *PluginGroup) SetOption(opt *PluginGroupOption) *PluginGroup
type PluginGroupOption ¶
type PluginGroupOption struct {
GPluginOpt *PluginOption // 组内插件的默认设置,详情见 PluginOption 的注释说明
}
PluginGroupOption 插件组选项
func DefaultPluginGroupOption ¶
func DefaultPluginGroupOption() *PluginGroupOption
type PluginOption ¶
type PluginOption struct { Name string FilterFunc []PluginFilterFunc // 消息过滤器,返回 false 则本条消息不执行插件 Middleware []func(ctx *Context) // TODO 中间件 RecoverFunc func(ctx *Context, err any) // 插件发生 panic 时的处理方法,默认控制台打印信息 IsTurnOff *bool // TODO 是否初始状态关闭插件,默认false,即不关闭 }
PluginOption 插件选项 如果设置在组上,则组内所有插件都会继承该选项 对于 slice类型,会从头部加入新的元素 比如针对组设置了 FilterFunc{f1, f2, f3} 针对插件设置了 FilterFunc{f4, f5, f6},则插件的 FilterFunc 的执行顺序为 f1->f2->f3->f4->f5->f6 对于非 slice/map/array 类型,除非插件指定值,否则会直接使用组设置的值 对组进行设置时会被忽略的值:Name
func DefaultPluginOption ¶
func DefaultPluginOption() *PluginOption
func (*PluginOption) AddFilterFunc ¶
func (o *PluginOption) AddFilterFunc(f func(ctx *Context) bool)
func (*PluginOption) SetIsTurnOff ¶
func (o *PluginOption) SetIsTurnOff(b bool)
func (*PluginOption) SetName ¶
func (o *PluginOption) SetName(n string)
func (*PluginOption) SetRecoverFunc ¶
func (o *PluginOption) SetRecoverFunc(f func(ctx *Context, err any))
type RecvNormalMsg ¶
type RecvNormalMsg struct { Anonymous string `json:"anonymous"` // 匿名,群属性 GroupId int64 `json:"group_id"` // 群ID Font int64 `json:"font"` Message string `json:"message"` MessageId int64 `json:"message_id"` MessageType string `json:"message_type"` PostType string `json:"PostType"` RowMessage string `json:"row_message"` SelfId int64 `json:"self_id"` TargetId int64 `json:"target_id"` // 发送目标的user_id 私聊属性 SubType string `json:"sub_type"` Time int64 `json:"time"` UserId int64 `json:"user_id"` Sender struct { Age int64 `json:"age"` Area string `json:"area"` // 地区,群属性 Card string `json:"card"` // 卡片?,群属性 Level string `json:"level"` // 等级,群属性 Role string `json:"admin"` // 角色,群属性 Nickname string `json:"nickname"` Title string `json:"title"` // 角色title,群属性(名字前面的称谓) Sex string `json:"sex"` UserId int64 `json:"user_id"` } }
RecvNormalMsg 接受的消息结构体类型
type ReplyMessage ¶
type ReplyMessage struct {
// contains filtered or unexported fields
}
type RespGroupForwardMsg ¶
type RespGroupForwardMsgNode ¶
type RespGroupMsg ¶
type RespPrivateForwardMsg ¶
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
src
|
|
common/mihoyo
Package mihoyo 提供米哈游相关的网络接口与辅助函数 此包以废弃状态,不再维护,仅供参考
|
Package mihoyo 提供米哈游相关的网络接口与辅助函数 此包以废弃状态,不再维护,仅供参考 |
common/ocr
Package ocr 图像识别相关功能,如用图片搜索相关信息
|
Package ocr 图像识别相关功能,如用图片搜索相关信息 |
common/setu_api
Package setu_api 提供公共的随机涩图API
|
Package setu_api 提供公共的随机涩图API |