Documentation
¶
Overview ¶
napcat 包提供 NapCat 专属 OneBot v11 扩展动作的类型化辅助方法。
Index ¶
- type API
- func (api *API) Call(ctx context.Context, action string, params any, out any) error
- func (api *API) CallRaw(ctx context.Context, action string, params any) (*onebot11.Response, error)
- func (api *API) DownloadFile(ctx context.Context, url string, threadCount int, headers []string) (FileInfo, error)
- func (api *API) GetFile(ctx context.Context, fileID any) (FileInfo, error)
- func (api *API) GetFriendMessageHistory(ctx context.Context, userID any, messageSeq any, count int) ([]MessageSummary, error)
- func (api *API) GetGroupMessageHistory(ctx context.Context, groupID any, messageSeq any, count int) ([]MessageSummary, error)
- func (api *API) SetMessageEmojiLike(ctx context.Context, messageID any, emojiID any) error
- type Client
- type FileInfo
- type MessageSummary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API 包装 NapCat 扩展动作,并保留原始调用能力。
func (*API) DownloadFile ¶
func (api *API) DownloadFile(ctx context.Context, url string, threadCount int, headers []string) (FileInfo, error)
DownloadFile 调用 NapCat download_file 扩展。
func (*API) GetFriendMessageHistory ¶
func (api *API) GetFriendMessageHistory(ctx context.Context, userID any, messageSeq any, count int) ([]MessageSummary, error)
GetFriendMessageHistory 调用 NapCat get_friend_msg_history 扩展。
func (*API) GetGroupMessageHistory ¶
func (api *API) GetGroupMessageHistory(ctx context.Context, groupID any, messageSeq any, count int) ([]MessageSummary, error)
GetGroupMessageHistory 调用 NapCat get_group_msg_history 扩展。
type Client ¶ added in v1.0.1
type Client interface {
Call(context.Context, string, any, any) error
CallRaw(context.Context, string, any) (*onebot11.Response, error)
}
Client 是 NapCat 扩展动作所需的 OneBot v11 调用能力。
type FileInfo ¶
type FileInfo struct {
File string `json:"file"`
URL string `json:"url,omitempty"`
Name string `json:"name,omitempty"`
Size int64 `json:"size,omitempty"`
}
FileInfo 描述 NapCat 文件下载或查询结果。
func (*FileInfo) UnmarshalJSON ¶
UnmarshalJSON 兼容 NapCat 返回的数字或字符串形式文件大小。
type MessageSummary ¶
type MessageSummary struct {
MessageID int64 `json:"message_id"`
RealID int64 `json:"real_id,omitempty"`
Time int64 `json:"time,omitempty"`
UserID int64 `json:"user_id,omitempty"`
GroupID int64 `json:"group_id,omitempty"`
RawMessage string `json:"raw_message,omitempty"`
}
MessageSummary 是 NapCat 历史消息接口返回的紧凑消息结构。
func (*MessageSummary) UnmarshalJSON ¶
func (m *MessageSummary) UnmarshalJSON(data []byte) error
UnmarshalJSON 兼容 NapCat 返回的数字或字符串形式 ID。
Click to show internal directories.
Click to hide internal directories.