Skip to content

Commit

Permalink
feat(utils): enhanced cqCode.stringify
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Apr 18, 2020
1 parent 735877f commit 26ba494
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/koishi-utils/src/cqCode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type CQCodeData = Record<string, string | number>
type CQCodeData = Record<string, string | number | boolean>

interface CQCode {
type: string
Expand All @@ -25,7 +25,7 @@ namespace CQCode {
.replace(/&amp;/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) {
Expand Down

0 comments on commit 26ba494

Please sign in to comment.