From e3dd100a06c0dfac5ff1a7a032e9fa3a5717433e Mon Sep 17 00:00:00 2001 From: Maiko Tan Date: Fri, 1 Nov 2024 10:55:31 +0800 Subject: [PATCH] feat: update tarot command to support text output instead of images --- src/index.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index c33378e..e623dab 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,14 +16,15 @@ export function apply(ctx: Context) { for (let i = 0; i < options.count || 1; i++) { let result = await getTarot(ctx) let img = result.match(/(?<=(±img=)).+(?=±)/g)[0] + let text1 = result.match(/.+(?=(±i))/g)[0].replace(/(\\r)/, '\n') + let text2 = result.match(/(?<=(g±)).+/g)[0].replace(/(\\r)/, ' ') if (options.minimal) { - ret.push(h('img', { src: img })) + ret.push(h('text', text1)) + ret.push(h('text', text2)) continue } - let text1 = result.match(/.+(?=(±i))/g)[0].replace(/(\\r)/, '\n') - let text2 = result.match(/(?<=(g±)).+/g)[0].replace(/(\\r)/, ' ') ret.push(h('img', { src: img }), text1, text2) } @@ -34,7 +35,7 @@ export function apply(ctx: Context) { 'commands.tarot': { description: '抽取一张塔罗牌', options: { - minimal: '仅输出图片', + minimal: '仅输出文本', count: '抽取张数', }, }, @@ -43,7 +44,7 @@ export function apply(ctx: Context) { 'commands.tarot': { description: 'Draw a tarot card (Chinese only)', options: { - minimal: 'show image only', + minimal: 'show text only', count: 'number of cards', }, },