mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
fix: 优化qq表情适配
This commit is contained in:
parent
bae27b7362
commit
f368f4f040
1 changed files with 6 additions and 5 deletions
|
|
@ -1,4 +1,5 @@
|
|||
// import { segment } from 'oicq'
|
||||
import _ from 'lodash'
|
||||
import {segment} from "oicq";
|
||||
export const faceMap = {
|
||||
0: '惊讶',
|
||||
1: '撇嘴',
|
||||
|
|
@ -506,11 +507,11 @@ export async function convertFaces (msg, handleAt = false, e) {
|
|||
tmpFace += msg[i]
|
||||
} else {
|
||||
foundFace = false
|
||||
if (faceMapReverse[tmpFace]) {
|
||||
if (faceMapReverse[tmpFace] || faceMapReverse['/' + tmpFace] || faceMapReverse[_.trimStart(tmpFace, '/')]) {
|
||||
if (tmpMsg) {
|
||||
msgs.push(tmpMsg)
|
||||
}
|
||||
msgs.push(segment.face(parseInt(faceMapReverse[tmpFace])))
|
||||
msgs.push(segment.face(parseInt(faceMapReverse[tmpFace] || faceMapReverse['/' + tmpFace] || faceMapReverse[_.trimStart(tmpFace, '/')])))
|
||||
tmpMsg = ''
|
||||
} else {
|
||||
tmpMsg += `[${tmpFace}]`
|
||||
|
|
@ -533,11 +534,11 @@ export async function convertFaces (msg, handleAt = false, e) {
|
|||
|
||||
export function testConvertFaces () {
|
||||
const toTest = [
|
||||
'你好啊[微笑][惊讶]'
|
||||
'你好啊[/微笑][惊讶]哈哈[/拜谢]'
|
||||
]
|
||||
toTest.forEach(t => {
|
||||
console.log(convertFaces(t))
|
||||
})
|
||||
}
|
||||
|
||||
// testConvertFaces()
|
||||
testConvertFaces()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue