Skip to content

Commit 2962101

Browse files
committed
feat: add minimal option to tarot command for image-only output
1 parent 32ec125 commit 2962101

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/index.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@ export function apply(ctx: Context) {
88
.command('tarot')
99
.alias('塔罗')
1010
.alias('塔罗牌')
11-
.action(async () => {
11+
.option('minimal', '-m')
12+
.action(async ({ options }) => {
1213
let result = await getTarot(ctx)
1314
let img = result.match(/(?<=(±img=)).+(?=±)/g)[0]
15+
16+
if (options.minimal) {
17+
return h('img', { src: img })
18+
}
19+
1420
let text1 = result.match(/.+(?=(±i))/g)[0].replace(/(\\r)/, '\n')
1521
let text2 = result.match(/(?<=(g±)).+/g)[0].replace(/(\\r)/, ' ')
1622
return h('message', h('img', { src: img }), text1, text2)
@@ -19,11 +25,17 @@ export function apply(ctx: Context) {
1925
ctx.i18n.define('zh-CN', {
2026
'commands.tarot': {
2127
description: '抽取一张塔罗牌',
28+
options: {
29+
minimal: '仅输出图片',
30+
},
2231
},
2332
})
2433
ctx.i18n.define('en-US', {
2534
'commands.tarot': {
2635
description: 'Draw a tarot card (Chinese only)',
36+
options: {
37+
minimal: 'show image only',
38+
},
2739
},
2840
})
2941
}

0 commit comments

Comments
 (0)