Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
koishi-decorators
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
3rdeye
koishi-decorators
Commits
d3771841
Commit
d3771841
authored
Mar 13, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add type to CommandLocale
parent
c5e8b4e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
src/decorators/decorators.ts
src/decorators/decorators.ts
+2
-1
src/def/interfaces.ts
src/def/interfaces.ts
+7
-0
No files found.
src/decorators/decorators.ts
View file @
d3771841
...
@@ -2,6 +2,7 @@ import {
...
@@ -2,6 +2,7 @@ import {
BeforeEventName
,
BeforeEventName
,
CommandConfigExtended
,
CommandConfigExtended
,
CommandDefinitionFun
,
CommandDefinitionFun
,
CommandLocaleDef
,
CommandOptionConfigWithDescription
,
CommandOptionConfigWithDescription
,
EventName
,
EventName
,
KoishiCommandDefinition
,
KoishiCommandDefinition
,
...
@@ -113,7 +114,7 @@ export const CommandUse = <T extends Command, R extends any[]>(
...
@@ -113,7 +114,7 @@ export const CommandUse = <T extends Command, R extends any[]>(
...
args
:
R
...
args
:
R
)
=>
CommandDef
((
cmd
)
=>
callback
(
cmd
,
...
args
));
)
=>
CommandDef
((
cmd
)
=>
callback
(
cmd
,
...
args
));
export
const
CommandLocale
=
(
locale
:
string
,
def
:
any
)
=>
export
const
CommandLocale
=
(
locale
:
string
,
def
:
CommandLocaleDef
)
=>
CommandDef
((
cmd
,
ctx
)
=>
{
CommandDef
((
cmd
,
ctx
)
=>
{
ctx
.
i18n
.
define
(
locale
,
`commands.
${
cmd
.
name
}
`
,
def
);
ctx
.
i18n
.
define
(
locale
,
`commands.
${
cmd
.
name
}
`
,
def
);
return
cmd
;
return
cmd
;
...
...
src/def/interfaces.ts
View file @
d3771841
...
@@ -6,6 +6,7 @@ import {
...
@@ -6,6 +6,7 @@ import {
EventMap
,
EventMap
,
Plugin
,
Plugin
,
Selection
,
Selection
,
Store
,
}
from
'
koishi
'
;
}
from
'
koishi
'
;
import
type
{
DefaultContext
,
DefaultState
,
ParameterizedContext
}
from
'
koa
'
;
import
type
{
DefaultContext
,
DefaultState
,
ParameterizedContext
}
from
'
koa
'
;
import
type
{
RouterParamContext
}
from
'
@koa/router
'
;
import
type
{
RouterParamContext
}
from
'
@koa/router
'
;
...
@@ -150,3 +151,9 @@ export type TopLevelActionDef = (ctx: Context, obj: any) => void;
...
@@ -150,3 +151,9 @@ export type TopLevelActionDef = (ctx: Context, obj: any) => void;
export
interface
CommandOptionConfigWithDescription
extends
Argv
.
OptionConfig
{
export
interface
CommandOptionConfigWithDescription
extends
Argv
.
OptionConfig
{
description
?:
string
|
Dict
<
string
>
;
description
?:
string
|
Dict
<
string
>
;
}
}
export
interface
CommandLocaleDef
extends
Store
{
description
?:
string
;
options
?:
Dict
<
string
>
;
messages
?:
Store
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment