mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-06 21:10:23 +00:00
fix: replace deprecated calls
This commit is contained in:
@@ -20,7 +20,7 @@ class ForwardSingleMsg extends BaseAction<Payload, null> {
|
||||
protected async getTargetPeer(payload: Payload): Promise<Peer> {
|
||||
const NTQQUserApi = this.CoreContext.apis.UserApi;
|
||||
if (payload.user_id) {
|
||||
const peerUid = await NTQQUserApi.getUidByUin(payload.user_id.toString());
|
||||
const peerUid = await NTQQUserApi.getUidByUinV2(payload.user_id.toString());
|
||||
if (!peerUid) {
|
||||
throw new Error(`无法找到私聊对象${payload.user_id}`);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class MarkMsgAsRead extends BaseAction<PlayloadType, null> {
|
||||
const NTQQUserApi = this.CoreContext.apis.UserApi;
|
||||
const NTQQFriendApi = this.CoreContext.apis.FriendApi;
|
||||
if (payload.user_id) {
|
||||
const peerUid = await NTQQUserApi.getUidByUin(payload.user_id.toString());
|
||||
const peerUid = await NTQQUserApi.getUidByUinV2(payload.user_id.toString());
|
||||
if (!peerUid) {
|
||||
throw `私聊${payload.user_id}不存在`;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ const _handlers: {
|
||||
|
||||
// then the qq is a group member
|
||||
// Mlikiowa V2.0.0 Refactor Todo
|
||||
const uid = await coreContext.apis.UserApi.getUidByUin(atQQ);
|
||||
const uid = await coreContext.apis.UserApi.getUidByUinV2(atQQ);
|
||||
if (!uid) throw new Error('Get Uid Error');
|
||||
return SendMsgElementConstructor.at(coreContext, atQQ, uid, AtType.atUser, '');
|
||||
},
|
||||
|
||||
@@ -99,7 +99,7 @@ async function createContext(coreContext: NapCatCore, payload: OB11PostSendMsg,
|
||||
};
|
||||
}
|
||||
if ((contextMode === ContextMode.Private || contextMode === ContextMode.Normal) && payload.user_id) {
|
||||
const Uid = await NTQQUserApi.getUidByUin(payload.user_id.toString());
|
||||
const Uid = await NTQQUserApi.getUidByUinV2(payload.user_id.toString());
|
||||
const isBuddy = await NTQQFriendApi.isBuddy(Uid!);
|
||||
//console.log("[调试代码] UIN:", payload.user_id, " UID:", Uid, " IsBuddy:", isBuddy);
|
||||
return {
|
||||
@@ -137,7 +137,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
||||
// return { valid: false, message: `群${payload.group_id}不存在` };
|
||||
// }
|
||||
if (payload.user_id && payload.message_type !== 'group') {
|
||||
const uid = await NTQQUserApi.getUidByUin(payload.user_id.toString());
|
||||
const uid = await NTQQUserApi.getUidByUinV2(payload.user_id.toString());
|
||||
const isBuddy = await NTQQFriendApi.isBuddy(uid!);
|
||||
// 此处有问题
|
||||
if (!isBuddy) {
|
||||
|
||||
Reference in New Issue
Block a user