mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
chore
This commit is contained in:
parent
e14ba108fc
commit
bdf1c7fd5f
@ -19,7 +19,7 @@ export class NTQQFriendApi extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 大于或等于 26702 应使用 getBuddyV2 */
|
/** 大于或等于 26702 应使用 getBuddyV2 */
|
||||||
async getFriends(_forced = false) {
|
async getFriends() {
|
||||||
const data = await invoke<{
|
const data = await invoke<{
|
||||||
data: {
|
data: {
|
||||||
categoryId: number
|
categoryId: number
|
||||||
|
@ -24,7 +24,7 @@ export class NTQQGroupApi extends Service {
|
|||||||
super(ctx, 'ntGroupApi', true)
|
super(ctx, 'ntGroupApi', true)
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroups(forced = false): Promise<Group[]> {
|
async getGroups(): Promise<Group[]> {
|
||||||
const result = await invoke<{
|
const result = await invoke<{
|
||||||
updateType: number
|
updateType: number
|
||||||
groupList: Group[]
|
groupList: Group[]
|
||||||
|
@ -65,7 +65,7 @@ export class NTQQUserApi extends Service {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
async getUserDetailInfo(uid: string, _getLevel = false) {
|
async getUserDetailInfo(uid: string) {
|
||||||
if (getBuildVersion() >= 26702) {
|
if (getBuildVersion() >= 26702) {
|
||||||
return this.fetchUserDetailInfo(uid)
|
return this.fetchUserDetailInfo(uid)
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ export namespace SendElementEntities {
|
|||||||
// log("生成缩略图", _thumbPath)
|
// log("生成缩略图", _thumbPath)
|
||||||
thumbPath.set(0, _thumbPath)
|
thumbPath.set(0, _thumbPath)
|
||||||
const thumbMd5 = await calculateFileMD5(_thumbPath)
|
const thumbMd5 = await calculateFileMD5(_thumbPath)
|
||||||
let element: SendVideoElement = {
|
const element: SendVideoElement = {
|
||||||
elementType: ElementType.VIDEO,
|
elementType: ElementType.VIDEO,
|
||||||
elementId: '',
|
elementId: '',
|
||||||
videoElement: {
|
videoElement: {
|
||||||
|
@ -34,7 +34,7 @@ export interface WrapperApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface WrapperConstructor {
|
export interface WrapperConstructor {
|
||||||
[key: string]: any
|
[key: string]: unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
const wrapperApi: WrapperApi = {}
|
const wrapperApi: WrapperApi = {}
|
||||||
|
@ -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 sendFileEle = await SendElementEntities.file(this.ctx, downloadResult.path, payload.name, payload.folder_id)
|
||||||
const peer = await createPeer(this.ctx, payload, CreatePeerMode.Group)
|
const peer = await createPeer(this.ctx, payload, CreatePeerMode.Group)
|
||||||
await sendMsg(this.ctx, peer, [sendFileEle], [], true)
|
await sendMsg(this.ctx, peer, [sendFileEle], [])
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ export class UploadPrivateFile extends BaseAction<UploadPrivateFilePayload, null
|
|||||||
throw new Error(downloadResult.errMsg)
|
throw new Error(downloadResult.errMsg)
|
||||||
}
|
}
|
||||||
const sendFileEle: SendFileElement = await SendElementEntities.file(this.ctx, downloadResult.path, payload.name)
|
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
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,8 @@ interface Payload {
|
|||||||
class GetGroupList extends BaseAction<Payload, OB11Group[]> {
|
class GetGroupList extends BaseAction<Payload, OB11Group[]> {
|
||||||
actionName = ActionName.GetGroupList
|
actionName = ActionName.GetGroupList
|
||||||
|
|
||||||
protected async _handle(payload: Payload) {
|
protected async _handle() {
|
||||||
const groupList = await this.ctx.ntGroupApi.getGroups(payload?.no_cache === true || payload?.no_cache === 'true')
|
const groupList = await this.ctx.ntGroupApi.getGroups()
|
||||||
return OB11Entities.groups(groupList)
|
return OB11Entities.groups(groupList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ class GetGroupMemberInfo extends BaseAction<Payload, OB11GroupMember> {
|
|||||||
if (member) {
|
if (member) {
|
||||||
if (isNullable(member.sex)) {
|
if (isNullable(member.sex)) {
|
||||||
//log('获取群成员详细信息')
|
//log('获取群成员详细信息')
|
||||||
const info = await this.ctx.ntUserApi.getUserDetailInfo(member.uid, true)
|
const info = await this.ctx.ntUserApi.getUserDetailInfo(member.uid)
|
||||||
//log('群成员详细信息结果', info)
|
//log('群成员详细信息结果', info)
|
||||||
Object.assign(member, info)
|
Object.assign(member, info)
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnData> {
|
|||||||
}
|
}
|
||||||
// log("分割后的转发节点", sendElementsSplit)
|
// log("分割后的转发节点", sendElementsSplit)
|
||||||
for (const eles of 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) {
|
if (!nodeMsg) {
|
||||||
this.ctx.logger.warn('转发节点生成失败', eles)
|
this.ctx.logger.warn('转发节点生成失败', eles)
|
||||||
continue
|
continue
|
||||||
|
@ -5,7 +5,7 @@ interface ReturnType {
|
|||||||
yes: boolean
|
yes: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class CanSendRecord extends BaseAction<any, ReturnType> {
|
export default class CanSendRecord extends BaseAction<null, ReturnType> {
|
||||||
actionName = ActionName.CanSendRecord
|
actionName = ActionName.CanSendRecord
|
||||||
|
|
||||||
protected async _handle() {
|
protected async _handle() {
|
||||||
|
@ -16,7 +16,7 @@ export class GetFriendList extends BaseAction<Payload, OB11User[]> {
|
|||||||
if (getBuildVersion() >= 26702) {
|
if (getBuildVersion() >= 26702) {
|
||||||
return OB11Entities.friendsV2(await this.ctx.ntFriendApi.getBuddyV2(refresh))
|
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())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,8 +173,8 @@ export namespace OB11Entities {
|
|||||||
id: MessageUnique.createMsg(peer, replyMsg ? replyMsg.msgId : records.msgId).toString()
|
id: MessageUnique.createMsg(peer, replyMsg ? replyMsg.msgId : records.msgId).toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch (e) {
|
||||||
ctx.logger.error('获取不到引用的消息', replyElement, e.stack)
|
ctx.logger.error('获取不到引用的消息', replyElement, (e as Error).stack)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -378,7 +378,7 @@ export namespace OB11Entities {
|
|||||||
if (element.grayTipElement.jsonGrayTipElement.busiId == 1061) {
|
if (element.grayTipElement.jsonGrayTipElement.busiId == 1061) {
|
||||||
//判断业务类型
|
//判断业务类型
|
||||||
//Poke事件
|
//Poke事件
|
||||||
const pokedetail: any[] = json.items
|
const pokedetail: Dict[] = json.items
|
||||||
//筛选item带有uid的元素
|
//筛选item带有uid的元素
|
||||||
const poke_uid = pokedetail.filter(item => item.uid)
|
const poke_uid = pokedetail.filter(item => item.uid)
|
||||||
if (poke_uid.length == 2) {
|
if (poke_uid.length == 2) {
|
||||||
|
@ -236,8 +236,7 @@ export async function sendMsg(
|
|||||||
ctx: Context,
|
ctx: Context,
|
||||||
peer: Peer,
|
peer: Peer,
|
||||||
sendElements: SendMessageElement[],
|
sendElements: SendMessageElement[],
|
||||||
deleteAfterSentFiles: string[],
|
deleteAfterSentFiles: string[]
|
||||||
waitComplete = true,
|
|
||||||
) {
|
) {
|
||||||
if (!sendElements.length) {
|
if (!sendElements.length) {
|
||||||
throw '消息体无法解析,请检查是否发送了不支持的消息类型'
|
throw '消息体无法解析,请检查是否发送了不支持的消息类型'
|
||||||
|
@ -88,7 +88,7 @@ async function handleMsg(ctx: Context, msg: OB11Message, quickAction: QuickOpera
|
|||||||
}
|
}
|
||||||
replyMessage = replyMessage.concat(convertMessage2List(reply, quickAction.auto_escape))
|
replyMessage = replyMessage.concat(convertMessage2List(reply, quickAction.auto_escape))
|
||||||
const { sendElements, deleteAfterSentFiles } = await createSendElements(ctx, replyMessage, peer)
|
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') {
|
if (msg.message_type === 'group') {
|
||||||
const groupMsgQuickAction = quickAction as QuickOperationGroupMessage
|
const groupMsgQuickAction = quickAction as QuickOperationGroupMessage
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { CheckVersion, Config } from '../common/types'
|
import { CheckVersion, Config } from '../common/types'
|
||||||
import { SettingButton, SettingItem, SettingList, SettingSwitch, SettingSelect } from './components'
|
import { SettingButton, SettingItem, SettingList, SettingSwitch, SettingSelect } from './components'
|
||||||
import { version } from '../version'
|
import { version } from '../version'
|
||||||
// @ts-expect-error
|
// @ts-expect-error: Unreachable code error
|
||||||
import StyleRaw from './style.css?raw'
|
import StyleRaw from './style.css?raw'
|
||||||
|
|
||||||
type HostsType = 'httpHosts' | 'wsHosts'
|
type HostsType = 'httpHosts' | 'wsHosts'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user