Skip to content

Commit

Permalink
chore: suppress type check
Browse files Browse the repository at this point in the history
  • Loading branch information
Wesley-Young committed Aug 26, 2024
1 parent 7b87b09 commit 542c5be
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/onebot/helper/cqcode.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { OB11MessageData } from '../types';

const pattern = /\[CQ:(\w+)((,\w+=[^,\]]*)*)\]/;
const pattern = /\[CQ:(\w+)((,\w+=[^,\]]*)*)]/;

function unescape(source: string) {
return String(source)
Expand Down Expand Up @@ -49,14 +49,14 @@ export function encodeCQCode(data: OB11MessageData) {
const CQCodeEscapeText = (text: string) => {
return text.replace(/&/g, '&')
.replace(/\[/g, '[')
.replace(/\]/g, ']');
.replace(/]/g, ']');

};

const CQCodeEscape = (text: string) => {
return text.replace(/&/g, '&')
.replace(/\[/g, '[')
.replace(/\]/g, ']')
.replace(/]/g, ']')
.replace(/,/g, ',');
};

Expand All @@ -66,7 +66,10 @@ export function encodeCQCode(data: OB11MessageData) {

let result = '[CQ:' + data.type;
for (const name in data.data) {
const value = data.data[name];
const value =
// eslint-disable-next-line
// @ts-ignore
data.data[name];
if (value === undefined) {
continue;
}
Expand All @@ -79,4 +82,4 @@ export function encodeCQCode(data: OB11MessageData) {
}
result += ']';
return result;
}
}

0 comments on commit 542c5be

Please sign in to comment.