mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
🐞 fix: 解决tiktok解析问题
This commit is contained in:
parent
9908d0e213
commit
0d0d67d881
@ -56,48 +56,56 @@ export class mystery extends plugin {
|
|||||||
this.mysteryConfig = config.getConfig('mystery')
|
this.mysteryConfig = config.getConfig('mystery')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 接受到消息都会先执行一次
|
/** 接受到消息都会先执行一次 */
|
||||||
async accept () {
|
async accept() {
|
||||||
let oldReply = this.e.reply
|
if (this.e.isGroup) {
|
||||||
|
let group = this.e.group;
|
||||||
|
if (!group.is_owner && (group.is_admin && group.mute_left > 0)) return;
|
||||||
|
if (!(group.is_owner || group.is_admin) && (group.all_muted || group.mute_left > 0)) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let old_reply = this.e.reply;
|
||||||
|
|
||||||
this.e.reply = async function (msgs, quote, data) {
|
this.e.reply = async function (msgs, quote, data) {
|
||||||
if (!msgs) return false
|
if (!msgs) return false;
|
||||||
if (!Array.isArray(msgs)) msgs = [ msgs ]
|
if (!Array.isArray(msgs)) msgs = [msgs];
|
||||||
let result = await oldReply(msgs, quote, data)
|
let result = await old_reply(msgs, quote, data);
|
||||||
|
|
||||||
if (!result || !result.message_id) {
|
if (!result || !result.message_id) {
|
||||||
let isxml = false
|
let isxml = false;
|
||||||
|
|
||||||
for (let msg of msgs) {
|
for (let msg of msgs) {
|
||||||
if (msg && msg?.type == 'xml' && msg?.data) {
|
if (msg && msg?.type == 'xml' && msg?.data) {
|
||||||
msg.data = msg.data.replace(/^<\?xml.*update=.*?>/g, '<?xml update="1.0" encoding="utf-8" ?>')
|
msg.data = msg.data.replace(/^<\?xml.*version=.*?>/g, '<?xml version="1.0" encoding="utf-8" ?>');
|
||||||
isxml = true
|
isxml = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isxml) {
|
if (isxml) {
|
||||||
result = await oldReply(msgs, quote, data)
|
result = await old_reply(msgs, quote, data);
|
||||||
} else {
|
} else {
|
||||||
let MsgList = [ {
|
let MsgList = [{
|
||||||
message: msgs, nickname: Bot.nickname, user_id: Bot.user_id
|
message: msgs,
|
||||||
} ]
|
nickname: Bot.nickname,
|
||||||
|
user_id: Bot.uin
|
||||||
|
}];
|
||||||
|
|
||||||
let forwardMsg = await Bot.makeForwardMsg(MsgList)
|
let forwardMsg = await Bot.makeForwardMsg(MsgList);
|
||||||
|
|
||||||
forwardMsg.data = forwardMsg.data
|
forwardMsg.data = forwardMsg.data
|
||||||
.replace('<?xml update="1.0" encoding="utf-8"?>', '<?xml update="1.0" encoding="utf-8" ?>')
|
.replace('<?xml version="1.0" encoding="utf-8"?>', '<?xml version="1.0" encoding="utf-8" ?>')
|
||||||
.replace(/\n/g, '')
|
.replace(/\n/g, '')
|
||||||
.replace(/<title color="#777777" size="26">(.+?)<\/title>/g, '___')
|
.replace(/<title color="#777777" size="26">(.+?)<\/title>/g, '___')
|
||||||
.replace(/___+/, '<title color="#777777" size="26">请点击查看内容</title>')
|
.replace(/___+/, '<title color="#777777" size="26">请点击查看内容</title>');
|
||||||
msgs = forwardMsg
|
msgs = forwardMsg;
|
||||||
result = await oldReply(msgs, quote, data)
|
result = await old_reply(msgs, quote, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result || !result.message_id) {
|
if (!result || !result.message_id) {
|
||||||
logger.error('风控消息处理失败,请登录手机QQ查看是否可手动解除风控!')
|
logger.error('风控消息处理失败,请登录手机QQ查看是否可手动解除风控!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,6 +129,7 @@ export class tools extends plugin {
|
|||||||
"User-Agent":
|
"User-Agent":
|
||||||
"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Mobile Safari/537.36",
|
"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Mobile Safari/537.36",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
"Accept-Encoding": "gzip,deflate,compress"
|
||||||
},
|
},
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
proxy: false,
|
proxy: false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user