diff --git a/src/onebot/action/extends/CreateCollection.ts b/src/onebot/action/extends/CreateCollection.ts index 31ead457..2f994f3b 100644 --- a/src/onebot/action/extends/CreateCollection.ts +++ b/src/onebot/action/extends/CreateCollection.ts @@ -17,7 +17,7 @@ export class CreateCollection extends BaseAction { actionName = ActionName.CreateCollection; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { return await this.CoreContext.getApiContext().CollectionApi.createCollection( this.CoreContext.selfInfo.uin, this.CoreContext.selfInfo.uid, diff --git a/src/onebot/action/extends/FetchCustomFace.ts b/src/onebot/action/extends/FetchCustomFace.ts index 0ec29fcc..29dd101b 100644 --- a/src/onebot/action/extends/FetchCustomFace.ts +++ b/src/onebot/action/extends/FetchCustomFace.ts @@ -15,7 +15,7 @@ export class FetchCustomFace extends BaseAction { actionName = ActionName.FetchCustomFace; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { //48 可能正好是QQ需要的一个页面的数量 Tagged Mlikiowa const ret = await this.CoreContext.getApiContext().MsgApi.fetchFavEmojiList(payload.count || 48); return ret.emojiInfoList.map(e => e.url); diff --git a/src/onebot/action/extends/FetchEmojiLike.ts b/src/onebot/action/extends/FetchEmojiLike.ts index 6939021d..21fd64f7 100644 --- a/src/onebot/action/extends/FetchEmojiLike.ts +++ b/src/onebot/action/extends/FetchEmojiLike.ts @@ -23,7 +23,7 @@ export class FetchEmojiLike extends BaseAction { actionName = ActionName.FetchEmojiLike; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; const msgIdPeer = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString())); if (!msgIdPeer) throw new Error('消息不存在'); diff --git a/src/onebot/action/extends/GetCollectionList.ts b/src/onebot/action/extends/GetCollectionList.ts index 3251b2f3..9f9da5d6 100644 --- a/src/onebot/action/extends/GetCollectionList.ts +++ b/src/onebot/action/extends/GetCollectionList.ts @@ -17,7 +17,7 @@ export class GetCollectionList extends BaseAction { actionName = ActionName.GetCollectionList; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQCollectionApi = this.CoreContext.getApiContext().CollectionApi; return await NTQQCollectionApi.getAllCollection(payload.category, payload.count); } diff --git a/src/onebot/action/extends/GetFriendWithCategory.ts b/src/onebot/action/extends/GetFriendWithCategory.ts index 4b19fba8..ee10edb9 100644 --- a/src/onebot/action/extends/GetFriendWithCategory.ts +++ b/src/onebot/action/extends/GetFriendWithCategory.ts @@ -5,7 +5,7 @@ import { OB11Constructor } from '@/onebot/helper/constructor'; export class GetFriendWithCategory extends BaseAction { actionName = ActionName.GetFriendsWithCategory; - protected async _handle(payload: void) { + async _handle(payload: void) { if (this.CoreContext.context.basicInfoWrapper.requireMinNTQQBuild('26702')) { //全新逻辑 return OB11Constructor.friendsV2(await this.CoreContext.getApiContext().FriendApi.getBuddyV2ExWithCate(true)); diff --git a/src/onebot/action/extends/GetGroupAddRequest.ts b/src/onebot/action/extends/GetGroupAddRequest.ts index ce108f17..10e9f19e 100644 --- a/src/onebot/action/extends/GetGroupAddRequest.ts +++ b/src/onebot/action/extends/GetGroupAddRequest.ts @@ -10,7 +10,7 @@ interface OB11GroupRequestNotify { export default class GetGroupAddRequest extends BaseAction { actionName = ActionName.GetGroupIgnoreAddRequest; - protected async _handle(payload: null): Promise { + async _handle(payload: null): Promise { const data = await this.CoreContext.getApiContext().GroupApi.getGroupIgnoreNotifies(); // log(data); // const notifies: GroupNotify[] = data.notifies.filter(notify => notify.status === GroupNotifyStatus.WAIT_HANDLE); diff --git a/src/onebot/action/extends/GetProfileLike.ts b/src/onebot/action/extends/GetProfileLike.ts index 09ad5fb9..31e9a76c 100644 --- a/src/onebot/action/extends/GetProfileLike.ts +++ b/src/onebot/action/extends/GetProfileLike.ts @@ -4,7 +4,7 @@ import { ActionName } from '../types'; export class GetProfileLike extends BaseAction { actionName = ActionName.GetProfileLike; - protected async _handle(payload: void) { + async _handle(payload: void) { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const ret = await NTQQUserApi.getProfileLike(this.CoreContext.selfInfo.uid); const listdata: any[] = ret.info.userLikeInfos[0].favoriteInfo.userInfos; diff --git a/src/onebot/action/extends/GetRobotUinRange.ts b/src/onebot/action/extends/GetRobotUinRange.ts index a3d47d22..a65574d8 100644 --- a/src/onebot/action/extends/GetRobotUinRange.ts +++ b/src/onebot/action/extends/GetRobotUinRange.ts @@ -4,7 +4,7 @@ import { ActionName } from '../types'; export class GetRobotUinRange extends BaseAction> { actionName = ActionName.GetRobotUinRange; - protected async _handle(payload: void) { + async _handle(payload: void) { // console.log(await NTQQUserApi.getRobotUinRange()); const NTQQUserApi = this.CoreContext.getApiContext().UserApi; return await NTQQUserApi.getRobotUinRange(); diff --git a/src/onebot/action/extends/OCRImage.ts b/src/onebot/action/extends/OCRImage.ts index 7eda4d6b..e963cb1f 100644 --- a/src/onebot/action/extends/OCRImage.ts +++ b/src/onebot/action/extends/OCRImage.ts @@ -18,7 +18,7 @@ export class OCRImage extends BaseAction { actionName = ActionName.OCRImage; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQSystemApi = this.CoreContext.getApiContext().SystemApi; const { path, isLocal, errMsg, success } = (await uri2local(this.CoreContext.NapCatTempPath, payload.image)); if (!success) { diff --git a/src/onebot/action/extends/SetGroupHeader.ts b/src/onebot/action/extends/SetGroupHeader.ts index c9b7a91e..b3af7133 100644 --- a/src/onebot/action/extends/SetGroupHeader.ts +++ b/src/onebot/action/extends/SetGroupHeader.ts @@ -26,7 +26,7 @@ export default class SetGroupHeader extends BaseAction { }; } - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const { path, isLocal, errMsg, success } = (await uri2local(this.CoreContext.NapCatTempPath, payload.file)); if (!success) { diff --git a/src/onebot/action/extends/SetLongNick.ts b/src/onebot/action/extends/SetLongNick.ts index 61322760..cf583ba6 100644 --- a/src/onebot/action/extends/SetLongNick.ts +++ b/src/onebot/action/extends/SetLongNick.ts @@ -16,7 +16,7 @@ export class SetLongNick extends BaseAction { actionName = ActionName.SetLongNick; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const ret = await NTQQUserApi.setLongNick(payload.longNick); return ret; diff --git a/src/onebot/action/extends/SetOnlineStatus.ts b/src/onebot/action/extends/SetOnlineStatus.ts index d7c3a7c1..3191f6dc 100644 --- a/src/onebot/action/extends/SetOnlineStatus.ts +++ b/src/onebot/action/extends/SetOnlineStatus.ts @@ -19,7 +19,7 @@ export class SetOnlineStatus extends BaseAction { actionName = ActionName.SetOnlineStatus; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { // 可设置状态 // { status: 10, extStatus: 1027, batteryStatus: 0 } // { status: 30, extStatus: 0, batteryStatus: 0 } diff --git a/src/onebot/action/extends/SetQQAvatar.ts b/src/onebot/action/extends/SetQQAvatar.ts index 16eb22bd..368f6008 100644 --- a/src/onebot/action/extends/SetQQAvatar.ts +++ b/src/onebot/action/extends/SetQQAvatar.ts @@ -23,7 +23,7 @@ export default class SetAvatar extends BaseAction { }; } - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const { path, isLocal, errMsg, success } = (await uri2local(this.CoreContext.NapCatTempPath, payload.file)); if (!success) { diff --git a/src/onebot/action/extends/SetSelfProfile.ts b/src/onebot/action/extends/SetSelfProfile.ts index 2ce5acb1..4f787ee9 100644 --- a/src/onebot/action/extends/SetSelfProfile.ts +++ b/src/onebot/action/extends/SetSelfProfile.ts @@ -18,7 +18,7 @@ export class SetSelfProfile extends BaseAction { actionName = ActionName.SetSelfProfile; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const ret = await NTQQUserApi.modifySelfProfile({ nick: payload.nick, diff --git a/src/onebot/action/extends/sharePeer.ts b/src/onebot/action/extends/ShareContact.ts similarity index 86% rename from src/onebot/action/extends/sharePeer.ts rename to src/onebot/action/extends/ShareContact.ts index bac92b2c..03621d7d 100644 --- a/src/onebot/action/extends/sharePeer.ts +++ b/src/onebot/action/extends/ShareContact.ts @@ -14,11 +14,11 @@ const SchemaData = { type Payload = FromSchema; -export class sharePeer extends BaseAction { +export class SharePeer extends BaseAction { actionName = ActionName.SharePeer; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; if (payload.group_id) { @@ -39,11 +39,11 @@ const SchemaDataGroupEx = { type PayloadGroupEx = FromSchema; -export class shareGroupEx extends BaseAction { +export class ShareGroupEx extends BaseAction { actionName = ActionName.ShareGroupEx; PayloadSchema = SchemaDataGroupEx; - protected async _handle(payload: PayloadGroupEx) { + async _handle(payload: PayloadGroupEx) { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; return await NTQQGroupApi.getArkJsonGroupShare(payload.group_id); } diff --git a/src/onebot/action/extends/TranslateEnWordToZn.ts b/src/onebot/action/extends/TranslateEnWordToZn.ts index 9b50848f..ccc3980a 100644 --- a/src/onebot/action/extends/TranslateEnWordToZn.ts +++ b/src/onebot/action/extends/TranslateEnWordToZn.ts @@ -19,7 +19,7 @@ export class TranslateEnWordToZn extends BaseAction | null> actionName = ActionName.TranslateEnWordToZn; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQSystemApi = this.CoreContext.getApiContext().SystemApi; const ret = await NTQQSystemApi.translateEnWordToZn(payload.words); if (ret.result !== 0) { diff --git a/src/onebot/action/file/DelGroupFile.ts b/src/onebot/action/file/DelGroupFile.ts index 601ee275..8a3e3b26 100644 --- a/src/onebot/action/file/DelGroupFile.ts +++ b/src/onebot/action/file/DelGroupFile.ts @@ -17,7 +17,7 @@ export class DelGroupFile extends BaseAction { actionName = ActionName.DelGroupFile; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; return await NTQQGroupApi.DelGroupFile(payload.group_id.toString(), [payload.file_id]); } diff --git a/src/onebot/action/file/DelGroupFileFolder.ts b/src/onebot/action/file/DelGroupFileFolder.ts index 51907876..a995df69 100644 --- a/src/onebot/action/file/DelGroupFileFolder.ts +++ b/src/onebot/action/file/DelGroupFileFolder.ts @@ -17,7 +17,7 @@ export class DelGroupFileFolder extends BaseAction { actionName = ActionName.DelGroupFileFolder; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; return (await NTQQGroupApi.DelGroupFileFolder(payload.group_id.toString(), payload.folder_id)).groupFileCommonResult; } diff --git a/src/onebot/action/file/GetFile.ts b/src/onebot/action/file/GetFile.ts index ecc9d3a6..17495e0c 100644 --- a/src/onebot/action/file/GetFile.ts +++ b/src/onebot/action/file/GetFile.ts @@ -41,7 +41,7 @@ export class GetFileBase extends BaseAction { return { id: element.elementId, element: element.fileElement }; } - protected async _handle(payload: GetFilePayload): Promise { + async _handle(payload: GetFilePayload): Promise { const NTQQFriendApi = this.CoreContext.getApiContext().FriendApi; const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; @@ -225,7 +225,7 @@ export default class GetFile extends GetFileBase { actionName = ActionName.GetFile; PayloadSchema = GetFile_PayloadSchema; - protected async _handle(payload: GetFile_Payload): Promise { + async _handle(payload: GetFile_Payload): Promise { payload.file = payload.file_id; return super._handle(payload); } diff --git a/src/onebot/action/file/GetGroupFileCount.ts b/src/onebot/action/file/GetGroupFileCount.ts index ba77b442..393d853c 100644 --- a/src/onebot/action/file/GetGroupFileCount.ts +++ b/src/onebot/action/file/GetGroupFileCount.ts @@ -16,7 +16,7 @@ export class GetGroupFileCount extends BaseAction { actionName = ActionName.GetGroupFileCount; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const ret = await NTQQGroupApi.GetGroupFileCount([payload.group_id?.toString()]); return { count: ret.groupFileCounts[0] }; diff --git a/src/onebot/action/file/GetGroupFileList.ts b/src/onebot/action/file/GetGroupFileList.ts index 24628fd5..f1d3a7af 100644 --- a/src/onebot/action/file/GetGroupFileList.ts +++ b/src/onebot/action/file/GetGroupFileList.ts @@ -18,7 +18,7 @@ export class GetGroupFileList extends BaseAction actionName = ActionName.GetGroupFileList; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; const ret = await NTQQMsgApi.getGroupFileList(payload.group_id.toString(), { sortType: 1, diff --git a/src/onebot/action/file/GetRecord.ts b/src/onebot/action/file/GetRecord.ts index 882472d1..933ba784 100644 --- a/src/onebot/action/file/GetRecord.ts +++ b/src/onebot/action/file/GetRecord.ts @@ -8,7 +8,7 @@ interface Payload extends GetFilePayload { export default class GetRecord extends GetFileBase { actionName = ActionName.GetRecord; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const res = super._handle(payload); return res; } diff --git a/src/onebot/action/file/SetGroupFileFolder.ts b/src/onebot/action/file/SetGroupFileFolder.ts index 4caa27b3..0dee6270 100644 --- a/src/onebot/action/file/SetGroupFileFolder.ts +++ b/src/onebot/action/file/SetGroupFileFolder.ts @@ -17,7 +17,7 @@ export class SetGroupFileFolder extends BaseAction { actionName = ActionName.SetGroupFileFolder; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; return (await NTQQGroupApi.CreatGroupFileFolder(payload.group_id.toString(), payload.folder_name)).resultWithGroupItem; } diff --git a/src/onebot/action/go-cqhttp/DownloadFile.ts b/src/onebot/action/go-cqhttp/DownloadFile.ts index 37b8d39c..044182e6 100644 --- a/src/onebot/action/go-cqhttp/DownloadFile.ts +++ b/src/onebot/action/go-cqhttp/DownloadFile.ts @@ -32,7 +32,7 @@ export default class GoCQHTTPDownloadFile extends BaseAction { + async _handle(payload: Payload): Promise { const isRandomName = !payload.name; const name = payload.name || randomUUID(); const filePath = joinPath(this.CoreContext.NapCatTempPath, name); diff --git a/src/onebot/action/go-cqhttp/GetForwardMsg.ts b/src/onebot/action/go-cqhttp/GetForwardMsg.ts index a073870a..09dabd27 100644 --- a/src/onebot/action/go-cqhttp/GetForwardMsg.ts +++ b/src/onebot/action/go-cqhttp/GetForwardMsg.ts @@ -23,7 +23,7 @@ export class GoCQHTTPGetForwardMsgAction extends BaseAction { actionName = ActionName.GoCQHTTP_GetForwardMsg; PayloadSchema = SchemaData; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; const msgId = payload.message_id || payload.id; if (!msgId) { diff --git a/src/onebot/action/go-cqhttp/GetFriendMsgHistory.ts b/src/onebot/action/go-cqhttp/GetFriendMsgHistory.ts index 972f5837..d0a45983 100644 --- a/src/onebot/action/go-cqhttp/GetFriendMsgHistory.ts +++ b/src/onebot/action/go-cqhttp/GetFriendMsgHistory.ts @@ -27,7 +27,7 @@ export default class GetFriendMsgHistory extends BaseAction { actionName = ActionName.GetFriendMsgHistory; PayloadSchema = SchemaData; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; const NTQQFriendApi = this.CoreContext.getApiContext().FriendApi; diff --git a/src/onebot/action/go-cqhttp/GetGroupHonorInfo.ts b/src/onebot/action/go-cqhttp/GetGroupHonorInfo.ts index 7d96dad3..f778bbff 100644 --- a/src/onebot/action/go-cqhttp/GetGroupHonorInfo.ts +++ b/src/onebot/action/go-cqhttp/GetGroupHonorInfo.ts @@ -18,7 +18,7 @@ export class GetGroupHonorInfo extends BaseAction> { actionName = ActionName.GetGroupHonorInfo; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { if (!payload.type) { payload.type = WebHonorType.ALL; } diff --git a/src/onebot/action/go-cqhttp/GetGroupMsgHistory.ts b/src/onebot/action/go-cqhttp/GetGroupMsgHistory.ts index 68f47856..d43f0d1f 100644 --- a/src/onebot/action/go-cqhttp/GetGroupMsgHistory.ts +++ b/src/onebot/action/go-cqhttp/GetGroupMsgHistory.ts @@ -27,7 +27,7 @@ export default class GoCQHTTPGetGroupMsgHistory extends BaseAction { + async _handle(payload: Payload): Promise { const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; //处理参数 const isReverseOrder = payload.reverseOrder || true; diff --git a/src/onebot/action/go-cqhttp/GetOnlineClient.ts b/src/onebot/action/go-cqhttp/GetOnlineClient.ts index ce162ff8..93d9becc 100644 --- a/src/onebot/action/go-cqhttp/GetOnlineClient.ts +++ b/src/onebot/action/go-cqhttp/GetOnlineClient.ts @@ -13,7 +13,7 @@ const SchemaData = { export class GetOnlineClient extends BaseAction> { actionName = ActionName.GetOnlineClient; - protected async _handle(payload: void) { + async _handle(payload: void) { //注册监听 const NTQQSystemApi = this.CoreContext.getApiContext().SystemApi; NTQQSystemApi.getOnlineDev(); diff --git a/src/onebot/action/go-cqhttp/GetStrangerInfo.ts b/src/onebot/action/go-cqhttp/GetStrangerInfo.ts index f08a3ff7..22630bba 100644 --- a/src/onebot/action/go-cqhttp/GetStrangerInfo.ts +++ b/src/onebot/action/go-cqhttp/GetStrangerInfo.ts @@ -18,7 +18,7 @@ type Payload = FromSchema; export default class GoCQHTTPGetStrangerInfo extends BaseAction { actionName = ActionName.GoCQHTTP_GetStrangerInfo; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const user_id = payload.user_id.toString(); const extendData = await NTQQUserApi.getUserDetailInfoByUin(user_id); diff --git a/src/onebot/action/go-cqhttp/QuickAction.ts b/src/onebot/action/go-cqhttp/QuickAction.ts index 7a5e895a..d7895549 100644 --- a/src/onebot/action/go-cqhttp/QuickAction.ts +++ b/src/onebot/action/go-cqhttp/QuickAction.ts @@ -11,7 +11,7 @@ interface Payload { export class GoCQHTTPHandleQuickAction extends BaseAction { actionName = ActionName.GoCQHTTP_HandleQuickAction; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { handleQuickOperation(this.CoreContext, payload.context, payload.operation).then().catch(this.CoreContext.context.logger.logError); return null; } diff --git a/src/onebot/action/go-cqhttp/SendGroupNotice.ts b/src/onebot/action/go-cqhttp/SendGroupNotice.ts index 14855949..4df8e5e0 100644 --- a/src/onebot/action/go-cqhttp/SendGroupNotice.ts +++ b/src/onebot/action/go-cqhttp/SendGroupNotice.ts @@ -21,7 +21,7 @@ type Payload = FromSchema; export class SendGroupNotice extends BaseAction { actionName = ActionName.GoCQHTTP_SendGroupNotice; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; let UploadImage: { id: string, width: number, height: number } | undefined = undefined; if (payload.image) { diff --git a/src/onebot/action/go-cqhttp/UploadGroupFile.ts b/src/onebot/action/go-cqhttp/UploadGroupFile.ts index 1f13e26c..794ac246 100644 --- a/src/onebot/action/go-cqhttp/UploadGroupFile.ts +++ b/src/onebot/action/go-cqhttp/UploadGroupFile.ts @@ -25,7 +25,7 @@ export default class GoCQHTTPUploadGroupFile extends BaseAction { actionName = ActionName.GoCQHTTP_UploadGroupFile; PayloadSchema = SchemaData; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { let file = payload.file; if (fs.existsSync(file)) { file = `file://${file}`; diff --git a/src/onebot/action/go-cqhttp/UploadPrivareFile.ts b/src/onebot/action/go-cqhttp/UploadPrivareFile.ts index 3aee0e86..c362ae11 100644 --- a/src/onebot/action/go-cqhttp/UploadPrivareFile.ts +++ b/src/onebot/action/go-cqhttp/UploadPrivareFile.ts @@ -37,7 +37,7 @@ export default class GoCQHTTPUploadPrivateFile extends BaseAction throw '缺少参数 user_id'; } - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const peer = await this.getPeer(payload); let file = payload.file; if (fs.existsSync(file)) { diff --git a/src/onebot/action/group/DelEssenceMsg.ts b/src/onebot/action/group/DelEssenceMsg.ts index e5f48a0a..860d43cb 100644 --- a/src/onebot/action/group/DelEssenceMsg.ts +++ b/src/onebot/action/group/DelEssenceMsg.ts @@ -17,7 +17,7 @@ export default class DelEssenceMsg extends BaseAction { actionName = ActionName.DelEssenceMsg; PayloadSchema = SchemaData; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const msg = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString())); if (!msg) { diff --git a/src/onebot/action/group/GetGroupEssence.ts b/src/onebot/action/group/GetGroupEssence.ts index 00cce90f..7a7b34f7 100644 --- a/src/onebot/action/group/GetGroupEssence.ts +++ b/src/onebot/action/group/GetGroupEssence.ts @@ -18,7 +18,7 @@ export class GetGroupEssence extends BaseAction { actionName = ActionName.GoCQHTTP_GetEssenceMsg; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQWebApi = this.CoreContext.getApiContext().WebApi; const ret = await NTQQWebApi.getGroupEssenceMsg(payload.group_id.toString(), payload.pages.toString()); if (!ret) { diff --git a/src/onebot/action/group/GetGroupInfo.ts b/src/onebot/action/group/GetGroupInfo.ts index 4f7cfee0..daa4ab92 100644 --- a/src/onebot/action/group/GetGroupInfo.ts +++ b/src/onebot/action/group/GetGroupInfo.ts @@ -18,7 +18,7 @@ class GetGroupInfo extends BaseAction { actionName = ActionName.GetGroupInfo; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const group = (await NTQQGroupApi.getGroups()).find(e => e.groupCode == payload.group_id.toString()); if (group) { diff --git a/src/onebot/action/group/GetGroupList.ts b/src/onebot/action/group/GetGroupList.ts index f09df6b3..d1fb89c1 100644 --- a/src/onebot/action/group/GetGroupList.ts +++ b/src/onebot/action/group/GetGroupList.ts @@ -18,7 +18,7 @@ class GetGroupList extends BaseAction { actionName = ActionName.GetGroupList; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const groupList: Group[] = await NTQQGroupApi.getGroups(payload?.no_cache === true || payload.no_cache === 'true'); return OB11Constructor.groups(groupList); diff --git a/src/onebot/action/group/GetGroupMemberInfo.ts b/src/onebot/action/group/GetGroupMemberInfo.ts index 1231a126..cf1693cb 100644 --- a/src/onebot/action/group/GetGroupMemberInfo.ts +++ b/src/onebot/action/group/GetGroupMemberInfo.ts @@ -20,7 +20,7 @@ class GetGroupMemberInfo extends BaseAction { actionName = ActionName.GetGroupMemberInfo; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const NTQQWebApi = this.CoreContext.getApiContext().WebApi; diff --git a/src/onebot/action/group/GetGroupMemberList.ts b/src/onebot/action/group/GetGroupMemberList.ts index 10a53d0a..2801b962 100644 --- a/src/onebot/action/group/GetGroupMemberList.ts +++ b/src/onebot/action/group/GetGroupMemberList.ts @@ -19,7 +19,7 @@ class GetGroupMemberList extends BaseAction { actionName = ActionName.GetGroupMemberList; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const NTQQWebApi = this.CoreContext.getApiContext().WebApi; const isNocache = payload.no_cache == true || payload.no_cache === 'true'; diff --git a/src/onebot/action/group/GetGroupNotice.ts b/src/onebot/action/group/GetGroupNotice.ts index 678ef92e..cc4d589a 100644 --- a/src/onebot/action/group/GetGroupNotice.ts +++ b/src/onebot/action/group/GetGroupNotice.ts @@ -32,7 +32,7 @@ export class GetGroupNotice extends BaseAction { actionName = ActionName.GoCQHTTP_GetGroupNotice; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQWebApi = this.CoreContext.getApiContext().WebApi; const group = payload.group_id.toString(); diff --git a/src/onebot/action/group/GetGroupSystemMsg.ts b/src/onebot/action/group/GetGroupSystemMsg.ts index 03e7291d..0f5fcfeb 100644 --- a/src/onebot/action/group/GetGroupSystemMsg.ts +++ b/src/onebot/action/group/GetGroupSystemMsg.ts @@ -14,7 +14,7 @@ type Payload = FromSchema; export class GetGroupSystemMsg extends BaseAction { actionName = ActionName.GetGroupSystemMsg; - protected async _handle(payload: void) { + async _handle(payload: void) { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; // 默认10条 该api未完整实现 包括响应数据规范化 类型规范化 diff --git a/src/onebot/action/group/GetGuildList.ts b/src/onebot/action/group/GetGuildList.ts index f297b618..cfba4ad3 100644 --- a/src/onebot/action/group/GetGuildList.ts +++ b/src/onebot/action/group/GetGuildList.ts @@ -4,7 +4,7 @@ import { ActionName } from '../types'; export default class GetGuildList extends BaseAction { actionName = ActionName.GetGuildList; - protected async _handle(payload: null): Promise { + async _handle(payload: null): Promise { return null; } -} \ No newline at end of file +} diff --git a/src/onebot/action/group/SetEssenceMsg.ts b/src/onebot/action/group/SetEssenceMsg.ts index c7c53ea5..82b07e79 100644 --- a/src/onebot/action/group/SetEssenceMsg.ts +++ b/src/onebot/action/group/SetEssenceMsg.ts @@ -17,7 +17,7 @@ export default class SetEssenceMsg extends BaseAction { actionName = ActionName.SetEssenceMsg; PayloadSchema = SchemaData; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const msg = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString())); if (!msg) { diff --git a/src/onebot/action/group/SetGroupAddRequest.ts b/src/onebot/action/group/SetGroupAddRequest.ts index 4934474a..7aa3bf38 100644 --- a/src/onebot/action/group/SetGroupAddRequest.ts +++ b/src/onebot/action/group/SetGroupAddRequest.ts @@ -19,7 +19,7 @@ export default class SetGroupAddRequest extends BaseAction { actionName = ActionName.SetGroupAddRequest; PayloadSchema = SchemaData; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const flag = payload.flag.toString(); const approve = payload.approve?.toString() !== 'false'; diff --git a/src/onebot/action/group/SetGroupAdmin.ts b/src/onebot/action/group/SetGroupAdmin.ts index 1daf1fe1..fcd687ef 100644 --- a/src/onebot/action/group/SetGroupAdmin.ts +++ b/src/onebot/action/group/SetGroupAdmin.ts @@ -19,7 +19,7 @@ export default class SetGroupAdmin extends BaseAction { actionName = ActionName.SetGroupAdmin; PayloadSchema = SchemaData; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const uid = await NTQQUserApi.getUidByUin(payload.user_id.toString()); diff --git a/src/onebot/action/group/SetGroupBan.ts b/src/onebot/action/group/SetGroupBan.ts index 7408a8ea..c3812e47 100644 --- a/src/onebot/action/group/SetGroupBan.ts +++ b/src/onebot/action/group/SetGroupBan.ts @@ -18,7 +18,7 @@ export default class SetGroupBan extends BaseAction { actionName = ActionName.SetGroupBan; PayloadSchema = SchemaData; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const uid = await NTQQUserApi.getUidByUin(payload.user_id.toString()); diff --git a/src/onebot/action/group/SetGroupCard.ts b/src/onebot/action/group/SetGroupCard.ts index 5a73bb2b..b919750e 100644 --- a/src/onebot/action/group/SetGroupCard.ts +++ b/src/onebot/action/group/SetGroupCard.ts @@ -18,7 +18,7 @@ export default class SetGroupCard extends BaseAction { actionName = ActionName.SetGroupCard; PayloadSchema = SchemaData; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; await NTQQGroupApi.setMemberCard(payload.group_id.toString(), member.uid, payload.card || ''); return null; diff --git a/src/onebot/action/group/SetGroupKick.ts b/src/onebot/action/group/SetGroupKick.ts index 782a386f..96ffdf13 100644 --- a/src/onebot/action/group/SetGroupKick.ts +++ b/src/onebot/action/group/SetGroupKick.ts @@ -19,7 +19,7 @@ export default class SetGroupKick extends BaseAction { actionName = ActionName.SetGroupKick; PayloadSchema = SchemaData; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const rejectReq = payload.reject_add_request?.toString() == 'true'; diff --git a/src/onebot/action/group/SetGroupLeave.ts b/src/onebot/action/group/SetGroupLeave.ts index 8ec8a495..66fc3c26 100644 --- a/src/onebot/action/group/SetGroupLeave.ts +++ b/src/onebot/action/group/SetGroupLeave.ts @@ -16,7 +16,7 @@ export default class SetGroupLeave extends BaseAction { actionName = ActionName.SetGroupLeave; PayloadSchema = SchemaData; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; await NTQQGroupApi.quitGroup(payload.group_id.toString()); } diff --git a/src/onebot/action/group/SetGroupName.ts b/src/onebot/action/group/SetGroupName.ts index 1c1ed3a6..44ac3dc9 100644 --- a/src/onebot/action/group/SetGroupName.ts +++ b/src/onebot/action/group/SetGroupName.ts @@ -16,7 +16,7 @@ export default class SetGroupName extends BaseAction { actionName = ActionName.SetGroupName; PayloadSchema = SchemaData; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; await NTQQGroupApi.setGroupName(payload.group_id.toString(), payload.group_name); return null; diff --git a/src/onebot/action/group/SetGroupWholeBan.ts b/src/onebot/action/group/SetGroupWholeBan.ts index 6f62983d..b7bf982e 100644 --- a/src/onebot/action/group/SetGroupWholeBan.ts +++ b/src/onebot/action/group/SetGroupWholeBan.ts @@ -17,7 +17,7 @@ export default class SetGroupWholeBan extends BaseAction { actionName = ActionName.SetGroupWholeBan; PayloadSchema = SchemaData; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const enable = payload.enable?.toString() !== 'false'; const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; await NTQQGroupApi.banGroup(payload.group_id.toString(), enable); diff --git a/src/onebot/action/index.ts b/src/onebot/action/index.ts index 263e9c4a..09d96b49 100644 --- a/src/onebot/action/index.ts +++ b/src/onebot/action/index.ts @@ -62,7 +62,7 @@ import { SetGroupFileFolder } from './file/SetGroupFileFolder'; import { DelGroupFile } from './file/DelGroupFile'; import { DelGroupFileFolder } from './file/DelGroupFileFolder'; import { SetSelfProfile } from './extends/SetSelfProfile'; -import { shareGroupEx, sharePeer } from './extends/sharePeer'; +import { ShareGroupEx, SharePeer } from './extends/ShareContact'; import { CreateCollection } from './extends/CreateCollection'; import { SetLongNick } from './extends/SetLongNick'; import DelEssenceMsg from './group/DelEssenceMsg'; @@ -81,8 +81,8 @@ export function createActionMap(onebotContext: NapCatOneBot11Adapter, coreContex new FetchEmojiLike(onebotContext, coreContext), new GetFile(onebotContext, coreContext), new SetSelfProfile(onebotContext, coreContext), - new shareGroupEx(onebotContext, coreContext), - new sharePeer(onebotContext, coreContext), + new ShareGroupEx(onebotContext, coreContext), + new SharePeer(onebotContext, coreContext), new CreateCollection(onebotContext, coreContext), new SetLongNick(onebotContext, coreContext), new ForwardFriendSingleMsg(onebotContext, coreContext), diff --git a/src/onebot/action/msg/DeleteMsg.ts b/src/onebot/action/msg/DeleteMsg.ts index 16b6368c..d4b488c4 100644 --- a/src/onebot/action/msg/DeleteMsg.ts +++ b/src/onebot/action/msg/DeleteMsg.ts @@ -23,7 +23,7 @@ class DeleteMsg extends BaseAction { actionName = ActionName.DeleteMsg; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; const msg = MessageUnique.getMsgIdAndPeerByShortId(Number(payload.message_id)); if (msg) { diff --git a/src/onebot/action/msg/ForwardSingleMsg.ts b/src/onebot/action/msg/ForwardSingleMsg.ts index 273f0295..c2b6a522 100644 --- a/src/onebot/action/msg/ForwardSingleMsg.ts +++ b/src/onebot/action/msg/ForwardSingleMsg.ts @@ -29,7 +29,7 @@ class ForwardSingleMsg extends BaseAction { return { chatType: ChatType.group, peerUid: payload.group_id!.toString() }; } - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; const msg = MessageUnique.getMsgIdAndPeerByShortId(payload.message_id); if (!msg) { diff --git a/src/onebot/action/msg/GetMsg.ts b/src/onebot/action/msg/GetMsg.ts index 2841035a..a0fe6679 100644 --- a/src/onebot/action/msg/GetMsg.ts +++ b/src/onebot/action/msg/GetMsg.ts @@ -22,7 +22,7 @@ class GetMsg extends BaseAction { actionName = ActionName.GetMsg; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; // log("history msg ids", Object.keys(msgHistory)); if (!payload.message_id) { diff --git a/src/onebot/action/msg/MarkMsgAsRead.ts b/src/onebot/action/msg/MarkMsgAsRead.ts index 953c5db5..e6605695 100644 --- a/src/onebot/action/msg/MarkMsgAsRead.ts +++ b/src/onebot/action/msg/MarkMsgAsRead.ts @@ -31,7 +31,7 @@ class MarkMsgAsRead extends BaseAction { return { chatType: ChatType.group, peerUid: payload.group_id.toString() }; } - protected async _handle(payload: PlayloadType): Promise { + async _handle(payload: PlayloadType): Promise { const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; // 调用API const ret = await NTQQMsgApi.setMsgRead(await this.getPeer(payload)); @@ -61,7 +61,7 @@ interface Payload { export class GoCQHTTPMarkMsgAsRead extends BaseAction { actionName = ActionName.GoCQHTTP_MarkMsgAsRead; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { return null; } } @@ -69,7 +69,7 @@ export class GoCQHTTPMarkMsgAsRead extends BaseAction { export class MarkAllMsgAsRead extends BaseAction { actionName = ActionName._MarkAllMsgAsRead; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; await NTQQMsgApi.markallMsgAsRead(); return null; diff --git a/src/onebot/action/msg/SendMsg/index.ts b/src/onebot/action/msg/SendMsg/index.ts index d595affd..31b5f9c8 100644 --- a/src/onebot/action/msg/SendMsg/index.ts +++ b/src/onebot/action/msg/SendMsg/index.ts @@ -147,7 +147,7 @@ export class SendMsg extends BaseAction { return { valid: true }; } - protected async _handle(payload: OB11PostSendMsg): Promise<{ message_id: number }> { + async _handle(payload: OB11PostSendMsg): Promise<{ message_id: number }> { const peer = await createContext(this.CoreContext, payload, this.contextMode); const messages = normalize( diff --git a/src/onebot/action/msg/SetMsgEmojiLike.ts b/src/onebot/action/msg/SetMsgEmojiLike.ts index de2fa341..2b9515b9 100644 --- a/src/onebot/action/msg/SetMsgEmojiLike.ts +++ b/src/onebot/action/msg/SetMsgEmojiLike.ts @@ -18,7 +18,7 @@ export class SetMsgEmojiLike extends BaseAction { actionName = ActionName.SetMsgEmojiLike; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; const msg = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString())); if (!msg) { diff --git a/src/onebot/action/system/CanSendRecord.ts b/src/onebot/action/system/CanSendRecord.ts index 6d52b638..6e17abe7 100644 --- a/src/onebot/action/system/CanSendRecord.ts +++ b/src/onebot/action/system/CanSendRecord.ts @@ -8,7 +8,7 @@ interface ReturnType { export default class CanSendRecord extends BaseAction { actionName = ActionName.CanSendRecord; - protected async _handle(_payload: void): Promise { + async _handle(_payload: void): Promise { return { yes: true, }; diff --git a/src/onebot/action/system/GetLoginInfo.ts b/src/onebot/action/system/GetLoginInfo.ts index 17500f8f..4ae2c4e5 100644 --- a/src/onebot/action/system/GetLoginInfo.ts +++ b/src/onebot/action/system/GetLoginInfo.ts @@ -6,7 +6,7 @@ import { ActionName } from '../types'; class GetLoginInfo extends BaseAction { actionName = ActionName.GetLoginInfo; - protected async _handle(payload: null) { + async _handle(payload: null) { return OB11Constructor.selfInfo(this.CoreContext.selfInfo); } } diff --git a/src/onebot/action/system/GetStatus.ts b/src/onebot/action/system/GetStatus.ts index 30d2ed2f..4be3c2ef 100644 --- a/src/onebot/action/system/GetStatus.ts +++ b/src/onebot/action/system/GetStatus.ts @@ -4,7 +4,7 @@ import { ActionName } from '../types'; export default class GetStatus extends BaseAction { actionName = ActionName.GetStatus; - protected async _handle(payload: any): Promise { + async _handle(payload: any): Promise { return { online: !!this.CoreContext.selfInfo.online, good: true, diff --git a/src/onebot/action/system/GetVersionInfo.ts b/src/onebot/action/system/GetVersionInfo.ts index 4e20a6a8..421cd7da 100644 --- a/src/onebot/action/system/GetVersionInfo.ts +++ b/src/onebot/action/system/GetVersionInfo.ts @@ -5,7 +5,7 @@ import { napcat_version } from '@/common/framework/napcat'; export default class GetVersionInfo extends BaseAction { actionName = ActionName.GetVersionInfo; - protected async _handle(payload: any): Promise { + async _handle(payload: any): Promise { return { app_name: 'NapCat.Onebot', protocol_version: 'v11', diff --git a/src/onebot/action/user/GetCookies.ts b/src/onebot/action/user/GetCookies.ts index ea5ae709..c0f849f3 100644 --- a/src/onebot/action/user/GetCookies.ts +++ b/src/onebot/action/user/GetCookies.ts @@ -21,7 +21,7 @@ export class GetCookies extends BaseAction { actionName = ActionName.GetCookies; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const NTQQWebApi = this.CoreContext.getApiContext().WebApi; // if (!payload.domain) { diff --git a/src/onebot/action/user/GetFriendList.ts b/src/onebot/action/user/GetFriendList.ts index f9f6c21f..aa2811dd 100644 --- a/src/onebot/action/user/GetFriendList.ts +++ b/src/onebot/action/user/GetFriendList.ts @@ -17,7 +17,7 @@ export default class GetFriendList extends BaseAction { actionName = ActionName.GetFriendList; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { //全新逻辑 const NTQQFriendApi = this.CoreContext.getApiContext().FriendApi; return OB11Constructor.friendsV2(await NTQQFriendApi.getBuddyV2(payload?.no_cache === true || payload?.no_cache === 'true')); diff --git a/src/onebot/action/user/GetRecentContact.ts b/src/onebot/action/user/GetRecentContact.ts index 3bab0a81..36140d5b 100644 --- a/src/onebot/action/user/GetRecentContact.ts +++ b/src/onebot/action/user/GetRecentContact.ts @@ -16,7 +16,7 @@ export default class GetRecentContact extends BaseAction { actionName = ActionName.GetRecentContact; PayloadSchema = SchemaData; - protected async _handle(payload: Payload) { + async _handle(payload: Payload) { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; const ret = await NTQQUserApi.getRecentContactListSnapShot(parseInt((payload.count || 10).toString())); diff --git a/src/onebot/action/user/SendLike.ts b/src/onebot/action/user/SendLike.ts index 5372e360..5ebdee86 100644 --- a/src/onebot/action/user/SendLike.ts +++ b/src/onebot/action/user/SendLike.ts @@ -17,7 +17,7 @@ export default class SendLike extends BaseAction { actionName = ActionName.SendLike; PayloadSchema = SchemaData; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; //logDebug('点赞参数', payload); try { diff --git a/src/onebot/action/user/SetFriendAddRequest.ts b/src/onebot/action/user/SetFriendAddRequest.ts index 76a2d75f..19fd24c9 100644 --- a/src/onebot/action/user/SetFriendAddRequest.ts +++ b/src/onebot/action/user/SetFriendAddRequest.ts @@ -18,7 +18,7 @@ export default class SetFriendAddRequest extends BaseAction { actionName = ActionName.SetFriendAddRequest; PayloadSchema = SchemaData; - protected async _handle(payload: Payload): Promise { + async _handle(payload: Payload): Promise { const NTQQFriendApi = this.CoreContext.getApiContext().FriendApi; const approve = payload.approve?.toString() !== 'false'; await NTQQFriendApi.handleFriendRequest(payload.flag, approve); diff --git a/src/onebot/main.ts b/src/onebot/main.ts index 4266f120..3ffdf632 100644 --- a/src/onebot/main.ts +++ b/src/onebot/main.ts @@ -1,15 +1,19 @@ -import { InstanceContext, NapCatCore } from '@/core'; +import { InstanceContext, MsgListener, NapCatCore } from '@/core'; import { OB11Config } from './helper/config'; import { NapCatPathWrapper } from '@/common/framework/napcat'; import { OneBotApiContextType } from './types/adapter'; import { OneBotFriendApi, OneBotGroupApi, OneBotUserApi } from './api'; +import { OB11NetworkManager } from '@/onebot/network'; +import { OB11InputStatusEvent } from '@/onebot/event/notice/OB11InputStatusEvent'; //OneBot实现类 export class NapCatOneBot11Adapter { readonly core: NapCatCore; readonly context: InstanceContext; + config: OB11Config; apiContext: OneBotApiContextType; + networkManager: OB11NetworkManager; constructor(core: NapCatCore, context: InstanceContext, pathWrapper: NapCatPathWrapper) { this.core = core; @@ -20,5 +24,20 @@ export class NapCatOneBot11Adapter { UserApi: new OneBotUserApi(this, core), FriendApi: new OneBotFriendApi(this, core), }; + this.networkManager = new OB11NetworkManager(); + } + + private initMsgListener() { + const msgListener = new MsgListener(); + + msgListener.onInputStatusPush = async data => { + const uin = await this.core.ApiContext.UserApi.getUinByUidV2(data.fromUin); + this.context.logger.log(`[Notice] [输入状态] ${uin} ${data.statusText}`); + this.networkManager.emitEvent(new OB11InputStatusEvent( + parseInt(uin), + data.eventType, + data.statusText + )); + }; } }