mirror of
https://github.com/koishijs/novelai-bot
synced 2025-01-07 07:06:54 +08:00
fix: add missing injects
This commit is contained in:
parent
816ed416b1
commit
052e57ac3d
18
package.json
18
package.json
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "koishi-plugin-novelai",
|
||||
"description": "Generate images by diffusion models",
|
||||
"version": "1.18.4",
|
||||
"version": "1.19.1",
|
||||
"main": "lib/index.js",
|
||||
"typings": "lib/index.d.ts",
|
||||
"files": [
|
||||
@ -63,22 +63,22 @@
|
||||
"generate"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"koishi": "^4.15.0"
|
||||
"koishi": "^4.15.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@koishijs/plugin-help": "^2.3.2",
|
||||
"@koishijs/plugin-help": "^2.3.3",
|
||||
"@koishijs/translator": "^1.1.1",
|
||||
"@koishijs/vitepress": "^3.0.1",
|
||||
"@types/libsodium-wrappers-sumo": "^0.7.5",
|
||||
"@types/node": "^20.4.2",
|
||||
"@types/libsodium-wrappers-sumo": "^0.7.7",
|
||||
"@types/node": "^20.8.9",
|
||||
"atsc": "^1.2.2",
|
||||
"koishi": "^4.15.0",
|
||||
"sass": "^1.63.6",
|
||||
"typescript": "^5.1.6",
|
||||
"koishi": "^4.15.3",
|
||||
"sass": "^1.69.5",
|
||||
"typescript": "^5.2.2",
|
||||
"vitepress": "1.0.0-rc.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"image-size": "^1.0.2",
|
||||
"libsodium-wrappers-sumo": "^0.7.11"
|
||||
"libsodium-wrappers-sumo": "^0.7.13"
|
||||
}
|
||||
}
|
||||
|
18
src/index.ts
18
src/index.ts
@ -28,6 +28,10 @@ function handleError(session: Session, err: Error) {
|
||||
return session.text('.unknown-error')
|
||||
}
|
||||
|
||||
export const inject = {
|
||||
optional: ['translator'],
|
||||
}
|
||||
|
||||
export function apply(ctx: Context, config: Config) {
|
||||
ctx.i18n.define('zh-CN', require('./locales/zh-CN'))
|
||||
ctx.i18n.define('zh-TW', require('./locales/zh-TW'))
|
||||
@ -85,7 +89,8 @@ export function apply(ctx: Context, config: Config) {
|
||||
}
|
||||
|
||||
const cmd = ctx.command('novelai <prompts:text>')
|
||||
.alias('nai', 'imagine')
|
||||
.alias('nai')
|
||||
.alias('imagine')
|
||||
.userFields(['authority'])
|
||||
.shortcut('imagine', { i18n: true, fuzzy: true })
|
||||
.shortcut('enhance', { i18n: true, fuzzy: true, options: { enhance: true } })
|
||||
@ -114,13 +119,12 @@ export function apply(ctx: Context, config: Config) {
|
||||
input = ''
|
||||
options = options.resolution ? { resolution: options.resolution } : {}
|
||||
}
|
||||
}
|
||||
else if (
|
||||
!config.defaultPromptSw &&
|
||||
session.user.authority < session.resolve(config.authLv)
|
||||
} else if (
|
||||
!config.defaultPromptSw
|
||||
&& session.user.authority < session.resolve(config.authLv)
|
||||
) return session.text('internal.low-auth')
|
||||
|
||||
const haveInput = input?.trim() ? true : false
|
||||
const haveInput = !!input?.trim()
|
||||
if (!haveInput && !config.defaultPromptSw) return session.execute('help novelai')
|
||||
|
||||
// Check if the user is allowed to use this command.
|
||||
@ -184,7 +188,7 @@ export function apply(ctx: Context, config: Config) {
|
||||
}
|
||||
|
||||
const [errPath, prompt, uc] = parseInput(
|
||||
session, input, config, options.override, config.defaultPromptSw
|
||||
session, input, config, options.override, config.defaultPromptSw,
|
||||
)
|
||||
if (errPath) return session.text(errPath)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user