mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
feat: new Api GetGroupEssence&GetGroupHonorInfo
This commit is contained in:
parent
6e5cfd827c
commit
9672f67a23
20
src/onebot11/action/group/GetGroupEssence.ts
Normal file
20
src/onebot11/action/group/GetGroupEssence.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { GroupEssenceMsgRet, WebApi } from "@/ntqqapi/api";
|
||||||
|
import BaseAction from "../BaseAction";
|
||||||
|
import { ActionName } from "../types";
|
||||||
|
|
||||||
|
interface PayloadType {
|
||||||
|
group_id: number;
|
||||||
|
pages: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GetGroupEssence extends BaseAction<PayloadType, GroupEssenceMsgRet> {
|
||||||
|
actionName = ActionName.GoCQHTTP_GetEssenceMsg;
|
||||||
|
|
||||||
|
protected async _handle(payload: PayloadType) {
|
||||||
|
const ret = await WebApi.getGroupEssenceMsg(payload.group_id.toString(), payload.pages.toString());
|
||||||
|
if (!ret) {
|
||||||
|
throw new Error('获取失败');
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
22
src/onebot11/action/group/GetGroupHonorInfo.ts
Normal file
22
src/onebot11/action/group/GetGroupHonorInfo.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import { WebApi, WebHonorType } from "@/ntqqapi/api";
|
||||||
|
import { ActionName } from "../types";
|
||||||
|
import BaseAction from "../BaseAction";
|
||||||
|
|
||||||
|
interface Payload {
|
||||||
|
group_id: number,
|
||||||
|
type?: WebHonorType
|
||||||
|
}
|
||||||
|
export class GetGroupHonorInfo extends BaseAction<Payload, Array<any>> {
|
||||||
|
actionName = ActionName.GetGroupHonorInfo;
|
||||||
|
|
||||||
|
protected async _handle(payload: Payload) {
|
||||||
|
// console.log(await NTQQUserApi.getRobotUinRange());
|
||||||
|
if (!payload.group_id) {
|
||||||
|
throw '缺少参数group_id';
|
||||||
|
}
|
||||||
|
if (!payload.type) {
|
||||||
|
payload.type = WebHonorType.ALL;
|
||||||
|
}
|
||||||
|
return await WebApi.getGroupHonorInfo(payload.group_id.toString(), payload.type);
|
||||||
|
}
|
||||||
|
}
|
@ -47,6 +47,8 @@ import { GoCQHTTGetForwardMsgAction } from './go-cqhttp/GetForwardMsg'
|
|||||||
import { GetCookies } from './user/GetCookie'
|
import { GetCookies } from './user/GetCookie'
|
||||||
import { SetMsgEmojiLike } from './msg/SetMsgEmojiLike'
|
import { SetMsgEmojiLike } from './msg/SetMsgEmojiLike'
|
||||||
import { ForwardFriendSingleMsg, ForwardSingleGroupMsg } from './msg/ForwardSingleMsg'
|
import { ForwardFriendSingleMsg, ForwardSingleGroupMsg } from './msg/ForwardSingleMsg'
|
||||||
|
import { GetGroupEssence } from './group/GetGroupEssence'
|
||||||
|
import { GetGroupHonorInfo } from './group/GetGroupHonorInfo'
|
||||||
|
|
||||||
export const actionHandlers = [
|
export const actionHandlers = [
|
||||||
new GetFile(),
|
new GetFile(),
|
||||||
@ -89,6 +91,8 @@ export const actionHandlers = [
|
|||||||
new ForwardFriendSingleMsg(),
|
new ForwardFriendSingleMsg(),
|
||||||
new ForwardSingleGroupMsg(),
|
new ForwardSingleGroupMsg(),
|
||||||
//以下为go-cqhttp api
|
//以下为go-cqhttp api
|
||||||
|
new GetGroupEssence(),
|
||||||
|
new GetGroupHonorInfo(),
|
||||||
new GoCQHTTPSendForwardMsg(),
|
new GoCQHTTPSendForwardMsg(),
|
||||||
new GoCQHTTPSendGroupForwardMsg(),
|
new GoCQHTTPSendGroupForwardMsg(),
|
||||||
new GoCQHTTPSendPrivateForwardMsg(),
|
new GoCQHTTPSendPrivateForwardMsg(),
|
||||||
|
@ -66,4 +66,6 @@ export enum ActionName {
|
|||||||
GoCQHTTP_DownloadFile = 'download_file',
|
GoCQHTTP_DownloadFile = 'download_file',
|
||||||
GoCQHTTP_GetGroupMsgHistory = 'get_group_msg_history',
|
GoCQHTTP_GetGroupMsgHistory = 'get_group_msg_history',
|
||||||
GoCQHTTP_GetForwardMsg = 'get_forward_msg',
|
GoCQHTTP_GetForwardMsg = 'get_forward_msg',
|
||||||
|
GoCQHTTP_GetEssenceMsg = "get_essence_msg_list",
|
||||||
|
GetGroupHonorInfo = "get_group_honor_info",
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user