http

package
v0.0.0-...-ff82ded Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2022 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func About

func About() (result PluginInfoResult)

About 获取插件信息

使用此方法获取插件的信息,如版本号
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#获取插件信息

func BotInvJoinGroupEvent

func BotInvJoinGroupEvent(sessionKey string, event model.Message, operate int, message string) (result any, err error)

BotInvJoinGroupEvent Bot被邀请入群申请

使用此方法处理Bot被邀请入群申请, 关于operate参数的取值:
- 0: 同意
- 1: 拒绝
其余用法同官方文档,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#Bot被邀请入群申请

⚠️警告: 所有公告相关接口需要 mirai-api-http 2.5.0 及以上版本

func BotProfile

func BotProfile(sessionKey string) (result Profile, err error)

BotProfile 获取Bot资料

此接口获取 session 绑定 bot 的详细资料
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#获取Bot资料

func DeleteFriend

func DeleteFriend(sessionKey string, target int) (result HttpResult[any])

DeleteFriend 删除好友

使用此方法删除指定好友
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#删除好友

⚠️警告: 此接口未测试

func FileDelete

func FileDelete(sessionKey string, file FileParams) (result HttpResult[any])

FileDelete 删除文件

使用此方法删除文件, 建议使用 FileDeleteForId
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#删除文件

⚠️警告: 目前官方仅支持群文件操作,所有好友相关字段均为保留字段

func FileDeleteForId

func FileDeleteForId(sessionKey string, id string, group int) (result HttpResult[any])

FileDeleteForId 根据文件id删除文件

使用此方法根据文件id删除文件, 此函数为 FileDelete 函数封装
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#删除文件

func FileMove

func FileMove(sessionKey string, file FileParams, moveTo string, moveToPath string) (result HttpResult[any])

FileMove 移动文件

使用此方法移动文件
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#移动文件

⚠️警告: 目前官方仅支持群文件操作,所有好友相关字段均为保留字段

func FileRename

func FileRename(sessionKey string, file FileParams, renameTo string) (result HttpResult[any])

FileRename 重命名文件

使用此方法重命名文件
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#重命名文件

⚠️警告: 目前官方仅支持群文件操作,所有好友相关字段均为保留字段

⚠️警告: 此接口权限貌似存在一些问题

func FileRenameForId

func FileRenameForId(sessionKey string, id string, renameTo string, group int) (result HttpResult[any])

FileRenameForId 根据id重命名文件

使用此方法重命名文件, 此函数为 FileRename 函数的封装
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#重命名文件

⚠️警告: 此接口权限貌似存在一些问题

func FriendProfile

func FriendProfile(sessionKey string, friendId int) (result Profile, err error)

FriendProfile 获取好友资料

此接口获取好友的详细资料
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#获取好友资料

func GetGroupConfig

func GetGroupConfig(sessionKey string, group int) (result GroupConfig, e error)

GetGroupConfig 获取群设置

使用此方法获取群设置
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#获取群设置

func GetMemberInfo

func GetMemberInfo(sessionKey string, group int, qq int) (result Member, e error)

GetMemberInfo 获取群员设置

使用此方法获取群员设置(资料)
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#获取群员设置

func Kick

func Kick(sessionKey string, group int, qq int, msg string) (result HttpResult[any])

Kick 移除群成员

使用此方法移除群成员, 需要对应权限
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#移除群成员

func MemberJoinRequestEvent

func MemberJoinRequestEvent(sessionKey string, event model.Message, operate int, message string) (result any, err error)

MemberJoinRequestEvent 用户入群申请

使用此方法处理用户入群申请, 关于operate参数的取值:
- 0: 同意入群
- 1: 拒绝入群
- 2: 忽略请求
- 3: 拒绝入群并添加黑名单,不再接收该用户的入群申请
- 4: 忽略入群并添加黑名单,不再接收该用户的入群申请
其余用法同官方文档,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#用户入群申请

⚠️警告: 所有公告相关接口需要 mirai-api-http 2.5.0 及以上版本

func MemberProfile

func MemberProfile(sessionKey string, groupId int, memberId int) (result Profile, err error)

MemberProfile 获取群成员资料

此接口获取群成员的消息资料
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#获取群成员资料

func Mute

func Mute(sessionKey string, group int, qq int, time int) (result HttpResult[any])

Mute 禁言群成员

使用此方法禁言群成员, 需要对应权限
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#禁言群成员

func MuteAll

func MuteAll(sessionKey string, group int) (result HttpResult[any])

MuteAll 全体禁言

使用此方法全体禁言, 需要对应权限
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#全体禁言

func NewFriendEvent

func NewFriendEvent(sessionKey string, event model.Message, operate int, message string) (result any, err error)

NewFriendEvent 添加好友申请

使用此方法处理添加好友申请, 关于operate参数的取值:
- 0: 同意添加好友
- 1: 拒绝添加好友
- 2: 拒绝添加好友并添加黑名单,不再接收该用户的好友申请
其余用法同官方文档,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#添加好友申请

⚠️警告: 所有公告相关接口需要 mirai-api-http 2.5.0 及以上版本

func Quit

func Quit(sessionKey string, group int) (result HttpResult[any])

Quit 退出群聊

使用此方法退出群聊
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#退出群聊

func Recall

func Recall(sessionKey string, messageId int) (result HttpResult[any])

Recall 撤回消息

使用此方法根据messageId撤回指定消息
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#撤回消息

⚠️警告: 不建议直接使用此函数,建议使用 SendNudgeFriend / SendNudgeMember

func SendFriendMessage

func SendFriendMessage(sessionKey string, target int, chain []MessageChain, quoteId int) (result SendMsgResult)

SendFriendMessage 发送好友消息

使用此方法向指定好友发送消息, quoteId为引用消息id, 无需引用传0
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#发送好友消息

func SendGroupMessage

func SendGroupMessage(sessionKey string, target int, chain []MessageChain, quoteId int) (result SendMsgResult)

SendGroupMessage 发送群消息

使用此方法向指定群发送消息, quoteId为引用消息id, 无需引用传0
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#发送群消息

func SendNudge

func SendNudge(sessionKey string, target int, subject int, kind string) (result HttpResult[any])

SendNudge 发送头像戳一戳消息

使用此方法发送头像戳一戳消息
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#发送头像戳一戳消息

⚠️警告: 不建议直接使用此函数,建议使用 SendNudgeFriend / SendNudgeMember

func SendNudgeFriend

func SendNudgeFriend(sessionKey string, qq int) (result HttpResult[any])

SendNudgeFriend 发送好友头像戳一戳消息

使用此方法向指定好友发送头像戳一戳消息
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#发送头像戳一戳消息

func SendNudgeMember

func SendNudgeMember(sessionKey string, group int, qq int) (result HttpResult[any])

SendNudgeMember 发送群成员头像戳一戳消息

func SendTempMessage

func SendTempMessage(sessionKey string, group int, qq int, chain []MessageChain, quoteId int) (result SendMsgResult)

SendTempMessage 发送临时会话消息

使用此方法向指定群成员发送临时消息, quoteId为引用消息id, 无需引用传0
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#发送临时会话消息

func SetEssence

func SetEssence(sessionKey string, messageId int) (result HttpResult[any])

SetEssence 解除全体禁言

使用此方法解除全体禁言, 需要对应权限
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#解除全体禁言

func SetGroupConfig

func SetGroupConfig(sessionKey string, group int, config GroupConfig) (result HttpResult[any])

SetGroupConfig 修改群设置

使用此方法修改群设置(需要有相关限权)
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#修改群设置

⚠️警告: 根据官方源码来看,目前只支持修改Name和AllowMemberInvite,后续官方支持后即可支持

func SetMemberAdmin

func SetMemberAdmin(sessionKey string, group int, qq int, assign bool) (result HttpResult[any])

SetMemberAdmin 修改群员管理员

使用此方法修改群员的管理员权限(需要有群主限权)
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#修改群员管理员

⚠️警告: 未测试

func SetMemberInfo

func SetMemberInfo(sessionKey string, group int, qq int, name string) (result HttpResult[any])

SetMemberInfo 修改群员设置(只支持改群名片)

使用此方法修改群员资料(需要有相关限权)
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#修改群员设置

func Unmute

func Unmute(sessionKey string, group int, qq int) (result HttpResult[any])

Unmute 解除群成员禁言

使用此方法解除群成员禁言, 需要对应权限
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#解除群成员禁言

func UnmuteAll

func UnmuteAll(sessionKey string, group int) (result HttpResult[any])

UnmuteAll 解除全体禁言

使用此方法解除全体禁言, 需要对应权限
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#解除全体禁言

func UploadImage

func UploadImage(sessionKey string, typ UploadType, img string) (result ImageInfo, e error)

UploadImage 图片文件上传

使用此方法上传图片文件至服务器并返回ImageId
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#图片文件上传

func UploadVoice

func UploadVoice(sessionKey string, voice string) (result VoiceInfo, e error)

UploadVoice 语音文件上传

使用此方法上传语音文件至服务器并返回VoiceId
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#语音文件上传

func UserProfile

func UserProfile(sessionKey string, id int) (result Profile, err error)

UserProfile 获取QQ用户资料

此接口获取任意QQ用户的资料
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#获取QQ用户资料

⚠️警告: 此条API需要 mirai-api-http 2.5.0及以上版本

func Verify

func Verify(verifyKey string) (result model.VerifyResult)

Verify 认证

使用此方法验证你的身份,并返回一个会话
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#%E8%AE%A4%E8%AF%81

Types

type AnnoListResult

type AnnoListResult HttpResult[[]Anno]

func AnnoList

func AnnoList(sessionKey string, group int, offset int, size int) (result AnnoListResult)

AnnoList 获取群公告

此方法获取指定群公告列表
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#获取群公告

⚠️警告: 所有公告相关接口需要 mirai-api-http 2.5.0 及以上版本

type AnnoResult

type AnnoResult HttpResult[Anno]

func AnnoDelete

func AnnoDelete(sessionKey string, group int, id string) (result AnnoResult)

AnnoDelete 删除群公告

此方法删除指定群中一条公告
其余用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#删除群公告

⚠️警告: 所有公告相关接口需要 mirai-api-http 2.5.0 及以上版本

func AnnoPublish

func AnnoPublish(sessionKey string, group int, content string, imageUrl string, pinned bool, args ...bool) (result AnnoResult)

AnnoPublish 发布群公告

此方法获取指定群公告列表, imageUrl参数设置为""表示无图片,args参数解释如下
- args[0]: 是否发送给新成员
- args[1]: 是否引导用户修改名片
- args[2]: 是否自动弹窗显示
- args[3]: 是否需要成员确认
以上参数默认皆为false, 多余的参数将会被忽略
其余用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#发布群公告

⚠️警告: 所有公告相关接口需要 mirai-api-http 2.5.0 及以上版本

type BindResult

type BindResult model.HttpResult[string]

func Bind

func Bind(sessionKey string, qq int) (result BindResult)

Bind 绑定

使用此方法校验并激活你的Session,同时将Session与一个已登录的Bot绑定
用法同官方文档,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#%E7%BB%91%E5%AE%9A

type CountMsgResult

type CountMsgResult model.HttpResult[int]

func CountMessage

func CountMessage(sessionKey string) (result CountMsgResult)

CountMessage 查看队列大小

使用此方法获取 session 未读缓存消息的数量
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#%E6%9F%A5%E7%9C%8B%E9%98%9F%E5%88%97%E5%A4%A7%E5%B0%8F

type FileInfoResult

type FileInfoResult HttpResult[File]

func FileInfo

func FileInfo(sessionKey string, file FileParams) (result FileInfoResult)

FileInfo 获取文件信息

使用此方法获取文件信息, 建议使用 FileInfoForId
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#获取文件信息

⚠️警告: 目前官方仅支持群文件操作,所有好友相关字段均为保留字段

func FileInfoForId

func FileInfoForId(sessionKey string, id string, group int, withDownloadInfo bool) (result FileInfoResult)

FileInfoForId 获取文件信息

使用此方法获取文件信息,此函数为 FileInfo 函数的封装
- id: 文件id
- group: 要查看的群群号
- withDownloadInfo: 是否附带文件下载信息, 此接口不建议附带
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#获取文件信息

func FileInfoForPath

func FileInfoForPath(sessionKey string, path string, group int, withDownloadInfo bool) (result FileInfoResult)

FileInfoForPath 获取文件信息

使用此方法获取文件信息,此函数为 FileInfo 函数的封装
- id: 文件id
- group: 要查看的群群号
- withDownloadInfo: 是否附带文件下载信息, 此接口不建议附带
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#获取文件信息

⚠️警告: 由于path的不准确性,建议使用 FileInfoForId 查询

func FileMkdir

func FileMkdir(sessionKey string, file FileParams, directoryName string) (result FileInfoResult)

FileMkdir 创建文件夹

使用此方法创建文件夹, 建议使用 FileMkdirInRoot
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#创建文件夹

⚠️警告: 目前官方仅支持群文件操作,所有好友相关字段均为保留字段

⚠️警告: 此接口似乎也存在bug, 不建议使用

func FileMkdirInRoot

func FileMkdirInRoot(sessionKey string, group int, directoryName string) (result FileInfoResult)

FileMkdirInRoot 在群文件根目录创建文件夹

使用此方法在群文件根目录创建文件夹,此函数为 FileMkdir 函数的封装
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#获取文件信息

⚠️警告: 此接口似乎也存在bug, 不建议使用

func UploadFile

func UploadFile(sessionKey string, file string, group int, path string) (result FileInfoResult, e error)

UploadFile 群文件上传

使用此方法上传文件至群文件
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#群文件上传

type FileListResult

type FileListResult HttpResult[[]File]

func FileList

func FileList(sessionKey string, file FileParams, offset int, size int) (result FileListResult)

FileList 查看文件列表

使用此方法查看文件列表, 建议使用 FileListForGroup
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#查看文件列表

⚠️警告: 目前官方仅支持群文件操作,所有好友相关字段均为保留字段

func FileListForGroup

func FileListForGroup(sessionKey string, id string, path string, group int, withDownloadInfo bool, offset int, size int) (result FileListResult)

FileListForGroup 查看群文件列表

使用此方法查看群文件列表,此函数为 FileList 函数的封装
- id: 文件id,空串为根目录,id和path都为空时读取根目录
- path: 文件夹路径, 文件夹允许重名, 不保证准确, 准确定位使用 id
- group: 要查看的群群号
- withDownloadInfo: 是否附带文件下载信息, 此接口不建议附带
- offset: 分页偏移
- size: 分页大小
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#查看文件列表

type FriendsResult

type FriendsResult HttpResult[[]Friend]

func FriendList

func FriendList(sessionKey string) (result FriendsResult)

FriendList 获取好友列表

使用此方法获取bot的好友列表
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#获取好友列表

type GroupsResult

type GroupsResult HttpResult[[]Group]

func GroupList

func GroupList(sessionKey string) (result GroupsResult)

GroupList 获取群列表

使用此方法获取bot的群列表
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#获取群列表

type MembersResult

type MembersResult HttpResult[[]Member]

func MemberList

func MemberList(sessionKey string, groupId int) (result MembersResult)

MemberList 获取群成员列表

使用此方法获取bot指定群中的成员列表
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#获取群成员列表

type MessageResult

type MessageResult model.HttpResult[model.Message]

func GetMessageForId

func GetMessageForId(sessionKey string, id int) (result MessageResult)

GetMessageForId 通过messageId获取信息

当该messageId没有被缓存或缓存失效时,返回code 5(指定对象不存在)
用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/api/API.html#通过messageid获取消息

type MessagesResult

type MessagesResult model.HttpResult[[]model.Message]

func GetMessage

func GetMessage(flag int, sessionKey string, count int) (result MessagesResult)

GetMessage 获取消息队列

使用此方法整合了官网获取消息队列相关4个接口, flag字段取值范围1-4,分别表示:
1. 按时间顺序获取消息,获取消息后从队列中移除
2. 获取最新的消息,获取消息后从队列中移除
3. 按时间顺序查看消息,查看消息后不从队列中移除
4. 查看最新的消息,查看消息后不从队列中移除
其余用法同官方文档,返回值增加msg字段,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#%E6%8E%A5%E6%94%B6%E6%B6%88%E6%81%AF%E4%B8%8E%E4%BA%8B%E4%BB%B6

type ReleaseResult

type ReleaseResult model.HttpResult[string]

func Release

func Release(sessionKey string, qq int) (result ReleaseResult)

Release 释放

使用此方式释放session及其相关资源(Bot不会被释放) 不使用的Session应当被释放,长时间(30分钟)未使用的Session将自动释放,否则Session持续保存Bot收到的消息,将会导致内存泄露
用法同官方文档,错误代码-10000为自定义错误, 错误信息见msg字段
NOTE: https://docs.mirai.mamoe.net/mirai-api-http/adapter/HttpAdapter.html#%E9%87%8A%E6%94%BE

type UploadType

type UploadType string
const (
	UploadTypeFriend UploadType = "friend"
	UploadTypeGroup  UploadType = "group"
	UploadTypeTemp   UploadType = "temp"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL