Documentation ¶
Overview ¶
api.go文件包含了可以调用的各个api
event.go为对各种event事件进行处理
Index ¶
- Variables
- func Hand() *gin.Engine
- type Api
- type Bool
- type Bots
- func (bot Bots) CanSendImage() (Bool, error)
- func (bot Bots) CanSendRecord() (Bool, error)
- func (bot Bots) CleanCache()
- func (bot Bots) DeleteMsg(messageId int32) error
- func (bot Bots) DownloadFile(url string, threadCount int, headers []string) (DownloadFilePath, error)
- func (bot Bots) GetCookies(domain string) (Cookie, error)
- func (bot Bots) GetCredentials(domain string) (Credentials, error)
- func (bot Bots) GetCsrfToken() (CsrfToken, error)
- func (bot Bots) GetForwardMsg(messageId int) ([]ForwardMsg, error)
- func (bot Bots) GetFriendList() ([]FriendList, error)
- func (bot Bots) GetGroupAtAllRemain(groupId int) (GroupAtAllRemain, error)
- func (bot Bots) GetGroupFileSystemInfo(groupId int) (GroupFileSystemInfo, error)
- func (bot Bots) GetGroupFileUrl(groupId int, fileId string, busid int) (fileUrl, error)
- func (bot Bots) GetGroupFilesByFolder(groupId int, folderId string) (GroupFilesByFolder, error)
- func (bot Bots) GetGroupHonorInfo(groupId int, honorType string) (GroupHonorInfo, error)
- func (bot Bots) GetGroupInfo(groupId int, noCache bool) (GroupInfo, error)
- func (bot Bots) GetGroupList() ([]GroupInfo, error)
- func (bot Bots) GetGroupMemberInfo(groupId int, UserId int, noCache bool) (GroupMemberInfo, error)
- func (bot Bots) GetGroupMemberList(groupId int) ([]GroupMemberInfo, error)
- func (bot Bots) GetGroupMsgHistory(messageSeq int64, groupId int) (MessageHistory, error)
- func (bot Bots) GetGroupRootFiles(groupId int) (GroupRootFiles, error)
- func (bot Bots) GetGroupSystemMsg() (GroupSystemMsg, error)
- func (bot Bots) GetImage(file string) (Image, error)
- func (bot Bots) GetLoginInfo() (LoginInfo, error)
- func (bot Bots) GetMsg(messageId int32) (GetMessage, error)
- func (bot Bots) GetMsgSpecial(messageId int) (MsgData, error)
- func (bot Bots) GetNextEvent(n, UserId int) Event
- func (bot Bots) GetOnlineClients(noCache bool) (Clients, error)
- func (bot Bots) GetRecord(file, outFormat string) (Record, error)
- func (bot Bots) GetStatus() (OnlineStatus, error)
- func (bot Bots) GetStrangerInfo() (Senders, error)
- func (bot Bots) GetVipInfoTest(UserId int) (VipInfo, error)
- func (bot Bots) GetWordSlices(content string) ([]string, error)
- func (bot Bots) OcrImage(image string) (OcrImage, error)
- func (bot Bots) ReloadEventFilter() error
- func (bot Bots) SendGroupForwardMsg(groupId int, messages []Node) error
- func (bot Bots) SendGroupMsg(groupId int, message string, autoEscape bool) (int32, error)
- func (bot Bots) SendGroupNotice(groupId int64, content string) error
- func (bot Bots) SendLike(userId int, times int) error
- func (bot Bots) SendMsg(messageType string, userId int, groupId int, message string, autoEscape bool) (int32, error)
- func (bot Bots) SendPrivateMsg(userId int, message string, autoEscape bool) (int32, error)
- func (bot Bots) SetFriendAddRequest(flag string, approve bool, remark string) error
- func (bot Bots) SetGroupAddRequest(flag string, subType string, approve bool, reason string) error
- func (bot Bots) SetGroupAdmin(groupId int, UserId int, enable bool) error
- func (bot Bots) SetGroupAnonymous(groupId int, enable bool) error
- func (bot Bots) SetGroupAnonymousBan(groupId int, flag string, duration int) error
- func (bot Bots) SetGroupBan(groupId int, userId int, duration int) error
- func (bot Bots) SetGroupCard(groupId int, userId int, card string) error
- func (bot Bots) SetGroupKick(groupId int, UserId int, rejectAddRequest bool) error
- func (bot Bots) SetGroupLeave(groupId int, isDisMiss bool) error
- func (bot Bots) SetGroupName(groupId int, groupName string) error
- func (bot Bots) SetGroupNameSpecial(groupId int, groupName string) error
- func (bot Bots) SetGroupPortrait(groupId int, file string, cache int) error
- func (bot Bots) SetGroupSpecialTitle(groupId int, userId int, specialTitle string, duration int) error
- func (bot Bots) SetGroupWholeBan(groupId int, enable bool) error
- func (bot Bots) SetRestart(delay int)
- func (bot Bots) UploadGroupFile(groupId int, file string, name string, folder string) error
- type Clients
- type CommandFun
- type ConstMessageType
- type ConstNoticeType
- type Content
- type Cookie
- type Credentials
- type CsrfToken
- type CurrentTalkativeS
- type Device
- type DownloadFilePath
- type Event
- type File
- type Files
- type Filter
- type FilterGroup
- type FilterNum
- 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 Message
- type MessageFun
- type MessageHistory
- type MessageIds
- type MsgData
- type Node
- type OcrImage
- type OnlineStatus
- type Record
- type Reflect
- type Rule
- type RuleCheck
- type RuleCheckIn
- type Senders
- type SpecialApi
- type TextDetection
- type ViewMessageApi
- type ViewOnC0CommandApi
- type ViewOnNoticeApi
- type VipInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //MessageSubTypeApi = ConstMessageSubType{ // Friend: "friend", // Group: "group", // Other: "other", // Normal: "normal", // Anonymous: "anonymous", // Notice: "notice"} 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"} MessageTypeApi = ConstMessageType{ Group: "group", Private: "private"} )
View Source
var ( LoginInfoJson responseLoginIndoJson StrangerInfo responseStrangerInfoJson FriendListJson responseFriendListJson GroupInfoJson responseGroupInfoJson GroupListJson responseGroupListJson GroupMemberInfoJson responseGroupMemberInfoJson GroupMemberListJson responseGroupMemberListJson GroupHonorInfoJson responseGroupHonorInfoJson CookiesJson responseCookiesJson )
View Source
var ( Fil = Filter{} ViewMessage []ViewMessageApi //ViewMessage为一个需要上报到各个Message事件的切片 ViewNotice []ViewOnNoticeApi //ViewNotice为一个需要上报到各个Notice事件的切片 ViewRequest []MessageFun //ViewRequest为一个需要上报到各个Request事件的切片 ViewMeta []MessageFun //ViewMeta为一个需要上报到各个Meta事件的切片 ViewOnCoCommand []ViewOnC0CommandApi //ViewOnCommand为一个需要上报到各个Command事件的切片 Info LoginInfo //Info为当前账号的信息 )
Functions ¶
Types ¶
type Api ¶
type Api interface { SendGroupMsg(groupId int, message string, autoEscape bool) (int32, error) SendPrivateMsg(userId int, message string, autoEscape bool) (int32, error) DeleteMsg(messageId int32) error GetMsg(messageId int32) (GetMessage, error) SetGroupBan(groupId int, userId int, duration int) error SetGroupCard(groupId int, userId int, card string) error SendMsg(messageType string, userId int, groupId int, message string, autoEscape bool) (int32, error) SendLike(userId int, times int) error SetGroupKick(groupId int, UserId int, rejectAddRequest bool) error SetGroupAnonymousBan(groupId int, flag string, duration int) error SetGroupWholeBan(groupId int, enable bool) error SetGroupAdmin(groupId int, UserId int, enable bool) error SetGroupAnonymous(groupId int, enable bool) error SetGroupName(groupId int, groupName string) error SetGroupLeave(groupId int, isDisMiss bool) error SetGroupSpecialTitle(groupId int, userId int, specialTitle string, duration int) error SetFriendAddRequest(flag string, approve bool, remark string) error SetGroupAddRequest(flag string, subType string, approve bool, reason string) error GetLoginInfo() (LoginInfo, error) GetStrangerInfo() (Senders, error) GetFriendList() ([]FriendList, error) GetGroupInfo(groupId int, noCache bool) (GroupInfo, error) GetGroupList() ([]GroupInfo, error) GetGroupMemberInfo(groupId int, UserId int, noCache bool) (GroupMemberInfo, error) GetGroupMemberList(groupId int) ([]GroupMemberInfo, error) GetGroupHonorInfo(groupId int, honorType string) (GroupHonorInfo, error) GetCookies(domain string) (Cookie, error) GetCsrfToken() (CsrfToken, error) GetCredentials(domain string) (Credentials, error) GetRecord(file, outFormat string) (Record, error) GetImage(file string) (Image, error) CanSendImage() (Bool, error) CanSendRecord() (Bool, error) GetStatus() (OnlineStatus, error) SetRestart(delay int) CleanCache() }
type Bots ¶
func (Bots) CanSendImage ¶
func (Bots) CanSendRecord ¶
func (Bots) CleanCache ¶
func (bot Bots) CleanCache()
func (Bots) DownloadFile ¶
func (Bots) GetCredentials ¶
func (bot Bots) GetCredentials(domain string) (Credentials, error)
func (Bots) GetCsrfToken ¶
func (Bots) GetForwardMsg ¶
func (bot Bots) GetForwardMsg(messageId int) ([]ForwardMsg, error)
func (Bots) GetFriendList ¶
func (bot Bots) GetFriendList() ([]FriendList, error)
func (Bots) GetGroupAtAllRemain ¶
func (bot Bots) GetGroupAtAllRemain(groupId int) (GroupAtAllRemain, error)
func (Bots) GetGroupFileSystemInfo ¶
func (bot Bots) GetGroupFileSystemInfo(groupId int) (GroupFileSystemInfo, error)
func (Bots) GetGroupFileUrl ¶
func (Bots) GetGroupFilesByFolder ¶
func (bot Bots) GetGroupFilesByFolder(groupId int, folderId string) (GroupFilesByFolder, error)
func (Bots) GetGroupHonorInfo ¶
func (bot Bots) GetGroupHonorInfo(groupId int, honorType string) (GroupHonorInfo, error)
func (Bots) GetGroupInfo ¶
func (Bots) GetGroupList ¶
func (Bots) GetGroupMemberInfo ¶
func (Bots) GetGroupMemberList ¶
func (bot Bots) GetGroupMemberList(groupId int) ([]GroupMemberInfo, error)
func (Bots) GetGroupMsgHistory ¶
func (bot Bots) GetGroupMsgHistory(messageSeq int64, groupId int) (MessageHistory, error)
func (Bots) GetGroupRootFiles ¶
func (bot Bots) GetGroupRootFiles(groupId int) (GroupRootFiles, error)
func (Bots) GetGroupSystemMsg ¶
func (bot Bots) GetGroupSystemMsg() (GroupSystemMsg, error)
func (Bots) GetLoginInfo ¶
func (Bots) GetNextEvent ¶
GetNextEvent方法 int n: 需要等待多少个事件之后放弃获取该事件 int UserId: 需要获取的信息对应的qq账号
return: Message类型的Event
func (Bots) GetStatus ¶
func (bot Bots) GetStatus() (OnlineStatus, error)
func (Bots) GetStrangerInfo ¶
func (Bots) ReloadEventFilter ¶
func (Bots) SendGroupForwardMsg ¶
func (Bots) SendGroupMsg ¶
func (Bots) SendPrivateMsg ¶
func (Bots) SetFriendAddRequest ¶
func (Bots) SetGroupAddRequest ¶
func (Bots) SetGroupAdmin ¶
func (Bots) SetGroupAnonymousBan ¶
func (Bots) SetGroupKick ¶
func (Bots) SetGroupNameSpecial ¶
func (Bots) SetGroupPortrait ¶
func (Bots) SetGroupSpecialTitle ¶
func (Bots) SetRestart ¶
type CommandFun ¶
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 DownloadFilePath ¶
type DownloadFilePath struct {
File string `json:"file"`
}
type Event ¶
type Event struct { Anonymous anonymous `json:"anonymous"` Font string `json:"font"` GroupId int `json:"group_id"` Message string `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 string `json:"status"` Interval string `json:"interval"` CardNew string `json:"card_new"` //新名片 CardOld string `json:"card_old"` //旧名片 MessageIds }
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 Filter ¶
type Filter struct { Group FilterGroup `json:"group"` Private []FilterNum `json:"private"` }
func LoadFilter ¶
type FilterGroup ¶
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, error) GetGroupMsgHistory(messageSeq int64, groupId int) (MessageHistory, error) GetOnlineClients(noCache bool) (Clients, error) GetVipInfoTest(UserId int) (VipInfo, error) SendGroupNotice(groupId int64, content string) error ReloadEventFilter() error UploadGroupFile(groupId int, file string, name string, folder string) error }
go-cqhttp新增api
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 MessageFun ¶
type MessageFun func(event Event)
type MessageHistory ¶
type MessageHistory struct {
Messages []string `json:"messages"`
}
type MessageIds ¶
type MessageIds struct {
MessageId int32 `json:"message_id"`
}
type OcrImage ¶
type OcrImage struct { Texts []TextDetection `json:"texts"` Language string `json:"language"` }
type OnlineStatus ¶
type Rule ¶
type Rule struct {
// contains filtered or unexported fields
}
Rule结构体两个成员分别为RuleCheck类型的函数和需要传递的参数
type RuleCheck ¶
type RuleCheck struct { }
type RuleCheckIn ¶
type RuleCheckIn interface { OnlyToMe(event Event) bool StartWith(event Event, s string) bool EndWith(event Event, s string) bool }
RuleCheckIn为RuleCheck结构体的实现
type SpecialApi ¶
type SpecialApi interface { SetGroupNameSpecial(groupId int, groupName string) error SetGroupPortrait(groupId int, file string, cache int) error GetMsgSpecial(messageId int) (MsgData, error) GetForwardMsg(messageId int) ([]ForwardMsg, error) SendGroupForwardMsg(groupId int, messages []Node) error GetWordSlices(content string) ([]string, error) OcrImage(image string) (OcrImage, error) GetGroupSystemMsg() (GroupSystemMsg, error) GetGroupFileSystemInfo(groupId int) (GroupFileSystemInfo, error) GetGroupRootFiles(groupId int) (GroupRootFiles, error) GetGroupFilesByFolder(groupId int, folderId string) (GroupFilesByFolder, error) GetGroupFileUrl(groupId int, fileId string, busid int) (fileUrl, error) GetGroupAtAllRemain(groupId int) (GroupAtAllRemain, error) }
type TextDetection ¶
type ViewMessageApi ¶
type ViewMessageApi struct { OnMessage MessageFun MessageType string SubType string }
ViewMessageApi结构体为一个Message消息上报位置,包含了具体的方法和需要传递的Message的MessageType和SubType
type ViewOnC0CommandApi ¶
type ViewOnC0CommandApi struct { CoCommand CommandFun Command string Allies string RuleChecked []Rule }
ViewOnCommandApi结构体为一个Command上报位置,包含了具体的方法和该命令的具体命令以及别名,RuleChecked为一个Rule切片,
type ViewOnNoticeApi ¶
type ViewOnNoticeApi struct { OnNotice MessageFun NoticeType string SubType string }
ViewOnNoticeApi结构体为一个Notice上报位置,包含了具体的方法和需要传递的Notice的NoticeType和SubType
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"` //会员成长总值 }
Click to show internal directories.
Click to hide internal directories.