Compare commits

..

21 Commits

Author SHA1 Message Date
linyuchen
0fb30df1bc chore: version 4.3.1 2024-11-17 15:22:06 +08:00
linyuchen
62e23614fb Merge branch 'dev' 2024-11-17 15:20:45 +08:00
linyuchen
5514bf0bb8 chore: bump version 2024-11-17 15:20:22 +08:00
linyuchen
f5d093cc45 fix: 调用发包接口时检查 QQ 版本,兼容 27333 - 27597 的戳一戳 2024-11-17 15:19:48 +08:00
linyuchen
44c6debd01 Merge branch 'dev' 2024-11-16 23:03:01 +08:00
linyuchen
2c1d12e04b Merge remote-tracking branch 'origin/dev' into dev 2024-11-16 23:01:39 +08:00
linyuchen
110193ea15 fix: 调用发包接口时检查QQ版本 2024-11-16 23:01:24 +08:00
idranme
fafcf058b1 refactor 2024-11-16 19:39:14 +08:00
linyuchen
825c7c8e29 Merge branch 'dev' 2024-11-16 14:49:13 +08:00
linyuchen
c8d5eebe5d feat: new api set_friend_remark, set_friend_category, set_group_remark, set_group_msg_mask, set_restart 2024-11-16 14:48:45 +08:00
linyuchen
466a3e4d66 Merge branch 'dev'
# Conflicts:
#	manifest.json
#	src/version.ts
2024-11-15 11:01:52 +08:00
linyuchen
f6263375f1 chore: version 4.2.2 2024-11-15 11:01:25 +08:00
linyuchen
f79581d97e 🐛修复 hook ipc 时获取不到 callbackId 导致其他插件 ipc 通信失败 2024-11-15 10:58:35 +08:00
linyuchen
56f26e9aa8 chore: version 4.2.1 2024-11-14 20:00:36 +08:00
linyuchen
9e03071629 Merge branch 'dev' 2024-11-14 19:58:27 +08:00
idranme
1f02c98c8f chore 2024-11-14 15:24:46 +08:00
linyuchen
e1e5c278b9 🐛修复 hook ipc 时获取不到 eventName 导致其他插件 ipc 通信失败 2024-11-14 14:51:01 +08:00
idranme
104839f7ea fix 2024-11-14 12:34:48 +08:00
idranme
bb8771a5b4 refactor 2024-11-14 11:40:19 +08:00
linyuchen
4a2523463b Merge remote-tracking branch 'origin/main' 2024-11-13 19:35:04 +08:00
idranme
0d27ef7ebc Merge pull request #502 from LLOneBot/dev
release: 4.1.4
2024-11-09 22:29:16 +08:00
31 changed files with 355 additions and 4326 deletions

View File

@@ -4,7 +4,7 @@
"name": "LLOneBot",
"slug": "LLOneBot",
"description": "实现 OneBot 11 和 Satori 协议,用于 QQ 机器人开发",
"version": "4.2.0",
"version": "4.3.1",
"icon": "./icon.webp",
"authors": [
{

View File

@@ -35,9 +35,7 @@ import {
NTQQWindowApi
} from '../ntqqapi/api'
import { existsSync, mkdirSync } from 'node:fs'
import { initWrapperSession} from '@/ntqqapi/native/napcat-protocol-packet'
initWrapperSession().then()
import { NTQQSystemApi } from '@/ntqqapi/api/system'
declare module 'cordis' {
interface Events {
@@ -77,6 +75,7 @@ function onLoad() {
ctx.plugin(NTQQWebApi)
ctx.plugin(NTQQWindowApi)
ctx.plugin(Database)
ctx.plugin(NTQQSystemApi)
let started = false
@@ -231,6 +230,9 @@ function onLoad() {
// 创建窗口时触发
function onBrowserWindowCreated(window: BrowserWindow) {
if (window.id === 2) {
mainWindow = window
}
}
try {

View File

@@ -107,7 +107,7 @@ export class NTQQFriendApi extends Service {
return ret.arkMsg
}
async setBuddyRemark(uid: string, remark: string) {
async setBuddyRemark(uid: string, remark = '') {
return await invoke('nodeIKernelBuddyService/setBuddyRemark', [{
remarkParams: { uid, remark }
}])
@@ -122,4 +122,8 @@ export class NTQQFriendApi extends Service {
}
}])
}
async setBuddyCategory(uid: string, categoryId: number) {
return await invoke('nodeIKernelBuddyService/setBuddyCategory', [{ uid, categoryId }])
}
}

View File

@@ -9,7 +9,8 @@ import {
PublishGroupBulletinReq,
GroupAllInfo,
GroupFileInfo,
GroupBulletinListResult
GroupBulletinListResult,
GroupMsgMask
} from '../types'
import { invoke, NTClass, NTMethod } from '../ntcall'
import { GeneralCallResult } from '../services'
@@ -341,4 +342,12 @@ export class NTQQGroupApi extends Service {
[{ groupId }]
)
}
async setGroupMsgMask(groupCode: string, msgMask: GroupMsgMask) {
return await invoke('nodeIKernelGroupService/setGroupMsgMask', [{ groupCode, msgMask }])
}
async setGroupRemark(groupCode: string, groupRemark = '') {
return await invoke('nodeIKernelGroupService/modifyGroupRemark', [{ groupCode, groupRemark }])
}
}

38
src/ntqqapi/api/system.ts Normal file
View File

@@ -0,0 +1,38 @@
import { Context, Service } from 'cordis'
import { invoke, NTClass } from '@/ntqqapi/ntcall'
declare module 'cordis' {
interface Context {
ntSystemApi: NTQQSystemApi
}
}
export class NTQQSystemApi extends Service {
constructor(protected ctx: Context) {
super(ctx, 'ntSystemApi', true)
}
async restart() {
// todo: 调用此接口后会将 NTQQ 设置里面的自动登录和无需手机确认打开,重启后将状态恢复到之前的状态
// 设置自动登录
await this.setSettingAutoLogin(true)
// 退出账号
invoke('quitAccount', [], {
className: NTClass.BUSINESS_API
}).then()
invoke('notifyQQClose', [{ type: 1 }], { className: NTClass.QQ_EX_API }).then()
// 等待登录界面,模拟点击登录按钮?还是直接调用登录方法?
}
async getSettingAutoLogin() {
// 查询是否自动登录
return invoke('nodeIKernelNodeMiscService/queryAutoRun', [])
}
async setSettingAutoLogin(state: boolean) {
await invoke('nodeIKernelSettingService/setNeedConfirmSwitch', [{ state: 1 }]) // 1不需要手机确认2需要手机确认
await invoke('nodeIKernelSettingService/setAutoLoginSwitch', [{ state }])
}
}

View File

@@ -41,12 +41,14 @@ class Core extends Service {
static inject = ['ntMsgApi', 'ntFriendApi', 'ntGroupApi', 'store']
public startTime = 0
public native
public ntqqPacketApi: NTQQPacketApi
public packet!: NTQQPacketApi
constructor(protected ctx: Context, public config: Core.Config) {
super(ctx, 'app', true)
this.native = new Native(ctx)
initWrapperSession().then(session=>{this.ntqqPacketApi = new NTQQPacketApi(session)})
initWrapperSession().then(session => {
this.packet = new NTQQPacketApi(session)
})
}
public start() {

View File

@@ -2,6 +2,7 @@ import { NTMethod } from './ntcall'
import { log } from '@/common/utils'
import { randomUUID } from 'node:crypto'
import { ipcMain } from 'electron'
import { Dict } from 'cosmokit'
export const hookApiCallbacks: Record<string, (res: any) => void> = {}
@@ -45,8 +46,8 @@ export function startHook() {
const senderExclude = Symbol()
ipcMain.emit = new Proxy(ipcMain.emit, {
apply(target, thisArg, args: [eventName: string, ...args: any]) {
if (args[2]?.eventName.startsWith('ns-LoggerApi')) {
apply(target, thisArg, args: [channel: string, ...args: any]) {
if (args[2]?.eventName?.startsWith('ns-LoggerApi')) {
return target.apply(thisArg, args)
}
if (logHook) {
@@ -56,15 +57,15 @@ export function startHook() {
if (event.sender && !event.sender[senderExclude]) {
event.sender[senderExclude] = true
event.sender.send = new Proxy(event.sender.send, {
apply(target, thisArg, args: any[]) {
if (args[1].eventName?.startsWith('ns-LoggerApi')) {
apply(target, thisArg, args: [channel: string, meta: Dict, data: Dict[]]) {
if (args[1]?.eventName?.startsWith('ns-LoggerApi')) {
return target.apply(thisArg, args)
}
if (logHook) {
log('received', args)
}
const callbackId = args[1].callbackId
const callbackId = args[1]?.callbackId
if (callbackId) {
if (hookApiCallbacks[callbackId]) {
Promise.resolve(hookApiCallbacks[callbackId](args[2]))
@@ -96,7 +97,7 @@ export function startHook() {
}
}
return target.apply(thisArg, args)
}
},
})
}

View File

@@ -11,7 +11,7 @@ export class Native {
public activated = false
private crychic?: Dict
private seq = 0
private cb: Map<number, Function> = new Map()
private cb: Map<number, (res: any) => void> = new Map()
constructor(private ctx: Context) {
ctx.on('ready', () => {

View File

@@ -1,13 +1,13 @@
import { WrapperSession } from './wrapper-session/types';
export { initWrapperSession } from './wrapper-session';
export declare function checkSupportVersion(): void;
export declare class NTQQPacketApi {
private qqVersion;
private packetSession;
private readonly packetClient;
private readonly packer;
private logger;
private readonly wrapperSession;
constructor(wrapperSession: WrapperSession);
get available(): boolean;
private checkQQVersion;
private InitSendPacket;
private sendPacket;
private sendOidbPacket;

File diff suppressed because one or more lines are too long

View File

@@ -29,7 +29,8 @@ export enum NTClass {
SKEY_API = 'ns-SkeyApi',
GROUP_HOME_WORK = 'ns-GroupHomeWork',
GROUP_ESSENCE = 'ns-GroupEssence',
NODE_STORE_API = 'ns-NodeStoreApi'
NODE_STORE_API = 'ns-NodeStoreApi',
QQ_EX_API = 'ns-QQEXApi',
}
export enum NTMethod {

View File

@@ -13,7 +13,7 @@ export interface NodeIKernelBuddyService {
}[]
}>
setBuddyRemark(arg: unknown): void
setBuddyRemark(arg: unknown): Promise<GeneralCallResult>
isBuddy(uid: string): boolean

View File

@@ -12,4 +12,6 @@ export interface NodeIKernelNodeMiscService {
score: ''
}[]
}>
queryAutoRun(): Promise<boolean>
}

View File

@@ -1,10 +1,3 @@
export enum GroupListUpdateType {
REFRESHALL,
GETALL,
MODIFIED,
REMOVE
}
export interface Group {
groupCode: string
maxMember: number
@@ -188,3 +181,10 @@ export interface GroupBulletinListResult {
nextIndex: number
jointime: string
}
export enum GroupMsgMask {
AllowNotify = 1, // 允许提醒
AllowNotNotify = 4, // 接受消息不提醒
BoxNotNotify = 2, // 收进群助手不提醒
NotAllow = 3, // 屏蔽
}

View File

@@ -442,6 +442,7 @@ export interface RawMessage {
attrType: number
attrId: string
}>
isOnlineMsg: boolean
}
export interface Peer {

View File

@@ -1,6 +1,5 @@
import { BaseAction, Schema } from '../BaseAction'
import { ActionName } from '../types'
import { getBuildVersion } from '@/common/utils/misc'
import { selfInfo } from '@/common/globalVars'
interface Payload {
@@ -14,7 +13,7 @@ export class SendGroupSign extends BaseAction<Payload, null> {
})
async _handle(payload: Payload) {
await this.ctx.app.ntqqPacketApi.sendGroupSignPacket(selfInfo.uin, payload.group_id.toString())
await this.ctx.app.packet.sendGroupSignPacket(selfInfo.uin, payload.group_id.toString())
return null
}
}

View File

@@ -1,6 +1,5 @@
import { BaseAction, Schema } from '../BaseAction'
import { ActionName } from '../types'
import { getBuildVersion } from '@/common/utils/misc'
import { selfInfo } from '@/common/globalVars'
import { GroupMemberRole } from '@/ntqqapi/types'
@@ -25,7 +24,7 @@ export class SetGroupSpecialTitle extends BaseAction<Payload, null> {
if (self.role !== GroupMemberRole.Owner){
throw new Error(`不是群${payload.group_id}的群主,无法设置群头衔`)
}
await this.ctx.app.ntqqPacketApi.sendSetSpecialTittlePacket(payload.group_id.toString(), uid, payload.special_title || "")
await this.ctx.app.packet.sendSetSpecialTittlePacket(payload.group_id.toString(), uid, payload.special_title || "")
return null
}
}

View File

@@ -80,6 +80,11 @@ import { GetGroupFileSystemInfo } from './go-cqhttp/GetGroupFileSystemInfo'
import { GetCredentials } from './system/GetCredentials'
import { SetGroupSpecialTitle } from '@/onebot11/action/go-cqhttp/SetGroupSpecialTitle'
import { SendGroupSign } from '@/onebot11/action/go-cqhttp/SendGroupSign'
import { SetRestart } from '@/onebot11/action/system/SetRestart'
import { SetFriendCategory } from '@/onebot11/action/llonebot/SetFriendCategory'
import { SetFriendRemark } from '@/onebot11/action/llonebot/SetFriendRemark'
import { SetGroupMsgMask } from '@/onebot11/action/llonebot/SetGroupMsgMask'
import { SetGroupRemark } from '@/onebot11/action/llonebot/SetGroupRemark'
export function initActionMap(adapter: Adapter) {
const actionHandlers = [
@@ -100,6 +105,10 @@ export function initActionMap(adapter: Adapter) {
new GetRobotUinRange(adapter),
new GroupPoke(adapter),
new FriendPoke(adapter),
new SetFriendCategory(adapter),
new SetFriendRemark(adapter),
new SetGroupMsgMask(adapter),
new SetGroupRemark(adapter),
// onebot11
new SendLike(adapter),
new GetMsg(adapter),
@@ -133,6 +142,7 @@ export function initActionMap(adapter: Adapter) {
new ForwardFriendSingleMsg(adapter),
new ForwardGroupSingleMsg(adapter),
new GetCredentials(adapter),
new SetRestart(adapter),
// go-cqhttp
new GetEssenceMsgList(adapter),
new GetGroupHonorInfo(adapter),

View File

@@ -1,6 +1,6 @@
import { BaseAction, Schema } from '../BaseAction'
import { ActionName } from '../types'
import { getBuildVersion } from '@/common/utils/misc'
import { getBuildVersion } from '@/common/utils'
interface Payload {
user_id: number | string
@@ -13,15 +13,12 @@ export class FriendPoke extends BaseAction<Payload, null> {
})
async _handle(payload: Payload) {
// if (!this.ctx.app.native.checkPlatform()) {
// throw new Error('当前系统平台或架构不支持')
// }
// if (!this.ctx.app.native.checkVersion()) {
// throw new Error(`当前 QQ 版本 ${getBuildVersion()} 不支持,可尝试其他版本 27333—27597`)
// }
// await this.ctx.app.native.sendFriendPoke(+payload.user_id)
await this.ctx.app.ntqqPacketApi.sendPokePacket(+payload.user_id)
if (!this.ctx.app.native.checkPlatform() || !this.ctx.app.native.checkVersion()) {
await this.ctx.app.packet.sendPokePacket(+payload.user_id)
}
else{
await this.ctx.app.native.sendFriendPoke(+payload.user_id)
}
return null
}
}

View File

@@ -1,7 +1,6 @@
import { BaseAction, Schema } from '../BaseAction'
import { ActionName } from '../types'
import { getBuildVersion } from '@/common/utils/misc'
import {NTQQPacketApi} from '@/ntqqapi/native/napcat-protocol-packet'
import { getBuildVersion } from '@/common/utils'
interface Payload {
group_id: number | string
@@ -16,14 +15,12 @@ export class GroupPoke extends BaseAction<Payload, null> {
})
async _handle(payload: Payload) {
// if (!this.ctx.app.native.checkPlatform()) {
// throw new Error('当前系统平台或架构不支持')
// }
// if (!this.ctx.app.native.checkVersion()) {
// throw new Error(`当前 QQ 版本 ${getBuildVersion()} 不支持,可尝试其他版本 27333—27597`)
// }
// await this.ctx.app.native.sendGroupPoke(+payload.group_id, +payload.user_id)
await this.ctx.app.ntqqPacketApi.sendPokePacket(+payload.user_id, +payload.group_id)
if (!this.ctx.app.native.checkPlatform() || !this.ctx.app.native.checkVersion()) {
await this.ctx.app.packet.sendPokePacket(+payload.user_id, +payload.group_id)
}
else{
await this.ctx.app.native.sendGroupPoke(+payload.group_id, +payload.user_id)
}
return null
}
}

View File

@@ -0,0 +1,21 @@
import { BaseAction, Schema } from '../BaseAction'
import { ActionName } from '../types'
interface Payload {
user_id: number | string
category_id: number | string
}
export class SetFriendCategory extends BaseAction<Payload, unknown> {
actionName = ActionName.SetFriendCategory
payloadSchema = Schema.object({
user_id: Schema.union([Number, String]).required(),
category_id: Schema.union([Number, String]).required()
})
protected async _handle(payload: Payload) {
const uid = await this.ctx.ntUserApi.getUidByUin(payload.user_id.toString())
if (!uid) throw new Error('无法获取好友信息')
return this.ctx.ntFriendApi.setBuddyCategory(uid, +payload.category_id)
}
}

View File

@@ -0,0 +1,21 @@
import { BaseAction, Schema } from '../BaseAction'
import { ActionName } from '../types'
interface Payload {
user_id: number | string
remark?: string
}
export class SetFriendRemark extends BaseAction<Payload, unknown> {
actionName = ActionName.SetFriendRemark
payloadSchema = Schema.object({
user_id: Schema.union([Number, String]).required(),
remark: Schema.string()
})
protected async _handle(payload: Payload) {
const uid = await this.ctx.ntUserApi.getUidByUin(payload.user_id.toString())
if (!uid) throw new Error('无法获取好友信息')
return this.ctx.ntFriendApi.setBuddyRemark(uid, payload.remark || '')
}
}

View File

@@ -0,0 +1,19 @@
import { BaseAction, Schema } from '../BaseAction'
import { ActionName } from '../types'
interface Payload {
group_id: number | string
mask: number | string // 1, 2, 3, 4
}
export class SetGroupMsgMask extends BaseAction<Payload, unknown> {
actionName = ActionName.SetGroupMsgMask
payloadSchema = Schema.object({
group_id: Schema.union([Number, String]).required(),
mask: Schema.union([Number, String]).required()
})
protected async _handle(payload: Payload) {
return this.ctx.ntGroupApi.setGroupMsgMask(payload.group_id.toString(), +payload.mask)
}
}

View File

@@ -0,0 +1,15 @@
import { BaseAction } from '../BaseAction'
import { ActionName } from '../types'
interface Payload {
group_id: string,
remark?: string
}
export class SetGroupRemark extends BaseAction<Payload, unknown> {
actionName = ActionName.SetGroupRemark
protected async _handle(payload: Payload): Promise<unknown>{
return this.ctx.ntGroupApi.setGroupRemark(payload.group_id.toString(), payload.remark)
}
}

View File

@@ -7,62 +7,52 @@ import { ChatCacheListItemBasic, CacheFileType } from '@/ntqqapi/types'
export default class CleanCache extends BaseAction<void, void> {
actionName = ActionName.CleanCache
protected _handle(): Promise<void> {
return new Promise<void>(async (res, rej) => {
try {
// dbUtil.clearCache()
const cacheFilePaths: string[] = []
protected async _handle(): Promise<void> {
const cacheFilePaths: string[] = []
await this.ctx.ntFileCacheApi.setCacheSilentScan(false)
await this.ctx.ntFileCacheApi.setCacheSilentScan(false)
cacheFilePaths.push(await this.ctx.ntFileCacheApi.getHotUpdateCachePath())
cacheFilePaths.push(await this.ctx.ntFileCacheApi.getDesktopTmpPath())
cacheFilePaths.push(await this.ctx.ntFileCacheApi.getHotUpdateCachePath())
cacheFilePaths.push(await this.ctx.ntFileCacheApi.getDesktopTmpPath())
const list = await this.ctx.ntFileCacheApi.getCacheSessionPathList()
list.forEach((e) => cacheFilePaths.push(e.value))
const list = await this.ctx.ntFileCacheApi.getCacheSessionPathList()
list.forEach((e) => cacheFilePaths.push(e.value))
// await NTQQApi.addCacheScannedPaths(); // XXX: 调用就崩溃,原因目前还未知
const cacheScanResult = await this.ctx.ntFileCacheApi.scanCache()
const cacheSize = parseInt(cacheScanResult.size[6])
// await NTQQApi.addCacheScannedPaths(); // XXX: 调用就崩溃,原因目前还未知
const cacheScanResult = await this.ctx.ntFileCacheApi.scanCache()
const cacheSize = parseInt(cacheScanResult.size[6])
if (cacheScanResult.result !== 0) {
throw 'Something went wrong while scanning cache. Code: ' + cacheScanResult.result
}
if (cacheScanResult.result !== 0) {
throw 'Something went wrong while scanning cache. Code: ' + cacheScanResult.result
}
await this.ctx.ntFileCacheApi.setCacheSilentScan(true)
if (cacheSize > 0 && cacheFilePaths.length > 2) {
// 存在缓存文件且大小不为 0 时执行清理动作
// await NTQQApi.clearCache([ 'tmp', 'hotUpdate', ...cacheScanResult ]) // XXX: 也是调用就崩溃,调用 fs 删除得了
deleteCachePath(cacheFilePaths)
}
await this.ctx.ntFileCacheApi.setCacheSilentScan(true)
if (cacheSize > 0 && cacheFilePaths.length > 2) {
// 存在缓存文件且大小不为 0 时执行清理动作
// await NTQQApi.clearCache([ 'tmp', 'hotUpdate', ...cacheScanResult ]) // XXX: 也是调用就崩溃,调用 fs 删除得了
deleteCachePath(cacheFilePaths)
}
// 获取聊天记录列表
// NOTE: 以防有人不需要删除聊天记录,暂时先注释掉,日后加个开关
// const privateChatCache = await getCacheList(ChatType.friend); // 私聊消息
// const groupChatCache = await getCacheList(ChatType.group); // 群聊消息
// const chatCacheList = [ ...privateChatCache, ...groupChatCache ];
const chatCacheList: ChatCacheListItemBasic[] = []
// 获取聊天记录列表
// NOTE: 以防有人不需要删除聊天记录,暂时先注释掉,日后加个开关
// const privateChatCache = await getCacheList(ChatType.friend); // 私聊消息
// const groupChatCache = await getCacheList(ChatType.group); // 群聊消息
// const chatCacheList = [ ...privateChatCache, ...groupChatCache ];
const chatCacheList: ChatCacheListItemBasic[] = []
// 获取聊天缓存文件列表
const cacheFileList: string[] = []
// 获取聊天缓存文件列表
const cacheFileList: string[] = []
for (const name in CacheFileType) {
if (!isNaN(parseInt(name))) continue
for (const name in CacheFileType) {
if (!isNaN(parseInt(name))) continue
const fileTypeAny: any = CacheFileType[name]
const fileType: CacheFileType = fileTypeAny
const fileType = CacheFileType[name] as unknown as CacheFileType
cacheFileList.push(...(await this.ctx.ntFileCacheApi.getFileCacheInfo(fileType)).infos.map((file) => file.fileKey))
}
cacheFileList.push(...(await this.ctx.ntFileCacheApi.getFileCacheInfo(fileType)).infos.map((file) => file.fileKey))
}
// 一并清除
await this.ctx.ntFileCacheApi.clearChatCache(chatCacheList, cacheFileList)
res()
} catch (e) {
console.error('清理缓存时发生了错误')
rej(e)
}
})
// 一并清除
await this.ctx.ntFileCacheApi.clearChatCache(chatCacheList, cacheFileList)
}
}

View File

@@ -0,0 +1,10 @@
import { BaseAction } from '@/onebot11/action/BaseAction'
import { ActionName } from '@/onebot11/action/types'
export class SetRestart extends BaseAction<null, void> {
actionName = ActionName.SetRestart
protected async _handle() {
await this.ctx.ntSystemApi.restart()
}
}

View File

@@ -29,6 +29,10 @@ export enum ActionName {
GetRobotUinRange = 'get_robot_uin_range',
GroupPoke = 'group_poke',
FriendPoke = 'friend_poke',
SetFriendRemark = 'set_friend_remark',
SetFriendCategory = 'set_friend_category',
SetGroupMsgMask = 'set_group_msg_mask',
SetGroupRemark = 'set_group_remark',
// onebot 11
SendLike = 'send_like',
GetLoginInfo = 'get_login_info',
@@ -47,6 +51,7 @@ export enum ActionName {
SetGroupLeave = 'set_group_leave',
GetVersionInfo = 'get_version_info',
GetStatus = 'get_status',
SetRestart = 'set_restart',
CanSendRecord = 'can_send_record',
CanSendImage = 'can_send_image',
SetGroupKick = 'set_group_kick',

View File

@@ -221,7 +221,7 @@ export class MessageEncoder {
}
}
async generate(content: any[]) {
async generate(content: OB11MessageData[]) {
await this.render(content)
return {
multiMsgItems: [{

View File

@@ -11,6 +11,10 @@ function isEmpty(value: unknown) {
}
async function onSettingWindowCreated(view: Element) {
console.log(view)
if (!view){
return
}
const config = await window.llonebot.getConfig()
const ob11Config = { ...config.ob11 }
@@ -247,7 +251,9 @@ async function onSettingWindowCreated(view: Element) {
} else {
errDom?.classList.add('show')
}
errCodeDom!.innerHTML = errMsg
if (errCodeDom) {
errCodeDom.innerHTML = errMsg
}
}
showError().then()
@@ -456,8 +462,8 @@ async function onSettingWindowCreated(view: Element) {
}
window.llonebot.checkVersion().then(checkVersionFunc)
window.addEventListener('beforeunload', () => {
window.llonebot.getConfig().then(oldConfig=>{
if(JSON.stringify(oldConfig) !== JSON.stringify(config)){
window.llonebot.getConfig().then(oldConfig => {
if (JSON.stringify(oldConfig) !== JSON.stringify(config)) {
window.llonebot.setConfig(true, config)
}
})

View File

@@ -91,7 +91,7 @@ class SatoriAdapter extends Service {
input.subMsgType === 12 &&
input.elements[0]?.grayTipElement?.xmlElement?.templId === '10382'
) {
// 机器人被表情回应
}
else {
// 普通的消息

View File

@@ -1 +1 @@
export const version = '4.2.0'
export const version = '4.3.1'