This commit is contained in:
idranme 2024-09-07 02:56:59 +08:00
parent e14ba108fc
commit bdf1c7fd5f
No known key found for this signature in database
GPG Key ID: 926F7B5B668E495F
15 changed files with 19 additions and 20 deletions

View File

@ -19,7 +19,7 @@ export class NTQQFriendApi extends Service {
}
/** 大于或等于 26702 应使用 getBuddyV2 */
async getFriends(_forced = false) {
async getFriends() {
const data = await invoke<{
data: {
categoryId: number

View File

@ -24,7 +24,7 @@ export class NTQQGroupApi extends Service {
super(ctx, 'ntGroupApi', true)
}
async getGroups(forced = false): Promise<Group[]> {
async getGroups(): Promise<Group[]> {
const result = await invoke<{
updateType: number
groupList: Group[]

View File

@ -65,7 +65,7 @@ export class NTQQUserApi extends Service {
return ret
}
async getUserDetailInfo(uid: string, _getLevel = false) {
async getUserDetailInfo(uid: string) {
if (getBuildVersion() >= 26702) {
return this.fetchUserDetailInfo(uid)
}

View File

@ -201,7 +201,7 @@ export namespace SendElementEntities {
// log("生成缩略图", _thumbPath)
thumbPath.set(0, _thumbPath)
const thumbMd5 = await calculateFileMD5(_thumbPath)
let element: SendVideoElement = {
const element: SendVideoElement = {
elementType: ElementType.VIDEO,
elementId: '',
videoElement: {

View File

@ -34,7 +34,7 @@ export interface WrapperApi {
}
export interface WrapperConstructor {
[key: string]: any
[key: string]: unknown
}
const wrapperApi: WrapperApi = {}

View File

@ -28,7 +28,7 @@ export class UploadGroupFile extends BaseAction<UploadGroupFilePayload, null> {
}
const sendFileEle = await SendElementEntities.file(this.ctx, downloadResult.path, payload.name, payload.folder_id)
const peer = await createPeer(this.ctx, payload, CreatePeerMode.Group)
await sendMsg(this.ctx, peer, [sendFileEle], [], true)
await sendMsg(this.ctx, peer, [sendFileEle], [])
return null
}
}
@ -53,7 +53,7 @@ export class UploadPrivateFile extends BaseAction<UploadPrivateFilePayload, null
throw new Error(downloadResult.errMsg)
}
const sendFileEle: SendFileElement = await SendElementEntities.file(this.ctx, downloadResult.path, payload.name)
await sendMsg(this.ctx, peer, [sendFileEle], [], true)
await sendMsg(this.ctx, peer, [sendFileEle], [])
return null
}
}

View File

@ -10,8 +10,8 @@ interface Payload {
class GetGroupList extends BaseAction<Payload, OB11Group[]> {
actionName = ActionName.GetGroupList
protected async _handle(payload: Payload) {
const groupList = await this.ctx.ntGroupApi.getGroups(payload?.no_cache === true || payload?.no_cache === 'true')
protected async _handle() {
const groupList = await this.ctx.ntGroupApi.getGroups()
return OB11Entities.groups(groupList)
}
}

View File

@ -18,7 +18,7 @@ class GetGroupMemberInfo extends BaseAction<Payload, OB11GroupMember> {
if (member) {
if (isNullable(member.sex)) {
//log('获取群成员详细信息')
const info = await this.ctx.ntUserApi.getUserDetailInfo(member.uid, true)
const info = await this.ctx.ntUserApi.getUserDetailInfo(member.uid)
//log('群成员详细信息结果', info)
Object.assign(member, info)
}

View File

@ -214,7 +214,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnData> {
}
// log("分割后的转发节点", sendElementsSplit)
for (const eles of sendElementsSplit) {
const nodeMsg = await sendMsg(this.ctx, selfPeer, eles, [], true)
const nodeMsg = await sendMsg(this.ctx, selfPeer, eles, [])
if (!nodeMsg) {
this.ctx.logger.warn('转发节点生成失败', eles)
continue

View File

@ -5,7 +5,7 @@ interface ReturnType {
yes: boolean
}
export default class CanSendRecord extends BaseAction<any, ReturnType> {
export default class CanSendRecord extends BaseAction<null, ReturnType> {
actionName = ActionName.CanSendRecord
protected async _handle() {

View File

@ -16,7 +16,7 @@ export class GetFriendList extends BaseAction<Payload, OB11User[]> {
if (getBuildVersion() >= 26702) {
return OB11Entities.friendsV2(await this.ctx.ntFriendApi.getBuddyV2(refresh))
}
return OB11Entities.friends(await this.ctx.ntFriendApi.getFriends(refresh))
return OB11Entities.friends(await this.ctx.ntFriendApi.getFriends())
}
}

View File

@ -173,8 +173,8 @@ export namespace OB11Entities {
id: MessageUnique.createMsg(peer, replyMsg ? replyMsg.msgId : records.msgId).toString()
}
}
} catch (e: any) {
ctx.logger.error('获取不到引用的消息', replyElement, e.stack)
} catch (e) {
ctx.logger.error('获取不到引用的消息', replyElement, (e as Error).stack)
continue
}
}
@ -378,7 +378,7 @@ export namespace OB11Entities {
if (element.grayTipElement.jsonGrayTipElement.busiId == 1061) {
//判断业务类型
//Poke事件
const pokedetail: any[] = json.items
const pokedetail: Dict[] = json.items
//筛选item带有uid的元素
const poke_uid = pokedetail.filter(item => item.uid)
if (poke_uid.length == 2) {

View File

@ -236,8 +236,7 @@ export async function sendMsg(
ctx: Context,
peer: Peer,
sendElements: SendMessageElement[],
deleteAfterSentFiles: string[],
waitComplete = true,
deleteAfterSentFiles: string[]
) {
if (!sendElements.length) {
throw '消息体无法解析,请检查是否发送了不支持的消息类型'

View File

@ -88,7 +88,7 @@ async function handleMsg(ctx: Context, msg: OB11Message, quickAction: QuickOpera
}
replyMessage = replyMessage.concat(convertMessage2List(reply, quickAction.auto_escape))
const { sendElements, deleteAfterSentFiles } = await createSendElements(ctx, replyMessage, peer)
sendMsg(ctx, peer, sendElements, deleteAfterSentFiles, false).catch(e => ctx.logger.error(e))
sendMsg(ctx, peer, sendElements, deleteAfterSentFiles).catch(e => ctx.logger.error(e))
}
if (msg.message_type === 'group') {
const groupMsgQuickAction = quickAction as QuickOperationGroupMessage

View File

@ -1,7 +1,7 @@
import { CheckVersion, Config } from '../common/types'
import { SettingButton, SettingItem, SettingList, SettingSwitch, SettingSelect } from './components'
import { version } from '../version'
// @ts-expect-error
// @ts-expect-error: Unreachable code error
import StyleRaw from './style.css?raw'
type HostsType = 'httpHosts' | 'wsHosts'