mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
Merge branch 'main' into pr/466
This commit is contained in:
commit
b44a9e696c
@ -34,7 +34,13 @@ export class NTQQFriendApi {
|
||||
data.forEach((value) => retMap.set(value.uin!, value.uid!));
|
||||
return retMap;
|
||||
}
|
||||
|
||||
async delBuudy(uid: string, tempBlock = false, tempBothDel = false) {
|
||||
return this.context.session.getBuddyService().delBuddy({
|
||||
friendUid: uid,
|
||||
tempBlock: tempBlock,
|
||||
tempBothDel: tempBothDel
|
||||
});
|
||||
}
|
||||
async getBuddyV2ExWithCate(refresh = false) {
|
||||
const categoryMap: Map<string, any> = new Map();
|
||||
const buddyService = this.context.session.getBuddyService();
|
||||
|
@ -449,7 +449,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) {
|
||||
|
@ -66,7 +66,11 @@ export interface NodeIKernelBuddyService {
|
||||
accept: boolean;
|
||||
}): Promise<void>;
|
||||
|
||||
delBuddy(uid: number): void;
|
||||
delBuddy(param: {
|
||||
friendUid: string;
|
||||
tempBlock: boolean;
|
||||
tempBothDel: boolean;
|
||||
}): Promise<unknown>;
|
||||
|
||||
delBatchBuddy(uids: number[]): void;
|
||||
|
||||
|
@ -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<string, GroupMember>, finish: boolean, hasRobot: boolean }
|
||||
}>;
|
||||
@ -225,7 +225,15 @@ export interface NodeIKernelGroupService {
|
||||
|
||||
getGroupStatisticInfo(groupCode: string): unknown;
|
||||
|
||||
getGroupRemainAtTimes(groupCode: string): number;
|
||||
getGroupRemainAtTimes(groupCode: string): Promise<GeneralCallResult & {
|
||||
atInfo: {
|
||||
canAtAll: boolean
|
||||
RemainAtAllCountForUin: number
|
||||
RemainAtAllCountForGroup: number
|
||||
atTimesMsg: string
|
||||
canNotAtAllMsg: ''
|
||||
}
|
||||
}>;
|
||||
|
||||
getJoinGroupNoVerifyFlag(groupCode: string): unknown;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
30
src/onebot/action/go-cqhttp/GetGroupAtAllRemain.ts
Normal file
30
src/onebot/action/go-cqhttp/GetGroupAtAllRemain.ts
Normal file
@ -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<typeof SchemaData>;
|
||||
|
||||
export class GoCQHTTPGetGroupAtAllRemain extends BaseAction<Payload, any> {
|
||||
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;
|
||||
}
|
||||
}
|
21
src/onebot/action/go-cqhttp/GoCQHTTPCheckUrlSafely.ts
Normal file
21
src/onebot/action/go-cqhttp/GoCQHTTPCheckUrlSafely.ts
Normal file
@ -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<typeof SchemaData>;
|
||||
|
||||
export class GoCQHTTPCheckUrlSafely extends BaseAction<Payload, any> {
|
||||
actionName = ActionName.GoCQHTTP_CheckUrlSafely;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
return { level: 1 };
|
||||
}
|
||||
}
|
38
src/onebot/action/go-cqhttp/GoCQHTTPDeleteFriend.ts
Normal file
38
src/onebot/action/go-cqhttp/GoCQHTTPDeleteFriend.ts
Normal file
@ -0,0 +1,38 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
|
||||
const SchemaData = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
friend_id: { type: ['string', 'number'] },
|
||||
temp_block: { type: 'boolean' },
|
||||
temp_both_del: { type: 'boolean' },
|
||||
},
|
||||
required: ['friend_id'],
|
||||
} as const satisfies JSONSchema;
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class GoCQHTTPDeleteFriend extends BaseAction<Payload, any> {
|
||||
actionName = ActionName.GoCQHTTP_DeleteFriend;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
let uid = await this.core.apis.UserApi.getUidByUinV2(payload.friend_id.toString());
|
||||
|
||||
if (!uid) {
|
||||
return {
|
||||
valid: false,
|
||||
message: '好友不存在',
|
||||
};
|
||||
}
|
||||
let isBuddy = await this.core.apis.FriendApi.isBuddy(uid);
|
||||
if (!isBuddy) {
|
||||
return {
|
||||
valid: false,
|
||||
message: '不是好友',
|
||||
};
|
||||
}
|
||||
return await this.core.apis.FriendApi.delBuudy(uid, payload.temp_block, payload.temp_both_del);
|
||||
}
|
||||
}
|
28
src/onebot/action/go-cqhttp/GoCQHTTPGetModelShow.ts
Normal file
28
src/onebot/action/go-cqhttp/GoCQHTTPGetModelShow.ts
Normal file
@ -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<typeof SchemaData>;
|
||||
|
||||
export class GoCQHTTPGetModelShow extends BaseAction<Payload, any> {
|
||||
actionName = ActionName.GoCQHTTP_GetModelShow;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
if (!payload.model) {
|
||||
payload.model = 'napcat';
|
||||
}
|
||||
return [{
|
||||
variants: {
|
||||
model_show: "napcat",
|
||||
need_pay: false
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
19
src/onebot/action/go-cqhttp/GoCQHTTPSetModelShow.ts
Normal file
19
src/onebot/action/go-cqhttp/GoCQHTTPSetModelShow.ts
Normal file
@ -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<typeof SchemaData>;
|
||||
|
||||
//兼容性代码
|
||||
export class GoCQHTTPSetModelShow extends BaseAction<Payload, any> {
|
||||
actionName = ActionName.GoCQHTTP_SetModelShow;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { ActionName } from '../types';
|
||||
|
||||
export default class SetModelShow extends BaseAction<null, null> {
|
||||
actionName = ActionName.SetModelShow;
|
||||
|
||||
async _handle(payload: null): Promise<null> {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -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,11 @@ 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';
|
||||
import { GoCQHTTPDeleteFriend } from './go-cqhttp/GoCQHTTPDeleteFriend';
|
||||
|
||||
|
||||
export type ActionMap = Map<string, BaseAction<any, any>>;
|
||||
@ -151,6 +155,8 @@ export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCo
|
||||
new GetRobotUinRange(obContext, core),
|
||||
new GetFriendWithCategory(obContext, core),
|
||||
//以下为go-cqhttp api
|
||||
new GoCQHTTPDeleteFriend(obContext, core),
|
||||
new GoCQHTTPCheckUrlSafely(obContext, core),
|
||||
new GetOnlineClient(obContext, core),
|
||||
new OCRImage(obContext, core),
|
||||
new IOCRImage(obContext, core),
|
||||
@ -158,6 +164,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 +187,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),
|
||||
|
@ -57,11 +57,11 @@ 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',
|
||||
GoCQHTTP_DeleteFriend = 'delete_friend',
|
||||
// DeleteUnidirectionalFriendList = 'delete_unidirectional_friend',
|
||||
GoCQHTTP_MarkMsgAsRead = 'mark_msg_as_read',
|
||||
GoCQHTTP_SendGroupForwardMsg = 'send_group_forward_msg',
|
||||
@ -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扩展
|
||||
|
Loading…
x
Reference in New Issue
Block a user