Skip to content

Commit 0c7911c

Browse files
committed
fix: remove unused files and added fallback for regex escaping
1 parent 7dfafc3 commit 0c7911c

3 files changed

Lines changed: 8 additions & 107 deletions

File tree

src/app/plugins/pluralkit-handler/PKitCommandMessageHandler.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ const helpTextPkMemberRemoveProxy =
2121
'To remove a shorthand from a persona: pk;member Yumi proxy remove [text]';
2222
const helpTextPkMember = `Available 'pk;member' commands:\n${helpTextPkMemberNew}\n${helpTextPkMemberRename}\n${helpTextPkMemberNewProxy}\n${helpTextPkMemberRemoveProxy}`;
2323

24+
function regexEscapeFallBackFunc(template: string): string {
25+
return template.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
26+
}
27+
2428
/**
2529
* build a regex to recognize proxies
2630
* a template can be for example `[text]` or `f:text`
@@ -30,7 +34,10 @@ const helpTextPkMember = `Available 'pk;member' commands:\n${helpTextPkMemberNew
3034
*/
3135
function buildRegex(template: string): RegExp {
3236
const [before, after] = template.split('text');
33-
const pattern = `${RegExp.escape(before)}(.+)${RegExp.escape(after)}`;
37+
// RegExp.escape is baseline since May 2025
38+
// @ts-ignore TS2322
39+
const escape = RegExp.escape ?? regexEscapeFallBackFunc;
40+
const pattern = `${escape(before)}(.+)${escape(after)}`;
3441
return new RegExp(`^${pattern}$`);
3542
}
3643

src/app/plugins/pluralkit-handler/pluralkitImportFormat.ts

Lines changed: 0 additions & 106 deletions
This file was deleted.

src/app/plugins/pluralkit-handler/pluralkitSyntaxAdapter.ts

Whitespace-only changes.

0 commit comments

Comments
 (0)