Documentation
¶
Index ¶
- Constants
- Variables
- func BanPluginByID(id string)
- func BanPluginByName(name string) int
- func CallApi(ctx *gin.Context)
- func GetConfig(ctx *gin.Context)
- func GetFriendList(ctx *gin.Context)
- func GetGroupList(ctx *gin.Context)
- func GetHandleList() map[string][]BaseHandle
- func GetLogLevel(level string) log.Level
- func InitBots()
- func InitPluginManager()
- func InitWindow()
- func LoadConfig()
- func OnCommand(command string) *commandHandle
- func OnConnect() *connectHandle
- func OnDisConnect() *disConnectHandle
- func OnEndWith(str string) *messageHandle
- func OnKeyWords(keyword string) *messageHandle
- func OnMessage(messageType string) *messageHandle
- func OnMeta() *metaHandle
- func OnNotice(noticeType string) *noticeHandle
- func OnRegex(regex string) *commandHandle
- func OnRequest(requestType string) *requestHandle
- func OnStartWith(str string) *messageHandle
- func OnTime(crons string, selfId int, handle func(bot *Bot))
- func OnlyGroupMessage(event Event, _ *Bot) bool
- func OnlySuperUser(event Event, _ *Bot, _ *State) bool
- func OnlyToMe(event Event, _ *Bot, state *State) bool
- func OpenUi()
- func StartPlugin(name string) int
- func StartPluginByID(id string)
- type Api
- type BaseHandle
- type Bool
- type Bot
- func (b *Bot) CallApi(Action string, param interface{}) interface{}
- func (b *Bot) CanSendImage() Bool
- func (b *Bot) CanSendRecord() Bool
- func (b *Bot) CheckUrlSafely(url string) int
- func (b *Bot) CleanCache()
- func (b *Bot) CloseMessageChan(id int)
- func (b *Bot) DeleteEssenceMsg(messageId int)
- func (b *Bot) DeleteMsg(messageId int32)
- func (b *Bot) DownloadFile(url string, threadCount int, headers []string) DownloadFilePath
- func (b *Bot) GetCookies(domain string) Cookie
- func (b *Bot) GetCredentials(domain string) Credentials
- func (b *Bot) GetCsrfToken() CsrfToken
- func (b *Bot) GetEssenceMsgList(groupId int)
- func (b *Bot) GetForwardMsg(messageId int) []ForwardMsg
- func (b *Bot) GetFriendList() []FriendList
- func (b *Bot) GetGroupAtAllRemain(groupId int) GroupAtAllRemain
- func (b *Bot) GetGroupFileSystemInfo(groupId int) GroupFileSystemInfo
- func (b *Bot) GetGroupFileUrl(groupId int, fileId string, busid int) FileUrl
- func (b *Bot) GetGroupFilesByFolder(groupId int, folderId string) GroupFilesByFolder
- func (b *Bot) GetGroupHonorInfo(groupId int, honorType string) GroupHonorInfo
- func (b *Bot) GetGroupInfo(groupId int, noCache bool) GroupInfo
- func (b *Bot) GetGroupList() []GroupInfo
- func (b *Bot) GetGroupMemberInfo(groupId int, userId int, noCache bool) GroupMemberInfo
- func (b *Bot) GetGroupMemberList(groupId int) []GroupMemberInfo
- func (b *Bot) GetGroupMsgHistory(messageSeq int64, groupId int) MessageHistory
- func (b *Bot) GetGroupRootFiles(groupId int) GroupRootFiles
- func (b *Bot) GetGroupSystemMsg() GroupSystemMsg
- func (b *Bot) GetImage(file string) Image
- func (b *Bot) GetLoginInfo() LoginInfo
- func (b *Bot) GetMoreEvent(rules ...Rule) (int, chan Event)
- func (b *Bot) GetMsg(messageId int32) GetMessage
- func (b *Bot) GetMsgSpecial(messageId int) MsgData
- func (b *Bot) GetOneEvent(rules ...Rule) (Event, error)
- func (b *Bot) GetOnlineClients(noCache bool) Clients
- func (b *Bot) GetRecord(file, outFormat string) Record
- func (b *Bot) GetStatus() OnlineStatus
- func (b *Bot) GetStrangerInfo(userId int, noCache bool) Senders
- func (b *Bot) GetVipInfoTest(UserId int) VipInfo
- func (b *Bot) GetWordSlices(content string) []string
- func (b *Bot) OcrImage(image string) OcrImage
- func (b *Bot) ReloadEventFilter()
- func (b *Bot) Send(event Event, message interface{}) int
- func (b *Bot) SendAt(event Event, message interface{}) int
- func (b *Bot) SendGroupForwardMsg(groupId int, messages interface{})
- func (b *Bot) SendGroupMsg(groupId int, message interface{}) int32
- func (b *Bot) SendGroupNotice(groupId int, content string)
- func (b *Bot) SendLike(userId int, times int)
- func (b *Bot) SendMsg(messageType string, userId int, groupId int, message interface{}) int32
- func (b *Bot) SendPrivateMsg(userId int, message interface{}) int32
- func (b *Bot) SetEssenceMsg(messageId int)
- func (b *Bot) SetFriendAddRequest(flag string, approve bool, remark string)
- func (b *Bot) SetGroupAddRequest(flag string, subType string, approve bool, reason string)
- func (b *Bot) SetGroupAdmin(groupId int, userId int, enable bool)
- func (b *Bot) SetGroupAnonymous(groupId int, enable bool)
- func (b *Bot) SetGroupAnonymousBan(groupId int, flag string, duration int)
- func (b *Bot) SetGroupBan(groupId int, userId int, duration int)
- func (b *Bot) SetGroupCard(groupId int, userId int, card string)
- func (b *Bot) SetGroupKick(groupId int, userId int, rejectAddRequest bool)
- func (b *Bot) SetGroupLeave(groupId int, isDisMiss bool)
- func (b *Bot) SetGroupName(groupId int, groupName string)
- func (b *Bot) SetGroupNameSpecial(groupId int, groupName string)
- func (b *Bot) SetGroupPortrait(groupId int, file string, cache int)
- func (b *Bot) SetGroupSpecialTitle(groupId int, userId int, specialTitle string, duration int)
- func (b *Bot) SetGroupWholeBan(groupId int, enable bool)
- func (b *Bot) SetRestart(delay int)
- func (b *Bot) UploadGroupFile(groupId int, file string, name string, folder string)
- type Clients
- type CommandChain
- type CommandInt
- type Config
- type Connect
- type ConnectChain
- type ConnectInt
- type ConstMessageType
- type ConstNoticeType
- type Content
- type Cookie
- type Credentials
- type CsrfToken
- type CurrentTalkativeS
- type Device
- type DisConnectChain
- type DisConnectInt
- type DownloadFilePath
- type Event
- type File
- type FileUrl
- type Files
- type Folder
- type ForwardMsg
- type FriendList
- type GetMessage
- type GroupAtAllRemain
- type GroupFileSystemInfo
- type GroupFilesByFolder
- type GroupHonorInfo
- type GroupHonorInfoList
- type GroupInfo
- type GroupMemberInfo
- type GroupRootFiles
- type GroupSystemMsg
- type Image
- type IncreaseApi
- type InvitedRequest
- type JoinRequest
- type LoginInfo
- type M
- type MessageChain
- type MessageHistory
- type MessageIds
- type MessageInt
- type MetaChain
- type MetaInt
- type MsgData
- type Node
- type NoticeChain
- type NoticeInt
- type OcrImage
- type OnlineStatus
- type Plugin
- func (p *Plugin) OnCommand(command string) *commandHandle
- func (p *Plugin) OnConnect() *connectHandle
- func (p *Plugin) OnDisConnect() *disConnectHandle
- func (p *Plugin) OnEndWith(str string) *messageHandle
- func (p *Plugin) OnKeyWords(keyword string) *messageHandle
- func (p *Plugin) OnMessage(messageType string) *messageHandle
- func (p *Plugin) OnMeta() *metaHandle
- func (p *Plugin) OnNotice(noticeType string) *noticeHandle
- func (p *Plugin) OnPretreatment() *PretreatmentHandle
- func (p *Plugin) OnRegex(regex string) *commandHandle
- func (p *Plugin) OnRequest(requestType string) *requestHandle
- func (p *Plugin) OnStartWith(str string) *messageHandle
- func (p *Plugin) OnTime(crons string, selfId int, handle func(bot *Bot))
- func (p *Plugin) SetHelp(help map[string]string)
- type PretreatmentChain
- type PretreatmentHandle
- type PretreatmentInt
- type QuickUseApi
- type Record
- type RequestChain
- type RequestInt
- type Rule
- type Senders
- type SpecialApi
- type State
- type Status
- type TextDetection
- type UseApi
- type VipInfo
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 = true // 是否启用gui
var (
MessageChan = make(chan Event, 10)
)
var (
NoticeTypeApi = ConstNoticeType{
GroupUpload: "group_upload",
GroupAdmin: "group_admin",
GroupDecrease: "group_decrease",
GroupIncrease: "group_increase",
GroupBan: "group_ban",
FriendAdd: "friend_add",
GroupRecall: "group_recall",
FriendRecall: "friend_recall",
Notify: "notify",
OfflineFile: "offline_file",
GroupCard: "group_card"}
)
Functions ¶
func GetFriendList ¶
func GetGroupList ¶
func GetHandleList ¶
func GetHandleList() map[string][]BaseHandle
func InitPluginManager ¶
func InitPluginManager()
func InitWindow ¶
func InitWindow()
func LoadConfig ¶
func LoadConfig()
func OnCommand ¶
func OnCommand(command string) *commandHandle
OnCommand *
@Description: command触发handle
@param 该插件响应的命令
@return *commandHandle
example leafBot.OnCommand("天气"). SetPluginName("天气插件"). AddHandle( func(event LeafBot.Event,bot *leafBot.Bot,args []string){
})
func OnConnect ¶
func OnConnect() *connectHandle
OnConnect *
- @Description: 在bot进行连接使响应
- @return *connectHandle
- example
func OnDisConnect ¶
func OnDisConnect() *disConnectHandle
OnDisConnect *
- @Description: 在bot断开连接时进行响应
- @return *disConnectHandle
- example
func OnKeyWords ¶ added in v1.1.1
func OnKeyWords(keyword string) *messageHandle
func OnMessage ¶
func OnMessage(messageType string) *messageHandle
OnMessage *
- @Description: message事件触发handle
- @param messageType message事件的子类型
- @return *messageHandle
- example
func OnMeta ¶
func OnMeta() *metaHandle
OnMeta *
- @Description: 元事件触发handle
- @return *metaHandle
- example
func OnNotice ¶
func OnNotice(noticeType string) *noticeHandle
OnNotice *
@Description: notice触发handle
@param noticeType notice事件类型
@return *noticeHandle
example 响应戳一戳事件的示例 leafBot.OnNotice(leafBot.NoticeTypeApi.Notify). SetPluginName("poke"). AddRule( func(event leafBot.Event, bot *leafBot.Bot) bool { if event.SubType != "poke" || event.UserId == event.SelfId || int(event.TargetId) != event.SelfId { return false } return true }).SetWeight(10). AddHandle( func(event leafBot.Event, bot *leafBot.Bot) {
})
func OnRequest ¶
func OnRequest(requestType string) *requestHandle
OnRequest *
- @Description: request事件触发handle
- @param requestType request事件的子类型
- @return *requestHandle
- example
func OnStartWith ¶
func OnStartWith(str string) *messageHandle
func OnlyGroupMessage ¶
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 StartPluginByID ¶
func StartPluginByID(id string)
Types ¶
type Api ¶
type Api interface {
SendGroupMsg(groupId int, message interface{}) int32
SendPrivateMsg(userId int, message interface{}) int32
DeleteMsg(messageId int32)
GetMsg(messageId int32) GetMessage
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() LoginInfo
GetStrangerInfo(userId int, noCache bool) Senders
GetFriendList() []FriendList
GetGroupInfo(groupId int, noCache bool) GroupInfo
GetGroupList() []GroupInfo
GetGroupMemberInfo(groupId int, UserId int, noCache bool) GroupMemberInfo
GetGroupMemberList(groupId int) []GroupMemberInfo
GetGroupHonorInfo(groupId int, honorType string) GroupHonorInfo
GetCookies(domain string) Cookie
GetCsrfToken() CsrfToken
GetCredentials(domain string) Credentials
GetRecord(file, outFormat string) Record
GetImage(file string) Image
CanSendImage() Bool
CanSendRecord() Bool
GetStatus() OnlineStatus
SetRestart(delay int)
CleanCache()
}
type BaseHandle ¶
type Bot ¶
type Bot struct {
Name string `json:"name" yaml:"name" hjson:"name"`
SelfId int `json:"self_id" yaml:"self_id" hjson:"self_id"`
Client *connection `json:"con" yaml:"client" hjson:"client"`
}
func (*Bot) CheckUrlSafely ¶
func (*Bot) CloseMessageChan ¶
CloseMessageChan
@Description: 关闭session,即从等待队列中删除 @receiver b @param id int
func (*Bot) DeleteEssenceMsg ¶
func (*Bot) DownloadFile ¶
func (b *Bot) DownloadFile(url string, threadCount int, headers []string) DownloadFilePath
DownloadFile
@Description: @receiver b @param url string @param threadCount int @param headers []string @return DownloadFilePath
func (*Bot) GetCredentials ¶
func (b *Bot) GetCredentials(domain string) Credentials
GetCredentials
@Description: @receiver b @param domain string @return Credentials
func (*Bot) GetEssenceMsgList ¶
func (*Bot) GetForwardMsg ¶
func (b *Bot) GetForwardMsg(messageId int) []ForwardMsg
GetForwardMsg
@Description: @receiver b @param messageId int @return []ForwardMsg
func (*Bot) GetFriendList ¶
func (b *Bot) GetFriendList() []FriendList
GetFriendList
@Description: @receiver b @return []FriendList
func (*Bot) GetGroupAtAllRemain ¶
func (b *Bot) GetGroupAtAllRemain(groupId int) GroupAtAllRemain
GetGroupAtAllRemain
@Description: @receiver b @param groupId int @return GroupAtAllRemain
func (*Bot) GetGroupFileSystemInfo ¶
func (b *Bot) GetGroupFileSystemInfo(groupId int) GroupFileSystemInfo
GetGroupFileSystemInfo
@Description: @receiver b @param groupId int @return GroupFileSystemInfo
func (*Bot) GetGroupFileUrl ¶
GetGroupFileUrl
@Description: @receiver b @param groupId int @param fileId string @param busid int @return FileUrl
func (*Bot) GetGroupFilesByFolder ¶
func (b *Bot) GetGroupFilesByFolder(groupId int, folderId string) GroupFilesByFolder
GetGroupFilesByFolder
@Description: @receiver b @param groupId int @param folderId string @return GroupFilesByFolder
func (*Bot) GetGroupHonorInfo ¶
func (b *Bot) GetGroupHonorInfo(groupId int, honorType string) GroupHonorInfo
GetGroupHonorInfo
@Description: @receiver b @param groupId int @param honorType string @return GroupHonorInfo
func (*Bot) GetGroupInfo ¶
GetGroupInfo
@Description: @receiver b @param groupId int @param noCache bool @return GroupInfo
func (*Bot) GetGroupMemberInfo ¶
func (b *Bot) GetGroupMemberInfo(groupId int, userId int, noCache bool) GroupMemberInfo
GetGroupMemberInfo
@Description: @receiver b @param groupId int @param userId int @param noCache bool @return GroupMemberInfo
func (*Bot) GetGroupMemberList ¶
func (b *Bot) GetGroupMemberList(groupId int) []GroupMemberInfo
GetGroupMemberList
@Description: @receiver b @param groupId int @return []GroupMemberInfo
func (*Bot) GetGroupMsgHistory ¶
func (b *Bot) GetGroupMsgHistory(messageSeq int64, groupId int) MessageHistory
GetGroupMsgHistory
@Description: @receiver b @param messageSeq int64 @param groupId int @return MessageHistory
func (*Bot) GetGroupRootFiles ¶
func (b *Bot) GetGroupRootFiles(groupId int) GroupRootFiles
GetGroupRootFiles
@Description: @receiver b @param groupId int @return GroupRootFiles
func (*Bot) GetGroupSystemMsg ¶
func (b *Bot) GetGroupSystemMsg() GroupSystemMsg
GetGroupSystemMsg
@Description: @receiver b @return GroupSystemMsg
func (*Bot) GetMoreEvent ¶
GetMoreEvent
@Description: 获取一个通道不断从用户获取消息 @receiver b @param rules ...Rule @return int int 对应session在队列中的编号,后面关闭需要该编号 @return chan Event 事件通道
func (*Bot) GetMsg ¶
func (b *Bot) GetMsg(messageId int32) GetMessage
GetMsg
@Description: @receiver b @param messageId int32 @return GetMessage
func (*Bot) GetMsgSpecial ¶
GetMsgSpecial
@Description: @receiver b @param messageId int @return MsgData
func (*Bot) GetOneEvent ¶
GetOneEvent
@Description: 向session队列里面添加一个对象,等待用户的响应,设置超时时间 @receiver b @param rules ...Rule @return Event Event @return error error
func (*Bot) GetOnlineClients ¶
GetOnlineClients
@Description: @receiver b @param noCache bool @return Clients
func (*Bot) GetRecord ¶
GetRecord
@Description: @receiver b @param file file @param outFormat string @return Record
func (*Bot) GetStatus ¶
func (b *Bot) GetStatus() OnlineStatus
GetStatus
@Description: @receiver b @return OnlineStatus
func (*Bot) GetStrangerInfo ¶
GetStrangerInfo
@Description: @receiver b @param userId int @param noCache bool @return Senders
func (*Bot) GetVipInfoTest ¶
GetVipInfoTest
@Description: @receiver b @param UserId int @return VipInfo
func (*Bot) GetWordSlices ¶
GetWordSlices
@Description: @receiver b @param content string @return []string
func (*Bot) ReloadEventFilter ¶
func (b *Bot) ReloadEventFilter()
ReloadEventFilter
@Description: @receiver b
func (*Bot) Send ¶
Send
@Description: @receiver b @param event Event @param message string @return int
func (*Bot) SendAt ¶
SendAt
@Description: @receiver b @param event Event @param message string @return int
func (*Bot) SendGroupForwardMsg ¶
SendGroupForwardMsg
@Description: @receiver b @param groupId int @param messages []Node
func (*Bot) SendGroupMsg ¶
SendGroupMsg *
- @Description:
- @receiver b
- @param groupId
- @param message
- @return int32
func (*Bot) SendGroupNotice ¶
SendGroupNotice
@Description: @receiver b @param groupId int @param content string
func (*Bot) SendMsg ¶
SendMsg
@Description: @receiver b @param messageType string @param userId int @param groupId int @param message string @param autoEscape bool @return int32
func (*Bot) SendPrivateMsg ¶
SendPrivateMsg
@Description: @receiver b @param userId int @param message string @param autoEscape bool @return int32
func (*Bot) SetEssenceMsg ¶
func (*Bot) SetFriendAddRequest ¶
SetFriendAddRequest
@Description: @receiver b @param flag string @param approve bool @param remark string
func (*Bot) SetGroupAddRequest ¶
SetGroupAddRequest
@Description: @receiver b @param flag string @param subType string @param approve bool @param reason string
func (*Bot) SetGroupAdmin ¶
SetGroupAdmin
@Description: @receiver b @param groupId int @param userId int @param enable bool
func (*Bot) SetGroupAnonymous ¶
SetGroupAnonymous
@Description: @receiver b @param groupId int @param enable bool
func (*Bot) SetGroupAnonymousBan ¶
SetGroupAnonymousBan
@Description: @receiver b @param groupId int @param flag string @param duration int
func (*Bot) SetGroupBan ¶
SetGroupBan
@Description: @receiver b @param groupId int @param userId int @param duration int
func (*Bot) SetGroupCard ¶
SetGroupCard
@Description: @receiver b @param groupId int @param userId int @param card string
func (*Bot) SetGroupKick ¶
SetGroupKick
@Description: @receiver b @param groupId int @param userId int @param rejectAddRequest bool
func (*Bot) SetGroupLeave ¶
SetGroupLeave
@Description: @receiver b @param groupId int @param isDisMiss bool
func (*Bot) SetGroupName ¶
SetGroupName
@Description: @receiver b @param groupId int @param groupName string
func (*Bot) SetGroupNameSpecial ¶
SetGroupNameSpecial
@Description: @receiver b @param groupId int @param groupName string
func (*Bot) SetGroupPortrait ¶
SetGroupPortrait
@Description: @receiver b @param groupId int @param file string @param cache int
func (*Bot) SetGroupSpecialTitle ¶
SetGroupSpecialTitle
@Description: @receiver b @param groupId int @param userId int @param specialTitle string @param duration int
func (*Bot) SetGroupWholeBan ¶
SetGroupWholeBan
@Description: @receiver b @param groupId int @param enable bool
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 CommandInt interface {
SetPluginName(name string) *commandHandle
AddAllies(allies string) *commandHandle
AddRule(rule Rule) *commandHandle
SetWeight(weight int) *commandHandle
SetBlock(IsBlock bool) *commandHandle
AddHandle(func(event Event, bot *Bot, args []string))
SetCD(types string, long int) *commandHandle
}
type Config ¶
type Config struct {
Bots []*Bot `json:"bots" yaml:"bots" hjson:"bots"`
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"`
LogLevel string `json:"log_level" yaml:"log_level" hjson:"log_level"`
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"`
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"`
}
type ConnectChain ¶
type ConnectChain []*connectHandle
type ConnectInt ¶
type ConstMessageType ¶
type ConstNoticeType ¶
type ConstNoticeType struct {
GroupUpload string //群文件上传
GroupAdmin string //群管理员变动
GroupDecrease string //群成员减少
GroupIncrease string //群成员增加
GroupBan string //群禁言
FriendAdd string //好友添加
GroupRecall string //群消息撤回
FriendRecall string //好友消息撤回
Notify string //群内戳一戳,群红包运气王,群成员荣誉变更,好友戳一戳
GroupCard string //群成员名片更新
OfflineFile string //接收到离线文件
}
type Credentials ¶
type CurrentTalkativeS ¶
type DisConnectChain ¶
type DisConnectChain []*disConnectHandle
type DisConnectInt ¶
type DownloadFilePath ¶
type DownloadFilePath struct {
File string `json:"file"`
}
type Event ¶
type Event struct {
Anonymous anonymous `json:"anonymous"`
Font int `json:"font"`
GroupId int `json:"group_id"`
Message message2.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) GetImages ¶
func (e Event) GetImages() []message.MessageSegment
func (Event) GetPlainText ¶
type File ¶
type File struct {
FileId string `json:"file_id"` //文件ID
FileName string `json:"file_name"` //文件名
Busid int `json:"busid"` //文件类型
FileSize int64 `json:"file_size"` //文件大小
UploadTime int64 `json:"upload_time"` //上传时间
DeadTime int64 `json:"dead_time"` //过期时间,永久文件恒为0
ModifyTime int64 `json:"modify_time"` //最后修改时间
DownloadTimes int32 `json:"download_times"` //下载次数
Uploader int64 `json:"uploader"` //上传者ID
UploaderName string `json:"uploader_name"` //上传者名字
}
type ForwardMsg ¶
type FriendList ¶
type GetMessage ¶
type GroupAtAllRemain ¶
type GroupFileSystemInfo ¶
type GroupFilesByFolder ¶
type GroupHonorInfo ¶
type GroupHonorInfo struct {
GroupId int `json:"group_id"`
CurrentTalkative CurrentTalkativeS `json:"current_talkative"`
TalkativeList []GroupHonorInfoList `json:"talkative_list"`
PerformerList []GroupHonorInfoList `json:"performer_list"`
LegendList []GroupHonorInfoList `json:"legend_list"`
StrongNewbieList []GroupHonorInfoList `json:"strong_newbie_list"`
EmotionList []GroupHonorInfoList `json:"emotion_list"`
}
type GroupHonorInfoList ¶
type GroupMemberInfo ¶
type GroupRootFiles ¶
type GroupSystemMsg ¶
type GroupSystemMsg struct {
InvitedRequests []InvitedRequest `json:"invited_requests"` //邀请消息列表
JoinRequests []JoinRequest `json:"join_requests"` //进群消息列表
}
type IncreaseApi ¶
type IncreaseApi interface {
DownloadFile(url string, threadCount int, headers []string) DownloadFilePath
GetGroupMsgHistory(messageSeq int64, groupId int) MessageHistory
GetOnlineClients(noCache bool) Clients
GetVipInfoTest(UserId int) VipInfo
SendGroupNotice(groupId int, content string)
ReloadEventFilter()
UploadGroupFile(groupId int, file string, name string, folder string) error
GetStatus() Status
SetEssenceMsg(messageId int)
DeleteEssenceMsg(messageId int)
GetEssenceMsgList(groupId int)
CheckUrlSafely(url string) int
}
IncreaseApi /*
@Description:
type InvitedRequest ¶
type InvitedRequest struct {
RequestId int `json:"request_id"` //请求ID
InvitorUin int `json:"invitor_uin"` //邀请者
InvitorNick string `json:"invitor_nick"` //邀请者昵称
GroupId int `json:"group_id"` //群号
GroupName string `json:"group_name"` //群名
Checked bool `json:"checked"` //是否已被处理
Actor int64 `json:"actor"` //处理者, 未处理为0
}
type JoinRequest ¶
type JoinRequest struct {
RequestId int `json:"request_id"` //请求ID
RequesterUin int `json:"requester_uin"` //请求者ID
RequesterNick string `json:"requester_nick"` //请求者昵称
Message string `json:"message"` //验证消息
GroupId int `json:"group_id"` //群号
GroupName string `json:"group_name"` //群名
Checked bool `json:"checked"` //是否已被处理
Actor int `json:"actor"` //处理者, 未处理为0
}
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 MessageHistory ¶
type MessageHistory struct {
Messages []string `json:"messages"`
}
type MessageIds ¶
type MessageIds struct {
MessageID int32 `json:"message_id"`
}
type MessageInt ¶
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 OcrImage ¶
type OcrImage struct {
Texts []TextDetection `json:"texts"`
Language string `json:"language"`
}
type OnlineStatus ¶
type Plugin ¶ added in v1.1.1
func (*Plugin) OnDisConnect ¶ added in v1.1.1
func (p *Plugin) OnDisConnect() *disConnectHandle
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 OnPretreatment ¶
func OnPretreatment() *PretreatmentHandle
OnPretreatment *
- @Description: 预处理事件
- @return *PretreatmentHandle
- example
func (*PretreatmentHandle) AddHandle ¶
func (p *PretreatmentHandle) AddHandle(f func(event Event, bot *Bot) 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(event Event, bot *Bot) bool)
}
type QuickUseApi ¶
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 SpecialApi ¶
type SpecialApi interface {
SetGroupNameSpecial(groupId int, groupName string)
SetGroupPortrait(groupId int, file string, cache int)
GetMsgSpecial(messageId int) MsgData
GetForwardMsg(messageId int) []ForwardMsg
SendGroupForwardMsg(groupId int, messages interface{})
GetWordSlices(content string) []string
OcrImage(image string) OcrImage
GetGroupSystemMsg() GroupSystemMsg
GetGroupFileSystemInfo(groupId int) GroupFileSystemInfo
GetGroupRootFiles(groupId int) GroupRootFiles
GetGroupFilesByFolder(groupId int, folderId string) GroupFilesByFolder
GetGroupFileUrl(groupId int, fileId string, busid int) FileUrl
GetGroupAtAllRemain(groupId int) GroupAtAllRemain
}
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"`
}
type TextDetection ¶
type VipInfo ¶
type VipInfo struct {
UserId int64 `json:"user_id"` //QQ 号
Nickname string `json:"nickname"` //用户昵称
Level int64 `json:"level"` //QQ 等级
LevelSpeed float64 `json:"level_speed"` //等级加速度
VipLevel string `json:"vip_level"` //会员等级
VipGrowthSpeed int64 `json:"vip_growth_speed"` //会员成长速度
VipGrowthTotal int64 `json:"vip_growth_total"` //会员成长总值
}