Merge branch 'dev'

This commit is contained in:
linyuchen 2024-07-13 14:09:45 +08:00
commit 1633734e08
9 changed files with 38 additions and 9 deletions

View File

@ -1,10 +1,10 @@
{
"manifest_version": 4,
"type": "extension",
"name": "LLOneBot v3.26.7",
"name": "LLOneBot v3.27.0",
"slug": "LLOneBot",
"description": "使你的NTQQ支持OneBot11协议进行QQ机器人开发, 不支持商店在线更新",
"version": "3.26.7",
"description": "使你的NTQQ支持OneBot11协议进行QQ机器人开发",
"version": "3.27.0",
"icon": "./icon.jpg",
"authors": [
{

View File

@ -43,6 +43,7 @@ export class ConfigUtil {
enableQOAutoQuote: false
}
let defaultConfig: Config = {
enableLLOB: true,
ob11: ob11Default,
heartInterval: 60000,
token: '',

View File

@ -17,6 +17,7 @@ export interface CheckVersion {
version: string
}
export interface Config {
enableLLOB: boolean
ob11: OB11Config
token?: string
heartInterval?: number // ms

View File

@ -13,7 +13,7 @@ import {
CHANNEL_UPDATE,
} from '../common/channels'
import { ob11WebsocketServer } from '../onebot11/server/ws/WebsocketServer'
import { DATA_DIR } from '../common/utils'
import { DATA_DIR, qqPkgInfo } from '../common/utils'
import {
friendRequests,
getFriend,
@ -203,6 +203,10 @@ function onLoad() {
async function startReceiveHook() {
startHook().then()
if (getConfigUtil().getConfig().enablePoke) {
if ( qqPkgInfo.buildVersion > '23873'){
log(`当前版本${qqPkgInfo.buildVersion}不支持发送戳一戳模块`)
return
}
crychic.loadNode()
crychic.registerPokeHandler((id, isGroup) => {
log(`收到戳一戳消息了!是否群聊:${isGroup}id:${id}`)
@ -435,6 +439,11 @@ function onLoad() {
async function start() {
log('llonebot pid', process.pid)
const config = getConfigUtil().getConfig()
if (!config.enableLLOB){
log('LLOneBot 开关设置为关闭不启动LLOneBot')
return
}
llonebotError.otherError = ''
startTime = Date.now()
dbUtil.getReceivedTempUinMap().then((m) => {
@ -469,7 +478,6 @@ function onLoad() {
}
const config = getConfigUtil().getConfig()
if (config.ob11.enableHttp) {
ob11HTTPServer.start(config.ob11.httpPort)
}

View File

@ -226,6 +226,7 @@ export interface GrayTipElement {
content: string
}
jsonGrayTipElement: {
busiId: number
jsonStr: string
}
}

View File

@ -24,7 +24,7 @@ import {
User,
VideoElement,
} from '../ntqqapi/types'
import { deleteGroup, getFriend, getGroupMember, selfInfo, tempGroupCodeMap } from '../common/data'
import { deleteGroup, getFriend, getGroupMember, selfInfo, tempGroupCodeMap, uidMaps } from '../common/data'
import { EventType } from './event/OB11BaseEvent'
import { encodeCQCode } from './cqcode'
import { dbUtil } from '../common/db'
@ -47,6 +47,7 @@ import { mFaceCache } from '../ntqqapi/constructor'
import { OB11FriendAddNoticeEvent } from './event/notice/OB11FriendAddNoticeEvent'
import { OB11FriendRecallNoticeEvent } from './event/notice/OB11FriendRecallNoticeEvent'
import { OB11GroupRecallNoticeEvent } from './event/notice/OB11GroupRecallNoticeEvent'
import { OB11GroupPokeEvent } from './event/notice/OB11PokeEvent'
let lastRKeyUpdateTime = 0
@ -490,6 +491,16 @@ export class OB11Constructor {
}
* */
if (grayTipElement.jsonGrayTipElement.busiId == 1061) {
//判断业务类型
//Poke事件
let pokedetail: any[] = json.items;
//筛选item带有uid的元素
pokedetail = pokedetail.filter(item => item.uid);
if (pokedetail.length == 2) {
return new OB11GroupPokeEvent(parseInt(msg.peerUid), parseInt((uidMaps[pokedetail[0].uid])!), parseInt((uidMaps[pokedetail[1].uid])));
}
}
const memberUin = json.items[1].param[0]
const title = json.items[3].txt
log('收到群成员新头衔消息', json)

View File

@ -21,10 +21,10 @@ export class OB11FriendPokeEvent extends OB11PokeEvent {
export class OB11GroupPokeEvent extends OB11PokeEvent {
group_id: number
constructor(group_id: number, user_id: number = 0) {
constructor(group_id: number, user_id: number = 0, target_id: number = 0) {
super()
this.group_id = group_id
this.target_id = user_id
this.target_id = target_id
this.user_id = user_id
}
}

View File

@ -62,6 +62,13 @@ async function onSettingWindowCreated(view: Element) {
SettingButton('请稍候', 'llonebot-update-button', 'secondary'),
),
]),
SettingList([
SettingItem(
'是否启用 LLOneBot, 重启QQ后生效',
null,
SettingSwitch('enableLLOB', config.enableLLOB, { 'control-display-id': 'config-enableLLOB' }),
)]
),
SettingList([
SettingItem(
'启用 HTTP 服务',

View File

@ -1 +1 @@
export const version = '3.26.7'
export const version = '3.27.0'