Skip to content

Commit

Permalink
feat: improved regex
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki committed Feb 27, 2023
1 parent 54cf2e7 commit 82cd754
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kokkoro-plugin-base",
"version": "1.0.1",
"version": "1.0.2",
"description": "Provide basic plugin services for kokkoro.",
"main": "lib/index.js",
"engines": {
Expand Down Expand Up @@ -29,4 +29,4 @@
"files": [
"lib"
]
}
}
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugin
plugin
.command('print <message>')
.description('打印测试')
.sugar(/^(|)\s?(?<message>.+)$/)
.sugar(/^(|)\s*(?<message>.+)$/)
.action(async (ctx) => {
await ctx.reply(ctx.query.message);
})
Expand Down Expand Up @@ -51,7 +51,7 @@ plugin
.command('mount <...names>')
.description('挂载插件')
.limit(5)
.sugar(/^()\s?(?<names>([a-z]|\s)+)$/)
.sugar(/^()\s*(?<names>([a-z]|\s)+)$/)
.action(async (ctx) => {
const { names } = ctx.query;
const message = await service.batchMountPlugin(names);
Expand All @@ -65,7 +65,7 @@ plugin
.command('unmount <...names>')
.description('卸载插件')
.limit(5)
.sugar(/^()\s?(?<names>([a-z]|\s)+)$/)
.sugar(/^()\s*(?<names>([a-z]|\s)+)$/)
.action(async (ctx) => {
const { names } = ctx.query;
const message = await service.batchUnmountPlugin(names);
Expand All @@ -79,7 +79,7 @@ plugin
.command('reload <...names>')
.description('重载插件')
.limit(5)
.sugar(/^()\s?(?<names>([a-z]|\s)+)$/)
.sugar(/^()\s*(?<names>([a-z]|\s)+)$/)
.action(async (ctx) => {
const { names } = ctx.query;
const message = await service.batchReloadPlugin(names);
Expand All @@ -93,7 +93,7 @@ plugin
.command('enable <...names>')
.description('启用插件')
.limit(4)
.sugar(/^()\s?(?<names>([a-z]|\s)+)$/)
.sugar(/^()\s*(?<names>([a-z]|\s)+)$/)
.action(async (ctx, bot) => {
const { names } = ctx.query;
const message = await service.batchEnablePlugin(bot, names);
Expand All @@ -107,7 +107,7 @@ plugin
.command('disable <...names>')
.description('禁用插件')
.limit(4)
.sugar(/^()\s?(?<names>([a-z]|\s)+)$/)
.sugar(/^()\s*(?<names>([a-z]|\s)+)$/)
.action(async (ctx, bot) => {
const { names } = ctx.query;
const message = await service.batchDisablePlugin(bot, names);
Expand Down Expand Up @@ -147,7 +147,7 @@ plugin
.command('apply <...names>')
.description('应用群服务')
.limit(3)
.sugar(/^()\s?(?<names>([a-z]|\s)+)$/)
.sugar(/^()\s*(?<names>([a-z]|\s)+)$/)
.action(async (ctx, bot) => {
const { group_id, query } = ctx;

Expand All @@ -167,7 +167,7 @@ plugin
.command('exempt <...names>')
.description('免除群服务')
.limit(3)
.sugar(/^()\s?(?<names>([a-z]|\s)+)$/)
.sugar(/^()\s*(?<names>([a-z]|\s)+)$/)
.action(async (ctx, bot) => {
const { group_id, query } = ctx;

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@
"include": [
"src"
]
}
}

0 comments on commit 82cd754

Please sign in to comment.