Documentation ¶
Index ¶
- Constants
- func ConnectUniversal(cli *client.QQClient)
- func EmptyText() *message.TextElement
- func ForwrdSendMsg(cli *client.QQClient, f *onebot.Frame)
- func GetCSRFToken(c *client.QQClient) int
- func GetCookiesWithDomain(c *client.QQClient, domain string) string
- func HandleDeletMsg(cli *client.QQClient, req *onebot.DeleteMsgReq) *onebot.DeleteMsgResp
- func HandleEventFrame(cli *client.QQClient, eventFrame *onebot.Frame)
- func HandleGetCSRFToken(cli *client.QQClient, req *onebot.GetCsrfTokenReq) *onebot.GetCsrfTokenResp
- func HandleGetCookies(cli *client.QQClient, req *onebot.GetCookiesReq) *onebot.GetCookiesResp
- func HandleGetFriendList(cli *client.QQClient, req *onebot.GetFriendListReq) *onebot.GetFriendListResp
- func HandleGetGroupInfo(cli *client.QQClient, req *onebot.GetGroupInfoReq) *onebot.GetGroupInfoResp
- func HandleGetGroupList(cli *client.QQClient, req *onebot.GetGroupListReq) *onebot.GetGroupListResp
- func HandleGetGroupMemberInfo(cli *client.QQClient, req *onebot.GetGroupMemberInfoReq) *onebot.GetGroupMemberInfoResp
- func HandleGetGroupMemberList(cli *client.QQClient, req *onebot.GetGroupMemberListReq) *onebot.GetGroupMemberListResp
- func HandleGetLoginInfo(cli *client.QQClient, req *onebot.GetLoginInfoReq) *onebot.GetLoginInfoResp
- func HandleGetMsg(cli *client.QQClient, req *onebot.GetMsgReq) *onebot.GetMsgResp
- func HandleImageOcr(cli *client.QQClient)
- func HandleSendForwardMsg(cli *client.QQClient, req *onebot.SendForwardMsgReq) *onebot.SendForwardMsgResp
- func HandleSendFriendPoke(cli *client.QQClient, req *onebot.SendFriendPokeReq) *onebot.SendFriendPokeResp
- func HandleSendGroupMsg(cli *client.QQClient, req *onebot.SendGroupMsgReq) *onebot.SendGroupMsgResp
- func HandleSendGroupPoke(cli *client.QQClient, req *onebot.SendGroupPokeReq) *onebot.SendGroupPokeResp
- func HandleSendMsg(cli *client.QQClient, req *onebot.SendMsgReq) *onebot.SendMsgResp
- func HandleSendPrivateMsg(cli *client.QQClient, req *onebot.SendPrivateMsgReq) *onebot.SendPrivateMsgResp
- func HandleSetFriendAddRequest(cli *client.QQClient, req *onebot.SetFriendAddRequestReq) *onebot.SetFriendAddRequestResp
- func HandleSetGroupAddRequest(cli *client.QQClient, req *onebot.SetGroupAddRequestReq) *onebot.SetGroupAddRequestResp
- func HandleSetGroupBan(cli *client.QQClient, req *onebot.SetGroupBanReq) *onebot.SetGroupBanResp
- func HandleSetGroupCard(cli *client.QQClient, req *onebot.SetGroupCardReq) *onebot.SetGroupCardResp
- func HandleSetGroupKick(cli *client.QQClient, req *onebot.SetGroupKickReq) *onebot.SetGroupKickResp
- func HandleSetGroupLeave(cli *client.QQClient, req *onebot.SetGroupLeaveReq) *onebot.SetGroupLeaveResp
- func HandleSetGroupName(cli *client.QQClient, req *onebot.SetGroupNameReq) *onebot.SetGroupNameResp
- func HandleSetGroupSpecialTitle(cli *client.QQClient, req *onebot.SetGroupSpecialTitleReq) *onebot.SetGroupSpecialTitleResp
- func HandleSetGroupWholeBan(cli *client.QQClient, req *onebot.SetGroupWholeBanReq) *onebot.SetGroupWholeBanResp
- func IsClientExist(uin int64) bool
- func MiraiAtToProtoAt(elem *message.AtElement) *onebot.Message
- func MiraiFaceToProtoFace(elem *message.FaceElement) *onebot.Message
- func MiraiForwardToProtoForward(cli *client.QQClient, elem *message.ForwardMessage) *onebot.Message
- func MiraiForwardToRawForward(cli *client.QQClient, elem *message.ForwardMessage) string
- func MiraiImageToProtoImage(elem *message.ImageElement) *onebot.Message
- func MiraiMsgToProtoMsg(cli *client.QQClient, messageChain []message.IMessageElement) []*onebot.Message
- func MiraiMsgToRawMsg(cli *client.QQClient, messageChain []message.IMessageElement) string
- func MiraiReplyToProtoReply(cli *client.QQClient, elem *message.ReplyElement) *onebot.Message
- func MiraiTextToProtoText(elem *message.TextElement) *onebot.Message
- func MiraiVideoToProtoVideo(cli *client.QQClient, elem *message.ShortVideoElement) *onebot.Message
- func MiraiVoiceToProtoVoice(elem *message.VoiceElement) *onebot.Message
- func OnWsRecvMessage(cli *client.QQClient, plugin *config.Plugin) func(ws *safe_ws.SafeWebSocket, messageType int, data []byte)
- func ProtoAtToMiraiAt(data map[string]string) message.IMessageElement
- func ProtoFaceToMiraiFace(data map[string]string) message.IMessageElement
- func ProtoForwardToMiraiForward(data map[string]string) *message.ForwardMessage
- func ProtoImageToMiraiImage(data map[string]string) message.IMessageElement
- func ProtoMsgToMiraiMsg(cli *client.QQClient, msgList []*onebot.Message, notConvertText bool) []message.IMessageElement
- func ProtoReplyToMiraiReply(data map[string]string) *message.ReplyElement
- func ProtoSleep(data map[string]string)
- func ProtoTextToMiraiText(data map[string]string) message.IMessageElement
- func ProtoVideoToMiraiVideo(data map[string]string) *clz.LocalVideo
- func ProtoVoiceToMiraiVoice(data map[string]string) message.IMessageElement
- func RawMsgToMiraiMsg(cli *client.QQClient, str string) []message.IMessageElement
- func ReleaseClient(cli *client.QQClient)
- func UpgradeWebsocket(cli *client.QQClient, w http.ResponseWriter, r *http.Request) error
- type ClientMap
- func (m *ClientMap) Delete(key int64)
- func (m *ClientMap) Load(key int64) (value *client.QQClient, ok bool)
- func (m *ClientMap) LoadAndDelete(key int64) (value *client.QQClient, loaded bool)
- func (m *ClientMap) LoadOrStore(key int64, value *client.QQClient) (actual *client.QQClient, loaded bool)
- func (m *ClientMap) Range(f func(key int64, value *client.QQClient) bool)
- func (m *ClientMap) Store(key int64, value *client.QQClient)
- type ForwardChildNode
- type ForwardNode
- type ForwardServer
- type GMCLogin
- type LifeTime
- type Logger
- type Node
- type RemoteMap
- func (m *RemoteMap) Delete(key int64)
- func (m *RemoteMap) Load(key int64) (value map[string]*WsServer, ok bool)
- func (m *RemoteMap) LoadAndDelete(key int64) (value map[string]*WsServer, loaded bool)
- func (m *RemoteMap) LoadOrStore(key int64, value map[string]*WsServer) (actual map[string]*WsServer, loaded bool)
- func (m *RemoteMap) Range(f func(key int64, value map[string]*WsServer) bool)
- func (m *RemoteMap) Store(key int64, value map[string]*WsServer)
- type RequestCallback
- type RequestSignData
- type RequestSignResult
- type SafeForwards
- type SignRegister
- type TokenMap
- func (m *TokenMap) Delete(key int64)
- func (m *TokenMap) Load(key int64) (value []byte, ok bool)
- func (m *TokenMap) LoadAndDelete(key int64) (value []byte, loaded bool)
- func (m *TokenMap) LoadOrStore(key int64, value []byte) (actual []byte, loaded bool)
- func (m *TokenMap) Range(f func(key int64, value []byte) bool)
- func (m *TokenMap) Store(key int64, value []byte)
- type WsServer
Constants ¶
const MAX_TEXT_LENGTH = 80
Variables ¶
This section is empty.
Functions ¶
func ConnectUniversal ¶
func EmptyText ¶
func EmptyText() *message.TextElement
func GetCSRFToken ¶
func HandleDeletMsg ¶
func HandleDeletMsg(cli *client.QQClient, req *onebot.DeleteMsgReq) *onebot.DeleteMsgResp
func HandleGetCSRFToken ¶
func HandleGetCSRFToken(cli *client.QQClient, req *onebot.GetCsrfTokenReq) *onebot.GetCsrfTokenResp
func HandleGetCookies ¶
func HandleGetCookies(cli *client.QQClient, req *onebot.GetCookiesReq) *onebot.GetCookiesResp
func HandleGetFriendList ¶
func HandleGetFriendList(cli *client.QQClient, req *onebot.GetFriendListReq) *onebot.GetFriendListResp
func HandleGetGroupInfo ¶
func HandleGetGroupInfo(cli *client.QQClient, req *onebot.GetGroupInfoReq) *onebot.GetGroupInfoResp
func HandleGetGroupList ¶
func HandleGetGroupList(cli *client.QQClient, req *onebot.GetGroupListReq) *onebot.GetGroupListResp
func HandleGetGroupMemberInfo ¶
func HandleGetGroupMemberInfo(cli *client.QQClient, req *onebot.GetGroupMemberInfoReq) *onebot.GetGroupMemberInfoResp
func HandleGetGroupMemberList ¶
func HandleGetGroupMemberList(cli *client.QQClient, req *onebot.GetGroupMemberListReq) *onebot.GetGroupMemberListResp
func HandleGetLoginInfo ¶
func HandleGetLoginInfo(cli *client.QQClient, req *onebot.GetLoginInfoReq) *onebot.GetLoginInfoResp
func HandleGetMsg ¶
func HandleImageOcr ¶
func HandleSendForwardMsg ¶
func HandleSendForwardMsg(cli *client.QQClient, req *onebot.SendForwardMsgReq) *onebot.SendForwardMsgResp
func HandleSendFriendPoke ¶
func HandleSendFriendPoke(cli *client.QQClient, req *onebot.SendFriendPokeReq) *onebot.SendFriendPokeResp
func HandleSendGroupMsg ¶
func HandleSendGroupMsg(cli *client.QQClient, req *onebot.SendGroupMsgReq) *onebot.SendGroupMsgResp
func HandleSendGroupPoke ¶
func HandleSendGroupPoke(cli *client.QQClient, req *onebot.SendGroupPokeReq) *onebot.SendGroupPokeResp
func HandleSendMsg ¶
func HandleSendMsg(cli *client.QQClient, req *onebot.SendMsgReq) *onebot.SendMsgResp
func HandleSendPrivateMsg ¶
func HandleSendPrivateMsg(cli *client.QQClient, req *onebot.SendPrivateMsgReq) *onebot.SendPrivateMsgResp
func HandleSetFriendAddRequest ¶
func HandleSetFriendAddRequest(cli *client.QQClient, req *onebot.SetFriendAddRequestReq) *onebot.SetFriendAddRequestResp
func HandleSetGroupAddRequest ¶
func HandleSetGroupAddRequest(cli *client.QQClient, req *onebot.SetGroupAddRequestReq) *onebot.SetGroupAddRequestResp
accept bool, sequence uint64, typ uint32, groupUin uint32, message string
func HandleSetGroupBan ¶
func HandleSetGroupBan(cli *client.QQClient, req *onebot.SetGroupBanReq) *onebot.SetGroupBanResp
func HandleSetGroupCard ¶
func HandleSetGroupCard(cli *client.QQClient, req *onebot.SetGroupCardReq) *onebot.SetGroupCardResp
func HandleSetGroupKick ¶
func HandleSetGroupKick(cli *client.QQClient, req *onebot.SetGroupKickReq) *onebot.SetGroupKickResp
func HandleSetGroupLeave ¶
func HandleSetGroupLeave(cli *client.QQClient, req *onebot.SetGroupLeaveReq) *onebot.SetGroupLeaveResp
func HandleSetGroupName ¶
func HandleSetGroupName(cli *client.QQClient, req *onebot.SetGroupNameReq) *onebot.SetGroupNameResp
func HandleSetGroupSpecialTitle ¶
func HandleSetGroupSpecialTitle(cli *client.QQClient, req *onebot.SetGroupSpecialTitleReq) *onebot.SetGroupSpecialTitleResp
func HandleSetGroupWholeBan ¶
func HandleSetGroupWholeBan(cli *client.QQClient, req *onebot.SetGroupWholeBanReq) *onebot.SetGroupWholeBanResp
func IsClientExist ¶
func MiraiFaceToProtoFace ¶
func MiraiFaceToProtoFace(elem *message.FaceElement) *onebot.Message
func MiraiForwardToRawForward ¶
func MiraiForwardToRawForward(cli *client.QQClient, elem *message.ForwardMessage) string
func MiraiImageToProtoImage ¶
func MiraiImageToProtoImage(elem *message.ImageElement) *onebot.Message
func MiraiMsgToProtoMsg ¶
func MiraiMsgToRawMsg ¶
func MiraiMsgToRawMsg(cli *client.QQClient, messageChain []message.IMessageElement) string
func MiraiReplyToProtoReply ¶
func MiraiTextToProtoText ¶
func MiraiTextToProtoText(elem *message.TextElement) *onebot.Message
func MiraiVideoToProtoVideo ¶
func MiraiVoiceToProtoVoice ¶
func MiraiVoiceToProtoVoice(elem *message.VoiceElement) *onebot.Message
func OnWsRecvMessage ¶
func ProtoAtToMiraiAt ¶
func ProtoAtToMiraiAt(data map[string]string) message.IMessageElement
func ProtoFaceToMiraiFace ¶
func ProtoFaceToMiraiFace(data map[string]string) message.IMessageElement
func ProtoForwardToMiraiForward ¶
func ProtoForwardToMiraiForward(data map[string]string) *message.ForwardMessage
func ProtoImageToMiraiImage ¶
func ProtoImageToMiraiImage(data map[string]string) message.IMessageElement
func ProtoMsgToMiraiMsg ¶
func ProtoMsgToMiraiMsg(cli *client.QQClient, msgList []*onebot.Message, notConvertText bool) []message.IMessageElement
消息列表,不自动把code变成msg
func ProtoReplyToMiraiReply ¶
func ProtoReplyToMiraiReply(data map[string]string) *message.ReplyElement
func ProtoSleep ¶
func ProtoTextToMiraiText ¶
func ProtoTextToMiraiText(data map[string]string) message.IMessageElement
func ProtoVideoToMiraiVideo ¶
func ProtoVideoToMiraiVideo(data map[string]string) *clz.LocalVideo
func ProtoVoiceToMiraiVoice ¶
func ProtoVoiceToMiraiVoice(data map[string]string) message.IMessageElement
func RawMsgToMiraiMsg ¶
func RawMsgToMiraiMsg(cli *client.QQClient, str string) []message.IMessageElement
func ReleaseClient ¶
func UpgradeWebsocket ¶
Types ¶
type ClientMap ¶
type ClientMap struct {
// contains filtered or unexported fields
}
Map is like a Go map[interface{}]interface{} but is safe for concurrent use by multiple goroutines without additional locking or coordination. Loads, stores, and deletes run in amortized constant time.
The Map type is specialized. Most code should use a plain Go map instead, with separate locking or coordination, for better type safety and to make it easier to maintain other invariants along with the map content.
The Map type is optimized for two common use cases: (1) when the entry for a given key is only ever written once but read many times, as in caches that only grow, or (2) when multiple goroutines read, write, and overwrite entries for disjoint sets of keys. In these two cases, use of a Map may significantly reduce lock contention compared to a Go map paired with a separate Mutex or RWMutex.
The zero Map is empty and ready for use. A Map must not be copied after first use.
var (
Clients ClientMap
)
func (*ClientMap) Load ¶
Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.
func (*ClientMap) LoadAndDelete ¶
LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present.
func (*ClientMap) LoadOrStore ¶
func (m *ClientMap) LoadOrStore(key int64, value *client.QQClient) (actual *client.QQClient, loaded bool)
LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored.
func (*ClientMap) Range ¶
Range calls f sequentially for each key and value present in the map. If f returns false, range stops the iteration.
Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.
Range may be O(N) with the number of elements in the map even if f returns false after a constant number of calls.
type ForwardChildNode ¶
type ForwardNode ¶
type ForwardNode struct { Type string `json:"type,omitempty"` Data *ForwardChildNode `json:"data,omitempty"` }
type ForwardServer ¶
type ForwardServer struct { Url string Session *safe_ws.ForwardSafeWebSocket Mu sync.Mutex WaitingFrames map[string]*promise.Promise }
func ForwradConnect ¶
type RemoteMap ¶
type RemoteMap struct {
// contains filtered or unexported fields
}
Map is like a Go map[interface{}]interface{} but is safe for concurrent use by multiple goroutines without additional locking or coordination. Loads, stores, and deletes run in amortized constant time.
The Map type is specialized. Most code should use a plain Go map instead, with separate locking or coordination, for better type safety and to make it easier to maintain other invariants along with the map content.
The Map type is optimized for two common use cases: (1) when the entry for a given key is only ever written once but read many times, as in caches that only grow, or (2) when multiple goroutines read, write, and overwrite entries for disjoint sets of keys. In these two cases, use of a Map may significantly reduce lock contention compared to a Go map paired with a separate Mutex or RWMutex.
The zero Map is empty and ready for use. A Map must not be copied after first use.
var ( // RemoteServers key是botId,value是map(key是serverName,value是server) RemoteServers RemoteMap SafeForwardMap = NewForwards() )
func (*RemoteMap) Load ¶
Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.
func (*RemoteMap) LoadAndDelete ¶
LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present.
func (*RemoteMap) LoadOrStore ¶
func (m *RemoteMap) LoadOrStore(key int64, value map[string]*WsServer) (actual map[string]*WsServer, loaded bool)
LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored.
func (*RemoteMap) Range ¶
Range calls f sequentially for each key and value present in the map. If f returns false, range stops the iteration.
Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.
Range may be O(N) with the number of elements in the map even if f returns false after a constant number of calls.
type RequestCallback ¶
type RequestSignData ¶
type RequestSignData struct { Token string `json:"token,omitempty"` Extra string `json:"extra,omitempty"` Sign string `json:"sign,omitempty"` O3dId string `json:"o3did,omitempty"` RequestCallback []*RequestCallback }
type RequestSignResult ¶
type RequestSignResult struct { Code int `json:"code,omitempty"` Msg string `json:"msg,omitempty"` Data *RequestSignData }
type SafeForwards ¶
type SafeForwards struct { Map map[string]*ForwardServer RW *sync.RWMutex }
func NewForwards ¶
func NewForwards() *SafeForwards
func (*SafeForwards) DeleteForward ¶
func (f *SafeForwards) DeleteForward(key string)
func (*SafeForwards) GetForward ¶
func (f *SafeForwards) GetForward(key string) *ForwardServer
func (*SafeForwards) SetForward ¶
func (f *SafeForwards) SetForward(key string, value *ForwardServer)
type SignRegister ¶
type TokenMap ¶
type TokenMap struct {
// contains filtered or unexported fields
}
Map is like a Go map[interface{}]interface{} but is safe for concurrent use by multiple goroutines without additional locking or coordination. Loads, stores, and deletes run in amortized constant time.
The Map type is specialized. Most code should use a plain Go map instead, with separate locking or coordination, for better type safety and to make it easier to maintain other invariants along with the map content.
The Map type is optimized for two common use cases: (1) when the entry for a given key is only ever written once but read many times, as in caches that only grow, or (2) when multiple goroutines read, write, and overwrite entries for disjoint sets of keys. In these two cases, use of a Map may significantly reduce lock contention compared to a Go map paired with a separate Mutex or RWMutex.
The zero Map is empty and ready for use. A Map must not be copied after first use.
func (*TokenMap) Load ¶
Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.
func (*TokenMap) LoadAndDelete ¶
LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present.
func (*TokenMap) LoadOrStore ¶
LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored.
func (*TokenMap) Range ¶
Range calls f sequentially for each key and value present in the map. If f returns false, range stops the iteration.
Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.
Range may be O(N) with the number of elements in the map even if f returns false after a constant number of calls.