Documentation ¶
Index ¶
- Constants
- type AuthRequest
- type AuthResponse
- type BindRequest
- type BindResponse
- type Bot
- func (b *Bot) AddFriendMessageHandler(info EventHandler)
- func (b *Bot) AddGroupMessageHandler(info EventHandler)
- func (b *Bot) AddPrefixHandler(name string, info EventHandler)
- func (b *Bot) AddSuffixHandler(name string, info EventHandler)
- func (b *Bot) Auth() error
- func (b *Bot) Bind() error
- func (b *Bot) CountMessage() (int64, error)
- func (b *Bot) FetchMessage() (MessageList, error)
- func (b *Bot) Release() error
- func (b *Bot) Run()
- func (b *Bot) RunOnce() error
- func (b *Bot) SendFriendMessage(quote, target int64, list MessageDataList) error
- func (b *Bot) SendGroupMessage(quote, target int64, list MessageDataList) error
- type CountMessageResponse
- type EventHandler
- type FetchLatestMessageResponse
- type FetchMessageResponse
- type Message
- type MessageData
- type MessageDataList
- type MessageList
- type MessageSender
- type MessageSenderGroup
- type PeekLatestMessageResponse
- type PeekMessageResponse
- type ReleaseRequest
- type ReleaseResponse
- type SendFriendMessageRequest
- type SendFriendMessageResponse
- type SendGroupMessageRequest
- type SendGroupMessageResponse
Constants ¶
View Source
const ( TypeTempMessage = "TempMessage" TypeGroupMessage = "GroupMessage" TypeFriendMessage = "FriendMessage" TypeStrangerMessage = "StrangerMessage" TypeOtherClientMessage = "OtherClientMessage" )
消息来源类型
View Source
const ( TypeAt = "At" TypeApp = "App" TypeXml = "Xml" TypeJson = "Json" TypeFace = "Face" TypePoke = "Poke" TypeText = "Plain" TypeImage = "Image" TypeVoice = "Voice" TypeSource = "Source" TypeMiraiCode = "MiraiCode" TypeFlashImage = "FlashImage" )
消息内容类型
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthRequest ¶
type AuthRequest struct {
Secret string `json:"verifyKey"`
}
type AuthResponse ¶
type BindRequest ¶
type BindResponse ¶
type Bot ¶
type Bot struct { URL string Secret string Number int64 Interval time.Duration SessionToken string PrefixesHandler map[string][]EventHandler SuffixesHandler map[string][]EventHandler GroupMessageHandler []EventHandler FriendMessageHandler []EventHandler }
func (*Bot) AddFriendMessageHandler ¶
func (b *Bot) AddFriendMessageHandler(info EventHandler)
func (*Bot) AddGroupMessageHandler ¶
func (b *Bot) AddGroupMessageHandler(info EventHandler)
func (*Bot) AddPrefixHandler ¶
func (b *Bot) AddPrefixHandler(name string, info EventHandler)
func (*Bot) AddSuffixHandler ¶
func (b *Bot) AddSuffixHandler(name string, info EventHandler)
func (*Bot) CountMessage ¶
func (*Bot) FetchMessage ¶
func (b *Bot) FetchMessage() (MessageList, error)
func (*Bot) SendFriendMessage ¶
func (b *Bot) SendFriendMessage(quote, target int64, list MessageDataList) error
func (*Bot) SendGroupMessage ¶
func (b *Bot) SendGroupMessage(quote, target int64, list MessageDataList) error
type CountMessageResponse ¶
type EventHandler ¶
type FetchLatestMessageResponse ¶
type FetchLatestMessageResponse FetchMessageResponse
type FetchMessageResponse ¶
type FetchMessageResponse struct { Code int64 `json:"code,omitempty"` Data MessageList `json:"data,omitempty"` Message string `json:"msg,omitempty"` }
type Message ¶
type Message struct { Type string `json:"type,omitempty"` List MessageDataList `json:"messageChain,omitempty"` Sender MessageSender `json:"sender,omitempty"` }
func (*Message) QuoteResponse ¶
func (m *Message) QuoteResponse(b *Bot, list MessageDataList) error
type MessageData ¶
type MessageData struct { Type string `json:"type,omitempty"` // 来源(Source) SourceID int64 `json:"id,omitempty"` SourceTime int64 `json:"time,omitempty"` // 引用(Quote) QuoteGroupID int64 `json:"groupId,omitempty"` QuoteSenderID int64 `json:"senderId,omitempty"` QuoteTargetID int64 `json:"targetId,omitempty"` QuoteOriginMessage []*MessageData `json:"origin,omitempty"` // 艾特(At) AtTarget int64 `json:"target,omitempty"` AtString string `json:"display,omitempty"` // 表情(Face) FaceID int64 `json:"faceId,omitempty"` // 表情(Face) / 戳一戳(Poke) Name string `json:"name,omitempty"` // 文本(Plain) Text string `json:"text,omitempty"` // 图片(Image) / 闪照(FlashImage) ImageID string `json:"imageId,omitempty"` // 语音(Voice) VoiceID string `json:"voiceId,omitempty"` // 图片(Image) / 闪照(FlashImage) / 语音(Voice) URL string `json:"url,omitempty"` Path string `json:"path,omitempty"` Base64 string `json:"base64,omitempty"` // XML(Xml) XML string `json:"xml,omitempty"` // JSON(Json) Json string `json:"json,omitempty"` // APP(App) AppContent string `json:"content,omitempty"` // Mirai Code Code string `json:"code,omitempty"` }
func (*MessageData) ToString ¶
func (m *MessageData) ToString() string
type MessageDataList ¶
type MessageDataList []*MessageData
func (*MessageDataList) ToString ¶
func (m *MessageDataList) ToString() string
type MessageList ¶
type MessageList []*Message
type MessageSender ¶
type MessageSender struct { ID int64 `json:"id,omitempty"` // FriendMessage & StrangerMessage FriendRemark string `json:"remark,omitempty"` FriendNickName string `json:"nickname,omitempty"` // GroupMessage & TempMessage GroupMemberName string `json:"memberName,omitempty"` GroupSpecialName string `json:"specialTitle,omitempty"` GroupPermission string `json:"permission,omitempty"` GroupJoinAt int64 `json:"joinTimestamp,omitempty"` GroupLastSpeakAt int64 `json:"lastSpeakTimestamp,omitempty"` GroupMuteTimeLeft int64 `json:"muteTimeRemaining,omitempty"` Group MessageSenderGroup `json:"group,omitempty"` // OtherClientMessage OtherPlatform string `json:"platform,omitempty"` }
type MessageSenderGroup ¶
type PeekLatestMessageResponse ¶
type PeekLatestMessageResponse FetchMessageResponse
type PeekMessageResponse ¶
type PeekMessageResponse FetchMessageResponse
type ReleaseRequest ¶
type ReleaseRequest BindRequest
type ReleaseResponse ¶
type ReleaseResponse BindResponse
type SendFriendMessageRequest ¶
type SendFriendMessageRequest SendGroupMessageRequest
type SendFriendMessageResponse ¶
type SendFriendMessageResponse SendGroupMessageResponse
type SendGroupMessageRequest ¶
type SendGroupMessageRequest struct { List MessageDataList `json:"messageChain,omitempty"` Quote int64 `json:"quote,omitempty"` Target int64 `json:"target,omitempty"` }
Click to show internal directories.
Click to hide internal directories.