koishi-plugin-onebot-verifier 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +2 -6
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -133,15 +133,11 @@ function apply(ctx, config = {}) {
133
133
  const rawText = session.event?._data?.comment || "";
134
134
  const cleanLines = rawText.split(/[\r\n]+/).map((s) => s.trim()).filter((s) => /^(回答)[::]/i.test(s)).map((s) => s.replace(/^(回答)[::]\s*/i, ""));
135
135
  const verifyText = cleanLines.length > 0 ? cleanLines.join("\n") : rawText;
136
- const toRegex = /* @__PURE__ */ __name((text) => {
137
- const match = text.match(/^\/(.+)\/([a-z]*)$/);
138
- return match ? new RegExp(match[1], match[2]) : new RegExp(text, "i");
139
- }, "toRegex");
140
136
  if (kind === "member") {
141
137
  const groupRule = config.verifyRules?.find((r) => r.guildId === session.guildId);
142
138
  if (!groupRule) return false;
143
139
  try {
144
- if (groupRule.keyword && !toRegex(groupRule.keyword).test(verifyText)) return false;
140
+ if (groupRule.keyword && !new RegExp(groupRule.keyword, "i").test(verifyText)) return false;
145
141
  const limitLevel = groupRule.minLevel ?? -1;
146
142
  if (limitLevel >= 0 && session.onebot && session.userId) {
147
143
  const stats = await session.onebot.getStrangerInfo(session.userId, true);
@@ -154,7 +150,7 @@ function apply(ctx, config = {}) {
154
150
  }
155
151
  if (kind === "friend") {
156
152
  try {
157
- if (config.friendRegex && toRegex(config.friendRegex).test(verifyText)) return true;
153
+ if (config.friendRegex && new RegExp(config.friendRegex, "i").test(verifyText)) return true;
158
154
  const limitLevel = config.friendLevel ?? -1;
159
155
  if (limitLevel >= 0 && session.onebot && session.userId) {
160
156
  const stats = await session.onebot.getStrangerInfo(session.userId, true);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-onebot-verifier",
3
3
  "description": "适用于 Onebot 的审核插件,支持自动审核好友/加群/邀请请求",
4
- "version": "1.0.2",
4
+ "version": "1.0.3",
5
5
  "contributors": [
6
6
  "Yis_Rime <yis_rime@outlook.com>"
7
7
  ],