From 20648226e868c4187fdc6553658b3e718c10cb16 Mon Sep 17 00:00:00 2001 From: Shigma Date: Sat, 3 Dec 2022 01:47:04 +0800 Subject: [PATCH] feat: support i18n shortcuts --- src/index.ts | 15 ++++++--------- src/locales/zh-CN.yml | 8 ++++++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/index.ts b/src/index.ts index f888624..e53182f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -83,14 +83,11 @@ export function apply(ctx: Context, config: Config) { } const cmd = ctx.command('novelai ') - .alias('nai') + .alias('nai', 'imagine') .userFields(['authority']) - .shortcut('画画', { fuzzy: true }) - .shortcut('畫畫', { fuzzy: true }) - .shortcut('约稿', { fuzzy: true }) - .shortcut('約稿', { fuzzy: true }) - .shortcut('增强', { fuzzy: true, options: { enhance: true } }) - .shortcut('增強', { fuzzy: true, options: { enhance: true } }) + .shortcut('draw', { i18n: true, fuzzy: true }) + .shortcut('draft', { i18n: true, fuzzy: true }) + .shortcut('enhance', { i18n: true, fuzzy: true, options: { enhance: true } }) .option('enhance', '-e', { hidden: restricted }) .option('model', '-m ', { type: models, hidden: thirdParty }) .option('resolution', '-r ', { type: resolution }) @@ -371,7 +368,7 @@ export function apply(ctx: Context, config: Config) { const subcmd = ctx.intersect(() => config.type === 'sd-webui') .command('novelai.upscale') - .shortcut('放大', { fuzzy: true }) + .shortcut('upscale', { i18n: true, fuzzy: true }) .option('scale', '-s ', { fallback: 2 }) .option('resolution', '-r ', { type: resolution }) .option('crop', '-C, --no-crop', { value: false, fallback: true }) @@ -402,7 +399,7 @@ export function apply(ctx: Context, config: Config) { const data: StableDiffusionWebUI.ExtraSingleImageRequest = { image: image.dataUrl, - resize_mode: !!options.resolution ? 1 : 0, + resize_mode: options.resolution ? 1 : 0, show_extras_results: true, upscaling_resize: options.scale, upscaling_resize_h: options.resolution?.height, diff --git a/src/locales/zh-CN.yml b/src/locales/zh-CN.yml index 4cbe9d6..3fc7722 100644 --- a/src/locales/zh-CN.yml +++ b/src/locales/zh-CN.yml @@ -6,6 +6,11 @@ commands: 查找标签可以使用 Danbooru。 快来给仓库点个 star 吧:https://github.com/koishijs/novelai-bot + shortcuts: + draw: 画画 + draft: 约稿 + enhance: 增强 + options: enhance: 图片增强模式 model: 设定生成模型 @@ -58,6 +63,9 @@ commands: novelai.upscale: description: AI 放大图片 + shortcuts: + upscale: 放大 + options: scale: 设置放大倍数 resolution: 设定放大尺寸