no message

This commit is contained in:
kuaifan 2024-11-21 09:30:08 +08:00
parent ec8d48292e
commit 906d87f43f
5 changed files with 7 additions and 7 deletions

View File

@ -701,7 +701,7 @@ class WebSocketDialogMsg extends AbstractModel
$key = ''; $key = '';
switch ($this->type) { switch ($this->type) {
case 'text': case 'text':
if (!preg_match("/<span[^>]*?data-quick-key=([\"'])(.*?)\\1[^>]*?>/is", $this->msg['text'])) { if (!preg_match("/<span[^>]*?data-quick-key=([\"'])([^\"']+?)\\1[^>]*?>/is", $this->msg['text'])) {
$key = strip_tags($this->msg['text']); $key = strip_tags($this->msg['text']);
} }
break; break;
@ -880,7 +880,7 @@ class WebSocketDialogMsg extends AbstractModel
$text = str_replace($matchs[0][$key], "[:{$matchChar[1]}:{$keyId}:{$matchValye[1]}:]", $text); $text = str_replace($matchs[0][$key], "[:{$matchChar[1]}:{$keyId}:{$matchValye[1]}:]", $text);
} }
// 处理快捷消息 // 处理快捷消息
preg_match_all("/<span[^>]*?data-quick-key=([\"'])(.*?)\\1[^>]*?>(.*?)<\/span>/is", $text, $matchs); preg_match_all("/<span[^>]*?data-quick-key=([\"'])([^\"']+?)\\1[^>]*?>(.*?)<\/span>/is", $text, $matchs);
foreach ($matchs[0] as $key => $str) { foreach ($matchs[0] as $key => $str) {
$quickKey = $matchs[2][$key]; $quickKey = $matchs[2][$key];
$quickLabel = $matchs[3][$key]; $quickLabel = $matchs[3][$key];
@ -900,7 +900,7 @@ class WebSocketDialogMsg extends AbstractModel
} }
} }
// 处理链接标签 // 处理链接标签
preg_match_all("/<a[^>]*?href=([\"'])(.*?)\\1[^>]*?>(.*?)<\/a>/is", $text, $matchs); preg_match_all("/<a[^>]*?href=([\"'])([^\"']+?)\\1[^>]*?>(.*?)<\/a>/is", $text, $matchs);
foreach ($matchs[0] as $key => $str) { foreach ($matchs[0] as $key => $str) {
$herf = $matchs[2][$key]; $herf = $matchs[2][$key];
$title = $matchs[3][$key] ?: $herf; $title = $matchs[3][$key] ?: $herf;

View File

@ -876,7 +876,7 @@ class Base
*/ */
public static function formatContentImg($content) public static function formatContentImg($content)
{ {
$pattern = '/<img(.*?)src=("|\')(.*?)\2/is'; $pattern = '/<img([^>]*?)src=(["\'])([^"\']+?)\2/i';
if (preg_match($pattern, $content)) { if (preg_match($pattern, $content)) {
preg_match_all($pattern, $content, $matchs); preg_match_all($pattern, $content, $matchs);
foreach ($matchs[3] as $index => $value) { foreach ($matchs[3] as $index => $value) {

View File

@ -86,7 +86,7 @@ class BotReceiveMsgTask extends AbstractTask
if ($this->mention) { if ($this->mention) {
$original = preg_replace("/<span class=\"mention user\" data-id=\"(\d+)\">(.*?)<\/span>/", "", $original); $original = preg_replace("/<span class=\"mention user\" data-id=\"(\d+)\">(.*?)<\/span>/", "", $original);
} }
if (preg_match("/<span[^>]*?data-quick-key=([\"'])(.*?)\\1[^>]*?>(.*?)<\/span>/is", $original, $match)) { if (preg_match("/<span[^>]*?data-quick-key=([\"'])([^\"']+?)\\1[^>]*?>(.*?)<\/span>/is", $original, $match)) {
$command = $match[2]; $command = $match[2];
if (str_starts_with($command, '%3A.')) { if (str_starts_with($command, '%3A.')) {
$command = ":" . substr($command, 4); $command = ":" . substr($command, 4);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long