Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
koishi-plugin-act
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
0
Merge Requests
0
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-plugin-act
Commits
3942369f
Commit
3942369f
authored
Dec 05, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate schema to Config
parent
90baedb6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
src/index.ts
src/index.ts
+4
-4
src/plugin.ts
src/plugin.ts
+4
-4
No files found.
src/index.ts
View file @
3942369f
import
'
source-map-support/register
'
;
import
'
source-map-support/register
'
;
import
type
{
Context
}
from
'
koishi
'
;
import
type
{
Context
}
from
'
koishi
'
;
import
{
Config
,
MyPlugin
}
from
'
./plugin
'
;
import
{
Plugin
Config
,
MyPlugin
}
from
'
./plugin
'
;
export
{
Config
}
from
'
./plugin
'
;
export
*
from
'
./plugin
'
;
declare
module
'
koishi
'
{
declare
module
'
koishi
'
{
interface
Modules
{
interface
Modules
{
...
@@ -11,7 +11,7 @@ declare module 'koishi' {
...
@@ -11,7 +11,7 @@ declare module 'koishi' {
export
const
name
=
'
act
'
;
export
const
name
=
'
act
'
;
const
plugin
=
new
MyPlugin
();
const
plugin
=
new
MyPlugin
();
export
const
schema
=
plugin
.
schema
;
export
const
Config
=
plugin
.
schema
;
export
function
apply
(
ctx
:
Context
,
config
:
Config
)
{
export
function
apply
(
ctx
:
Context
,
config
:
Plugin
Config
)
{
ctx
.
plugin
(
plugin
,
config
);
ctx
.
plugin
(
plugin
,
config
);
}
}
src/plugin.ts
View file @
3942369f
...
@@ -26,7 +26,7 @@ export interface Selection extends BaseSelection {
...
@@ -26,7 +26,7 @@ export interface Selection extends BaseSelection {
$not
?:
Selection
;
$not
?:
Selection
;
}
}
export
interface
Config
{
export
interface
Plugin
Config
{
adminContext
?:
Selection
;
adminContext
?:
Selection
;
autoChangeName
?:
boolean
;
autoChangeName
?:
boolean
;
dropHelp
?:
boolean
;
dropHelp
?:
boolean
;
...
@@ -34,13 +34,13 @@ export interface Config {
...
@@ -34,13 +34,13 @@ export interface Config {
}
}
export
class
MyPlugin
{
export
class
MyPlugin
{
config
:
Config
;
config
:
Plugin
Config
;
ctx
:
Context
;
ctx
:
Context
;
adminCtx
:
Context
;
adminCtx
:
Context
;
shows
=
new
Map
<
string
,
Show
>
();
shows
=
new
Map
<
string
,
Show
>
();
name
=
'
act-main
'
;
name
=
'
act-main
'
;
schema
:
Schema
<
Config
>
=
Schema
.
object
({
schema
:
Schema
<
Plugin
Config
>
=
Schema
.
object
({
adminContext
:
Schema
.
any
().
description
(
'
管理员接口作用域。
'
),
adminContext
:
Schema
.
any
().
description
(
'
管理员接口作用域。
'
),
autoChangeName
:
Schema
.
boolean
()
autoChangeName
:
Schema
.
boolean
()
.
description
(
'
公演开始之前是否修改每个演员机器人的群名片。推荐开启。
'
)
.
description
(
'
公演开始之前是否修改每个演员机器人的群名片。推荐开启。
'
)
...
@@ -54,7 +54,7 @@ export class MyPlugin {
...
@@ -54,7 +54,7 @@ export class MyPlugin {
.
description
(
'
是否删除 `help` 命令,避免社死 (?)
'
)
.
description
(
'
是否删除 `help` 命令,避免社死 (?)
'
)
.
default
(
false
),
.
default
(
false
),
});
});
apply
(
ctx
:
Context
,
config
:
Config
)
{
apply
(
ctx
:
Context
,
config
:
Plugin
Config
)
{
this
.
ctx
=
ctx
;
this
.
ctx
=
ctx
;
this
.
config
=
config
;
this
.
config
=
config
;
if
(
this
.
config
.
dropHelp
)
{
if
(
this
.
config
.
dropHelp
)
{
...
...
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