Package com.mikuac.shiro.core
Class Bot
java.lang.Object
com.mikuac.shiro.core.Bot
- All Implemented Interfaces:
GensokyoExtend,GoCQHTTPExtend,LagrangeExtend,LLOneBotExtend,NapCatExtend,OneBot,Closeable,AutoCloseable
public class Bot
extends Object
implements OneBot, GoCQHTTPExtend, GensokyoExtend, LagrangeExtend, LLOneBotExtend, NapCatExtend, Closeable
Created on 2021/7/7.
-
Constructor Summary
ConstructorsConstructorDescriptionBot(long selfId, org.springframework.web.socket.WebSocketSession session, ActionHandler actionHandler, List<Class<? extends BotPlugin>> pluginList, BotFactory.AnnotationMethodContainer annotationMethodContainer, Class<? extends BotMessageEventInterceptor> botMessageEventInterceptor) -
Method Summary
Modifier and TypeMethodDescription检查是否可以发送图片检查是否可以发送语音checkUrlSafely(String url) 检查链接安全性 安全等级, 1: 安全 2: 未知 3: 危险voidclose()createGroupFileFolder(long groupId, String folderName) 创建群文件文件夹customRawRequest(ActionPath action, Map<String, Object> params) 自定义请求<T> ActionData<T> customRawRequest(ActionPath action, Map<String, Object> params, Class<T> clazz) 自定义请求customRequest(ActionPath action, Map<String, Object> params) 自定义请求<T> ActionData<T> customRequest(ActionPath action, Map<String, Object> params, Class<T> clazz) 自定义请求deleteEssenceMsg(int msgId) 移出精华消息deleteFriend(long friendId) 删除好友deleteGroupFile(long groupId, String fileId, int busId) 删除群文件deleteGroupFileFolder(long groupId, String folderId) 删除群文件文件夹deleteMsg(int msgId) 撤回消息deleteMsg(long groupId, long userId, int msgId) 撤回消息(兼容gsk)deleteUnidirectionalFriend(long userId) 删除单向好友downloadFile(String url) 调用 go cq http 下载文件downloadFile(String url, int threadCount, String headers) 调用 go cq http 下载文件获取收藏表情org.springframework.util.MultiValueMap<Class<? extends Annotation>, HandlerMethod> Class<? extends BotMessageEventInterceptor> getEssenceMsgList(long groupId) 获取精华消息列表获取群文件资源链接getForwardMsg(int msgId) 获取合并转发消息获取好友列表getFriendMsgHistory(long userId, Long messageSeq, int count, boolean reverseOrder) 获取好友历史消息记录getGroupAtAllRemain(long groupId) 获取群 @全体成员 剩余次数getGroupFilesByFolder(long groupId, String folderId) 获取群子目录文件列表getGroupFileUrl(long groupId, String fileId, int busId) 获取群文件资源链接getGroupHonorInfo(long groupId, String type) 获取群荣誉信息getGroupInfo(long groupId, boolean noCache) 获取群信息获取群列表getGroupMemberInfo(long groupId, long userId, boolean noCache) 获取群成员信息getGroupMemberList(long groupId) 获取群成员列表getGroupMemberList(long groupId, boolean noCache) 获取群成员列表getGroupMsgHistory(long groupId, Long messageSeq, int count, boolean reverseOrder) 获取群聊历史消息记录getGroupRootFiles(long groupId) 获取群根目录文件列表getGuildChannelList(String guildId, boolean noCache) 获取子频道列表获取频道列表getGuildMemberList(String guildId, String nextToken) 获取频道成员列表 由于频道人数较多(数万), 请尽量不要全量拉取成员列表, 这将会导致严重的性能问题 尽量使用 getGuildMemberProfile 接口代替全量拉取 nextToken 为空的情况下, 将返回第一页的数据, 并在返回值附带下一页的 tokengetGuildMemberProfile(String guildId, String userId) 单独获取频道成员信息getGuildMetaByGuest(String guildId) 通过访客获取频道元数据getGuildMsg(String guildMsgId, boolean noCache) 获取频道消息获取频道系统内 BOT 的资料获取登录号信息getMsg(int msgId) 获取消息getOnlineClients(boolean noCache) 获取当前账号在线客户端列表longorg.springframework.web.socket.WebSocketSession获取状态getStrangerInfo(long userId, boolean noCache) 获取陌生人信息getToken()获取客户端连接的 token获取单向好友列表获取版本信息getWordSlices(String content) 获取中文分词图片 OCRsendForwardMsg(AnyMessageEvent event, List<Map<String, Object>> msg) 发送合并转发sendForwardMsg(List<Map<String, Object>> msg) 获取合并转发消息IdsendFriendPoke(long userId) sendFriendPoke(long userId, long targetId) sendGroupForwardMsg(long groupId, List<Map<String, Object>> msg) 发送合并转发 (群)sendGroupForwardMsg(long groupId, List<Map<String, Object>> msg, String prompt, String source, String summary, List<Map<String, String>> news) 发送群聊嵌套聊天记录sendGroupMsg(long groupId, long userId, String msg, boolean autoEscape) 发送群消息sendGroupMsg(long groupId, long userId, List<ArrayMsg> msg, boolean autoEscape) 发送群消息sendGroupMsg(long groupId, String msg, boolean autoEscape) 发送群消息sendGroupMsg(long groupId, List<ArrayMsg> msg, boolean autoEscape) 发送群消息sendGroupNotice(long groupId, String content) 发送群公告sendGroupPoke(long groupId, long userId) sendGroupSign(long groupId) 群打卡sendGuildMsg(String guildId, String channelId, String msg) 发送信息到子频道sendLike(long userId, int times) 好友点赞sendMsg(AnyMessageEvent event, String msg, boolean autoEscape) 发送消息sendMsg(AnyMessageEvent event, List<ArrayMsg> msg, boolean autoEscape) 发送消息sendPrivateForwardMsg(long userId, List<Map<String, Object>> msg) 发送合并转发 (私聊)sendPrivateForwardMsg(long userId, List<Map<String, Object>> msg, String prompt, String source, String summary, List<Map<String, String>> news) 发送私聊嵌套聊天记录sendPrivateMsg(long groupId, long userId, String msg, boolean autoEscape) 临时会话sendPrivateMsg(long groupId, long userId, List<ArrayMsg> msg, boolean autoEscape) 临时会话sendPrivateMsg(long userId, String msg, boolean autoEscape) 发送私聊消息sendPrivateMsg(long userId, List<ArrayMsg> msg, boolean autoEscape) 发送私聊消息voidsetActionHandler(ActionHandler actionHandler) voidsetAnnotationMethodContainer(BotFactory.AnnotationMethodContainer annotationMethodContainer) voidsetBotMessageEventInterceptor(Class<? extends BotMessageEventInterceptor> botMessageEventInterceptor) 设置机器人账号资料setEssenceMsg(int msgId) 设置精华消息setFriendAddRequest(String flag, boolean approve, String remark) 处理加好友请求setGroupAddRequest(String flag, String subType, boolean approve, String reason) 处理加群请求/邀请setGroupAdmin(long groupId, long userId, boolean enable) 群组设置管理员setGroupAnonymous(long groupId, boolean enable) 群组匿名setGroupAnonymousBan(long groupId, Anonymous anonymous, int duration) 群组匿名用户禁言setGroupAnonymousBan(long groupId, String flag, int duration) 群组匿名用户禁言setGroupBan(long groupId, long userId, int duration) 群组单人禁言setGroupCard(long groupId, long userId, String card) 设置群名片(群备注)setGroupKick(long groupId, long userId, boolean rejectAddRequest) 群组踢人setGroupLeave(long groupId, boolean isDismiss) 退出群组setGroupName(long groupId, String groupName) 设置群名setGroupPortrait(long groupId, String file, int cache) 设置群头像 目前这个API在登录一段时间后因cookie失效而失效, 请考虑后使用setGroupReaction(long groupId, int msgId, String code, boolean isAdd) 设置群消息表情回应setGroupSpecialTitle(long groupId, long userId, String specialTitle, int duration) 设置群组专属头衔setGroupWholeBan(long groupId, boolean enable) 全体禁言setMsgEmojiLike(int msgId, String code, boolean isSet) 设置消息表情回应(贴表情)voidsetPluginList(List<Class<? extends BotPlugin>> pluginList) voidsetSelfId(long selfId) voidsetSession(org.springframework.web.socket.WebSocketSession session) voiduploadGroupFile(long groupId, String file, String name) 上传群文件 在不提供 folder 参数的情况下默认上传到根目录 只能上传本地文件, 需要上传 http 文件的话请先下载到本地uploadGroupFile(long groupId, String file, String name, String folder) 上传群文件 在不提供 folder 参数的情况下默认上传到根目录 只能上传本地文件, 需要上传 http 文件的话请先下载到本地uploadPrivateFile(long userId, String file, String name) 私聊发送文件
-
Constructor Details
-
Bot
public Bot(long selfId, org.springframework.web.socket.WebSocketSession session, ActionHandler actionHandler, List<Class<? extends BotPlugin>> pluginList, BotFactory.AnnotationMethodContainer annotationMethodContainer, Class<? extends BotMessageEventInterceptor> botMessageEventInterceptor)
-
-
Method Details
-
getAnnotationHandler
public org.springframework.util.MultiValueMap<Class<? extends Annotation>,HandlerMethod> getAnnotationHandler() -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getToken
获取客户端连接的 token- Returns:
- token, 如果未提供, 则为 null
-
sendMsg
发送消息- Specified by:
sendMsgin interfaceOneBot- Parameters:
event-AnyMessageEventmsg- 要发送的内容autoEscape- 消息内容是否作为纯文本发送 ( 即不解析 CQ 码 ) , 只在 message 字段是字符串时有效- Returns:
- result
ActionDataofMsgId
-
sendMsg
发送消息- Specified by:
sendMsgin interfaceOneBot- Parameters:
event-AnyMessageEventmsg- 消息链autoEscape- 消息内容是否作为纯文本发送 ( 即不解析 CQ 码 ) , 只在 message 字段是字符串时有效- Returns:
- result
ActionDataofMsgId
-
sendPrivateMsg
发送私聊消息- Specified by:
sendPrivateMsgin interfaceOneBot- Parameters:
userId- 对方 QQ 号msg- 要发送的内容autoEscape- 消息内容是否作为纯文本发送 ( 即不解析 CQ 码 ) , 只在 message 字段是字符串时有效- Returns:
- result
ActionDataofMsgId
-
sendPrivateMsg
发送私聊消息- Specified by:
sendPrivateMsgin interfaceOneBot- Parameters:
userId- 对方 QQ 号msg- 消息链autoEscape- 消息内容是否作为纯文本发送 ( 即不解析 CQ 码 ) , 只在 message 字段是字符串时有效- Returns:
- result
ActionDataofMsgId
-
sendPrivateMsg
临时会话- Specified by:
sendPrivateMsgin interfaceOneBot- Parameters:
groupId- 主动发起临时会话群号(机器人本身必须是管理员/群主)userId- 对方 QQ 号msg- 要发送的内容autoEscape- 消息内容是否作为纯文本发送 ( 即不解析 CQ 码 ) , 只在 message 字段是字符串时有效- Returns:
- result
ActionDataofMsgId
-
sendPrivateMsg
public ActionData<MsgId> sendPrivateMsg(long groupId, long userId, List<ArrayMsg> msg, boolean autoEscape) 临时会话- Specified by:
sendPrivateMsgin interfaceOneBot- Parameters:
groupId- 主动发起临时会话群号(机器人本身必须是管理员/群主)userId- 对方 QQ 号msg- 消息链autoEscape- 消息内容是否作为纯文本发送 ( 即不解析 CQ 码 ) , 只在 message 字段是字符串时有效- Returns:
- result
ActionDataofMsgId
-
sendGroupMsg
发送群消息- Specified by:
sendGroupMsgin interfaceOneBot- Parameters:
groupId- 群号msg- 要发送的内容autoEscape- 消息内容是否作为纯文本发送 ( 即不解析 CQ 码 ) , 只在 message 字段是字符串时有效- Returns:
- result
ActionDataofMsgId
-
sendGroupMsg
发送群消息- Specified by:
sendGroupMsgin interfaceOneBot- Parameters:
groupId- 群号msg- 消息链autoEscape- 消息内容是否作为纯文本发送 ( 即不解析 CQ 码 ) , 只在 message 字段是字符串时有效- Returns:
- result
ActionDataofMsgId
-
sendGroupMsg
发送群消息- Specified by:
sendGroupMsgin interfaceOneBot- Parameters:
groupId- 群号userId- 调用者的QQ号 , 在QQ开放平台中用于设定@对象,如果不设置此参数会导致: 在bot返回前如果被不同用户多次调用,只会@最后一次调用的用户msg- 要发送的内容autoEscape- 消息内容是否作为纯文本发送 ( 即不解析 CQ 码 ) , 只在 message 字段是字符串时有效- Returns:
- result
ActionDataofMsgId
-
sendGroupMsg
public ActionData<MsgId> sendGroupMsg(long groupId, long userId, List<ArrayMsg> msg, boolean autoEscape) 发送群消息- Specified by:
sendGroupMsgin interfaceGensokyoExtend- Parameters:
groupId- 群号userId- 调用者的QQ号 , 在QQ开放平台中用于设定@对象,如果不设置此参数会导致: 在bot返回前如果被不同用户多次调用,只会@最后一次调用的用户msg- 要发送的内容autoEscape- 消息内容是否作为纯文本发送 ( 即不解析 CQ 码 ) , 只在 message 字段是字符串时有效- Returns:
- result
ActionDataofMsgId
-
getGuildMemberList
获取频道成员列表 由于频道人数较多(数万), 请尽量不要全量拉取成员列表, 这将会导致严重的性能问题 尽量使用 getGuildMemberProfile 接口代替全量拉取 nextToken 为空的情况下, 将返回第一页的数据, 并在返回值附带下一页的 token- Specified by:
getGuildMemberListin interfaceGoCQHTTPExtend- Parameters:
guildId- 频道IDnextToken- 翻页Token- Returns:
- result
ActionDataofGuildMemberListResp
-
sendGuildMsg
发送信息到子频道- Specified by:
sendGuildMsgin interfaceGoCQHTTPExtend- Parameters:
guildId- 频道 IDchannelId- 子频道 IDmsg- 要发送的内容- Returns:
- result
ActionDataofGuildMsgId
-
getGuildMsg
获取频道消息- Specified by:
getGuildMsgin interfaceGoCQHTTPExtend- Parameters:
guildMsgId- 频道 IDnoCache- 是否使用缓存- Returns:
- result
ActionDataofGetGuildMsgResp
-
getGuildServiceProfile
获取频道系统内 BOT 的资料- Specified by:
getGuildServiceProfilein interfaceGoCQHTTPExtend- Returns:
- result
ActionDataofGuildServiceProfileResp
-
getGuildList
获取频道列表- Specified by:
getGuildListin interfaceGoCQHTTPExtend- Returns:
- result
ActionListofGuildListResp
-
getGuildMetaByGuest
通过访客获取频道元数据- Specified by:
getGuildMetaByGuestin interfaceGoCQHTTPExtend- Parameters:
guildId- 频道 ID- Returns:
- result
ActionDataofGuildMetaByGuestResp
-
getGuildChannelList
获取子频道列表- Specified by:
getGuildChannelListin interfaceGoCQHTTPExtend- Parameters:
guildId- 频道 IDnoCache- 是否无视缓存- Returns:
- result
ActionListofChannelInfoResp
-
getGuildMemberProfile
单独获取频道成员信息- Specified by:
getGuildMemberProfilein interfaceGoCQHTTPExtend- Parameters:
guildId- 频道IDuserId- 用户ID- Returns:
- result
ActionDataofGuildMemberProfileResp
-
getMsg
获取消息- Specified by:
getMsgin interfaceOneBot- Parameters:
msgId- 消息 ID- Returns:
- result
ActionDataofMsgResp
-
deleteMsg
撤回消息 -
deleteMsg
撤回消息(兼容gsk)- Specified by:
deleteMsgin interfaceGensokyoExtend- Parameters:
groupId- 群号userId- 用户idmsgId- 消息 ID- Returns:
- result
ActionRaw
-
setGroupKick
群组踢人- Specified by:
setGroupKickin interfaceOneBot- Parameters:
groupId- 群号userId- 要踢的 QQ 号rejectAddRequest- 拒绝此人的加群请求 (默认false)- Returns:
- result
ActionRaw
-
setGroupBan
群组单人禁言- Specified by:
setGroupBanin interfaceOneBot- Parameters:
groupId- 群号userId- 要禁言的 QQ 号duration- 禁言时长, 单位秒, 0 表示取消禁言 (默认30 * 60)- Returns:
- result
ActionRaw
-
setGroupWholeBan
全体禁言- Specified by:
setGroupWholeBanin interfaceOneBot- Parameters:
groupId- 群号enable- 是否禁言(默认True,False为取消禁言)- Returns:
- result
ActionRaw
-
setGroupAdmin
群组设置管理员- Specified by:
setGroupAdminin interfaceOneBot- Parameters:
groupId- 群号userId- 要设置管理员的 QQ 号enable- true 为设置,false 为取消- Returns:
- result
ActionRaw
-
setGroupAnonymous
群组匿名- Specified by:
setGroupAnonymousin interfaceOneBot- Parameters:
groupId- 群号enable- 是否允许匿名聊天- Returns:
- result
ActionRaw
-
setGroupCard
设置群名片(群备注)- Specified by:
setGroupCardin interfaceOneBot- Parameters:
groupId- 群号userId- 要设置的 QQ 号card- 群名片内容,不填或空字符串表示删除群名片- Returns:
- result
ActionRaw
-
setGroupName
设置群名- Specified by:
setGroupNamein interfaceOneBot- Parameters:
groupId- 群号groupName- 新群名- Returns:
- result
ActionRaw
-
setGroupLeave
退出群组- Specified by:
setGroupLeavein interfaceOneBot- Parameters:
groupId- 群号isDismiss- 是否解散, 如果登录号是群主, 则仅在此项为 true 时能够解散- Returns:
- result
ActionRaw
-
setGroupSpecialTitle
设置群组专属头衔- Specified by:
setGroupSpecialTitlein interfaceGoCQHTTPExtend- Parameters:
groupId- 群号userId- 要设置的 QQ 号specialTitle- 专属头衔,不填或空字符串表示删除专属头衔duration- 专属头衔有效期,单位秒,-1 表示永久,不过此项似乎没有效果,可能是只有某些特殊的时间长度有效,有待测试- Returns:
- result
ActionRaw
-
setFriendAddRequest
处理加好友请求- Specified by:
setFriendAddRequestin interfaceOneBot- Parameters:
flag- 加好友请求的 flag(需从上报的数据中获得)approve- 是否同意请求(默认为true)remark- 添加后的好友备注(仅在同意时有效)- Returns:
- result
ActionRaw
-
setGroupAddRequest
处理加群请求/邀请- Specified by:
setGroupAddRequestin interfaceOneBot- Parameters:
flag- 加群请求的 flag(需从上报的数据中获得)subType- add 或 invite,请求类型(需要和上报消息中的 sub_type 字段相符)approve- 是否同意请求/邀请reason- 拒绝理由(仅在拒绝时有效)- Returns:
- result
ActionRaw
-
getLoginInfo
获取登录号信息- Specified by:
getLoginInfoin interfaceOneBot- Returns:
- result
ActionDataof @LoginInfoResp
-
getStrangerInfo
获取陌生人信息- Specified by:
getStrangerInfoin interfaceOneBot- Parameters:
userId- QQ 号noCache- 是否不使用缓存(使用缓存可能更新不及时,但响应更快)- Returns:
- result
ActionDataofStrangerInfoResp
-
getFriendList
获取好友列表- Specified by:
getFriendListin interfaceOneBot- Returns:
- result
ActionListofFriendInfoResp
-
deleteFriend
删除好友- Specified by:
deleteFriendin interfaceGoCQHTTPExtend- Parameters:
friendId- 好友 QQ 号- Returns:
- result
ActionRaw
-
getGroupInfo
获取群信息- Specified by:
getGroupInfoin interfaceOneBot- Parameters:
groupId- 群号noCache- 是否不使用缓存(使用缓存可能更新不及时,但响应更快)- Returns:
- result
ActionDataofGroupInfoResp
-
getGroupList
获取群列表- Specified by:
getGroupListin interfaceOneBot- Returns:
- result
ActionListofGroupInfoResp
-
getGroupMemberInfo
public ActionData<GroupMemberInfoResp> getGroupMemberInfo(long groupId, long userId, boolean noCache) 获取群成员信息- Specified by:
getGroupMemberInfoin interfaceOneBot- Parameters:
groupId- 群号userId- QQ 号noCache- 是否不使用缓存(使用缓存可能更新不及时,但响应更快)- Returns:
- result
ActionDataofGroupMemberInfoResp
-
getGroupMemberList
获取群成员列表- Specified by:
getGroupMemberListin interfaceOneBot- Parameters:
groupId- 群号- Returns:
- result
ActionListofGroupMemberInfoResp
-
getGroupMemberList
获取群成员列表- Specified by:
getGroupMemberListin interfaceGoCQHTTPExtend- Parameters:
groupId- 群号noCache- 是否不使用缓存(使用缓存可能更新不及时,但响应更快)- Returns:
- result
ActionListofGroupMemberInfoResp
-
getVersionInfo
Description copied from interface:GoCQHTTPExtend获取版本信息- Specified by:
getVersionInfoin interfaceGoCQHTTPExtend- Returns:
- result
ActionDataofVersionInfoResp - See Also:
-
getGroupHonorInfo
获取群荣誉信息- Specified by:
getGroupHonorInfoin interfaceOneBot- Parameters:
groupId- 群号type- 要获取的群荣誉类型, 可传入 talkative performer legend strong_newbie emotion 以分别获取单个类型的群荣誉数据, 或传入 all 获取所有数据- Returns:
- result
ActionDataofGroupHonorInfoResp
-
canSendImage
检查是否可以发送图片- Specified by:
canSendImagein interfaceOneBot- Returns:
- result
ActionDataofBooleanResp
-
canSendRecord
检查是否可以发送语音- Specified by:
canSendRecordin interfaceOneBot- Returns:
- result
ActionDataofBooleanResp
-
setGroupPortrait
设置群头像 目前这个API在登录一段时间后因cookie失效而失效, 请考虑后使用- Specified by:
setGroupPortraitin interfaceGoCQHTTPExtend- Parameters:
groupId- 群号file- 图片文件名(支持绝对路径,网络URL,Base64编码)cache- 表示是否使用已缓存的文件 (通过网络URL发送时有效, 1表示使用缓存, 0关闭关闭缓存, 默认为1)- Returns:
- result
ActionRaw
-
checkUrlSafely
检查链接安全性 安全等级, 1: 安全 2: 未知 3: 危险- Specified by:
checkUrlSafelyin interfaceGoCQHTTPExtend- Parameters:
url- 需要检查的链接- Returns:
- result
ActionDataofCheckUrlSafelyResp
-
sendGroupNotice
发送群公告- Specified by:
sendGroupNoticein interfaceGoCQHTTPExtend- Parameters:
groupId- 群号content- 公告内容- Returns:
- result
ActionRaw
-
getGroupAtAllRemain
获取群 @全体成员 剩余次数- Specified by:
getGroupAtAllRemainin interfaceGoCQHTTPExtend- Parameters:
groupId- 群号- Returns:
- result
ActionDataofGroupAtAllRemainResp
-
uploadGroupFile
上传群文件 在不提供 folder 参数的情况下默认上传到根目录 只能上传本地文件, 需要上传 http 文件的话请先下载到本地- Specified by:
uploadGroupFilein interfaceGoCQHTTPExtend- Parameters:
groupId- 群号file- 本地文件路径name- 储存名称folder- 父目录ID- Returns:
- result
ActionRaw
-
uploadGroupFile
上传群文件 在不提供 folder 参数的情况下默认上传到根目录 只能上传本地文件, 需要上传 http 文件的话请先下载到本地- Specified by:
uploadGroupFilein interfaceGoCQHTTPExtend- Parameters:
groupId- 群号file- 本地文件路径name- 储存名称- Returns:
- result
ActionRaw
-
setGroupAnonymousBan
群组匿名用户禁言- Specified by:
setGroupAnonymousBanin interfaceOneBot- Parameters:
groupId- 群号anonymous- 要禁言的匿名用户对象(群消息上报的 anonymous 字段)duration- 禁言时长,单位秒,无法取消匿名用户禁言- Returns:
- result
ActionRaw
-
setGroupAnonymousBan
群组匿名用户禁言- Specified by:
setGroupAnonymousBanin interfaceOneBot- Parameters:
groupId- 群号flag- 要禁言的匿名用户的 flag(需从群消息上报的数据中获得)duration- 禁言时长,单位秒,无法取消匿名用户禁言- Returns:
- result
ActionRaw
-
downloadFile
调用 go cq http 下载文件- Specified by:
downloadFilein interfaceGoCQHTTPExtend- Parameters:
url- 链接地址threadCount- 下载线程数headers- 自定义请求头- Returns:
- result
ActionDataofDownloadFileResp
-
downloadFile
调用 go cq http 下载文件- Specified by:
downloadFilein interfaceGoCQHTTPExtend- Parameters:
url- 链接地址- Returns:
- result
ActionDataofDownloadFileResp
-
sendGroupForwardMsg
发送合并转发 (群)- Specified by:
sendGroupForwardMsgin interfaceGoCQHTTPExtend- Parameters:
groupId- 群号msg- 自定义转发消息 (可使用 ShiroUtils.generateForwardMsg() 方法创建) 参考文档- Returns:
- result
ActionRaw
-
getGroupRootFiles
获取群根目录文件列表- Specified by:
getGroupRootFilesin interfaceGoCQHTTPExtend- Parameters:
groupId- 群号- Returns:
- result
ActionDataofGroupFilesResp
-
getGroupFilesByFolder
获取群子目录文件列表- Specified by:
getGroupFilesByFolderin interfaceGoCQHTTPExtend- Parameters:
groupId- 群号folderId- 文件夹ID 参考 Folder 对象- Returns:
- result
ActionDataofGroupFilesResp
-
getEssenceMsgList
获取精华消息列表- Specified by:
getEssenceMsgListin interfaceGoCQHTTPExtend- Parameters:
groupId- 群号- Returns:
- result
ActionListofEssenceMsgResp
-
setEssenceMsg
设置精华消息- Specified by:
setEssenceMsgin interfaceGoCQHTTPExtend- Parameters:
msgId- 消息 ID- Returns:
- result
ActionRaw
-
deleteEssenceMsg
移出精华消息- Specified by:
deleteEssenceMsgin interfaceGoCQHTTPExtend- Parameters:
msgId- 消息 ID- Returns:
- result
ActionRaw
-
setBotProfile
public ActionRaw setBotProfile(String nickname, String company, String email, String college, String personalNote) 设置机器人账号资料- Specified by:
setBotProfilein interfaceGoCQHTTPExtend- Parameters:
nickname- 昵称company- 公司email- 邮箱college- 学校personalNote- 个性签名- Returns:
- result
ActionRaw
-
sendPrivateForwardMsg
发送合并转发 (私聊)- Specified by:
sendPrivateForwardMsgin interfaceGoCQHTTPExtend- Parameters:
userId- 目标用户msg- 自定义转发消息 (可使用 ShiroUtils.generateForwardMsg() 方法创建) 参考文档- Returns:
- result
ActionRaw
-
sendForwardMsg
发送合并转发- Specified by:
sendForwardMsgin interfaceGoCQHTTPExtend- Parameters:
event- 事件msg- 自定义转发消息 (可使用 ShiroUtils.generateForwardMsg() 方法创建) 参考文档- Returns:
- result
ActionRaw
-
sendGroupForwardMsg
public ActionData<MsgId> sendGroupForwardMsg(long groupId, List<Map<String, Object>> msg, String prompt, String source, String summary, List<Map<String, String>> news) 发送群聊嵌套聊天记录- Parameters:
groupId- 为要发送的群聊msg- 为消息记录prompt- 为在外部消息列表显示的文字source- 为顶部文本summary- 为底部文本news- 为外显的摘要消息,最多三条;内容的构建参考消息节点。一般来说key为text,value为文本内容 来生成单条聊天记录
-
sendPrivateForwardMsg
public ActionData<MsgId> sendPrivateForwardMsg(long userId, List<Map<String, Object>> msg, String prompt, String source, String summary, List<Map<String, String>> news) 发送私聊嵌套聊天记录- Parameters:
userId- 为要发送的用户msg- 为消息记录prompt- 为在外部消息列表显示的文字source- 为顶部文本summary- 为底部文本news- 为外显的摘要消息,最多三条;内容的构建参考消息节点。一般来说key为text,value为文本内容 来生成单条聊天记录
-
getWordSlices
获取中文分词- Specified by:
getWordSlicesin interfaceGoCQHTTPExtend- Parameters:
content- 内容- Returns:
- result
ActionDataofWordSlicesResp
-
getOnlineClients
获取当前账号在线客户端列表- Specified by:
getOnlineClientsin interfaceGoCQHTTPExtend- Parameters:
noCache- 是否无视缓存- Returns:
- result
ActionDataofClientsResp
-
ocrImage
图片 OCR- Specified by:
ocrImagein interfaceGoCQHTTPExtend- Parameters:
image- 图片ID- Returns:
- result
ActionDataofOcrResp
-
uploadPrivateFile
私聊发送文件- Specified by:
uploadPrivateFilein interfaceGoCQHTTPExtend- Parameters:
userId- 目标用户file- 本地文件路径name- 文件名- Returns:
- result
ActionRaw
-
sendGroupSign
群打卡- Specified by:
sendGroupSignin interfaceGoCQHTTPExtend- Parameters:
groupId- 群号- Returns:
- result
ActionRaw
-
deleteUnidirectionalFriend
删除单向好友- Specified by:
deleteUnidirectionalFriendin interfaceGoCQHTTPExtend- Parameters:
userId- QQ号- Returns:
- result
ActionRaw
-
getUnidirectionalFriendList
获取单向好友列表- Specified by:
getUnidirectionalFriendListin interfaceGoCQHTTPExtend- Returns:
- result
ActionListofUnidirectionalFriendListResp
-
getGroupFileUrl
获取群文件资源链接- Specified by:
getGroupFileUrlin interfaceGoCQHTTPExtend- Parameters:
groupId- 群号fileId- 文件IDbusId- 文件类型- Returns:
- result
ActionDataofUrlResp
-
getFile
获取群文件资源链接- Specified by:
getFilein interfaceLLOneBotExtend- Parameters:
groupId- 群号fileId- 文件IDbusId- 文件类型- Returns:
- result
ActionDataofUrlResp
-
createGroupFileFolder
创建群文件文件夹- Specified by:
createGroupFileFolderin interfaceGoCQHTTPExtend- Parameters:
groupId- 群号folderName- 文件夹名- Returns:
- result
ActionRaw
-
deleteGroupFileFolder
删除群文件文件夹- Specified by:
deleteGroupFileFolderin interfaceGoCQHTTPExtend- Parameters:
groupId- 群号folderId- 文件夹ID- Returns:
- result
ActionRaw
-
deleteGroupFile
删除群文件- Specified by:
deleteGroupFilein interfaceGoCQHTTPExtend- Parameters:
groupId- 群号fileId- 文件IDbusId- 文件类型- Returns:
- result
ActionRaw
-
sendLike
好友点赞 -
getStatus
获取状态- Specified by:
getStatusin interfaceOneBot- Returns:
- result
GetStatusResp
-
fetchCustomFace
获取收藏表情- Specified by:
fetchCustomFacein interfaceLagrangeExtend- Returns:
- 表情的下载 URL
-
sendForwardMsg
获取合并转发消息Id- Specified by:
sendForwardMsgin interfaceLagrangeExtend- Parameters:
msg- 自定义转发消息 (可使用 ShiroUtils.generateForwardMsg() 方法创建)- Returns:
- result
ActionDataofString合并转发的消息Id
-
getGroupMsgHistory
public ActionData<GetMsgListResp> getGroupMsgHistory(long groupId, Long messageSeq, int count, boolean reverseOrder) 获取群聊历史消息记录- Specified by:
getGroupMsgHistoryin interfaceNapCatExtend- Parameters:
groupId- 指定的群聊messageSeq- 指定的消息idcount- 获取的消息条数reverseOrder- 是否反转获取到的消息,false:返回的消息为正序;true:返回的消息为倒序- Returns:
- 返回的消息列表
-
getFriendMsgHistory
public ActionData<GetMsgListResp> getFriendMsgHistory(long userId, Long messageSeq, int count, boolean reverseOrder) 获取好友历史消息记录- Specified by:
getFriendMsgHistoryin interfaceNapCatExtend- Parameters:
userId- 指定的好友messageSeq- 指定的消息idcount- 获取的消息条数reverseOrder- 是否反转获取到的消息,false:返回的消息为正序;true:返回的消息为倒序- Returns:
- 返回的消息列表
-
sendFriendPoke
- Specified by:
sendFriendPokein interfaceNapCatExtend
-
sendFriendPoke
- Specified by:
sendFriendPokein interfaceNapCatExtend
-
sendGroupPoke
- Specified by:
sendGroupPokein interfaceNapCatExtend
-
setGroupReaction
设置群消息表情回应- Specified by:
setGroupReactionin interfaceLagrangeExtend- Parameters:
groupId- 群号msgId- 消息 IDcode- 表情 IDisAdd- 添加/取消 回应- Returns:
- result
ActionRaw
-
setMsgEmojiLike
设置消息表情回应(贴表情)- Specified by:
setMsgEmojiLikein interfaceNapCatExtend- Parameters:
msgId- 消息 IDcode- 表情 IDisSet- 添加/取消 回应- Returns:
- result
ActionRaw
-
getForwardMsg
获取合并转发消息- Parameters:
msgId- 消息ID- Returns:
- result
ActionDataofGetForwardMsgResp
-
customRequest
自定义请求- Parameters:
action- 请求路径params- 请求参数- Returns:
- result
ActionData
-
customRequest
public <T> ActionData<T> customRequest(ActionPath action, Map<String, Object> params, Class<T> clazz) 自定义请求- Parameters:
action- 请求路径params- 请求参数- Returns:
- result
ActionData
-
customRawRequest
自定义请求- Parameters:
action- 请求路径params- 请求参数- Returns:
- result
ActionData
-
customRawRequest
public <T> ActionData<T> customRawRequest(ActionPath action, Map<String, Object> params, Class<T> clazz) 自定义请求- Parameters:
action- 请求路径params- 请求参数- Returns:
- result
ActionData
-
getSelfId
public long getSelfId() -
getActionHandler
-
getSession
public org.springframework.web.socket.WebSocketSession getSession() -
getPluginList
-
getAnnotationMethodContainer
-
getBotMessageEventInterceptor
-
setSelfId
public void setSelfId(long selfId) -
setToken
-
setActionHandler
-
setSession
public void setSession(org.springframework.web.socket.WebSocketSession session) -
setPluginList
-
setAnnotationMethodContainer
public void setAnnotationMethodContainer(BotFactory.AnnotationMethodContainer annotationMethodContainer) -
setBotMessageEventInterceptor
public void setBotMessageEventInterceptor(Class<? extends BotMessageEventInterceptor> botMessageEventInterceptor)
-