Documentation
¶
Overview ¶
Package leafBot @Description:
Package leafBot @Description:
Package leafBot @Description:
Index ¶
- Constants
- Variables
- func BanPluginByID(id string)
- func BanPluginByName(name string) int
- func CallApi(ctx *gin.Context)
- func Cors() gin.HandlerFunc
- func GetConfig(ctx *gin.Context)
- func GetEngine() (*gin.Engine, error)
- func GetFont() []byte
- func GetFriendList(ctx *gin.Context)
- func GetGroupList(ctx *gin.Context)
- func GetHandleList() map[string][]BaseHandle
- func InitBots()
- func InitDefaultPlugin()
- func InitPluginManager()
- func InitWindow()
- func LoadConfig()
- func LoadDriver(driver2 Driver)
- func MustReply(ctx *Context) bool
- func OnlyGroupMessage(ctx *Context) bool
- func OnlySuperUser(ctx *Context) bool
- func OnlyToMe(ctx *Context) bool
- func OpenUi()
- func StartPlugin(name string) int
- func StartPluginByID(id string)
- type Api
- type BaseHandle
- type CommandChain
- type CommandInt
- type Config
- type Conn
- type Connect
- type ConnectChain
- type ConnectInt
- type Context
- func (ctx *Context) CallApi(Action string, param interface{}) gjson.Result
- func (ctx *Context) CanSendImage() bool
- func (ctx *Context) CanSendRecord() bool
- func (ctx *Context) CheckUrlSafely(url string) int
- func (ctx *Context) CleanCache()
- func (ctx *Context) DeleteEssenceMsg(messageId int)
- func (ctx *Context) DeleteMsg(messageId int32)
- func (ctx *Context) DownloadFile(url string, threadCount int, headers []string) gjson.Result
- func (ctx *Context) GetCookies(domain string) gjson.Result
- func (ctx *Context) GetCredentials(domain string) gjson.Result
- func (ctx *Context) GetCsrfToken() gjson.Result
- func (ctx *Context) GetEssenceMsgList(groupId int) gjson.Result
- func (ctx *Context) GetForwardMsg(messageId int) gjson.Result
- func (ctx *Context) GetFriendList() gjson.Result
- func (ctx *Context) GetGroupAtAllRemain(groupId int) gjson.Result
- func (ctx *Context) GetGroupFileSystemInfo(groupId int) gjson.Result
- func (ctx *Context) GetGroupFileUrl(groupId int, fileId string, busid int) gjson.Result
- func (ctx *Context) GetGroupFilesByFolder(groupId int, folderId string) gjson.Result
- func (ctx *Context) GetGroupHonorInfo(groupId int, honorType string) gjson.Result
- func (ctx *Context) GetGroupInfo(groupId int, noCache bool) gjson.Result
- func (ctx *Context) GetGroupList() gjson.Result
- func (ctx *Context) GetGroupMemberInfo(groupId int, userId int, noCache bool) gjson.Result
- func (ctx *Context) GetGroupMemberList(groupId int) gjson.Result
- func (ctx *Context) GetGroupMsgHistory(messageSeq int64, groupId int) gjson.Result
- func (ctx *Context) GetGroupRootFiles(groupId int) gjson.Result
- func (ctx *Context) GetGroupSystemMsg() gjson.Result
- func (ctx *Context) GetImage(file string) gjson.Result
- func (ctx *Context) GetLoginInfo() gjson.Result
- func (ctx *Context) GetMsg(messageId int32) gjson.Result
- func (ctx *Context) GetMsgSpecial(messageId int) gjson.Result
- func (ctx *Context) GetOnlineClients(noCache bool) gjson.Result
- func (ctx *Context) GetRecord(file, outFormat string) gjson.Result
- func (ctx *Context) GetStatus() gjson.Result
- func (ctx *Context) GetStrangerInfo(userId int, noCache bool) gjson.Result
- func (ctx *Context) GetVipInfoTest(UserId int) gjson.Result
- func (ctx *Context) GetWordSlices(content string) gjson.Result
- func (ctx *Context) OcrImage(image string) gjson.Result
- func (ctx *Context) ReloadEventFilter()
- func (ctx *Context) Send(message interface{}) int32
- func (ctx *Context) SendGroupForwardMsg(groupId int, messages interface{})
- func (ctx *Context) SendGroupMsg(groupId int, message interface{}) int32
- func (ctx *Context) SendGroupNotice(groupId int, content string)
- func (ctx *Context) SendLike(userId int, times int)
- func (ctx *Context) SendMsg(messageType string, userId int, groupId int, message interface{}) int32
- func (ctx *Context) SendPrivateMsg(userId int, message interface{}) int32
- func (ctx *Context) SetEssenceMsg(messageId int)
- func (ctx *Context) SetFriendAddRequest(flag string, approve bool, remark string)
- func (ctx *Context) SetGroupAddRequest(flag string, subType string, approve bool, reason string)
- func (ctx *Context) SetGroupAdmin(groupId int, userId int, enable bool)
- func (ctx *Context) SetGroupAnonymous(groupId int, enable bool)
- func (ctx *Context) SetGroupAnonymousBan(groupId int, flag string, duration int)
- func (ctx *Context) SetGroupBan(groupId int, userId int, duration int)
- func (ctx *Context) SetGroupCard(groupId int, userId int, card string)
- func (ctx *Context) SetGroupKick(groupId int, userId int, rejectAddRequest bool)
- func (ctx *Context) SetGroupLeave(groupId int, isDisMiss bool)
- func (ctx *Context) SetGroupName(groupId int, groupName string)
- func (ctx *Context) SetGroupNameSpecial(groupId int, groupName string)
- func (ctx *Context) SetGroupPortrait(groupId int, file string, cache int)
- func (ctx *Context) SetGroupSpecialTitle(groupId int, userId int, specialTitle string, duration int)
- func (ctx *Context) SetGroupWholeBan(groupId int, enable bool)
- func (ctx *Context) SetRestart(delay int)
- func (ctx *Context) UploadGroupFile(groupId int, file string, name string, folder string)
- type CoolDown
- type DisConnectChain
- type DisConnectInt
- type Driver
- type Event
- func (e Event) CloseMessageChan(id int)
- func (e Event) GetImages() []message.MessageSegment
- func (e Event) GetMoreEvent(rules ...Rule) (int, chan Event)
- func (e Event) GetMsg() message.Message
- func (e Event) GetOneEvent(rules ...Rule) (Event, error)
- func (e Event) GetPlainText() string
- func (e Event) Send(message interface{}) int32
- type Files
- type M
- type MessageChain
- type MessageIds
- type MessageInt
- type MetaChain
- type MetaInt
- type MiraiEvent
- type NoticeChain
- type NoticeInt
- type OneBotApi
- type Option
- type Options
- type Plugin
- func (p *Plugin) OnCommand(command string, options ...Option) *commandHandle
- func (p *Plugin) OnConnect() *connectHandle
- func (p *Plugin) OnDisConnect() *disConnectHandle
- func (p *Plugin) OnEndWith(str string, options ...Option) *messageHandle
- func (p *Plugin) OnFullMatch(match string, options ...Option) *messageHandle
- func (p *Plugin) OnFullMatchGroup(matchs []string, options ...Option) *messageHandle
- func (p *Plugin) OnKeyWords(keyword string, options ...Option) *messageHandle
- func (p *Plugin) OnMessage(messageType string, options ...Option) *messageHandle
- func (p *Plugin) OnMeta() *metaHandle
- func (p *Plugin) OnNotice(noticeType string, options ...Option) *noticeHandle
- func (p *Plugin) OnPretreatment() *PretreatmentHandle
- func (p *Plugin) OnRegex(regex string, options ...Option) *commandHandle
- func (p *Plugin) OnRequest(requestType string, options ...Option) *requestHandle
- func (p *Plugin) OnStartWith(str string, options ...Option) *messageHandle
- func (p *Plugin) OnTime(crons string, selfId int, handle func(bot Api))
- func (p *Plugin) SetHelp(help map[string]string)
- type PretreatmentChain
- type PretreatmentHandle
- type PretreatmentInt
- type RequestChain
- type RequestInt
- type Rule
- type Senders
- type State
- type Status
Constants ¶
const ( JSON = "json" HJSON = "hjson" YAML = "yaml" )
Variables ¶
var ( ConnectHandles ConnectChain DisConnectHandles DisConnectChain MessageHandles MessageChain RequestHandles RequestChain NoticeHandles NoticeChain CommandHandles CommandChain MetaHandles MetaChain PretreatmentHandles PretreatmentChain )
var (
DefaultConfig = new(Config)
)
var ENABLE = false // 是否启用gui
var (
MessageChan = make(chan Event, 10)
)
Functions ¶
func BanPluginByID ¶
func BanPluginByID(id string)
BanPluginByID * * @Description: 根据id禁用插件 * @param id
func BanPluginByName ¶
BanPluginByName * * @Description: 禁用某个插件 * @param name 插件名 * @return int 禁用的插件个数
func Cors ¶ added in v1.1.3
func Cors() gin.HandlerFunc
func GetEngine ¶ added in v1.1.4
GetEngine *
- @Description: 获取web的引擎
- @return *gin.Engine
- @return error
- example
func GetFont ¶ added in v1.1.4
func GetFont() []byte
GetFont *
- @Description: 向外导出思源黑体字体文件
- @return []byte
- example
func GetFriendList ¶
func GetGroupList ¶
func GetHandleList ¶
func GetHandleList() map[string][]BaseHandle
func InitDefaultPlugin ¶ added in v1.1.6
func InitDefaultPlugin()
func InitPluginManager ¶
func InitPluginManager()
func LoadConfig ¶
func LoadConfig()
func LoadDriver ¶ added in v1.1.2
func LoadDriver(driver2 Driver)
LoadDriver *
- @Description: 为leafBot注册一个驱动
- @param driver2 实现了Driver接口的驱动
- example
func MustReply ¶ added in v1.1.4
MustReply *
- @Description:
- @param event
- @param api
- @param state
- @return bool
- example
func OnlySuperUser ¶
OnlySuperUser *
- @Description: 加了该rule的插件只会对配置文件中配置的管理员用户进行响应
- @param event leafBot event
- @param bot bot实例对象
- @return bool 是否通过该rule验证
- example
func OnlyToMe ¶
OnlyToMe *
- @Description: 添加了该rule的插件需要在群里艾特或者私聊才会进行响应
- @param event leafBot event
- @param bot bot实例对象
- @return bool 返回是否验证通过该rule
- example
func StartPlugin ¶
StartPlugin * * @Description: 启用某个插件 * @param name 插件名 * @return int 启用插件个数
func StartPluginByID ¶
func StartPluginByID(id string)
Types ¶
type Api ¶
type Api interface { CallApi(action string, params interface{}) gjson.Result SendGroupMsg(groupId int, message interface{}) int32 SendPrivateMsg(userId int, message interface{}) int32 DeleteMsg(messageId int32) }
Api @Description:
type BaseHandle ¶
type CommandChain ¶
type CommandChain []*commandHandle
func (CommandChain) Len ¶
func (c CommandChain) Len() int
func (CommandChain) Less ¶
func (c CommandChain) Less(i, j int) bool
func (CommandChain) Swap ¶
func (c CommandChain) Swap(i, j int)
type CommandInt ¶
type Config ¶
type Config struct { NickName []string `json:"nick_name" yaml:"nick_name" hjson:"nick_name"` Admin int `json:"admin" yaml:"admin" hjson:"admin"` Host string `json:"host" yaml:"host" hjson:"host"` Port int `json:"port" yaml:"port" hjson:"port"` Token string `json:"token"` LogLevel string `json:"log_level" yaml:"log_level" hjson:"log_level"` LogTruncate bool `json:"log_truncate" yaml:"log_truncate" hjson:"log_truncate"` SuperUser []int `json:"super_user" yaml:"super_user" hjson:"super_user"` CommandStart []string `json:"command_start" yaml:"command_start" hjson:"command_start"` EnablePlaywright bool `json:"enable_playwright" yaml:"enable_playwright" hjson:"enable_playwright"` ListenHost string `json:"listen_host" yaml:"listen_host"` ListenPort int `json:"listen_port" yaml:"listen_port"` WebHook []struct { PostHost string `json:"post_host" yaml:"post_host"` PostPort int `json:"post_port" yaml:"post_port"` SelfID int64 `json:"self_id" yaml:"self_id"` } `json:"web_hook" yaml:"web_hook" hjson:"web_hook"` Plugins struct { FlashGroupID int `json:"flash_group_id" yaml:"flash_group_id" hjson:"flash_group_id"` AlApiToken string `json:"al_api_token" yaml:"al_api_token" hjson:"al_api_token"` EnableReplyTome bool `json:"enable_reply_tome" yaml:"enable_reply_tome" hjson:"enable_reply_tome"` Welcome []struct { GroupId int `json:"group_id" yaml:"group_id" hjson:"group_id"` Message string `json:"message" yaml:"message" hjson:"message"` } `json:"welcome" yaml:"welcome" hjson:"welcome"` GithubToken string `json:"github_token" yaml:"github_token" hjson:"github_token"` AutoPassFriendRequest []string `json:"auto_pass_friend_request" yaml:"auto_pass_friend_request" hjson:"auto_pass_friend_request"` } `json:"plugins" yaml:"plugins" hjson:"plugins"` Datas map[string]interface{} `json:"datas" yaml:"datas" hjson:"datas"` }
Config @Description:
type Conn ¶ added in v1.1.2
type Conn interface { // Do // @Description: 执行一个api // @param interface{} // Do(interface{}) // GetResponse // @Description: 获取一次api的执行结果 // @param echo 标识一次执行的唯一参数 // @return []byte 响应结果 // @return error 超时会返回一个error // GetResponse(echo string) ([]byte, error) GetSelfId() int64 }
Conn @Description: 所有bot对象都应该实现该接口
type ConnectChain ¶
type ConnectChain []*connectHandle
type ConnectInt ¶
type Context ¶ added in v1.1.6
Context @Description:
func (*Context) CanSendRecord ¶ added in v1.1.6
CanSendRecord
@Description: @receiver b @return Bool
func (*Context) CheckUrlSafely ¶ added in v1.1.6
func (*Context) CleanCache ¶ added in v1.1.6
func (ctx *Context) CleanCache()
CleanCache *
- @Description:
- @receiver b
- example
func (*Context) DeleteEssenceMsg ¶ added in v1.1.6
func (*Context) DeleteMsg ¶ added in v1.1.6
DeleteMsg
@Description: @receiver b @param messageId int32
func (*Context) DownloadFile ¶ added in v1.1.6
DownloadFile
@Description: @receiver b @param url string @param threadCount int @param headers []string @return DownloadFilePath
func (*Context) GetCookies ¶ added in v1.1.6
GetCookies
@Description: @receiver b @param domain string @return Cookie
func (*Context) GetCredentials ¶ added in v1.1.6
GetCredentials
@Description: @receiver b @param domain string @return Credentials
func (*Context) GetCsrfToken ¶ added in v1.1.6
GetCsrfToken
@Description: @receiver b @return CsrfToken
func (*Context) GetEssenceMsgList ¶ added in v1.1.6
func (*Context) GetForwardMsg ¶ added in v1.1.6
GetForwardMsg
@Description: @receiver b @param messageId int @return []ForwardMsg
func (*Context) GetFriendList ¶ added in v1.1.6
GetFriendList *
- @Description:
- @receiver b
- @return gjson.Result
- example
func (*Context) GetGroupAtAllRemain ¶ added in v1.1.6
GetGroupAtAllRemain
@Description: @receiver b @param groupId int @return GroupAtAllRemain
func (*Context) GetGroupFileSystemInfo ¶ added in v1.1.6
GetGroupFileSystemInfo
@Description: @receiver b @param groupId int @return GroupFileSystemInfo
func (*Context) GetGroupFileUrl ¶ added in v1.1.6
GetGroupFileUrl
@Description: @receiver b @param groupId int @param fileId string @param busid int @return FileUrl
func (*Context) GetGroupFilesByFolder ¶ added in v1.1.6
GetGroupFilesByFolder
@Description: @receiver b @param groupId int @param folderId string @return GroupFilesByFolder
func (*Context) GetGroupHonorInfo ¶ added in v1.1.6
GetGroupHonorInfo
@Description: @receiver b @param groupId int @param honorType string @return GroupHonorInfo
func (*Context) GetGroupInfo ¶ added in v1.1.6
GetGroupInfo *
- @Description:
- @receiver b
- @param groupId
- @param noCache
- @return gjson.Result
- example
func (*Context) GetGroupList ¶ added in v1.1.6
GetGroupList
@Description: @receiver b @return []GroupInfo
func (*Context) GetGroupMemberInfo ¶ added in v1.1.6
GetGroupMemberInfo
@Description: @receiver b @param groupId int @param userId int @param noCache bool @return GroupMemberInfo
func (*Context) GetGroupMemberList ¶ added in v1.1.6
GetGroupMemberList
@Description: @receiver b @param groupId int @return []GroupMemberInfo
func (*Context) GetGroupMsgHistory ¶ added in v1.1.6
GetGroupMsgHistory
@Description: @receiver b @param messageSeq int64 @param groupId int @return MessageHistory
func (*Context) GetGroupRootFiles ¶ added in v1.1.6
GetGroupRootFiles
@Description: @receiver b @param groupId int @return GroupRootFiles
func (*Context) GetGroupSystemMsg ¶ added in v1.1.6
GetGroupSystemMsg
@Description: @receiver b @return GroupSystemMsg
func (*Context) GetImage ¶ added in v1.1.6
GetImage
@Description: @receiver b @param file string @return Image
func (*Context) GetLoginInfo ¶ added in v1.1.6
GetLoginInfo
@Description: @receiver b @return LoginInfo
func (*Context) GetMsg ¶ added in v1.1.6
GetMsg
@Description: @receiver b @param messageId int32 @return GetMessage
func (*Context) GetMsgSpecial ¶ added in v1.1.6
GetMsgSpecial
@Description: @receiver b @param messageId int @return MsgData
func (*Context) GetOnlineClients ¶ added in v1.1.6
GetOnlineClients *
- @Description:
- @receiver b
- @param noCache
- @return gjson.Result
- example
func (*Context) GetRecord ¶ added in v1.1.6
GetRecord
@Description: @receiver b @param file file @param outFormat string @return Record
func (*Context) GetStatus ¶ added in v1.1.6
GetStatus
@Description: @receiver b @return OnlineStatus
func (*Context) GetStrangerInfo ¶ added in v1.1.6
GetStrangerInfo
@Description: @receiver b @param userId int @param noCache bool @return Senders
func (*Context) GetVipInfoTest ¶ added in v1.1.6
GetVipInfoTest
@Description: @receiver b @param UserId int @return VipInfo
func (*Context) GetWordSlices ¶ added in v1.1.6
GetWordSlices
@Description: @receiver b @param content string @return []string
func (*Context) OcrImage ¶ added in v1.1.6
OcrImage
@Description: @receiver b @param image string @return OcrImage
func (*Context) ReloadEventFilter ¶ added in v1.1.6
func (ctx *Context) ReloadEventFilter()
ReloadEventFilter
@Description: @receiver b
func (*Context) SendGroupForwardMsg ¶ added in v1.1.6
SendGroupForwardMsg
@Description: @receiver b @param groupId int @param messages []Node
func (*Context) SendGroupMsg ¶ added in v1.1.6
SendGroupMsg *
- @Description:
- @receiver b
- @param groupId
- @param message
- @return int32
func (*Context) SendGroupNotice ¶ added in v1.1.6
SendGroupNotice
@Description: @receiver b @param groupId int @param content string
func (*Context) SendLike ¶ added in v1.1.6
SendLike
@Description: @receiver b @param userId int @param times int
func (*Context) SendMsg ¶ added in v1.1.6
SendMsg
@Description: @receiver b @param messageType string @param userId int @param groupId int @param message string @param autoEscape bool @return int32
func (*Context) SendPrivateMsg ¶ added in v1.1.6
SendPrivateMsg
@Description: @receiver b @param userId int @param message string @param autoEscape bool @return int32
func (*Context) SetEssenceMsg ¶ added in v1.1.6
func (*Context) SetFriendAddRequest ¶ added in v1.1.6
SetFriendAddRequest
@Description: @receiver b @param flag string @param approve bool @param remark string
func (*Context) SetGroupAddRequest ¶ added in v1.1.6
SetGroupAddRequest
@Description: @receiver b @param flag string @param subType string @param approve bool @param reason string
func (*Context) SetGroupAdmin ¶ added in v1.1.6
SetGroupAdmin
@Description: @receiver b @param groupId int @param userId int @param enable bool
func (*Context) SetGroupAnonymous ¶ added in v1.1.6
SetGroupAnonymous
@Description: @receiver b @param groupId int @param enable bool
func (*Context) SetGroupAnonymousBan ¶ added in v1.1.6
SetGroupAnonymousBan
@Description: @receiver b @param groupId int @param flag string @param duration int
func (*Context) SetGroupBan ¶ added in v1.1.6
SetGroupBan
@Description: @receiver b @param groupId int @param userId int @param duration int
func (*Context) SetGroupCard ¶ added in v1.1.6
SetGroupCard
@Description: @receiver b @param groupId int @param userId int @param card string
func (*Context) SetGroupKick ¶ added in v1.1.6
SetGroupKick
@Description: @receiver b @param groupId int @param userId int @param rejectAddRequest bool
func (*Context) SetGroupLeave ¶ added in v1.1.6
SetGroupLeave
@Description: @receiver b @param groupId int @param isDisMiss bool
func (*Context) SetGroupName ¶ added in v1.1.6
SetGroupName
@Description: @receiver b @param groupId int @param groupName string
func (*Context) SetGroupNameSpecial ¶ added in v1.1.6
SetGroupNameSpecial
@Description: @receiver b @param groupId int @param groupName string
func (*Context) SetGroupPortrait ¶ added in v1.1.6
SetGroupPortrait
@Description: @receiver b @param groupId int @param file string @param cache int
func (*Context) SetGroupSpecialTitle ¶ added in v1.1.6
func (ctx *Context) SetGroupSpecialTitle(groupId int, userId int, specialTitle string, duration int)
SetGroupSpecialTitle
@Description: @receiver b @param groupId int @param userId int @param specialTitle string @param duration int
func (*Context) SetGroupWholeBan ¶ added in v1.1.6
SetGroupWholeBan
@Description: @receiver b @param groupId int @param enable bool
type DisConnectChain ¶
type DisConnectChain []*disConnectHandle
type DisConnectInt ¶
type Driver ¶ added in v1.1.2
type Driver interface { // Run // @Description: 运行该驱动的接口,该接口应该为阻塞式运行 // Run() // GetEvent // @Description: 返回一个chan,该chan为事件传递的chan // @return chan // GetEvent() chan []byte OnConnect(func(selfId int64, host string, clientRole string)) OnDisConnect(func(selfId int64)) // GetBot // @Description: 获取一个实现了APi接口的bot // @param int64 bot的id // @return interface{} // GetBot(int64) interface{} // GetBots // @Description: 获取所有bot // @return map[int64]interface{} // GetBots() map[int64]interface{} SetConfig(config map[string]interface{}) AddWebHook(selfID int64, postHost string, postPort int) SetToken(token string) }
Driver @Description:
type Event ¶
type Event struct { Anonymous anonymous `json:"anonymous"` Font int `json:"font"` GroupId int `json:"group_id"` Message message.Message `json:"message"` MessageType string `json:"message_type"` PostType string `json:"post_type"` RawMessage string `json:"raw_message"` SelfId int `json:"self_id"` Sender Senders `json:"sender"` SubType string `json:"sub_type"` UserId int `json:"user_id"` Time int `json:"time"` NoticeType string `json:"notice_type"` RequestType string `json:"request_type"` Comment string `json:"comment"` Flag string `json:"flag"` OperatorId int `json:"operator_id"` File Files `json:"file"` Duration int64 `json:"duration"` TargetId int64 `json:"target_id"` //运气王id HonorType string `json:"honor_type"` MetaEventType string `json:"meta_event_type"` Status Status `json:"status"` Interval int `json:"interval"` CardNew string `json:"card_new"` //新名片 CardOld string `json:"card_old"` //旧名片 MessageIds }
func (Event) CloseMessageChan ¶ added in v1.1.2
CloseMessageChan
@Description: 关闭session,即从等待队列中删除 @receiver b @param id int
func (Event) GetImages ¶
func (e Event) GetImages() []message.MessageSegment
func (Event) GetMoreEvent ¶ added in v1.1.2
GetMoreEvent
@Description: 获取一个通道不断从用户获取消息 @receiver b @param rules ...Rule @return int int 对应session在队列中的编号,后面关闭需要该编号 @return chan Event 事件通道
func (Event) GetOneEvent ¶ added in v1.1.2
GetOneEvent
@Description: 向session队列里面添加一个对象,等待用户的响应,设置超时时间 @receiver b @param rules ...Rule @return Event Event @return error error
func (Event) GetPlainText ¶
type M ¶
type M interface {
// contains filtered or unexported methods
}
M
通过id从插件列表获取插件 所有的插件队列都实现了该接口
type MessageChain ¶
type MessageChain []*messageHandle
func (MessageChain) Len ¶
func (m MessageChain) Len() int
func (MessageChain) Less ¶
func (m MessageChain) Less(i, j int) bool
func (MessageChain) Swap ¶
func (m MessageChain) Swap(i, j int)
type MessageIds ¶
type MessageIds struct {
MessageID int32 `json:"message_id"`
}
type MessageInt ¶
type MiraiEvent ¶ added in v1.1.6
type NoticeChain ¶
type NoticeChain []*noticeHandle
func (NoticeChain) Len ¶
func (n NoticeChain) Len() int
func (NoticeChain) Less ¶
func (n NoticeChain) Less(i, j int) bool
func (NoticeChain) Swap ¶
func (n NoticeChain) Swap(i, j int)
type OneBotApi ¶ added in v1.1.6
type OneBotApi interface { Api GetMsg(messageId int32) gjson.Result SetGroupBan(groupId int, userId int, duration int) SetGroupCard(groupId int, userId int, card string) SendMsg(messageType string, userId int, groupId int, message interface{}) int32 SendLike(userId int, times int) SetGroupKick(groupId int, userId int, rejectAddRequest bool) SetGroupAnonymousBan(groupId int, flag string, duration int) SetGroupWholeBan(groupId int, enable bool) SetGroupAdmin(groupId int, UserId int, enable bool) SetGroupAnonymous(groupId int, enable bool) SetGroupName(groupId int, groupName string) SetGroupLeave(groupId int, isDisMiss bool) SetGroupSpecialTitle(groupId int, userId int, specialTitle string, duration int) SetFriendAddRequest(flag string, approve bool, remark string) SetGroupAddRequest(flag string, subType string, approve bool, reason string) GetLoginInfo() gjson.Result GetStrangerInfo(userId int, noCache bool) gjson.Result GetFriendList() gjson.Result GetGroupInfo(groupId int, noCache bool) gjson.Result GetGroupList() gjson.Result GetGroupMemberInfo(groupId int, UserId int, noCache bool) gjson.Result GetGroupMemberList(groupId int) gjson.Result GetGroupHonorInfo(groupId int, honorType string) gjson.Result GetCookies(domain string) gjson.Result GetCsrfToken() gjson.Result GetCredentials(domain string) gjson.Result GetRecord(file, outFormat string) gjson.Result GetImage(file string) gjson.Result CanSendImage() bool CanSendRecord() bool GetStatus() gjson.Result SetRestart(delay int) CleanCache() DownloadFile(url string, threadCount int, headers []string) gjson.Result GetGroupMsgHistory(messageSeq int64, groupId int) gjson.Result GetOnlineClients(noCache bool) gjson.Result GetVipInfoTest(UserId int) gjson.Result SendGroupNotice(groupId int, content string) ReloadEventFilter() SetEssenceMsg(messageId int) DeleteEssenceMsg(messageId int) GetEssenceMsgList(groupId int) gjson.Result CheckUrlSafely(url string) int UploadGroupFile(groupId int, file string, name string, folder string) SetGroupNameSpecial(groupId int, groupName string) SetGroupPortrait(groupId int, file string, cache int) GetMsgSpecial(messageId int) gjson.Result GetForwardMsg(messageId int) gjson.Result SendGroupForwardMsg(groupId int, messages interface{}) GetWordSlices(content string) gjson.Result OcrImage(image string) gjson.Result GetGroupSystemMsg() gjson.Result GetGroupFileSystemInfo(groupId int) gjson.Result GetGroupRootFiles(groupId int) gjson.Result GetGroupFilesByFolder(groupId int, folderId string) gjson.Result GetGroupFileUrl(groupId int, fileId string, busid int) gjson.Result GetGroupAtAllRemain(groupId int) gjson.Result }
OneBotApi @Description:
type Plugin ¶ added in v1.1.1
type Plugin struct { Name string Helps []map[string]string // contains filtered or unexported fields }
Plugin @Description:
func (*Plugin) OnDisConnect ¶ added in v1.1.1
func (p *Plugin) OnDisConnect() *disConnectHandle
func (*Plugin) OnFullMatch ¶ added in v1.1.4
func (*Plugin) OnFullMatchGroup ¶ added in v1.1.4
func (*Plugin) OnKeyWords ¶ added in v1.1.1
func (*Plugin) OnPretreatment ¶ added in v1.1.1
func (p *Plugin) OnPretreatment() *PretreatmentHandle
func (*Plugin) OnStartWith ¶ added in v1.1.1
type PretreatmentChain ¶
type PretreatmentChain []*PretreatmentHandle
func (PretreatmentChain) Len ¶
func (p PretreatmentChain) Len() int
func (PretreatmentChain) Less ¶
func (p PretreatmentChain) Less(i, j int) bool
func (PretreatmentChain) Swap ¶
func (p PretreatmentChain) Swap(i, j int)
type PretreatmentHandle ¶
type PretreatmentHandle struct { BaseHandle // contains filtered or unexported fields }
func (*PretreatmentHandle) AddHandle ¶
func (p *PretreatmentHandle) AddHandle(f func(ctx *Context) bool)
AddHandle *
- @Description:
- @receiver p
- @param f
func (*PretreatmentHandle) AddRule ¶
func (p *PretreatmentHandle) AddRule(rule Rule) *PretreatmentHandle
AddRule *
- @Description:
- @receiver p
- @param rule
- @return PretreatmentHandle
func (*PretreatmentHandle) SetPluginName ¶
func (p *PretreatmentHandle) SetPluginName(name string) *PretreatmentHandle
func (*PretreatmentHandle) SetWeight ¶
func (p *PretreatmentHandle) SetWeight(weight int) *PretreatmentHandle
SetWeight *
- @Description:
- @receiver p
- @param weight
- @return PretreatmentHandle
type PretreatmentInt ¶
type PretreatmentInt interface { SetPluginName(name string) *PretreatmentHandle AddRule(rule Rule) *PretreatmentHandle SetWeight(weight int) *PretreatmentHandle AddHandle(func(ctx *Context) bool) }
type RequestChain ¶
type RequestChain []*requestHandle
func (RequestChain) Len ¶
func (r RequestChain) Len() int
func (RequestChain) Less ¶
func (r RequestChain) Less(i, j int) bool
func (RequestChain) Swap ¶
func (r RequestChain) Swap(i, j int)
type RequestInt ¶
type State ¶
type State struct { Args []string Cmd string Allies []string RegexResult []string Data map[string]interface{} }
State @Description: sdk处理消息后将内容传递给plugin
type Status ¶
type Status struct { AppEnabled bool `json:"app_enabled"` AppGood bool `json:"app_good"` AppInitialized bool `json:"app_initialized"` Good bool `json:"good"` Online bool `json:"online"` PluginsGood interface{} `json:"plugins_good"` Stat struct { PacketReceived int `json:"packet_received"` PacketSent int `json:"packet_sent"` PacketLost int `json:"packet_lost"` MessageReceived int `json:"message_received"` MessageSent int `json:"message_sent"` DisconnectTimes int `json:"disconnect_times"` LostTimes int `json:"lost_times"` LastMessageTime int `json:"last_message_time"` } `json:"stat"` }
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
docs
|
|
gui
|
|
Package message @Description: 用于message转换和封装的一个包
|
Package message @Description: 用于message转换和封装的一个包 |
Package utils @Description: Package utils @Description:
|
Package utils @Description: Package utils @Description: |