Documentation ¶
Overview ¶
Package leafbot @Description:
Package leafbot @Description:
Package leafbot @Description:
Index ¶
- Constants
- Variables
- func AddPlugin(pluginName string, help map[string]string, matcher Matcher)
- func InitBots(config Config)
- func LoadConfig(config *Config)
- func LoadDriver(driver2 Driver)
- func MustReply(ctx *Context) bool
- func OnlyGroupMessage(ctx *Context) bool
- func OnlySuperUser(ctx *Context) bool
- func OnlyToMe(ctx *Context) bool
- type API
- type Action
- type CommandMatcher
- type Config
- type Conn
- 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) GetAtUsers() (users []int64)
- 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 int64) gjson.Result
- func (ctx *Context) GetForwardMsg(messageId int) gjson.Result
- func (ctx *Context) GetFriendList() gjson.Result
- func (ctx *Context) GetGroupAtAllRemain(groupID int64) gjson.Result
- func (ctx *Context) GetGroupFileSystemInfo(groupID int64) gjson.Result
- func (ctx *Context) GetGroupFileUrl(groupID int64, fileId string, busid int) gjson.Result
- func (ctx *Context) GetGroupFilesByFolder(groupID int64, folderId string) gjson.Result
- func (ctx *Context) GetGroupHonorInfo(groupID int64, honorType string) gjson.Result
- func (ctx *Context) GetGroupInfo(groupID int64, noCache bool) gjson.Result
- func (ctx *Context) GetGroupList() gjson.Result
- func (ctx *Context) GetGroupMemberInfo(groupID int64, userId int64, noCache bool) gjson.Result
- func (ctx *Context) GetGroupMemberList(groupID int64) gjson.Result
- func (ctx *Context) GetGroupMsgHistory(messageSeq int64, groupID int64) gjson.Result
- func (ctx *Context) GetGroupRootFiles(groupID int64) gjson.Result
- func (ctx *Context) GetGroupSystemMsg() gjson.Result
- func (ctx *Context) GetGuildChannelList(guildID int64, noCache bool) gjson.Result
- func (ctx *Context) GetGuildList() gjson.Result
- func (ctx *Context) GetGuildMembers(guildID int64) gjson.Result
- func (ctx *Context) GetGuildMetaByQuest(guildID int64) gjson.Result
- func (ctx *Context) GetGuildServiceProfile() gjson.Result
- func (ctx *Context) GetImage(file string) gjson.Result
- func (ctx *Context) GetImages() (images []message2.MessageSegment)
- func (ctx *Context) GetLoginInfo() gjson.Result
- func (ctx *Context) GetMoreEvent(rules ...Rule) (chan Event, func())
- func (ctx *Context) GetMsg(messageId int32) gjson.Result
- func (ctx *Context) GetMsgSpecial(messageId int) gjson.Result
- func (ctx *Context) GetOneEvent(rules ...Rule) (Event, error)
- func (ctx *Context) GetOnlineClients(noCache bool) gjson.Result
- func (ctx *Context) GetQuestion(question string) (string, error)
- 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 int64) 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 int64, messages interface{})
- func (ctx *Context) SendGroupMsg(groupId int64, message interface{}) int32
- func (ctx *Context) SendGroupNotice(groupID int64, content string)
- func (ctx *Context) SendGuildChannelMsg(guildID, channelID int64, message interface{}) gjson.Result
- func (ctx *Context) SendLike(userID int64, times int)
- func (ctx *Context) SendMsg(messageType string, userId int64, groupId int64, message interface{}) int32
- func (ctx *Context) SendPrivateForwardMsg(userID int64, messages interface{})
- func (ctx *Context) SendPrivateMsg(userId int64, 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 int64, userId int64, enable bool)
- func (ctx *Context) SetGroupAnonymous(groupID int64, enable bool)
- func (ctx *Context) SetGroupAnonymousBan(groupID int64, flag string, duration int)
- func (ctx *Context) SetGroupBan(groupId int64, userId int64, duration int64)
- func (ctx *Context) SetGroupCard(groupID int64, userId int64, card string)
- func (ctx *Context) SetGroupKick(groupID int64, userId int64, rejectAddRequest bool)
- func (ctx *Context) SetGroupLeave(groupID int64, isDisMiss bool)
- func (ctx *Context) SetGroupName(groupID int64, groupName string)
- func (ctx *Context) SetGroupNameSpecial(groupID int64, groupName string)
- func (ctx *Context) SetGroupPortrait(groupID int64, file string, cache int)
- func (ctx *Context) SetGroupSpecialTitle(groupID int64, userId int64, specialTitle string, duration int)
- func (ctx *Context) SetGroupWholeBan(groupId int64, enable bool)
- func (ctx *Context) SetRestart(delay int)
- func (ctx *Context) UploadGroupFile(groupID int64, file string, name string, folder string)
- func (ctx *Context) UploadPrivateFile(userID int64, file, name string)
- type Driver
- type Event
- type Files
- type GuildAPI
- type Matcher
- type MatcherSet
- type MessageIds
- type OneBotAPI
- type Option
- type Plugin
- func (p *Plugin) GetHelp() map[string]string
- func (p *Plugin) GetMather() []Matcher
- func (p *Plugin) GetName() string
- func (p *Plugin) OnCommand(command string, options ...Option) Matcher
- func (p *Plugin) OnConnect(options ...Option) Matcher
- func (p *Plugin) OnDisConnect(options ...Option) Matcher
- func (p *Plugin) OnEnd(end string, options ...Option) Matcher
- func (p *Plugin) OnFullMatch(content string, options ...Option) Matcher
- func (p *Plugin) OnFullMatchGroup(content string, options ...Option) Matcher
- func (p *Plugin) OnMessage(messageType string, options ...Option) Matcher
- func (p *Plugin) OnMeta(options ...Option) Matcher
- func (p *Plugin) OnNotice(noticeType string, options ...Option) Matcher
- func (p *Plugin) OnRegex(regexMatcher string, options ...Option) Matcher
- func (p *Plugin) OnRequest(requestType string, options ...Option) Matcher
- func (p *Plugin) OnSelfMessage(options ...Option) Matcher
- func (p *Plugin) OnStart(start string, options ...Option) Matcher
- func (p *Plugin) SetHelp(m map[string]string)
- type PluginInt
- type Rule
- type Senders
- type State
- type Status
Constants ¶
const ( COMMAND = "command" MESSAGE = "message" REQUEST = "request" REGEX = "regex" NOTICE = "notice" META = "meta" CONNECT = "connect" DISCONNECT = "dis_connect" SELF_MESSAGE = "message_sent" )
Variables ¶
var DefaultConfig = Config{ NickName: []string{"leafBot"}, Admin: 0, SuperUser: nil, CommandStart: []string{"/"}, LogLevel: "", }
Functions ¶
func LoadConfig ¶
func LoadConfig(config *Config)
func LoadDriver ¶
func LoadDriver(driver2 Driver)
LoadDriver *
- @Description: 为leafBot注册一个驱动
- @param driver2 实现了Driver接口的驱动
- example
func MustReply ¶
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
Types ¶
type API ¶
type API interface { CallApi(action string, params interface{}) gjson.Result SendGroupMsg(groupID int64, message interface{}) int32 SendPrivateMsg(userID int64, message interface{}) int32 }
API @Description:
type CommandMatcher ¶
type CommandMatcher interface { Matcher GetCommand() string GetAlias() []string GetRegexMatcher() string }
插件的基本接口,实现Handler接口即可成为一个插件
type Config ¶
type Config struct { NickName []string `json:"nick_name" yaml:"nick_name" hjson:"nick_name"` Admin int64 `json:"admin" yaml:"admin" hjson:"admin"` SuperUser []int64 `json:"super_user" yaml:"super_user" hjson:"super_user"` CommandStart []string `json:"command_start" yaml:"command_start" hjson:"command_start"` LogLevel string `json:"log_level" yaml:"log_level"` }
Config @Description: 配置信息
type Conn ¶
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:
type Context ¶
type Context struct { Event *Event Bot API State *State RawEvent gjson.Result UserID int64 GroupID int64 SelfID int64 }
Context @Description: 上下文管理对象
func (*Context) CheckUrlSafely ¶
CheckUrlSafely *
- @Description:
- @receiver ctx
- @param url
- @return int
func (*Context) CleanCache ¶
func (ctx *Context) CleanCache()
CleanCache *
- @Description:
- @receiver b
- example
func (*Context) DownloadFile ¶
DownloadFile
@Description: @receiver b @param url string @param threadCount int @param headers []string @return DownloadFilePath
func (*Context) GetCookies ¶
GetCookies
@Description: @receiver b @param domain string @return Cookie
func (*Context) GetCredentials ¶
GetCredentials
@Description: @receiver b @param domain string @return Credentials
func (*Context) GetEssenceMsgList ¶
GetEssenceMsgList *
- @Description:
- @receiver ctx
- @param groupID
- @return gjson.Result
func (*Context) GetForwardMsg ¶
GetForwardMsg
@Description: @receiver b @param messageId int @return []ForwardMsg
func (*Context) GetFriendList ¶
GetFriendList *
- @Description:
- @receiver b
- @return gjson.Result
- example
func (*Context) GetGroupAtAllRemain ¶
GetGroupAtAllRemain
@Description: @receiver b @param groupID int64 @return GroupAtAllRemain
func (*Context) GetGroupFileSystemInfo ¶
GetGroupFileSystemInfo
@Description: @receiver b @param groupID int64 @return GroupFileSystemInfo
func (*Context) GetGroupFileUrl ¶
GetGroupFileUrl
@Description: @receiver b @param groupID int64 @param fileId string @param busid int @return FileUrl
func (*Context) GetGroupFilesByFolder ¶
GetGroupFilesByFolder
@Description: @receiver b @param groupID int64 @param folderId string @return GroupFilesByFolder
func (*Context) GetGroupHonorInfo ¶
GetGroupHonorInfo
@Description: @receiver b @param groupID int64 @param honorType string @return GroupHonorInfo
func (*Context) GetGroupInfo ¶
GetGroupInfo *
- @Description:
- @receiver b
- @param groupID
- @param noCache
- @return gjson.Result
- example
func (*Context) GetGroupMemberInfo ¶
GetGroupMemberInfo
@Description: @receiver b @param groupID int64 @param userId int @param noCache bool @return GroupMemberInfo
func (*Context) GetGroupMemberList ¶
GetGroupMemberList
@Description: @receiver b @param groupID int64 @return []GroupMemberInfo
func (*Context) GetGroupMsgHistory ¶
GetGroupMsgHistory
@Description: @receiver b @param messageSeq int64 @param groupID int64 @return MessageHistory
func (*Context) GetGroupRootFiles ¶
GetGroupRootFiles
@Description: @receiver b @param groupID int64 @return GroupRootFiles
func (*Context) GetGroupSystemMsg ¶
GetGroupSystemMsg
@Description: @receiver b @return GroupSystemMsg
func (*Context) GetGuildChannelList ¶
func (*Context) GetGuildList ¶
func (*Context) GetGuildMetaByQuest ¶
func (*Context) GetGuildServiceProfile ¶
func (*Context) GetImages ¶
func (ctx *Context) GetImages() (images []message2.MessageSegment)
GetImages *
- @Description: 获取消息中所有的图片
- @receiver ctx
- @return images
func (*Context) GetMoreEvent ¶
GetMoreEvent
@Description: 获取一个通道不断从用户获取消息 @receiver b @param rules ...Rule @return int int 对应session在队列中的编号,后面关闭需要该编号 @return chan Event 事件通道
func (*Context) GetMsgSpecial ¶
GetMsgSpecial
@Description: @receiver b @param messageId int @return MsgData
func (*Context) GetOneEvent ¶
GetOneEvent
@Description: 向session队列里面添加一个对象,等待用户的响应,设置超时时间 @receiver b @param rules ...Rule @return Event Event @return error error
func (*Context) GetOnlineClients ¶
GetOnlineClients *
- @Description:
- @receiver b
- @param noCache
- @return gjson.Result
- example
func (*Context) GetQuestion ¶
GetQuestion *
- @Description: 向当前用户发送一个问题,并获取答案
- @receiver ctx
- @param question
- @return string
- @return error
func (*Context) GetRecord ¶
GetRecord
@Description: @receiver b @param file file @param outFormat string @return Record
func (*Context) GetStrangerInfo ¶
GetStrangerInfo
@Description: @receiver b @param userId int @param noCache bool @return Senders
func (*Context) GetVipInfoTest ¶
GetVipInfoTest
@Description: @receiver b @param UserId int @return VipInfo
func (*Context) GetWordSlices ¶
GetWordSlices
@Description: @receiver b @param content string @return []string
func (*Context) ReloadEventFilter ¶
func (ctx *Context) ReloadEventFilter()
ReloadEventFilter
@Description: @receiver b
func (*Context) Send ¶
Send *
- @Description: 使用上下文对象方便的回复当前会话
- @receiver ctx
- @param message
- @return int32
func (*Context) SendGroupForwardMsg ¶
SendGroupForwardMsg
@Description: @receiver b @param groupID int64 @param messages []Node
func (*Context) SendGroupMsg ¶
func (*Context) SendGroupNotice ¶
SendGroupNotice
@Description: @receiver b @param groupID int64 @param content string
func (*Context) SendGuildChannelMsg ¶
func (*Context) SendMsg ¶
func (ctx *Context) SendMsg(messageType string, userId int64, groupId int64, message interface{}) int32
SendMsg
@Description: @receiver b @param messageType string @param userId int @param groupId int @param message string @param autoEscape bool @return int32
func (*Context) SendPrivateForwardMsg ¶
func (*Context) SendPrivateMsg ¶
SendPrivateMsg *
- @Description:
- @receiver ctx
- @param userId
- @param message
- @return int32
func (*Context) SetFriendAddRequest ¶
SetFriendAddRequest
@Description: @receiver b @param flag string @param approve bool @param remark string
func (*Context) SetGroupAddRequest ¶
SetGroupAddRequest
@Description: @receiver b @param flag string @param subType string @param approve bool @param reason string
func (*Context) SetGroupAdmin ¶
SetGroupAdmin
@Description: @receiver b @param groupId int @param userId int @param enable bool
func (*Context) SetGroupAnonymous ¶
SetGroupAnonymous
@Description: @receiver b @param groupID int64 @param enable bool
func (*Context) SetGroupAnonymousBan ¶
SetGroupAnonymousBan
@Description: @receiver b @param groupId int @param flag string @param duration int
func (*Context) SetGroupBan ¶
SetGroupBan
@Description: @receiver b @param groupId int @param userId int @param duration int
func (*Context) SetGroupCard ¶
SetGroupCard
@Description: @receiver b @param groupId int @param userId int @param card string
func (*Context) SetGroupKick ¶
SetGroupKick
@Description: @receiver b @param groupId int @param userId int @param rejectAddRequest bool
func (*Context) SetGroupLeave ¶
SetGroupLeave
@Description: @receiver b @param groupID int64 @param isDisMiss bool
func (*Context) SetGroupName ¶
SetGroupName
@Description: @receiver b @param groupID int64 @param groupName string
func (*Context) SetGroupNameSpecial ¶
SetGroupNameSpecial
@Description: @receiver b @param groupID int64 @param groupName string
func (*Context) SetGroupPortrait ¶
SetGroupPortrait
@Description: @receiver b @param groupID int64 @param file string @param cache int
func (*Context) SetGroupSpecialTitle ¶
func (ctx *Context) SetGroupSpecialTitle(groupID int64, userId int64, specialTitle string, duration int)
SetGroupSpecialTitle
@Description: @receiver b @param groupID int64 @param userId int @param specialTitle string @param duration int
func (*Context) SetGroupWholeBan ¶
SetGroupWholeBan
@Description: @receiver b @param groupId int @param enable bool
func (*Context) UploadGroupFile ¶
UploadGroupFile
@Description: @receiver b @param groupID int64 @param file string @param name string @param folder string
func (*Context) UploadPrivateFile ¶
type Driver ¶
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{} }
Driver @Description: 驱动器接口
type Event ¶
type Event struct { Anonymous anonymous `json:"anonymous"` Font int `json:"font"` GroupId int64 `json:"group_id"` Message message.Message `json:"message"` MessageType string `json:"message_type"` PostType string `json:"post_type"` RawMessage string `json:"raw_message"` SelfId int64 `json:"self_id"` Sender Senders `json:"sender"` SubType string `json:"sub_type"` UserId int64 `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 GuildID int64 `json:"guild_id"` ChannelID int64 `json:"channel_id"` }
Event
- 事件 *
func (Event) GetImages ¶
func (e Event) GetImages() []message.MessageSegment
func (Event) GetPlainText ¶
type GuildAPI ¶
type GuildAPI interface { API // GetGuildServiceProfile // @Description: 获取频道系统内BOT的资料 // https://github.com/Mrs4s/go-cqhttp/blob/master/docs/guild.md#%E8%8E%B7%E5%8F%96%E9%A2%91%E9%81%93%E7%B3%BB%E7%BB%9F%E5%86%85bot%E7%9A%84%E8%B5%84%E6%96%99 GetGuildServiceProfile() gjson.Result // GetGuildList // @Description: 获取频道列表 // https://github.com/Mrs4s/go-cqhttp/blob/master/docs/guild.md#%E8%8E%B7%E5%8F%96%E9%A2%91%E9%81%93%E5%88%97%E8%A1%A8 // GetGuildList() gjson.Result // GetGuildMetaByQuest // @Description: 通过访客获取频道元数据 // https://github.com/Mrs4s/go-cqhttp/blob/master/docs/guild.md#%E9%80%9A%E8%BF%87%E8%AE%BF%E5%AE%A2%E8%8E%B7%E5%8F%96%E9%A2%91%E9%81%93%E5%85%83%E6%95%B0%E6%8D%AE // GetGuildMetaByQuest(guildID int64) gjson.Result // GetGuildChannelList // @Description: 获取子频道列表 // https://github.com/Mrs4s/go-cqhttp/blob/master/docs/guild.md#%E8%8E%B7%E5%8F%96%E5%AD%90%E9%A2%91%E9%81%93%E5%88%97%E8%A1%A8 // GetGuildChannelList(guildID int64, noCache bool) gjson.Result // GetGuildMembers // @Description: 获取频道成员列表 // https://github.com/Mrs4s/go-cqhttp/blob/master/docs/guild.md#%E8%8E%B7%E5%8F%96%E9%A2%91%E9%81%93%E6%88%90%E5%91%98%E5%88%97%E8%A1%A8 // GetGuildMembers(guildID int64) gjson.Result // SendGuildChannelMsg // @Description: 发送信息到子频道 // @param guildID 频道ID // @param channelID 子频道ID // @param message 消息 // https://github.com/Mrs4s/go-cqhttp/blob/master/docs/guild.md#%E5%8F%91%E9%80%81%E4%BF%A1%E6%81%AF%E5%88%B0%E5%AD%90%E9%A2%91%E9%81%93 // SendGuildChannelMsg(guildID, channelID int64, message interface{}) gjson.Result }
GuildAPI @Description: 频道相关api
type Matcher ¶
type Matcher interface { MatcherSet Enabled() bool GetHandler() Action GetRules() []Rule GetWeight() int IsBlock() bool GetDisAbleGroup() []int64 GetType() string GetPluginType() string }
插件的基本接口,实现Handler接口即可成为一个插件
type MatcherSet ¶
type MatcherSet interface { AddRule(rule Rule) Matcher SetWeight(weight int) Matcher SetBlock(block bool) Matcher SetAllies(allies []string) Matcher Handle(action Action) }
插件的基本接口,实现Handler接口即可成为一个插件
type MessageIds ¶
type MessageIds struct {
MessageID int32 `json:"message_id"`
}
type OneBotAPI ¶
type OneBotAPI interface { API DeleteMsg(messageID int32) GetMsg(messageID int32) gjson.Result SetGroupBan(groupID int64, userID int64, duration int64) SetGroupCard(groupID int64, userID int64, card string) SendMsg(messageType string, userID int64, groupID int64, message interface{}) int32 SendLike(userID int64, times int) SetGroupKick(groupID int64, userID int64, rejectAddRequest bool) SetGroupAnonymousBan(groupID int64, flag string, duration int) SetGroupWholeBan(groupID int64, enable bool) SetGroupAdmin(groupID int64, UserID int64, enable bool) SetGroupAnonymous(groupID int64, enable bool) SetGroupName(groupID int64, groupName string) SetGroupLeave(groupID int64, isDisMiss bool) SetGroupSpecialTitle(groupID int64, userID int64, 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 int64, noCache bool) gjson.Result GetGroupList() gjson.Result GetGroupMemberInfo(groupID int64, UserID int64, noCache bool) gjson.Result GetGroupMemberList(groupID int64) gjson.Result GetGroupHonorInfo(groupID int64, 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() GetGroupFileSystemInfo(groupID int64) gjson.Result GetGroupRootFiles(groupID int64) gjson.Result GetGroupFilesByFolder(groupID int64, folderID string) gjson.Result GetGroupFileUrl(groupID int64, fileID string, busid int) gjson.Result DownloadFile(url string, threadCount int, headers []string) gjson.Result UploadGroupFile(groupID int64, file string, name string, folder string) UploadPrivateFile(userID int64, file, name string) GetGroupMsgHistory(messageSeq int64, groupID int64) gjson.Result GetOnlineClients(noCache bool) gjson.Result GetVipInfoTest(UserID int64) gjson.Result SendGroupNotice(groupID int64, content string) ReloadEventFilter() SetEssenceMsg(messageID int) DeleteEssenceMsg(messageID int) GetEssenceMsgList(groupID int64) gjson.Result CheckUrlSafely(url string) int SetGroupNameSpecial(groupID int64, groupName string) SetGroupPortrait(groupID int64, file string, cache int) GetMsgSpecial(messageID int) gjson.Result GetForwardMsg(messageID int) gjson.Result SendGroupForwardMsg(groupID int64, messages interface{}) SendPrivateForwardMsg(userID int64, messages interface{}) GetWordSlices(content string) gjson.Result OcrImage(image string) gjson.Result GetGroupSystemMsg() gjson.Result GetGroupAtAllRemain(groupID int64) gjson.Result }
OneBotAPI @Description:
type Plugin ¶
type Plugin struct { Name string Help map[string]string Matchers []Matcher // contains filtered or unexported fields }
Plugin
- 用于记录插件的基本信息
func (*Plugin) OnCommand ¶
OnCommand *
- @Description:
- @receiver p
- @param command
- @param options
- @return Matcher
func (*Plugin) OnDisConnect ¶
OnDisConnect *
- @Description:
- @receiver p
- @param options
- @return Matcher
func (*Plugin) OnEnd ¶
OnEnd *
- @Description: 匹配消息结尾
- @receiver p
- @param end
- @param options
- @return Matcher
func (*Plugin) OnFullMatch ¶
OnFullMatch *
- @Description:
- @receiver p
- @param content
- @param options
- @return Matcher
func (*Plugin) OnFullMatchGroup ¶
OnFullMatchGroup *
- @Description:
- @receiver p
- @param content
- @param options
- @return Matcher
func (*Plugin) OnMessage ¶
OnMessage *
- @Description:
- @receiver p
- @param messageType
- @param options
- @return Matcher
func (*Plugin) OnNotice ¶
OnNotice *
- @Description:
- @receiver p
- @param noticeType
- @param options
- @return Matcher
func (*Plugin) OnRegex ¶
OnRegex *
- @Description:
- @receiver p
- @param regexMatcher
- @param options
- @return Matcher
func (*Plugin) OnRequest ¶
OnRequest *
- @Description:
- @receiver p
- @param requestType
- @param options
- @return Matcher
func (*Plugin) OnSelfMessage ¶
OnSelfMessage *
- @Description:
- @receiver p
- @param options
- @return Matcher
type PluginInt ¶
type PluginInt interface { GetHelp() map[string]string GetName() string GetMather() []Matcher SetHelp(map[string]string) // contains filtered or unexported methods }
插件的基本接口,实现Handler接口即可成为一个插件
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 |
---|---|
driver
|
|
Package message @Description: 用于message转换和封装的一个包
|
Package message @Description: 用于message转换和封装的一个包 |
Package utils @Description:
|
Package utils @Description: |