From 26ba4940a82c6ed1c1fe921d24092a518b6279e7 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Sat, 18 Apr 2020 19:55:41 +0800 Subject: [PATCH] feat(utils): enhanced cqCode.stringify --- packages/koishi-utils/src/cqCode.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/koishi-utils/src/cqCode.ts b/packages/koishi-utils/src/cqCode.ts index 0910d5ed1a..6f9704448d 100644 --- a/packages/koishi-utils/src/cqCode.ts +++ b/packages/koishi-utils/src/cqCode.ts @@ -1,4 +1,4 @@ -type CQCodeData = Record +type CQCodeData = Record interface CQCode { type: string @@ -25,7 +25,7 @@ namespace CQCode { .replace(/&/g, '&') } - export function stringify (type: string, data: CQCodeData) { + export function stringify (type: string, data: CQCodeData = {}) { if (type === 'text') return '' + data.text let output = '[CQ:' + type for (const key in data) {