Merge branch 'dev' into dev

This commit is contained in:
linyuchen 2024-07-16 21:21:50 +08:00 committed by GitHub
commit 408463f63b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 23 additions and 18 deletions

View File

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

View File

@ -206,8 +206,8 @@ function onLoad() {
if (getConfigUtil().getConfig().enablePoke) { if (getConfigUtil().getConfig().enablePoke) {
if ( qqPkgInfo.buildVersion > '23873'){ if ( qqPkgInfo.buildVersion > '23873'){
log(`当前版本${qqPkgInfo.buildVersion}不支持发送戳一戳模块`) log(`当前版本${qqPkgInfo.buildVersion}不支持发送戳一戳模块`)
return
} }
else {
crychic.loadNode() crychic.loadNode()
crychic.registerPokeHandler((id, isGroup) => { crychic.registerPokeHandler((id, isGroup) => {
log(`收到戳一戳消息了!是否群聊:${isGroup}id:${id}`) log(`收到戳一戳消息了!是否群聊:${isGroup}id:${id}`)
@ -216,11 +216,12 @@ function onLoad() {
pokeEvent = new OB11GroupPokeEvent(parseInt(id)) pokeEvent = new OB11GroupPokeEvent(parseInt(id))
} }
else { else {
pokeEvent = new OB11FriendPokeEvent(parseInt(selfInfo.uin), parseInt(id)) pokeEvent = new OB11FriendPokeEvent(parseInt(id))
} }
postOb11Event(pokeEvent) postOb11Event(pokeEvent)
}) })
} }
}
registerReceiveHook<{ registerReceiveHook<{
msgList: Array<RawMessage> msgList: Array<RawMessage>
}>([ReceiveCmdS.NEW_MSG, ReceiveCmdS.NEW_ACTIVE_MSG], async (payload) => { }>([ReceiveCmdS.NEW_MSG, ReceiveCmdS.NEW_ACTIVE_MSG], async (payload) => {

View File

@ -188,6 +188,7 @@ export const IMAGE_HTTP_HOST = 'https://gchat.qpic.cn'
export const IMAGE_HTTP_HOST_NT = 'https://multimedia.nt.qq.com.cn' export const IMAGE_HTTP_HOST_NT = 'https://multimedia.nt.qq.com.cn'
export interface PicElement { export interface PicElement {
picSubType: PicSubType
picType: PicType // 有这玩意儿吗 picType: PicType // 有这玩意儿吗
originImageUrl: string // http url, 没有hosthost是https://gchat.qpic.cn/, 带download参数的是https://multimedia.nt.qq.com.cn originImageUrl: string // http url, 没有hosthost是https://gchat.qpic.cn/, 带download参数的是https://multimedia.nt.qq.com.cn
originImageMd5?: string originImageMd5?: string

View File

@ -163,10 +163,12 @@ export class OB11Constructor {
// message_data["data"]["file"] = element.picElement.sourcePath // message_data["data"]["file"] = element.picElement.sourcePath
let fileName = element.picElement.fileName let fileName = element.picElement.fileName
const sourcePath = element.picElement.sourcePath const sourcePath = element.picElement.sourcePath
if (element.picElement.picType === PicType.gif && !fileName.endsWith('.gif')) { const isGif = element.picElement.picType === PicType.gif
if (isGif && !fileName.endsWith('.gif')) {
fileName += '.gif' fileName += '.gif'
} }
message_data['data']['file'] = fileName message_data['data']['file'] = fileName
message_data['data']['subType'] = element.picElement.picSubType
// message_data["data"]["path"] = element.picElement.sourcePath // message_data["data"]["path"] = element.picElement.sourcePath
// let currentRKey = "CAQSKAB6JWENi5LMk0kc62l8Pm3Jn1dsLZHyRLAnNmHGoZ3y_gDZPqZt-64" // let currentRKey = "CAQSKAB6JWENi5LMk0kc62l8Pm3Jn1dsLZHyRLAnNmHGoZ3y_gDZPqZt-64"
@ -297,7 +299,7 @@ export class OB11Constructor {
if (message_data.type !== 'unknown' && message_data.data) { if (message_data.type !== 'unknown' && message_data.data) {
const cqCode = encodeCQCode(message_data) const cqCode = encodeCQCode(message_data)
if (messagePostFormat === 'string') { if (messagePostFormat === 'string') {
;(resMsg.message as string) += cqCode (resMsg.message as string) += cqCode
} }
else (resMsg.message as OB11MessageData[]).push(message_data) else (resMsg.message as OB11MessageData[]).push(message_data)

View File

@ -50,6 +50,7 @@ export function encodeCQCode(data: OB11MessageData) {
} }
const CQCodeEscape = (text: string) => { const CQCodeEscape = (text: string) => {
text = text.toString()
return text.replace(/\&/g, '&amp;').replace(/\[/g, '&#91;').replace(/\]/g, '&#93;').replace(/,/g, '&#44;') return text.replace(/\&/g, '&amp;').replace(/\[/g, '&#91;').replace(/\]/g, '&#93;').replace(/,/g, '&#44;')
} }

View File

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