Documentation
¶
Index ¶
- type Anonymous
- type AtSegment
- type Client
- func (c *Client) DeleteMessage(id int32) error
- func (c *Client) DownloadMedia(seg ISegment) (string, []byte, error)
- func (c *Client) GetFriendList() ([]*UserInfo, error)
- func (c *Client) GetGroupInfo(id string) (*GroupInfo, error)
- func (c *Client) GetGroupList() ([]*GroupInfo, error)
- func (c *Client) GetGroupMemberInfo(gid string, uid string) (*MemberInfo, error)
- func (c *Client) GetGroupMemberList(id string) ([]*MemberInfo, error)
- func (c *Client) GetLoginInfo() (*UserInfo, error)
- func (c *Client) GetToken() string
- func (c *Client) GetUserInfo(id string) (*UserInfo, error)
- func (c *Client) IsLoggedIn() bool
- func (c *Client) Release()
- func (c *Client) SendGroupMessage(groupID int64, segments []ISegment) (*SendMessageResponse, error)
- func (c *Client) SendPrivateMessage(userID int64, segments []ISegment) (*SendMessageResponse, error)
- func (c *Client) SetEventHandler(handler func(IEvent))
- func (c *Client) StartLoop(conn *websocket.Conn)
- type ContactSegment
- type Event
- type EventType
- type FaceSegment
- type FileInfo
- type FileSegment
- type ForwardSegment
- type FriendRecall
- type GroupInfo
- type GroupRecall
- type Heartbeat
- type IEvent
- type ISegment
- type ImageSegment
- type JSONSegment
- type Lifecycle
- type LightAPPSegment
- type LocationSegment
- type MarketFaceSegment
- type MemberInfo
- type Message
- type MusicSegment
- type NodeSegment
- type Payload
- type PayloadType
- type RecordSegment
- type ReplySegment
- type Request
- func NewDeleteMsgRequest(messageID int32) *Request
- func NewGetFileRequest(fileID string) *Request
- func NewGetForwardMsgRequest(msgID string) *Request
- func NewGetFriendListRequest() *Request
- func NewGetGroupInfoRequest(groupID int64) *Request
- func NewGetGroupListRequest() *Request
- func NewGetGroupMemberInfoRequest(groupID, userID int64) *Request
- func NewGetGroupMemberListRequest(groupID int64) *Request
- func NewGetImageRequest(fileID string) *Request
- func NewGetLoginInfoRequest() *Request
- func NewGetRecordRequest(fileID string) *Request
- func NewGetUserInfoRequest(userID int64) *Request
- func NewGroupMsgRequest(groupID int64, segments []ISegment) *Request
- func NewPrivateMsgRequest(userID int64, segments []ISegment) *Request
- type RequestType
- type Response
- type Segment
- type SegmentType
- type SendMessageResponse
- type Sender
- type Service
- type ShareSegment
- type Status
- type TextSegment
- type UserInfo
- type VideoSegment
- type XMLSegment
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) DeleteMessage ¶
func (*Client) GetFriendList ¶
func (*Client) GetGroupList ¶
func (*Client) GetGroupMemberInfo ¶
func (c *Client) GetGroupMemberInfo(gid string, uid string) (*MemberInfo, error)
func (*Client) GetGroupMemberList ¶
func (c *Client) GetGroupMemberList(id string) ([]*MemberInfo, error)
func (*Client) GetLoginInfo ¶
func (*Client) IsLoggedIn ¶
func (*Client) SendGroupMessage ¶
func (c *Client) SendGroupMessage(groupID int64, segments []ISegment) (*SendMessageResponse, error)
func (*Client) SendPrivateMessage ¶
func (c *Client) SendPrivateMessage(userID int64, segments []ISegment) (*SendMessageResponse, error)
func (*Client) SetEventHandler ¶
type ContactSegment ¶
type ContactSegment struct {
Segment `mapstructure:",squash"`
}
type Event ¶
type Event struct {
Time int64 `json:"time" mapstructure:"time"`
SelfID int64 `json:"self_id" mapstructure:"self_id"`
PostType string `json:"post_type" mapstructure:"post_type"`
}
func (*Event) PayloadType ¶
func (e *Event) PayloadType() PayloadType
type EventType ¶
type EventType string
const ( MessagePrivate EventType = "message_private" MessageGroup EventType = "message_group" MetaLifecycle EventType = "meta_lifecycle" MetaHeartbeat EventType = "meta_heartbeat" NoticeOfflineFile EventType = "notice_offline_file" NoticeGroupUpload EventType = "notice_group_upload" NoticeGroupAdminSet EventType = "notice_group_admin_set" NoticeGroupAdminUnset EventType = "notice_group_admin_unset" NoticeGroupDecreaseleave EventType = "notice_group_decrease_leave" NoticeGroupDecreaseKick EventType = "notice_group_decrease_kick" NoticeGroupDecreaseKickMe EventType = "notice_group_decrease_kick_me" NoticeGroupIncreaseApprove EventType = "notice_group_increase_approve" NoticeGroupIncreaseInvite EventType = "notice_group_increase_invite" NoticeGroupBanBan EventType = "notice_group_ban_ban" NoticeGroupBanLiftBan EventType = "notice_group_ban_lift_ban" NoticeFriendAdd EventType = "notice_friend_add" NoticeGroupRecall EventType = "notice_group_recall" NoticeFriendRecall EventType = "notice_friend_recall" NoticeNotifyPoke EventType = "notice_notify_poke" NoticeNotifyLuckyKing EventType = "notice_notify_lucky_king" NoticeNotifyHonnor EventType = "notice_notify_honnor" RequestFriend EventType = "request_friend" RequestGroupAdd EventType = "request_group_add" RequestGroupInvite EventType = "request_group_invite" EventUnknown EventType = "event_unknown" )
type FaceSegment ¶
type FaceSegment struct {
Segment `mapstructure:",squash"`
}
func NewFace ¶
func NewFace(id string) *FaceSegment
func (*FaceSegment) ID ¶
func (s *FaceSegment) ID() string
type FileInfo ¶
type FileInfo struct {
ID string `json:"id,omitempty" mapstructure:"id,omitempty"`
Name string `json:"name,omitempty" mapstructure:"name,omitempty"`
File string `json:"file,omitempty" mapstructure:"file,omitempty"`
FileName string `json:"file_name,omitempty" mapstructure:"file_name,omitempty"`
URL string `json:"url" mapstructure:"url"`
Base64 string `json:"base64,omitempty" mapstructure:"base64,omitempty"`
}
type FileSegment ¶
type FileSegment struct {
Segment `mapstructure:",squash"`
}
func NewFile ¶
func NewFile(file, name string) *FileSegment
func (*FileSegment) File ¶
func (s *FileSegment) File() string
type ForwardSegment ¶
type ForwardSegment struct {
Segment `mapstructure:",squash"`
}
func (*ForwardSegment) ID ¶
func (s *ForwardSegment) ID() string
type FriendRecall ¶
type FriendRecall struct {
Event `mapstructure:",squash"`
NoticeType string `json:"notice_type" mapstructure:"notice_type"`
UserID int64 `json:"user_id" mapstructure:"user_id"`
MessageID int64 `json:"message_id" mapstructure:"message_id"`
}
func (*FriendRecall) EventType ¶
func (g *FriendRecall) EventType() EventType
type GroupRecall ¶
type GroupRecall struct {
Event `mapstructure:",squash"`
NoticeType string `json:"notice_type" mapstructure:"notice_type"`
GroupID int64 `json:"group_id" mapstructure:"group_id"`
UserID int64 `json:"user_id" mapstructure:"user_id"`
OperatorID int64 `json:"operator_id" mapstructure:"operator_id"`
MessageID int64 `json:"message_id" mapstructure:"message_id"`
}
func (*GroupRecall) EventType ¶
func (g *GroupRecall) EventType() EventType
type Heartbeat ¶
type ISegment ¶
type ISegment interface {
SegmentType() SegmentType
}
type ImageSegment ¶
type ImageSegment struct {
Segment `mapstructure:",squash"`
}
func NewImage ¶
func NewImage(file, name string) *ImageSegment
func (*ImageSegment) File ¶
func (s *ImageSegment) File() string
func (*ImageSegment) IsSticker ¶
func (s *ImageSegment) IsSticker() bool
func (*ImageSegment) URL ¶
func (s *ImageSegment) URL() string
type JSONSegment ¶
type JSONSegment struct {
Segment `mapstructure:",squash"`
}
func (*JSONSegment) Content ¶
func (s *JSONSegment) Content() string
type Lifecycle ¶
type LightAPPSegment ¶
type LightAPPSegment struct {
Segment `mapstructure:",squash"`
}
type LocationSegment ¶
type LocationSegment struct {
Segment `mapstructure:",squash"`
}
func (*LocationSegment) Content ¶
func (s *LocationSegment) Content() string
func (*LocationSegment) Latitude ¶
func (s *LocationSegment) Latitude() float64
func (*LocationSegment) Longitude ¶
func (s *LocationSegment) Longitude() float64
func (*LocationSegment) Title ¶
func (s *LocationSegment) Title() string
type MarketFaceSegment ¶
type MarketFaceSegment struct {
Segment `mapstructure:",squash"`
}
func (*MarketFaceSegment) Content ¶
func (s *MarketFaceSegment) Content() string
func (*MarketFaceSegment) File ¶
func (s *MarketFaceSegment) File() string
func (*MarketFaceSegment) URL ¶
func (s *MarketFaceSegment) URL() string
type MemberInfo ¶
type MemberInfo struct {
UserID int64 `json:"user_id" mapstructure:"user_id"`
GroupID int64 `json:"group_id" mapstructure:"group_id"`
Nickname string `json:"nickname,omitempty" mapstructure:"nickname,omitempty"`
Card string `json:"card,omitempty" mapstructure:"card,omitempty"`
Role string `json:"role,omitempty" mapstructure:"role,omitempty"`
}
type Message ¶
type Message struct {
Event `mapstructure:",squash"`
MessageType string `json:"message_type" mapstructure:"message_type"`
SubType string `json:"sub_type" mapstructure:"sub_type"`
MessageID int32 `json:"message_id" mapstructure:"message_id"`
GroupID int64 `json:"group_id,omitempty" mapstructure:"group_id,omitempty"`
UserID int64 `json:"user_id" mapstructure:"user_id"`
TargetID int64 `json:"target_id,omitempty" mapstructure:"target_id,omitempty"`
Anonymous Anonymous `json:"anonymous,omitempty" mapstructure:"anonymous,omitempty"`
Message any `json:"message" mapstructure:"message"`
Font int32 `json:"font" mapstructure:"font"`
Sender Sender `json:"sender" mapstructure:"sender"`
}
type MusicSegment ¶
type MusicSegment struct {
Segment `mapstructure:",squash"`
}
type NodeSegment ¶
type NodeSegment struct {
Segment `mapstructure:",squash"`
}
func NewJSON ¶
func NewJSON(content string) *NodeSegment
func (*NodeSegment) ID ¶
func (s *NodeSegment) ID() string
type PayloadType ¶
type PayloadType string
const ( PaylaodRequest PayloadType = "request" PayloadResponse PayloadType = "response" PayloadEvent PayloadType = "event" )
type RecordSegment ¶
type RecordSegment struct {
Segment `mapstructure:",squash"`
}
func NewRecord ¶
func NewRecord(file, name string) *RecordSegment
func (*RecordSegment) File ¶
func (s *RecordSegment) File() string
type ReplySegment ¶
type ReplySegment struct {
Segment `mapstructure:",squash"`
}
func NewReply ¶
func NewReply(id string) *ReplySegment
func (*ReplySegment) ID ¶
func (s *ReplySegment) ID() string
type Request ¶
type Request struct {
Action string `json:"action"`
Params map[string]interface{} `json:"params,omitempty"`
Echo string `json:"echo,omitempty"`
}
func NewDeleteMsgRequest ¶
func NewGetFileRequest ¶
func NewGetForwardMsgRequest ¶
func NewGetFriendListRequest ¶
func NewGetFriendListRequest() *Request
func NewGetGroupInfoRequest ¶
func NewGetGroupListRequest ¶
func NewGetGroupListRequest() *Request
func NewGetImageRequest ¶
func NewGetLoginInfoRequest ¶
func NewGetLoginInfoRequest() *Request
func NewGetRecordRequest ¶
func NewGetUserInfoRequest ¶
func NewGroupMsgRequest ¶
func NewPrivateMsgRequest ¶
func (*Request) PayloadType ¶
func (r *Request) PayloadType() PayloadType
type RequestType ¶
type RequestType string
const ( // OneBot11 SendPrivateMsg RequestType = "send_private_msg" SendGroupMsg RequestType = "send_group_msg" SendMsg RequestType = "send_msg" DeleteMsg RequestType = "delete_msg" GetMsg RequestType = "get_msg" GetForwardMsg RequestType = "get_forward_msg" SendLike RequestType = "send_like" SetGroupKick RequestType = "set_group_kick" SetGroupBan RequestType = "set_group_ban" SetGroupAnonymousBan RequestType = "set_group_anonymous_ban" SetGroupWholeBan RequestType = "set_group_whole_ban" SetGroupAdmin RequestType = "set_group_admin" SetGroupAnonymous RequestType = "set_group_anonymous" SetGroupCard RequestType = "set_group_card" SetGroupName RequestType = "set_group_name" SetGroupLeave RequestType = "set_group_leave" SetGroupSpecialTitle RequestType = "set_group_special_title" SetFriendAddRequest RequestType = "set_friend_add_request" SetGroupAddRequest RequestType = "set_group_add_request" GetLoginInfo RequestType = "get_login_info" GetStrangerInfo RequestType = "get_stranger_info" GetFriendList RequestType = "get_friend_list" GetGroupInfo RequestType = "get_group_info" GetGroupList RequestType = "get_group_list" GetGroupMemberInfo RequestType = "get_group_member_info" GetGroupMemberList RequestType = "get_group_member_list" GetGroupHonorInfo RequestType = "get_group_honor_info" GetCookies RequestType = "get_cookies" GetCSRFToken RequestType = "get_csrf_token" GetCredentials RequestType = "get_credentials" GetRecord RequestType = "get_record" GetImage RequestType = "get_image" CanSendImage RequestType = "can_send_image" CanSendRecord RequestType = "can_send_record" GetStatus RequestType = "get_status" GetVersionInfo RequestType = "get_version_info" SetRestart RequestType = "set_restart" CleanCache RequestType = "clean_cache" // go-cqhttp MarkMsgAsRead RequestType = "mark_msg_as_read" SendGroupForwardMsg RequestType = "send_group_forward_msg" SendPrivateForwardMsg RequestType = "send_private_forward_msg" GetGroupMsgHistory RequestType = "get_group_msg_history" UploadGroupFile RequestType = "upload_group_file" DownloadFile RequestType = "download_file" // NapCat GetFile RequestType = "get_file" ForwardFriendSingleMsg RequestType = "forward_friend_single_msg" ForwardGroupSingleMsg RequestType = "forward_group_single_msg" SendForwardMsg RequestType = "send_forward_msg" MarkPrivateMsgAsRead RequestType = "mark_private_msg_as_read" MarkGroupMsgAsRead RequestType = "mark_private_msg_as_read" GetFriendMsgHistory RequestType = "get_friend_msg_history" )
type Response ¶
type Response struct {
Status string `json:"status"`
Retcode int32 `json:"retcode"`
Data any `json:"params,omitempty"`
Echo string `json:"echo,omitempty"`
}
func (*Response) PayloadType ¶
func (r *Response) PayloadType() PayloadType
type Segment ¶
func (*Segment) SegmentType ¶
func (s *Segment) SegmentType() SegmentType
type SegmentType ¶
type SegmentType string
const ( Text SegmentType = "text" Face SegmentType = "face" MarketFace SegmentType = "mface" Image SegmentType = "image" Record SegmentType = "record" Video SegmentType = "video" File SegmentType = "file" At SegmentType = "at" Contact SegmentType = "contact" Location SegmentType = "location" Music SegmentType = "music" LightAPP SegmentType = "lightapp" Reply SegmentType = "reply" Forward SegmentType = "forward" Node SegmentType = "node" XML SegmentType = "xml" JSON SegmentType = "json" )
type SendMessageResponse ¶
type SendMessageResponse struct {
MessageID int32 `json:"message_id" mapstructure:"message_id"`
}
type Sender ¶
type Sender struct {
UserID int64 `json:"user_id" mapstructure:"user_id"`
Nickname string `json:"nickname,omitempty" mapstructure:"nickname,omitempty"`
Card string `json:"card,omitempty" mapstructure:"card,omitempty"`
Sex string `json:"sex,omitempty" mapstructure:"sex,omitempty"`
Age int32 `json:"age,omitempty" mapstructure:"age,omitempty"`
Area string `json:"area,omitempty" mapstructure:"area,omitempty"`
Level int32 `json:"level,omitempty" mapstructure:"level,omitempty"`
Role string `json:"role,omitempty" mapstructure:"role,omitempty"`
Title string `json:"title,omitempty" mapstructure:"title,omitempty"`
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
type ShareSegment ¶
type ShareSegment struct {
}
func (*ShareSegment) Content ¶
func (s *ShareSegment) Content() string
func (*ShareSegment) Image ¶
func (s *ShareSegment) Image() string
func (*ShareSegment) Title ¶
func (s *ShareSegment) Title() string
func (*ShareSegment) URL ¶
func (s *ShareSegment) URL() string
type TextSegment ¶
type TextSegment struct {
Segment `mapstructure:",squash"`
}
func NewText ¶
func NewText(content string) *TextSegment
func (*TextSegment) Content ¶
func (s *TextSegment) Content() string
type VideoSegment ¶
type VideoSegment struct {
Segment `mapstructure:",squash"`
}
func NewVideo ¶
func NewVideo(file, name string) *VideoSegment
func (*VideoSegment) File ¶
func (s *VideoSegment) File() string
func (*VideoSegment) URL ¶
func (s *VideoSegment) URL() string
type XMLSegment ¶
type XMLSegment struct {
Segment `mapstructure:",squash"`
}
func (*XMLSegment) Content ¶
func (s *XMLSegment) Content() string
Click to show internal directories.
Click to hide internal directories.