Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
koishi-plugin-ygotournament
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-ygotournament
Commits
941f6785
Commit
941f6785
authored
Nov 21, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
catchup
parent
bcc3d4cf
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
443 additions
and
191 deletions
+443
-191
package-lock.json
package-lock.json
+413
-149
package.json
package.json
+3
-4
src/config.ts
src/config.ts
+6
-12
src/index.ts
src/index.ts
+2
-2
src/plugin.ts
src/plugin.ts
+6
-9
webpack.config.js
webpack.config.js
+13
-15
No files found.
package-lock.json
View file @
941f6785
This diff is collapsed.
Click to expand it.
package.json
View file @
941f6785
...
@@ -35,12 +35,12 @@
...
@@ -35,12 +35,12 @@
"
@aws-sdk/types
"
:
"
^3.38.0
"
,
"
@aws-sdk/types
"
:
"
^3.38.0
"
,
"
@aws-sdk/util-format-url
"
:
"
^3.38.0
"
,
"
@aws-sdk/util-format-url
"
:
"
^3.38.0
"
,
"
class-transformer
"
:
"
^0.4.0
"
,
"
class-transformer
"
:
"
^0.4.0
"
,
"
koishi-utils-schemagen
"
:
"
^1.1.9
"
,
"
moment
"
:
"
^2.29.1
"
,
"
moment
"
:
"
^2.29.1
"
,
"
schemastery-gen
"
:
"
^1.0.3
"
,
"
source-map-support
"
:
"
^0.5.20
"
"
source-map-support
"
:
"
^0.5.20
"
},
},
"peerDependencies"
:
{
"peerDependencies"
:
{
"
koishi
"
:
"
^4.0.0-beta.
0
"
"
koishi
"
:
"
^4.0.0-beta.
2
"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"
@types/node
"
:
"
^16.11.6
"
,
"
@types/node
"
:
"
^16.11.6
"
,
...
@@ -50,9 +50,8 @@
...
@@ -50,9 +50,8 @@
"
eslint
"
:
"
^7.32.0
"
,
"
eslint
"
:
"
^7.32.0
"
,
"
eslint-config-prettier
"
:
"
^8.3.0
"
,
"
eslint-config-prettier
"
:
"
^8.3.0
"
,
"
eslint-plugin-prettier
"
:
"
^3.4.1
"
,
"
eslint-plugin-prettier
"
:
"
^3.4.1
"
,
"
koishi
"
:
"
^4.0.0-beta.
0
"
,
"
koishi
"
:
"
^4.0.0-beta.
2
"
,
"
prettier
"
:
"
^2.4.1
"
,
"
prettier
"
:
"
^2.4.1
"
,
"
proxy-agent
"
:
"
^5.0.0
"
,
"
raw-loader
"
:
"
^4.0.2
"
,
"
raw-loader
"
:
"
^4.0.2
"
,
"
ts-loader
"
:
"
^9.2.6
"
,
"
ts-loader
"
:
"
^9.2.6
"
,
"
typescript
"
:
"
^4.4.4
"
,
"
typescript
"
:
"
^4.4.4
"
,
...
...
src/config.ts
View file @
941f6785
import
'
source-map-support/register
'
;
import
'
source-map-support/register
'
;
import
{
Credentials
}
from
'
@aws-sdk/types
'
;
import
{
DefineSchema
,
SchemaConf
,
schemaFromClass
,
UseSchema
,
}
from
'
koishi-utils-schemagen
'
;
import
path
from
'
path
'
;
import
{
Context
,
Schema
}
from
'
koishi
'
;
import
{
Context
,
Schema
}
from
'
koishi
'
;
import
{
import
{
GetObjectCommand
,
GetObjectCommand
,
...
@@ -16,8 +8,9 @@ import {
...
@@ -16,8 +8,9 @@ import {
}
from
'
@aws-sdk/client-s3
'
;
}
from
'
@aws-sdk/client-s3
'
;
import
{
SRVProRoomInfo
}
from
'
./def/srvpro
'
;
import
{
SRVProRoomInfo
}
from
'
./def/srvpro
'
;
import
{
Selection
}
from
'
./def/selection
'
;
import
{
Selection
}
from
'
./def/selection
'
;
import
{
DefineSchema
,
RegisterSchema
}
from
'
schemastery-gen
'
;
const
credentialsSchema
:
Schema
<
Credentials
>
=
Schema
.
object
(
const
credentialsSchema
=
Schema
.
object
(
{
{
accessKeyId
:
Schema
.
string
().
required
(),
accessKeyId
:
Schema
.
string
().
required
(),
secretAccessKey
:
Schema
.
string
().
required
(),
secretAccessKey
:
Schema
.
string
().
required
(),
...
@@ -25,7 +18,7 @@ const credentialsSchema: Schema<Credentials> = Schema.object(
...
@@ -25,7 +18,7 @@ const credentialsSchema: Schema<Credentials> = Schema.object(
true
,
true
,
);
);
export
const
s3Schema
:
Schema
<
S3ClientConfig
>
=
Schema
.
object
(
export
const
s3Schema
=
Schema
.
object
(
{
{
region
:
Schema
.
string
().
default
(
'
none
'
),
region
:
Schema
.
string
().
default
(
'
none
'
),
endpoint
:
Schema
.
string
(),
endpoint
:
Schema
.
string
(),
...
@@ -34,7 +27,7 @@ export const s3Schema: Schema<S3ClientConfig> = Schema.object(
...
@@ -34,7 +27,7 @@ export const s3Schema: Schema<S3ClientConfig> = Schema.object(
true
,
true
,
);
);
@
SchemaConf
({
desc
:
'
发送卡组的置
'
})
@
RegisterSchema
({
desc
:
'
发送卡组的置
'
})
export
class
DeckFetchConfig
{
export
class
DeckFetchConfig
{
@
DefineSchema
({
desc
:
'
S3 配置
'
,
schema
:
s3Schema
})
@
DefineSchema
({
desc
:
'
S3 配置
'
,
schema
:
s3Schema
})
s3
:
S3ClientConfig
;
s3
:
S3ClientConfig
;
...
@@ -75,7 +68,7 @@ export class DeckFetchConfig {
...
@@ -75,7 +68,7 @@ export class DeckFetchConfig {
}
}
}
}
@
SchemaConf
({
desc
:
'
比赛过程的设置
'
})
@
RegisterSchema
({
desc
:
'
比赛过程的设置
'
})
export
class
TournamentConfig
{
export
class
TournamentConfig
{
@
DefineSchema
({
@
DefineSchema
({
desc
:
'
服务器 API 连接后台,不带任何路径和尾随斜杠
'
,
desc
:
'
服务器 API 连接后台,不带任何路径和尾随斜杠
'
,
...
@@ -133,6 +126,7 @@ export class TournamentConfig {
...
@@ -133,6 +126,7 @@ export class TournamentConfig {
}
}
}
}
@
RegisterSchema
()
export
class
YGOTournamentPluginConfig
{
export
class
YGOTournamentPluginConfig
{
@
DefineSchema
({
@
DefineSchema
({
type
:
'
object
'
,
type
:
'
object
'
,
...
...
src/index.ts
View file @
941f6785
import
'
source-map-support/register
'
;
import
'
source-map-support/register
'
;
import
{
Context
}
from
'
koishi
'
;
import
{
Context
}
from
'
koishi
'
;
import
{
YGOTournamentPlugin
}
from
'
./plugin
'
;
import
{
YGOTournamentPlugin
}
from
'
./plugin
'
;
import
{
YGOTournamentPluginConfig
Like
}
from
'
./config
'
;
import
{
YGOTournamentPluginConfig
}
from
'
./config
'
;
export
*
from
'
./config
'
;
export
*
from
'
./config
'
;
export
*
from
'
./plugin
'
;
export
*
from
'
./plugin
'
;
...
@@ -14,6 +14,6 @@ declare module 'koishi' {
...
@@ -14,6 +14,6 @@ declare module 'koishi' {
export
const
name
=
'
ygotournament
'
;
export
const
name
=
'
ygotournament
'
;
const
plugin
=
new
YGOTournamentPlugin
();
const
plugin
=
new
YGOTournamentPlugin
();
export
const
schema
=
plugin
.
schema
;
export
const
schema
=
plugin
.
schema
;
export
function
apply
(
ctx
:
Context
,
config
:
YGOTournamentPluginConfig
Like
)
{
export
function
apply
(
ctx
:
Context
,
config
:
YGOTournamentPluginConfig
)
{
ctx
.
plugin
(
plugin
,
config
);
ctx
.
plugin
(
plugin
,
config
);
}
}
src/plugin.ts
View file @
941f6785
...
@@ -4,12 +4,11 @@ import {
...
@@ -4,12 +4,11 @@ import {
YGOTournamentPluginConfig
,
YGOTournamentPluginConfig
,
YGOTournamentPluginConfigLike
,
YGOTournamentPluginConfigLike
,
}
from
'
./config
'
;
}
from
'
./config
'
;
import
{
schemaFromClass
,
schemaTransform
}
from
'
koishi-utils-schemagen
'
;
import
{
classToPlain
,
plainToClass
}
from
'
class-transformer
'
;
import
{
classToPlain
,
plainToClass
}
from
'
class-transformer
'
;
import
{
Tournament
,
Tournament
Wrapper
}
from
'
./def/challonge
'
;
import
{
TournamentWrapper
}
from
'
./def/challonge
'
;
import
{
S3Client
}
from
'
@aws-sdk/client-s3
'
;
import
{
S3Client
}
from
'
@aws-sdk/client-s3
'
;
import
{
getSignedUrl
}
from
'
./presign
'
;
import
{
getSignedUrl
}
from
'
./presign
'
;
import
{
Room
,
SRVProRoomInfo
}
from
'
./def/srvpro
'
;
import
{
SRVProRoomInfo
}
from
'
./def/srvpro
'
;
import
moment
from
'
moment
'
;
import
moment
from
'
moment
'
;
import
axios
,
{
AxiosRequestConfig
}
from
'
axios
'
;
import
axios
,
{
AxiosRequestConfig
}
from
'
axios
'
;
import
ProxyAgent
from
'
proxy-agent
'
;
import
ProxyAgent
from
'
proxy-agent
'
;
...
@@ -286,7 +285,7 @@ export class YGOTournamentPlugin {
...
@@ -286,7 +285,7 @@ export class YGOTournamentPlugin {
this
.
workaroundQuester
(
this
.
ctx
.
http
);
this
.
workaroundQuester
(
this
.
ctx
.
http
);
this
.
ctx
.
on
(
'
service/cache
'
,
()
=>
{
this
.
ctx
.
on
(
'
service/cache
'
,
()
=>
{
this
.
ctx
.
cache
.
table
(
'
lateDeclarationTime
'
,
{
maxAge
:
3600
*
1000
});
this
.
ctx
.
cache
.
table
(
'
lateDeclarationTime
'
,
{
maxAge
:
3600
*
1000
});
})
})
;
this
.
ctx
this
.
ctx
.
command
(
'
tournament/late
'
,
'
迟到杀
'
)
.
command
(
'
tournament/late
'
,
'
迟到杀
'
)
.
shortcut
(
'
迟到杀
'
)
.
shortcut
(
'
迟到杀
'
)
...
@@ -368,13 +367,11 @@ export class YGOTournamentPlugin {
...
@@ -368,13 +367,11 @@ export class YGOTournamentPlugin {
}
}
name
=
'
ygotournament-main
'
;
name
=
'
ygotournament-main
'
;
schema
:
Schema
<
YGOTournamentPluginConfigLike
>
=
schemaFromClass
(
schema
=
YGOTournamentPluginConfig
;
YGOTournamentPluginConfig
,
);
apply
(
ctx
:
Context
,
config
:
YGOTournamentPluginConfig
Like
)
{
apply
(
ctx
:
Context
,
config
:
YGOTournamentPluginConfig
)
{
this
.
ctx
=
ctx
;
this
.
ctx
=
ctx
;
this
.
config
=
schemaTransform
(
YGOTournamentPluginConfig
,
config
)
;
this
.
config
=
config
;
this
.
ctx
.
command
(
'
tournament
'
,
'
YGOPro 比赛相关命令
'
);
this
.
ctx
.
command
(
'
tournament
'
,
'
YGOPro 比赛相关命令
'
);
this
.
initializeTournament
();
this
.
initializeTournament
();
this
.
initializeDeckFetch
();
this
.
initializeDeckFetch
();
...
...
webpack.config.js
View file @
941f6785
const
path
=
require
(
'
path
'
);
const
path
=
require
(
'
path
'
);
const
packgeInfo
=
require
(
'
./package.json
'
);
function
externalsFromDep
()
{
return
Object
.
fromEntries
(
[
...
Object
.
keys
(
packgeInfo
.
dependencies
||
{}),
...
Object
.
keys
(
packgeInfo
.
peerDependencies
||
{}),
]
.
filter
((
dep
)
=>
dep
!==
'
source-map-support
'
)
.
map
((
dep
)
=>
[
dep
,
dep
]),
);
}
const
packAll
=
!!
process
.
env
.
PACK_ALL
;
const
packAll
=
!!
process
.
env
.
PACK_ALL
;
...
@@ -29,20 +41,6 @@ module.exports = {
...
@@ -29,20 +41,6 @@ module.exports = {
},
},
externals
:
{
externals
:
{
koishi
:
'
koishi
'
,
koishi
:
'
koishi
'
,
'
proxy-agent
'
:
'
proxy-agent
'
,
...(
packAll
?
{}
:
externalsFromDep
()),
axios
:
'
axios
'
,
...(
packAll
?
{}
:
{
'
@aws-sdk/client-s3
'
:
'
@aws-sdk/client-s3
'
,
'
@aws-sdk/middleware-sdk-s3
'
:
'
@aws-sdk/middleware-sdk-s3
'
,
'
@aws-sdk/protocol-http
'
:
'
@aws-sdk/protocol-http
'
,
'
@aws-sdk/smithy-client
'
:
'
@aws-sdk/smithy-client
'
,
'
@aws-sdk/util-format-url
'
:
'
@aws-sdk/util-format-url
'
,
'
@aws-sdk/types
'
:
'
@aws-sdk/types
'
,
'
koishi-utils-schemagen
'
:
'
koishi-utils-schemagen
'
,
'
class-transformer
'
:
'
class-transformer
'
,
moment
:
'
moment
'
,
}),
},
},
};
};
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