diff --git a/src/core/apis/group.ts b/src/core/apis/group.ts index 29e788b4..32d932d7 100644 --- a/src/core/apis/group.ts +++ b/src/core/apis/group.ts @@ -448,7 +448,7 @@ export class NTQQGroupApi { } async getGroupRemainAtTimes(GroupCode: string) { - this.context.session.getGroupService().getGroupRemainAtTimes(GroupCode); + return this.context.session.getGroupService().getGroupRemainAtTimes(GroupCode); } async getMemberExtInfo(groupCode: string, uin: string) { diff --git a/src/core/services/NodeIKernelBuddyService.ts b/src/core/services/NodeIKernelBuddyService.ts index 0de96b69..0deef0d7 100644 --- a/src/core/services/NodeIKernelBuddyService.ts +++ b/src/core/services/NodeIKernelBuddyService.ts @@ -66,7 +66,11 @@ export interface NodeIKernelBuddyService { accept: boolean; }): Promise; - delBuddy(uid: number): void; + delBuddy(param: { + friendUid: string; + tempBlock: boolean; + tempBothDel: boolean; + }): Promise; delBatchBuddy(uids: number[]): void; diff --git a/src/core/services/NodeIKernelGroupService.ts b/src/core/services/NodeIKernelGroupService.ts index d46255af..e1be4b46 100644 --- a/src/core/services/NodeIKernelGroupService.ts +++ b/src/core/services/NodeIKernelGroupService.ts @@ -115,7 +115,7 @@ export interface NodeIKernelGroupService { destroyMemberListScene(SceneId: string): void; getNextMemberList(sceneId: string, a: undefined, num: number): Promise<{ - errCode: number, + errCode: number, errMsg: string, result: { ids: string[], infos: Map, finish: boolean, hasRobot: boolean } }>; @@ -225,7 +225,15 @@ export interface NodeIKernelGroupService { getGroupStatisticInfo(groupCode: string): unknown; - getGroupRemainAtTimes(groupCode: string): number; + getGroupRemainAtTimes(groupCode: string): Promise; getJoinGroupNoVerifyFlag(groupCode: string): unknown; diff --git a/src/core/wrapper.ts b/src/core/wrapper.ts index d89e57dd..63978b0c 100644 --- a/src/core/wrapper.ts +++ b/src/core/wrapper.ts @@ -86,7 +86,7 @@ export interface NodeQQNTWrapperUtil { calcThumbSize(arg0: number, arg1: number, arg2: unknown): unknown; - fullWordToHalfWord(arg0: string): unknown; + fullWordToHalfWord(word: string): unknown; getNTUserDataInfoConfig(): unknown; diff --git a/src/onebot/action/go-cqhttp/GetGroupAtAllRemain.ts b/src/onebot/action/go-cqhttp/GetGroupAtAllRemain.ts new file mode 100644 index 00000000..798541c4 --- /dev/null +++ b/src/onebot/action/go-cqhttp/GetGroupAtAllRemain.ts @@ -0,0 +1,30 @@ +import BaseAction from '../BaseAction'; +import { ActionName } from '../types'; +import { FromSchema, JSONSchema } from 'json-schema-to-ts'; + +const SchemaData = { + type: 'object', + properties: { + group_id: { type: ['number', 'string'] } + }, + required: ['group_id'], +} as const satisfies JSONSchema; +type Payload = FromSchema; + +export class GoCQHTTPGetGroupAtAllRemain extends BaseAction { + actionName = ActionName.GoCQHTTP_GetGroupAtAllRemain; + payloadSchema = SchemaData; + + async _handle(payload: Payload) { + let ret = await this.core.apis.GroupApi.getGroupRemainAtTimes(payload.group_id.toString()); + if (!ret.atInfo || ret.result !== 0) { + throw new Error('atInfo not found'); + } + let data = { + can_at_all: ret.atInfo.canAtAll, + remain_at_all_count_for_group: ret.atInfo.RemainAtAllCountForGroup, + remain_at_all_count_for_uin: ret.atInfo.RemainAtAllCountForUin + }; + return data; + } +} diff --git a/src/onebot/action/go-cqhttp/GoCQHTTPCheckUrlSafely.ts b/src/onebot/action/go-cqhttp/GoCQHTTPCheckUrlSafely.ts new file mode 100644 index 00000000..7d026d10 --- /dev/null +++ b/src/onebot/action/go-cqhttp/GoCQHTTPCheckUrlSafely.ts @@ -0,0 +1,21 @@ +import BaseAction from '../BaseAction'; +import { ActionName } from '../types'; +import { FromSchema, JSONSchema } from 'json-schema-to-ts'; + +const SchemaData = { + type: 'object', + properties: { + url: { type: 'string' }, + }, + required: ['url'], +} as const satisfies JSONSchema; +type Payload = FromSchema; + +export class GoCQHTTPCheckUrlSafely extends BaseAction { + actionName = ActionName.GoCQHTTP_CheckUrlSafely; + payloadSchema = SchemaData; + + async _handle(payload: Payload) { + return { level: 1 }; + } +} diff --git a/src/onebot/action/go-cqhttp/GoCQHTTPGetModelShow.ts b/src/onebot/action/go-cqhttp/GoCQHTTPGetModelShow.ts new file mode 100644 index 00000000..9b442b63 --- /dev/null +++ b/src/onebot/action/go-cqhttp/GoCQHTTPGetModelShow.ts @@ -0,0 +1,28 @@ +import BaseAction from '../BaseAction'; +import { ActionName } from '../types'; +import { FromSchema, JSONSchema } from 'json-schema-to-ts'; + +const SchemaData = { + type: 'object', + properties: { + model: { type: 'string' }, + } +} as const satisfies JSONSchema; +type Payload = FromSchema; + +export class GoCQHTTPGetModelShow extends BaseAction { + actionName = ActionName.GoCQHTTP_GetModelShow; + payloadSchema = SchemaData; + + async _handle(payload: Payload) { + if (!payload.model) { + payload.model = 'napcat'; + } + return [{ + variants: { + model_show: "napcat", + need_pay: false + } + }]; + } +} diff --git a/src/onebot/action/go-cqhttp/GoCQHTTPSetModelShow.ts b/src/onebot/action/go-cqhttp/GoCQHTTPSetModelShow.ts new file mode 100644 index 00000000..f50eb5f2 --- /dev/null +++ b/src/onebot/action/go-cqhttp/GoCQHTTPSetModelShow.ts @@ -0,0 +1,19 @@ +import BaseAction from '../BaseAction'; +import { ActionName } from '../types'; +import { FromSchema, JSONSchema } from 'json-schema-to-ts'; + +const SchemaData = { + type: 'object', + properties: {}, +} as const satisfies JSONSchema; +type Payload = FromSchema; + +//兼容性代码 +export class GoCQHTTPSetModelShow extends BaseAction { + actionName = ActionName.GoCQHTTP_SetModelShow; + payloadSchema = SchemaData; + + async _handle(payload: Payload) { + return null; + } +} diff --git a/src/onebot/action/go-cqhttp/SetModelShow.ts b/src/onebot/action/go-cqhttp/SetModelShow.ts deleted file mode 100644 index be648e17..00000000 --- a/src/onebot/action/go-cqhttp/SetModelShow.ts +++ /dev/null @@ -1,10 +0,0 @@ -import BaseAction from '../BaseAction'; -import { ActionName } from '../types'; - -export default class SetModelShow extends BaseAction { - actionName = ActionName.SetModelShow; - - async _handle(payload: null): Promise { - return null; - } -} diff --git a/src/onebot/action/index.ts b/src/onebot/action/index.ts index a2cbf7ef..e1698fba 100644 --- a/src/onebot/action/index.ts +++ b/src/onebot/action/index.ts @@ -71,7 +71,6 @@ import { FetchUserProfileLike } from './extends/FetchUserProfileLike'; import { NapCatCore } from '@/core'; import { NapCatOneBot11Adapter } from '@/onebot'; import GetGuildProfile from './guild/GetGuildProfile'; -import SetModelShow from './go-cqhttp/SetModelShow'; import { SetInputStatus } from './extends/SetInputStatus'; import { GetCSRF } from './system/GetCSRF'; import { DelGroupNotice } from './group/DelGroupNotice'; @@ -94,6 +93,10 @@ import { GetPacketStatus } from "@/onebot/action/packet/GetPacketStatus"; import { FriendPoke } from "@/onebot/action/user/FriendPoke"; import { GetCredentials } from './system/GetCredentials'; import { SetGroupSign } from './extends/SetGroupSign'; +import { GoCQHTTPGetGroupAtAllRemain } from './go-cqhttp/GetGroupAtAllRemain'; +import { GoCQHTTPCheckUrlSafely } from './go-cqhttp/GoCQHTTPCheckUrlSafely'; +import { GoCQHTTPGetModelShow } from './go-cqhttp/GoCQHTTPGetModelShow'; +import { GoCQHTTPSetModelShow } from './go-cqhttp/GoCQHTTPSetModelShow'; export type ActionMap = Map>; @@ -151,6 +154,7 @@ export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCo new GetRobotUinRange(obContext, core), new GetFriendWithCategory(obContext, core), //以下为go-cqhttp api + new GoCQHTTPCheckUrlSafely(obContext, core), new GetOnlineClient(obContext, core), new OCRImage(obContext, core), new IOCRImage(obContext, core), @@ -158,6 +162,7 @@ export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCo new SendGroupNotice(obContext, core), new GetGroupNotice(obContext, core), new GetGroupEssence(obContext, core), + new GoCQHTTPGetGroupAtAllRemain(obContext, core), new GoCQHTTPSendForwardMsg(obContext, core), new GoCQHTTPSendGroupForwardMsg(obContext, core), new GoCQHTTPSendPrivateForwardMsg(obContext, core), @@ -180,7 +185,9 @@ export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCo new FetchCustomFace(obContext, core), new GoCQHTTPUploadPrivateFile(obContext, core), new GetGuildProfile(obContext, core), - new SetModelShow(obContext, core), + new GoCQHTTPGetModelShow(obContext, core), + new GoCQHTTPSetModelShow(obContext, core), + new GoCQHTTPCheckUrlSafely(obContext, core), new SetInputStatus(obContext, core), new GetCSRF(obContext, core), new GetCredentials(obContext, core), diff --git a/src/onebot/action/types.ts b/src/onebot/action/types.ts index 7ab3f71a..774a73ef 100644 --- a/src/onebot/action/types.ts +++ b/src/onebot/action/types.ts @@ -57,8 +57,8 @@ export enum ActionName { // go-cqhttp SetQQProfile = 'set_qq_profile', // QidianGetAccountInfo = 'qidian_get_account_info', - // GetModelShow = '_get_model_show', - // SetModelShow = '_set_model_show', + GoCQHTTP_GetModelShow = '_get_model_show', + GoCQHTTP_SetModelShow = '_set_model_show', GetOnlineClient = 'get_online_clients', // GetUnidirectionalFriendList = 'get_unidirectional_friend_list', // DeleteFriend = 'delete_friend', @@ -71,7 +71,7 @@ export enum ActionName { IOCRImage = '.ocr_image', GetGroupSystemMsg = 'get_group_system_msg', GoCQHTTP_GetEssenceMsg = 'get_essence_msg_list', - // GetGroupAtAllRemain = 'get_group_at_all_remain', + GoCQHTTP_GetGroupAtAllRemain = 'get_group_at_all_remain', SetGroupPortrait = 'set_group_portrait', SetEssenceMsg = 'set_essence_msg', DelEssenceMsg = 'delete_essence_msg', @@ -88,8 +88,8 @@ export enum ActionName { GOCQHTTP_UploadPrivateFile = 'upload_private_file', // GOCQHTTP_ReloadEventFilter = 'reload_event_filter', GoCQHTTP_DownloadFile = 'download_file', - // GoCQHTTP_CheckUrlSafely = 'check_url_safely', - // GoCQHTTP_GetWordSlices = '.get_word_slices', + GoCQHTTP_CheckUrlSafely = 'check_url_safely', + GoCQHTTP_GetWordSlices = '.get_word_slices', GoCQHTTP_HandleQuickAction = '.handle_quick_operation', // 以下为扩展napcat扩展