Skip to content

Commit

Permalink
fix: 修复 auxCode.lua 内转义问题
Browse files Browse the repository at this point in the history
修复 auxCode 内的转义问题,使其 `,`和`%`等特殊符号可以转义。

resolved: #70
  • Loading branch information
YummyCocoa authored and Mintimate committed Apr 25, 2024
1 parent 88ede4c commit 93ecf16
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lua/auxCode_filter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
local AuxFilter = {}

local function alt_lua_punc( s )
return s:gsub( '([%.%+%-%*%?%[%]%^%$%(%)%%])', '%%%1' )
if s then
return s:gsub( '([%.%+%-%*%?%[%]%^%$%(%)%%])', '%%%1' )
else
return ''
end
end

-- 日志模块
Expand Down Expand Up @@ -201,7 +205,7 @@ function AuxFilter.func(input, env)
local auxStr = ''
if string.find(inputCode, env.trigger_key_string) then
-- 字符串中包含輔助碼分隔符
local trigger_pattern = env.trigger_key_string:gsub("%W", "%%%1") -- 處理特殊字符
local trigger_pattern = env.trigger_key_string
local localSplit = inputCode:match(trigger_pattern .. "([^,]+)")
if localSplit then
auxStr = string.sub(localSplit, 1, 2)
Expand Down

0 comments on commit 93ecf16

Please sign in to comment.