Commit 8eb74866 authored by nanahira's avatar nanahira

bump

parent 7bb2cf1f
......@@ -16,14 +16,15 @@
"@aws-sdk/types": "^3.38.0",
"@aws-sdk/util-format-url": "^3.38.0",
"class-transformer": "^0.4.0",
"koishi-thirdeye": "^10.2.1",
"moment": "^2.29.1",
"schemastery-gen": "^3.1.10"
},
"devDependencies": {
"@koishijs/plugin-cache-lru": "^1.0.0-rc.0",
"@koishijs/plugin-console": "^3.2.4",
"@koishijs/plugin-database-memory": "^1.2.0",
"@koishijs/plugin-sandbox": "^1.1.0",
"@koishijs/plugin-console": "^3.3.2",
"@koishijs/plugin-database-memory": "^1.3.0",
"@koishijs/plugin-sandbox": "^1.1.3",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.6",
"@typescript-eslint/eslint-plugin": "^4.33.0",
......@@ -1760,18 +1761,6 @@
"integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
"dev": true
},
"node_modules/@cosmotype/driver-memory": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@cosmotype/driver-memory/-/driver-memory-1.0.2.tgz",
"integrity": "sha512-JtqwH36Ft0xN5jcN4YDb8BSA4uP9QmbyzUAU2LhMernE2NPI8JFYmhgP6WPke795ikWhE2FpbFRm0TljubD44Q==",
"dev": true,
"dependencies": {
"cosmokit": "^1.1.1"
},
"peerDependencies": {
"cosmotype": "^1.0.3"
}
},
"node_modules/@cspotcode/source-map-consumer": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz",
......@@ -2176,15 +2165,15 @@
}
},
"node_modules/@koishijs/core": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.7.0.tgz",
"integrity": "sha512-MCF8eJaDV8Bw74N3GesFMaxBmRfrUCvez4SwAPkODjRk2uuQpmnxKCAOJu/AFxyyLLg/vQNTGUMG4mPW8RDIyA==",
"version": "4.7.1",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.7.1.tgz",
"integrity": "sha512-vSd2BgyhDrTW/C7Ju1wDr5Z3vp7Qdyk7LgSpGI/b3QtDEfEkhdYKQ9J9LdHIVdUOFL0L0WeRgImW4ZMBtdVlfg==",
"peer": true,
"dependencies": {
"@koishijs/utils": "^5.4.3",
"@koishijs/utils": "^5.4.5",
"cordis": "^1.1.1",
"fastest-levenshtein": "^1.0.12",
"minato": "^1.0.10",
"ns-require": "^1.1.2"
"minato": "^1.1.0"
},
"engines": {
"node": ">=12.0.0"
......@@ -2204,38 +2193,56 @@
}
},
"node_modules/@koishijs/plugin-console": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-console/-/plugin-console-3.2.4.tgz",
"integrity": "sha512-R2mX0t8FyZHJb78Hh0IjewQfwKWi5WokuUKpCoLlQKSFKXLUobYi15hmN8QFe97J2TRPCyGWw7lZ7ix9HpSYgw==",
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-console/-/plugin-console-3.3.2.tgz",
"integrity": "sha512-rEt0s1TPsMNfJpaQdaTEpPcbj5Gf22KcfU5ramPPv6KrRRA3AuwdV18eqM0jVQcFOuG1plReP1ZYp9faAHTgXw==",
"dev": true,
"dependencies": {
"open": "^8.4.0",
"uuid": "^8.3.2",
"ws": "^8.5.0"
"ws": "^8.6.0"
},
"peerDependencies": {
"koishi": "^4.5.0"
"koishi": "^4.7.1"
}
},
"node_modules/@koishijs/plugin-database-memory": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-database-memory/-/plugin-database-memory-1.2.0.tgz",
"integrity": "sha512-kj5KjVl92BvYH65Fp0boAOZ6y83jych1Mc8HhikyvCB/PdPuu9vLdXuEUit1eR4yL1pulcGpGbhKFjeNe2Vc0g==",
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-database-memory/-/plugin-database-memory-1.3.0.tgz",
"integrity": "sha512-IR6SS25LUUek4UV2T8ClF0i3UmsbSR++I3wuq5WrF9iYTRaPhiW5g8Qya35BzV/mf6PlNCLaMsdC7wELpe361g==",
"dev": true,
"dependencies": {
"@cosmotype/driver-memory": "^1.0.2"
"@minatojs/driver-memory": "^1.0.3"
},
"peerDependencies": {
"koishi": "^4.6.0"
"koishi": "^4.7.0"
}
},
"node_modules/@koishijs/plugin-help": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-help/-/plugin-help-1.0.0.tgz",
"integrity": "sha512-SvOZiSmtysQxnhOUG0He+/Ftxr+IuIbTApsK6KypRpQ4a1q7OuJWmKb2e+f62zS3GhMYBJ8qT0wRMU+TFPP3AQ==",
"peer": true,
"peerDependencies": {
"koishi": "^4.7.1"
}
},
"node_modules/@koishijs/plugin-sandbox": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-sandbox/-/plugin-sandbox-1.1.0.tgz",
"integrity": "sha512-y0eJcgBMvGhCYjfVP1IsFvHkmiubAJHWdMlbnkss7eZ39nt0nzApfHAubITIEPBr7A0c7gqfC4fUUw5Z3UldXg==",
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-sandbox/-/plugin-sandbox-1.1.3.tgz",
"integrity": "sha512-DxSJTvF1j40GFgvx2AxuZRH0rd7e6cqn4R/KjCZ6F3JS+yMb8J5D2uE0L8u9XXq5p6WMU61dSE+vq96g+CVBZA==",
"dev": true,
"peerDependencies": {
"koishi": "^4.5.2"
"koishi": "^4.7.1"
}
},
"node_modules/@koishijs/plugin-suggest": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-suggest/-/plugin-suggest-1.0.0.tgz",
"integrity": "sha512-6jmhymcygID59Z3UblAARGXflJoH0+Tj/qi20GNQO0bxrKkoW4qjxJhlmZe2uv+D1hvTO0q2Yv98iEMDhKyXxw==",
"peer": true,
"peerDependencies": {
"koishi": "^4.7.1"
}
},
"node_modules/@koishijs/segment": {
......@@ -2245,15 +2252,15 @@
"peer": true
},
"node_modules/@koishijs/utils": {
"version": "5.4.3",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.4.3.tgz",
"integrity": "sha512-AzkApepb76zEEPNHmWrr1pXCc1DpCpaxL15nANoNMBS+G/2WNaJqUEyZoPQrhWlQzov3MWIzn8KeR4Xl75T4Gg==",
"version": "5.4.5",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.4.5.tgz",
"integrity": "sha512-tOmhFFcnuhFAudRcG9Bq7OeVmX1yxGvlSsJMbaSBHvb/hUrFzpXjEd2onqnJw4fyx/QLgYYFBeiFcKXDSujoLg==",
"peer": true,
"dependencies": {
"@koishijs/segment": "^1.1.1",
"cosmokit": "^1.1.2",
"reggol": "^1.0.3",
"schemastery": "^3.3.3",
"schemastery": "^3.4.3",
"supports-color": "^8.1.1"
}
},
......@@ -2272,6 +2279,18 @@
"url": "https://github.com/chalk/supports-color?sponsor=1"
}
},
"node_modules/@minatojs/driver-memory": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@minatojs/driver-memory/-/driver-memory-1.0.3.tgz",
"integrity": "sha512-h9FNfAeTSVXXO/JQIQkjXOz1RZorZZpyQ9kWoeleEZz/cB3sZZ047gNL5RBo9ucX5EKr1iCjwWbsJ3nFbDNJ0A==",
"dev": true,
"dependencies": {
"cosmokit": "^1.1.2"
},
"peerDependencies": {
"minato": "^1.0.10"
}
},
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
......@@ -2367,7 +2386,6 @@
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz",
"integrity": "sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==",
"peer": true,
"dependencies": {
"@types/node": "*"
}
......@@ -2417,7 +2435,6 @@
"version": "1.19.2",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz",
"integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==",
"peer": true,
"dependencies": {
"@types/connect": "*",
"@types/node": "*"
......@@ -2427,7 +2444,6 @@
"version": "3.4.35",
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz",
"integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==",
"peer": true,
"dependencies": {
"@types/node": "*"
}
......@@ -2435,14 +2451,12 @@
"node_modules/@types/content-disposition": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/@types/content-disposition/-/content-disposition-0.5.4.tgz",
"integrity": "sha512-0mPF08jn9zYI0n0Q/Pnz7C4kThdSt+6LD4amsrYDDpgBfrVWa3TcCOxKX1zkGgYniGagRv8heN2cbh+CAn+uuQ==",
"peer": true
"integrity": "sha512-0mPF08jn9zYI0n0Q/Pnz7C4kThdSt+6LD4amsrYDDpgBfrVWa3TcCOxKX1zkGgYniGagRv8heN2cbh+CAn+uuQ=="
},
"node_modules/@types/cookies": {
"version": "0.7.7",
"resolved": "https://registry.npmjs.org/@types/cookies/-/cookies-0.7.7.tgz",
"integrity": "sha512-h7BcvPUogWbKCzBR2lY4oqaZbO3jXZksexYJVFvkrFeLgbZjQkU4x8pRq6eg2MHXQhY0McQdqmmsxRWlVAHooA==",
"peer": true,
"dependencies": {
"@types/connect": "*",
"@types/express": "*",
......@@ -2480,7 +2494,6 @@
"version": "4.17.13",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz",
"integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==",
"peer": true,
"dependencies": {
"@types/body-parser": "*",
"@types/express-serve-static-core": "^4.17.18",
......@@ -2492,7 +2505,6 @@
"version": "4.17.28",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.28.tgz",
"integrity": "sha512-P1BJAEAW3E2DJUlkgq4tOL3RyMunoWXqbSCygWo5ZIWTjUgN1YnaXWW4VWl/oc8vs/XoYibEGBKP0uZyF4AHig==",
"peer": true,
"dependencies": {
"@types/node": "*",
"@types/qs": "*",
......@@ -2511,14 +2523,12 @@
"node_modules/@types/http-assert": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.3.tgz",
"integrity": "sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA==",
"peer": true
"integrity": "sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA=="
},
"node_modules/@types/http-errors": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-1.8.2.tgz",
"integrity": "sha512-EqX+YQxINb+MeXaIqYDASb6U6FCHbWjkj4a1CKDBks3d/QiB2+PqBLyO72vLDgAO1wUI4O+9gweRcQK11bTL/w==",
"peer": true
"integrity": "sha512-EqX+YQxINb+MeXaIqYDASb6U6FCHbWjkj4a1CKDBks3d/QiB2+PqBLyO72vLDgAO1wUI4O+9gweRcQK11bTL/w=="
},
"node_modules/@types/istanbul-lib-coverage": {
"version": "2.0.4",
......@@ -2563,14 +2573,12 @@
"node_modules/@types/keygrip": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.2.tgz",
"integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw==",
"peer": true
"integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw=="
},
"node_modules/@types/koa": {
"version": "2.13.4",
"resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.13.4.tgz",
"integrity": "sha512-dfHYMfU+z/vKtQB7NUrthdAEiSvnLebvBjwHtfFmpZmB7em2N3WVQdHgnFq+xvyVgxW5jKDmjWfLD3lw4g4uTw==",
"peer": true,
"dependencies": {
"@types/accepts": "*",
"@types/content-disposition": "*",
......@@ -2586,7 +2594,6 @@
"version": "8.0.11",
"resolved": "https://registry.npmjs.org/@types/koa__router/-/koa__router-8.0.11.tgz",
"integrity": "sha512-WXgKWpBsbS14kzmzD9LeFapOIa678h7zvUHxDwXwSx4ETKXhXLVUAToX6jZ/U7EihM7qwyD9W/BZvB0MRu7MTQ==",
"peer": true,
"dependencies": {
"@types/koa": "*"
}
......@@ -2595,7 +2602,6 @@
"version": "3.2.5",
"resolved": "https://registry.npmjs.org/@types/koa-compose/-/koa-compose-3.2.5.tgz",
"integrity": "sha512-B8nG/OoE1ORZqCkBVsup/AKcvjdgoHnfi4pZMn5UwAPCbhk/96xyv284eBYW8JlQbQ7zDmnpFr68I/40mFoIBQ==",
"peer": true,
"dependencies": {
"@types/koa": "*"
}
......@@ -2603,8 +2609,7 @@
"node_modules/@types/mime": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz",
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==",
"peer": true
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw=="
},
"node_modules/@types/node": {
"version": "16.11.6",
......@@ -2620,20 +2625,17 @@
"node_modules/@types/qs": {
"version": "6.9.7",
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz",
"integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==",
"peer": true
"integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw=="
},
"node_modules/@types/range-parser": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz",
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==",
"peer": true
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw=="
},
"node_modules/@types/serve-static": {
"version": "1.13.10",
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz",
"integrity": "sha512-nCkHGI4w7ZgAdNkrEu0bv+4xNV/XDqW+DydknebMOQwkpDGx8G+HTlj7R7ABI8i8nKxVw0wtKPi1D+lPOkh4YQ==",
"peer": true,
"dependencies": {
"@types/mime": "^1",
"@types/node": "*"
......@@ -3292,6 +3294,15 @@
"node": ">=8"
}
},
"node_modules/async": {
"version": "2.6.4",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
"integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
"peer": true,
"dependencies": {
"lodash": "^4.17.14"
}
},
"node_modules/async-limiter": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
......@@ -4290,6 +4301,15 @@
"integrity": "sha1-JoD7uAaKSNCGVrYJgJK9r8kG9KU=",
"peer": true
},
"node_modules/cordis": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/cordis/-/cordis-1.1.1.tgz",
"integrity": "sha512-l1tYxBqy+oEb3EKEvQAlH1g5BICDdnTdcIre1MuCY/qWO4bsrh97qd7jQe2Rq/+tg5HRqs7K6RgP5N/85c57xw==",
"peer": true,
"dependencies": {
"cosmokit": "^1.1.2"
}
},
"node_modules/core-util-is": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
......@@ -4301,17 +4321,6 @@
"resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.1.2.tgz",
"integrity": "sha512-cSNrcyxZ3GT+tjSlUzWIzMiK7Wndq1Nm/2tlRhT65RXltSIcH5zaHdmnz1TnIhLuOViaO9qfSdnRPzxNkxMv0g=="
},
"node_modules/cosmotype": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/cosmotype/-/cosmotype-1.0.9.tgz",
"integrity": "sha512-ot2m5LYBj9UNFvYpQNQ28hWYDG4GWmym094us2HNn6qgYzvALmjs4FxEVBsjA+VBnIf3ykuMGRYcex5cqZTvJQ==",
"dev": true,
"peer": true,
"dependencies": {
"cosmokit": "^1.1.2",
"ns-require": "^1.1.2"
}
},
"node_modules/create-require": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
......@@ -7414,14 +7423,16 @@
}
},
"node_modules/koishi": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.7.0.tgz",
"integrity": "sha512-aCtfE+QydqbcpoOspOp/QCY1CAXieqnPIR101eKtODgrPBHUVc8XbXbkqGAzx6c2kr6wC7mE4ZLBgECqGBn7tw==",
"version": "4.7.1",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.7.1.tgz",
"integrity": "sha512-WtY2ZujFMP4/ySKCc08oXLe2dYlZsdZP7f2eUck1w3cdvOh3eAgndckBP7xpkICAL0l6BYxrbzurIYh32Qck6g==",
"peer": true,
"dependencies": {
"@koa/router": "^10.1.1",
"@koishijs/core": "^4.7.0",
"@koishijs/utils": "^5.4.3",
"@koishijs/core": "^4.7.1",
"@koishijs/plugin-help": "^1.0.0",
"@koishijs/plugin-suggest": "^1.0.0",
"@koishijs/utils": "^5.4.5",
"@types/koa": "*",
"@types/koa__router": "*",
"@types/ws": "^8.5.3",
......@@ -7429,8 +7440,10 @@
"file-type": "^16.5.3",
"koa": "^2.13.4",
"koa-bodyparser": "^4.3.0",
"ns-require": "^1.1.2",
"parseurl": "^1.3.3",
"path-to-regexp": "^6.2.0",
"portfinder": "^1.0.28",
"proxy-agent": "^5.0.0",
"ws": "^8.6.0"
},
......@@ -7438,6 +7451,41 @@
"node": ">=12.0.0"
}
},
"node_modules/koishi-decorators": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/koishi-decorators/-/koishi-decorators-2.1.0.tgz",
"integrity": "sha512-b0opV0YfWXH7/sJ7ecBjPWhz9PsL4esQ1J8EUfymTcZE5jhiTjKhvp+TEdlEC+bDTM49LwMSnohGMU8nZxaD+g==",
"dependencies": {
"@types/koa": "^2.13.4",
"@types/koa__router": "^8.0.11",
"lodash": "^4.17.21",
"mustache": "^4.2.0",
"reflect-metadata": "^0.1.13",
"typed-reflector": "^1.0.10"
},
"peerDependencies": {
"koishi": "^4.7.1"
}
},
"node_modules/koishi-thirdeye": {
"version": "10.2.1",
"resolved": "https://registry.npmjs.org/koishi-thirdeye/-/koishi-thirdeye-10.2.1.tgz",
"integrity": "sha512-p+vn6/Z0w5URpoK+lY7w/rWYvF7dH+myPJD8XGxriH6IncPnsseraHisYZ+I+i2P2CFRJ4+zCgDfPu82VgefoQ==",
"dependencies": {
"@types/koa": "^2.13.4",
"@types/koa__router": "^8.0.11",
"koishi-decorators": "^2.1.0",
"lodash": "^4.17.21",
"minato-decorators": "^2.0.7",
"reflect-metadata": "^0.1.13",
"schemastery-gen": "^3.1.13",
"typed-reflector": "^1.0.10"
},
"peerDependencies": {
"koishi": "^4.7.1",
"schemastery": "^3.4.3"
}
},
"node_modules/lcid": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz",
......@@ -7713,15 +7761,27 @@
}
},
"node_modules/minato": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/minato/-/minato-1.0.10.tgz",
"integrity": "sha512-1R3cTrtz/xZocWBfmgHsNy6V/nILjyMksKDuGtvqjjToImdgqkQrHmW2ZpdOJaaXM/apivY/KqMEf0o0jksKkw==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/minato/-/minato-1.1.0.tgz",
"integrity": "sha512-by1KMWxWlzq0iDV7tMkqS3thDRzYNQoS2ECfX5HRpMGaPQJqSgm5aY9IAky7knwAMoW3cMxQ/IhpvEShQqyj6A==",
"peer": true,
"dependencies": {
"cosmokit": "^1.1.2",
"ns-require": "^1.1.2"
}
},
"node_modules/minato-decorators": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/minato-decorators/-/minato-decorators-2.0.7.tgz",
"integrity": "sha512-at/tp2GlrnzZ6BIsBH8kzV6u4Od41sc4Mw8wZRVlEe3rccKMDGSBYXelrofj7sF/t66KRbwrc57xAVCg2PaFGg==",
"dependencies": {
"lodash": "^4.17.21",
"typed-reflector": "^1.0.10"
},
"peerDependencies": {
"minato": "^1.1.0"
}
},
"node_modules/minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
......@@ -7734,9 +7794,9 @@
}
},
"node_modules/minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="
},
"node_modules/minipass": {
"version": "3.1.5",
......@@ -7893,6 +7953,14 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"node_modules/mustache": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz",
"integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==",
"bin": {
"mustache": "bin/mustache"
}
},
"node_modules/natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
......@@ -8328,6 +8396,41 @@
"node": ">=8"
}
},
"node_modules/portfinder": {
"version": "1.0.28",
"resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz",
"integrity": "sha512-Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA==",
"peer": true,
"dependencies": {
"async": "^2.6.2",
"debug": "^3.1.1",
"mkdirp": "^0.5.5"
},
"engines": {
"node": ">= 0.12.0"
}
},
"node_modules/portfinder/node_modules/debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"peer": true,
"dependencies": {
"ms": "^2.1.1"
}
},
"node_modules/portfinder/node_modules/mkdirp": {
"version": "0.5.6",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
"integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
"peer": true,
"dependencies": {
"minimist": "^1.2.6"
},
"bin": {
"mkdirp": "bin/cmd.js"
}
},
"node_modules/prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
......@@ -8928,18 +9031,18 @@
}
},
"node_modules/schemastery": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.3.3.tgz",
"integrity": "sha512-DwRsse6C+Qao90P/Bz+4G3gmAjM3he/VgHk3TykmEWv3KFqvwmqEn61SF3BPaTPP0L77a5Kc6q4+KQvdN1bBqA==",
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.4.3.tgz",
"integrity": "sha512-Ui9sPoxOVaKa2EzR6GS08qB/nIMJUczUtkaLfWjeE44kjYZ+GLUFNVE3TpbXRdxjnbIIExwG+paMd0+M7YimqQ==",
"peer": true,
"dependencies": {
"cosmokit": "^1.1.2"
}
},
"node_modules/schemastery-gen": {
"version": "3.1.10",
"resolved": "https://registry.npmjs.org/schemastery-gen/-/schemastery-gen-3.1.10.tgz",
"integrity": "sha512-hwCLOICGEodCcQt+eLoEEvNhm7iSEwJB37JQ+27cHbggTry/Rq07ivXVsPw63Et74EobEaOGDVOTzJ4kIQa01w==",
"version": "3.1.13",
"resolved": "https://registry.npmjs.org/schemastery-gen/-/schemastery-gen-3.1.13.tgz",
"integrity": "sha512-KXkjV9AuKWBlkJ8yEhLYDh7wRcM8p/M+s30Ig6g5eYlGfv7KVUGmpSVVtcH+fUZG+zS/7/UfCreMqqqFJBPdNw==",
"dependencies": {
"lodash": "^4.17.21",
"reflect-metadata": "^0.1.13",
......@@ -12039,15 +12142,6 @@
"integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
"dev": true
},
"@cosmotype/driver-memory": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@cosmotype/driver-memory/-/driver-memory-1.0.2.tgz",
"integrity": "sha512-JtqwH36Ft0xN5jcN4YDb8BSA4uP9QmbyzUAU2LhMernE2NPI8JFYmhgP6WPke795ikWhE2FpbFRm0TljubD44Q==",
"dev": true,
"requires": {
"cosmokit": "^1.1.1"
}
},
"@cspotcode/source-map-consumer": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz",
......@@ -12371,15 +12465,15 @@
}
},
"@koishijs/core": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.7.0.tgz",
"integrity": "sha512-MCF8eJaDV8Bw74N3GesFMaxBmRfrUCvez4SwAPkODjRk2uuQpmnxKCAOJu/AFxyyLLg/vQNTGUMG4mPW8RDIyA==",
"version": "4.7.1",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.7.1.tgz",
"integrity": "sha512-vSd2BgyhDrTW/C7Ju1wDr5Z3vp7Qdyk7LgSpGI/b3QtDEfEkhdYKQ9J9LdHIVdUOFL0L0WeRgImW4ZMBtdVlfg==",
"peer": true,
"requires": {
"@koishijs/utils": "^5.4.3",
"@koishijs/utils": "^5.4.5",
"cordis": "^1.1.1",
"fastest-levenshtein": "^1.0.12",
"minato": "^1.0.10",
"ns-require": "^1.1.2"
"minato": "^1.1.0"
}
},
"@koishijs/plugin-cache-lru": {
......@@ -12392,32 +12486,46 @@
}
},
"@koishijs/plugin-console": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-console/-/plugin-console-3.2.4.tgz",
"integrity": "sha512-R2mX0t8FyZHJb78Hh0IjewQfwKWi5WokuUKpCoLlQKSFKXLUobYi15hmN8QFe97J2TRPCyGWw7lZ7ix9HpSYgw==",
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-console/-/plugin-console-3.3.2.tgz",
"integrity": "sha512-rEt0s1TPsMNfJpaQdaTEpPcbj5Gf22KcfU5ramPPv6KrRRA3AuwdV18eqM0jVQcFOuG1plReP1ZYp9faAHTgXw==",
"dev": true,
"requires": {
"open": "^8.4.0",
"uuid": "^8.3.2",
"ws": "^8.5.0"
"ws": "^8.6.0"
}
},
"@koishijs/plugin-database-memory": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-database-memory/-/plugin-database-memory-1.2.0.tgz",
"integrity": "sha512-kj5KjVl92BvYH65Fp0boAOZ6y83jych1Mc8HhikyvCB/PdPuu9vLdXuEUit1eR4yL1pulcGpGbhKFjeNe2Vc0g==",
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-database-memory/-/plugin-database-memory-1.3.0.tgz",
"integrity": "sha512-IR6SS25LUUek4UV2T8ClF0i3UmsbSR++I3wuq5WrF9iYTRaPhiW5g8Qya35BzV/mf6PlNCLaMsdC7wELpe361g==",
"dev": true,
"requires": {
"@cosmotype/driver-memory": "^1.0.2"
"@minatojs/driver-memory": "^1.0.3"
}
},
"@koishijs/plugin-help": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-help/-/plugin-help-1.0.0.tgz",
"integrity": "sha512-SvOZiSmtysQxnhOUG0He+/Ftxr+IuIbTApsK6KypRpQ4a1q7OuJWmKb2e+f62zS3GhMYBJ8qT0wRMU+TFPP3AQ==",
"peer": true,
"requires": {}
},
"@koishijs/plugin-sandbox": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-sandbox/-/plugin-sandbox-1.1.0.tgz",
"integrity": "sha512-y0eJcgBMvGhCYjfVP1IsFvHkmiubAJHWdMlbnkss7eZ39nt0nzApfHAubITIEPBr7A0c7gqfC4fUUw5Z3UldXg==",
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-sandbox/-/plugin-sandbox-1.1.3.tgz",
"integrity": "sha512-DxSJTvF1j40GFgvx2AxuZRH0rd7e6cqn4R/KjCZ6F3JS+yMb8J5D2uE0L8u9XXq5p6WMU61dSE+vq96g+CVBZA==",
"dev": true,
"requires": {}
},
"@koishijs/plugin-suggest": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-suggest/-/plugin-suggest-1.0.0.tgz",
"integrity": "sha512-6jmhymcygID59Z3UblAARGXflJoH0+Tj/qi20GNQO0bxrKkoW4qjxJhlmZe2uv+D1hvTO0q2Yv98iEMDhKyXxw==",
"peer": true,
"requires": {}
},
"@koishijs/segment": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@koishijs/segment/-/segment-1.1.1.tgz",
......@@ -12425,15 +12533,15 @@
"peer": true
},
"@koishijs/utils": {
"version": "5.4.3",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.4.3.tgz",
"integrity": "sha512-AzkApepb76zEEPNHmWrr1pXCc1DpCpaxL15nANoNMBS+G/2WNaJqUEyZoPQrhWlQzov3MWIzn8KeR4Xl75T4Gg==",
"version": "5.4.5",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.4.5.tgz",
"integrity": "sha512-tOmhFFcnuhFAudRcG9Bq7OeVmX1yxGvlSsJMbaSBHvb/hUrFzpXjEd2onqnJw4fyx/QLgYYFBeiFcKXDSujoLg==",
"peer": true,
"requires": {
"@koishijs/segment": "^1.1.1",
"cosmokit": "^1.1.2",
"reggol": "^1.0.3",
"schemastery": "^3.3.3",
"schemastery": "^3.4.3",
"supports-color": "^8.1.1"
},
"dependencies": {
......@@ -12448,6 +12556,15 @@
}
}
},
"@minatojs/driver-memory": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@minatojs/driver-memory/-/driver-memory-1.0.3.tgz",
"integrity": "sha512-h9FNfAeTSVXXO/JQIQkjXOz1RZorZZpyQ9kWoeleEZz/cB3sZZ047gNL5RBo9ucX5EKr1iCjwWbsJ3nFbDNJ0A==",
"dev": true,
"requires": {
"cosmokit": "^1.1.2"
}
},
"@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
......@@ -12531,7 +12648,6 @@
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz",
"integrity": "sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==",
"peer": true,
"requires": {
"@types/node": "*"
}
......@@ -12581,7 +12697,6 @@
"version": "1.19.2",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz",
"integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==",
"peer": true,
"requires": {
"@types/connect": "*",
"@types/node": "*"
......@@ -12591,7 +12706,6 @@
"version": "3.4.35",
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz",
"integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==",
"peer": true,
"requires": {
"@types/node": "*"
}
......@@ -12599,14 +12713,12 @@
"@types/content-disposition": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/@types/content-disposition/-/content-disposition-0.5.4.tgz",
"integrity": "sha512-0mPF08jn9zYI0n0Q/Pnz7C4kThdSt+6LD4amsrYDDpgBfrVWa3TcCOxKX1zkGgYniGagRv8heN2cbh+CAn+uuQ==",
"peer": true
"integrity": "sha512-0mPF08jn9zYI0n0Q/Pnz7C4kThdSt+6LD4amsrYDDpgBfrVWa3TcCOxKX1zkGgYniGagRv8heN2cbh+CAn+uuQ=="
},
"@types/cookies": {
"version": "0.7.7",
"resolved": "https://registry.npmjs.org/@types/cookies/-/cookies-0.7.7.tgz",
"integrity": "sha512-h7BcvPUogWbKCzBR2lY4oqaZbO3jXZksexYJVFvkrFeLgbZjQkU4x8pRq6eg2MHXQhY0McQdqmmsxRWlVAHooA==",
"peer": true,
"requires": {
"@types/connect": "*",
"@types/express": "*",
......@@ -12644,7 +12756,6 @@
"version": "4.17.13",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz",
"integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==",
"peer": true,
"requires": {
"@types/body-parser": "*",
"@types/express-serve-static-core": "^4.17.18",
......@@ -12656,7 +12767,6 @@
"version": "4.17.28",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.28.tgz",
"integrity": "sha512-P1BJAEAW3E2DJUlkgq4tOL3RyMunoWXqbSCygWo5ZIWTjUgN1YnaXWW4VWl/oc8vs/XoYibEGBKP0uZyF4AHig==",
"peer": true,
"requires": {
"@types/node": "*",
"@types/qs": "*",
......@@ -12675,14 +12785,12 @@
"@types/http-assert": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.3.tgz",
"integrity": "sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA==",
"peer": true
"integrity": "sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA=="
},
"@types/http-errors": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-1.8.2.tgz",
"integrity": "sha512-EqX+YQxINb+MeXaIqYDASb6U6FCHbWjkj4a1CKDBks3d/QiB2+PqBLyO72vLDgAO1wUI4O+9gweRcQK11bTL/w==",
"peer": true
"integrity": "sha512-EqX+YQxINb+MeXaIqYDASb6U6FCHbWjkj4a1CKDBks3d/QiB2+PqBLyO72vLDgAO1wUI4O+9gweRcQK11bTL/w=="
},
"@types/istanbul-lib-coverage": {
"version": "2.0.4",
......@@ -12727,14 +12835,12 @@
"@types/keygrip": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.2.tgz",
"integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw==",
"peer": true
"integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw=="
},
"@types/koa": {
"version": "2.13.4",
"resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.13.4.tgz",
"integrity": "sha512-dfHYMfU+z/vKtQB7NUrthdAEiSvnLebvBjwHtfFmpZmB7em2N3WVQdHgnFq+xvyVgxW5jKDmjWfLD3lw4g4uTw==",
"peer": true,
"requires": {
"@types/accepts": "*",
"@types/content-disposition": "*",
......@@ -12750,7 +12856,6 @@
"version": "8.0.11",
"resolved": "https://registry.npmjs.org/@types/koa__router/-/koa__router-8.0.11.tgz",
"integrity": "sha512-WXgKWpBsbS14kzmzD9LeFapOIa678h7zvUHxDwXwSx4ETKXhXLVUAToX6jZ/U7EihM7qwyD9W/BZvB0MRu7MTQ==",
"peer": true,
"requires": {
"@types/koa": "*"
}
......@@ -12759,7 +12864,6 @@
"version": "3.2.5",
"resolved": "https://registry.npmjs.org/@types/koa-compose/-/koa-compose-3.2.5.tgz",
"integrity": "sha512-B8nG/OoE1ORZqCkBVsup/AKcvjdgoHnfi4pZMn5UwAPCbhk/96xyv284eBYW8JlQbQ7zDmnpFr68I/40mFoIBQ==",
"peer": true,
"requires": {
"@types/koa": "*"
}
......@@ -12767,8 +12871,7 @@
"@types/mime": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz",
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==",
"peer": true
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw=="
},
"@types/node": {
"version": "16.11.6",
......@@ -12784,20 +12887,17 @@
"@types/qs": {
"version": "6.9.7",
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz",
"integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==",
"peer": true
"integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw=="
},
"@types/range-parser": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz",
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==",
"peer": true
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw=="
},
"@types/serve-static": {
"version": "1.13.10",
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz",
"integrity": "sha512-nCkHGI4w7ZgAdNkrEu0bv+4xNV/XDqW+DydknebMOQwkpDGx8G+HTlj7R7ABI8i8nKxVw0wtKPi1D+lPOkh4YQ==",
"peer": true,
"requires": {
"@types/mime": "^1",
"@types/node": "*"
......@@ -13301,6 +13401,15 @@
"integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==",
"dev": true
},
"async": {
"version": "2.6.4",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
"integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
"peer": true,
"requires": {
"lodash": "^4.17.14"
}
},
"async-limiter": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
......@@ -14069,6 +14178,15 @@
"integrity": "sha1-JoD7uAaKSNCGVrYJgJK9r8kG9KU=",
"peer": true
},
"cordis": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/cordis/-/cordis-1.1.1.tgz",
"integrity": "sha512-l1tYxBqy+oEb3EKEvQAlH1g5BICDdnTdcIre1MuCY/qWO4bsrh97qd7jQe2Rq/+tg5HRqs7K6RgP5N/85c57xw==",
"peer": true,
"requires": {
"cosmokit": "^1.1.2"
}
},
"core-util-is": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
......@@ -14080,17 +14198,6 @@
"resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.1.2.tgz",
"integrity": "sha512-cSNrcyxZ3GT+tjSlUzWIzMiK7Wndq1Nm/2tlRhT65RXltSIcH5zaHdmnz1TnIhLuOViaO9qfSdnRPzxNkxMv0g=="
},
"cosmotype": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/cosmotype/-/cosmotype-1.0.9.tgz",
"integrity": "sha512-ot2m5LYBj9UNFvYpQNQ28hWYDG4GWmym094us2HNn6qgYzvALmjs4FxEVBsjA+VBnIf3ykuMGRYcex5cqZTvJQ==",
"dev": true,
"peer": true,
"requires": {
"cosmokit": "^1.1.2",
"ns-require": "^1.1.2"
}
},
"create-require": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
......@@ -16444,14 +16551,16 @@
}
},
"koishi": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.7.0.tgz",
"integrity": "sha512-aCtfE+QydqbcpoOspOp/QCY1CAXieqnPIR101eKtODgrPBHUVc8XbXbkqGAzx6c2kr6wC7mE4ZLBgECqGBn7tw==",
"version": "4.7.1",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.7.1.tgz",
"integrity": "sha512-WtY2ZujFMP4/ySKCc08oXLe2dYlZsdZP7f2eUck1w3cdvOh3eAgndckBP7xpkICAL0l6BYxrbzurIYh32Qck6g==",
"peer": true,
"requires": {
"@koa/router": "^10.1.1",
"@koishijs/core": "^4.7.0",
"@koishijs/utils": "^5.4.3",
"@koishijs/core": "^4.7.1",
"@koishijs/plugin-help": "^1.0.0",
"@koishijs/plugin-suggest": "^1.0.0",
"@koishijs/utils": "^5.4.5",
"@types/koa": "*",
"@types/koa__router": "*",
"@types/ws": "^8.5.3",
......@@ -16459,12 +16568,42 @@
"file-type": "^16.5.3",
"koa": "^2.13.4",
"koa-bodyparser": "^4.3.0",
"ns-require": "^1.1.2",
"parseurl": "^1.3.3",
"path-to-regexp": "^6.2.0",
"portfinder": "^1.0.28",
"proxy-agent": "^5.0.0",
"ws": "^8.6.0"
}
},
"koishi-decorators": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/koishi-decorators/-/koishi-decorators-2.1.0.tgz",
"integrity": "sha512-b0opV0YfWXH7/sJ7ecBjPWhz9PsL4esQ1J8EUfymTcZE5jhiTjKhvp+TEdlEC+bDTM49LwMSnohGMU8nZxaD+g==",
"requires": {
"@types/koa": "^2.13.4",
"@types/koa__router": "^8.0.11",
"lodash": "^4.17.21",
"mustache": "^4.2.0",
"reflect-metadata": "^0.1.13",
"typed-reflector": "^1.0.10"
}
},
"koishi-thirdeye": {
"version": "10.2.1",
"resolved": "https://registry.npmjs.org/koishi-thirdeye/-/koishi-thirdeye-10.2.1.tgz",
"integrity": "sha512-p+vn6/Z0w5URpoK+lY7w/rWYvF7dH+myPJD8XGxriH6IncPnsseraHisYZ+I+i2P2CFRJ4+zCgDfPu82VgefoQ==",
"requires": {
"@types/koa": "^2.13.4",
"@types/koa__router": "^8.0.11",
"koishi-decorators": "^2.1.0",
"lodash": "^4.17.21",
"minato-decorators": "^2.0.7",
"reflect-metadata": "^0.1.13",
"schemastery-gen": "^3.1.13",
"typed-reflector": "^1.0.10"
}
},
"lcid": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz",
......@@ -16693,15 +16832,24 @@
"dev": true
},
"minato": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/minato/-/minato-1.0.10.tgz",
"integrity": "sha512-1R3cTrtz/xZocWBfmgHsNy6V/nILjyMksKDuGtvqjjToImdgqkQrHmW2ZpdOJaaXM/apivY/KqMEf0o0jksKkw==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/minato/-/minato-1.1.0.tgz",
"integrity": "sha512-by1KMWxWlzq0iDV7tMkqS3thDRzYNQoS2ECfX5HRpMGaPQJqSgm5aY9IAky7knwAMoW3cMxQ/IhpvEShQqyj6A==",
"peer": true,
"requires": {
"cosmokit": "^1.1.2",
"ns-require": "^1.1.2"
}
},
"minato-decorators": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/minato-decorators/-/minato-decorators-2.0.7.tgz",
"integrity": "sha512-at/tp2GlrnzZ6BIsBH8kzV6u4Od41sc4Mw8wZRVlEe3rccKMDGSBYXelrofj7sF/t66KRbwrc57xAVCg2PaFGg==",
"requires": {
"lodash": "^4.17.21",
"typed-reflector": "^1.0.10"
}
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
......@@ -16711,9 +16859,9 @@
}
},
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="
},
"minipass": {
"version": "3.1.5",
......@@ -16818,6 +16966,11 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"mustache": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz",
"integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ=="
},
"natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
......@@ -17146,6 +17299,37 @@
"find-up": "^4.0.0"
}
},
"portfinder": {
"version": "1.0.28",
"resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz",
"integrity": "sha512-Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA==",
"peer": true,
"requires": {
"async": "^2.6.2",
"debug": "^3.1.1",
"mkdirp": "^0.5.5"
},
"dependencies": {
"debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"peer": true,
"requires": {
"ms": "^2.1.1"
}
},
"mkdirp": {
"version": "0.5.6",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
"integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
"peer": true,
"requires": {
"minimist": "^1.2.6"
}
}
}
},
"prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
......@@ -17583,18 +17767,18 @@
}
},
"schemastery": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.3.3.tgz",
"integrity": "sha512-DwRsse6C+Qao90P/Bz+4G3gmAjM3he/VgHk3TykmEWv3KFqvwmqEn61SF3BPaTPP0L77a5Kc6q4+KQvdN1bBqA==",
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.4.3.tgz",
"integrity": "sha512-Ui9sPoxOVaKa2EzR6GS08qB/nIMJUczUtkaLfWjeE44kjYZ+GLUFNVE3TpbXRdxjnbIIExwG+paMd0+M7YimqQ==",
"peer": true,
"requires": {
"cosmokit": "^1.1.2"
}
},
"schemastery-gen": {
"version": "3.1.10",
"resolved": "https://registry.npmjs.org/schemastery-gen/-/schemastery-gen-3.1.10.tgz",
"integrity": "sha512-hwCLOICGEodCcQt+eLoEEvNhm7iSEwJB37JQ+27cHbggTry/Rq07ivXVsPw63Et74EobEaOGDVOTzJ4kIQa01w==",
"version": "3.1.13",
"resolved": "https://registry.npmjs.org/schemastery-gen/-/schemastery-gen-3.1.13.tgz",
"integrity": "sha512-KXkjV9AuKWBlkJ8yEhLYDh7wRcM8p/M+s30Ig6g5eYlGfv7KVUGmpSVVtcH+fUZG+zS/7/UfCreMqqqFJBPdNw==",
"requires": {
"lodash": "^4.17.21",
"reflect-metadata": "^0.1.13",
......
// import 'source-map-support/register';
import { Context } from 'koishi';
import { YGOTournamentPlugin } from './plugin';
import { YGOTournamentPluginConfig } from './config';
export * from './config';
export * from './plugin';
const plugin = new YGOTournamentPlugin();
export default class YGOTournamentPluginEntry {
static Config: any = plugin.schema;
static using = ['cache'] as const;
constructor(ctx: Context, config: YGOTournamentPluginConfig) {
ctx.plugin(plugin, config);
import { YGOTournamentPluginConfig } from './config';
import { classToPlain, plainToClass } from 'class-transformer';
import { MatchWrapper, TournamentWrapper } from './def/challonge';
import { S3Client } from '@aws-sdk/client-s3';
import { getSignedUrl } from './presign';
import { SRVProRoomInfo } from './def/srvpro';
import moment from 'moment';
import { DefinePlugin, StarterPlugin } from 'koishi-thirdeye';
export interface FromAndToTimeUnix {
fromTime: number;
toTime: number;
}
declare module 'koishi' {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Cache {
interface Tables {
challongeData: any;
lateDeclarationTime: FromAndToTimeUnix;
}
}
}
@DefinePlugin()
export default class YGOTournamentPlugin extends StarterPlugin(
YGOTournamentPluginConfig,
) {
private s3: S3Client;
private async getChallongeCache() {
const data = this.ctx.cache.get(
'challongeData',
this.config.tournament.challongeTournamentId,
);
if (data) {
return plainToClass(TournamentWrapper, data);
}
}
private async deleteChallongeCache() {
return this.ctx.cache.del(
'challongeData',
this.config.tournament.challongeTournamentId,
);
}
private async setChallongeCache(data: TournamentWrapper) {
return this.ctx.cache.set(
'challongeData',
this.config.tournament.challongeTournamentId,
classToPlain(data),
);
}
private async fetchChallongeData() {
const cached = await this.getChallongeCache();
if (cached) {
return cached;
}
const plain = await this.ctx.http.get(
`${this.config.tournament.getChallongeUrl()}.json`,
{
params: {
api_key: this.config.tournament.challongeKey,
include_participants: 1,
include_matches: 1,
},
},
);
const data = plainToClass(TournamentWrapper, plain);
await this.setChallongeCache(data);
return data;
}
private async onUserQuit(userId: string) {
const tournament = await this.fetchChallongeData();
const participant = tournament.getParticipantFromId(userId);
if (!participant) {
return '未找到您的参赛信息。';
}
// const participantName = participant.getNameMatching().userName;
this.ctx
.logger('challonge')
.info(`Player ${participant.getDisplayName()} requested for quit.`);
const currentMatch = tournament.getCurrentMatchFromId(
participant.participant.id,
);
if (currentMatch) {
const scores_csv =
participant.participant.id === currentMatch.match.player2_id
? '2--1'
: '-1-2';
const winner_id = currentMatch
.getPlayerIds()
.find((id) => id !== participant.participant.id);
this.ctx
.logger('challonge')
.info(
`Cleaning remaining match for player ${participant.getDisplayName()}.`,
);
await this.ctx.http.put(
`${this.config.tournament.getChallongeUrl()}/matches/${
currentMatch.match.id
}.json`,
{
api_key: this.config.tournament.challongeKey,
match: { scores_csv, winner_id },
},
);
this.ctx
.logger('challonge')
.info(
`Cleaned remaining match for player ${participant.participant.name}.`,
);
}
await this.ctx.http.delete(
`${this.config.tournament.getChallongeUrl()}/participants/${
participant.participant.id
}.json`,
{
params: {
api_key: this.config.tournament.challongeKey,
},
},
);
this.ctx
.logger('challonge')
.info(`Player ${participant.getDisplayName()} quited.`);
await this.deleteChallongeCache();
return '退赛成功。';
}
private async onUserGetCurrentMatch(userId: string) {
const tournament = await this.fetchChallongeData();
const participant = tournament.getParticipantFromId(userId);
if (!participant) {
return '未找到您的参赛信息。';
}
const currentMatch = tournament.getCurrentMatchFromId(
participant.participant.id,
true,
);
if (!currentMatch) {
return '您没有正在进行的比赛。';
}
return `您当前的对局信息:\n${tournament.displayMatch(currentMatch)}`;
}
private async fetchSRVProRoomlist() {
const rawRoomlist = await this.config.tournament.fetchRooms(this.ctx);
return plainToClass(SRVProRoomInfo, rawRoomlist);
}
private async onUserDeclareLate(userId: string) {
const timeUnix = await this.ctx.cache.get('lateDeclarationTime', 'current');
// this.ctx.logger('test').warn(JSON.stringify(timeUnix));
if (
!timeUnix ||
!moment().isBetween(
moment.unix(timeUnix.fromTime),
moment.unix(timeUnix.toTime),
)
) {
return '现在不是允许迟到杀的时间。';
}
const tournament = await this.fetchChallongeData();
const participant = tournament.getParticipantFromId(userId);
if (!participant) {
return '未找到您的参赛信息。';
}
const participantName = participant.getNameMatching().userName;
const currentMatch = tournament.getCurrentMatchFromId(
participant.participant.id,
);
if (!currentMatch) {
return '你没有当前轮次的比赛。';
}
if (!currentMatch.isClean()) {
return '你涉及的比赛似乎已经有结果了,请联系裁判处理。';
}
const roomlist = await this.fetchSRVProRoomlist();
const roomsWithPlayer = roomlist.searchForUser(participantName);
if (!roomsWithPlayer.length) {
return '请先进入房间并打勾确认。';
}
if (
roomsWithPlayer.some((r) => r.istart !== 'wait' || r.users.length > 1)
) {
return '对局已经开始,不能迟到杀。';
}
const scores_csv =
participant.participant.id === currentMatch.match.player1_id
? '2--1'
: '-1-2';
const rivalId = currentMatch
.getPlayerIds()
.find((id) => id !== participant.participant.id);
const rival = tournament.tournament.participants.find(
(p) => p.participant.id === rivalId,
);
this.ctx
.logger('challonge')
.info(
`Player ${participant.getDisplayName()} requested for a late declaration against ${rival?.getDisplayName()}.`,
);
const result = await this.ctx.http.put(
`${this.config.tournament.getChallongeUrl()}/matches/${
currentMatch.match.id
}.json`,
{
api_key: this.config.tournament.challongeKey,
match: { scores_csv, winner_id: participant.participant.id },
},
);
this.ctx
.logger('challonge')
.info(
`Player ${participant.getDisplayName()} declared late against ${rival?.getDisplayName()}.`,
);
await Promise.all([
this.deleteChallongeCache(),
...roomsWithPlayer.map((r) =>
this.config.tournament.kickRoom(this.ctx, r.roomid),
),
]);
return '迟到杀成功。';
}
private async getZombieMatches() {
const tournament = await this.fetchChallongeData();
const matches = tournament.getZombieMatches();
if (!matches.length) {
return { tournament, matches };
}
const roomlist = await this.fetchSRVProRoomlist();
const zombieMatches = matches.filter(
(m) =>
!roomlist.rooms.some(
(r) =>
r.istart !== 'wait' && r.roomname.endsWith(m.match.id.toString()),
),
);
return { tournament, matches: zombieMatches };
}
private async cleanZombieMatch(match: MatchWrapper) {
await this.ctx.http.put(
`${this.config.tournament.getChallongeUrl()}/matches/${
match.match.id
}.json`,
{
api_key: this.config.tournament.challongeKey,
match: { scores_csv: '0-0', winner_id: 'tie' },
},
);
}
private initializeDeckFetch() {
if (!this.config.isDeckFetchEnabled()) {
return;
}
this.s3 = this.config.deckFetch.S3Client();
this.ctx
.command('tournament/deck', '获取自己的卡组')
.action(async ({ session }) => {
const userId = session.userId;
try {
const { Contents } = await this.s3.send(
this.config.deckFetch.listCommand(),
);
const deck = Contents.find(
(c) => c.Key.endsWith('.ydk') && c.Key.includes(userId),
);
if (!deck) {
return '未找到您的卡组。';
}
const url = await getSignedUrl(
this.s3,
this.config.deckFetch.getObjectCommand(deck.Key),
{
expiresIn: this.config.deckFetch.urlAge,
extraHeaders: this.config.deckFetch.host && {
host: this.config.deckFetch.host,
},
},
);
return `获取卡组成功。您可以在下列地址下载您的卡组:\n${url}`;
} catch (e) {
this.ctx
.logger('deckfetch')
.error(`Failed to fetch deck of ${userId}: ${e.toString()}`);
return '获取卡组出现了问题。请与技术人员联系。';
}
});
}
initializeTournament() {
if (!this.config.isTournamentEnabled()) {
return;
}
this.ctx.cache.table('lateDeclarationTime', { maxAge: 3600 * 1000 });
this.ctx
.command('tournament/currentmatch', '获取当前对局')
.shortcut('获取当前对局')
.usage('获取自己的当前对局和比分。')
.action(async ({ session }) => {
try {
return await this.onUserGetCurrentMatch(session.userId);
} catch (e) {
this.ctx
.logger('challonge')
.error(
`Failed to fetch current match of ${
session.userId
}: ${e.toString()}`,
);
return '获取比赛出现了一些问题,请与技术人员联系。';
}
});
this.ctx
.command('tournament/late', '迟到杀')
.shortcut('迟到杀')
.usage('迟到杀需要选手在房间内,且只有1人才可以迟到杀。')
.action(async ({ session }) => {
try {
return await this.onUserDeclareLate(session.userId);
} catch (e) {
this.ctx
.logger('challonge')
.error(`Failed to quit user ${session.userId}: ${e.toString()}`);
return '迟到杀出现了一些问题,请与技术人员联系。';
}
});
this.ctx
.command('tournament/quit', '退赛')
.shortcut('退赛')
.usage('退赛需要慎重,会取消后续的比赛资格。')
.action(async ({ session }) => {
await session.send('确定要退赛吗?输入 yes 以确认。');
const reply = await session.prompt();
if (reply !== 'yes') {
return '退赛被取消,接下来要继续努力哦。';
}
try {
return await this.onUserQuit(session.userId);
} catch (e) {
this.ctx
.logger('challonge')
.error(`Failed to quit user ${session.userId}: ${e.toString()}`);
return '退赛出现了一些问题,请与技术人员联系。';
}
});
const judgeCommand = this.ctx
.select(this.config.judgeSelection)
.command('tournament/judge', '裁判操作')
.usage('需要有裁判权限才能执行这些操作。');
judgeCommand
.subcommand('.enablelate', '开启迟到杀')
.usage('允许选手使用指令来进行迟到杀。')
.option('delay', '-d <time:posint> 在指定分钟后开启迟到杀。', {
fallback: 0,
})
.option('duration', '-t <time:posint> 迟到杀允许的分钟数。', {
fallback: 30,
})
.action(async ({ session, options }) => {
const fromTime = moment().add(options.delay, 'minutes');
const toTime = fromTime.clone().add(options.duration, 'minutes');
await this.ctx.cache.set(
'lateDeclarationTime',
'current',
{
fromTime: fromTime.unix(),
toTime: toTime.unix(),
},
(options.delay + options.duration) * 60000,
);
return `设置成功。将允许在 ${fromTime.format(
'HH:mm:ss',
)}${toTime.format('HH:mm:ss')} 期间允许迟到杀。`;
});
judgeCommand
.subcommand('.disablelate', '关闭迟到杀')
.usage('不再允许选手进行迟到杀操作。')
.action(async () => {
await this.ctx.cache.del('lateDeclarationTime', 'current');
return '设置成功。选手不再允许进行迟到杀操作。';
});
judgeCommand
.subcommand('.refresh', '清理 Challonge 缓存')
.action(async () => {
await this.ctx.cache.del(
'challongeData',
this.config.tournament.challongeTournamentId,
);
return '清理缓存成功。';
});
judgeCommand
.subcommand('.cleanzombie', '清理僵尸对局')
.usage('会清理所有没有开始的对局,统一设置为 0-0 平。')
.action(async ({ session }) => {
try {
const { tournament, matches } = await this.getZombieMatches();
if (!matches.length) {
return '未找到僵尸对局。';
}
await session.send(
`找到了 ${matches.length} 个僵尸对局:\n${matches
.map((m) => tournament.displayMatch(m))
.join('\n')}\n\n输入 yes 进行清理。`,
);
const reply = await session.prompt();
if (reply !== 'yes') {
return '清理被取消。';
}
const logger = this.ctx.logger('challonge');
logger.info(`Cleaning ${matches.length} zombie matches.`);
await Promise.all(matches.map((m) => this.cleanZombieMatch(m)));
logger.info(`Cleaned ${matches.length} zombie matches.`);
return `清理成功,清理了 ${matches.length} 个僵尸对局。`;
} catch (e) {
this.ctx
.logger('challonge')
.error(`Failed to clean zombie matches: ${e.toString()}`);
}
});
}
onApply() {
this.ctx.command('tournament', 'YGOPro 比赛相关命令');
this.initializeTournament();
this.initializeDeckFetch();
}
}
// import 'source-map-support/register';
import { Context } from 'koishi';
import { YGOTournamentPluginConfig } from './config';
import { classToPlain, plainToClass } from 'class-transformer';
import { MatchWrapper, TournamentWrapper } from './def/challonge';
import { S3Client } from '@aws-sdk/client-s3';
import { getSignedUrl } from './presign';
import { SRVProRoomInfo } from './def/srvpro';
import moment from 'moment';
export interface FromAndToTimeUnix {
fromTime: number;
toTime: number;
}
declare module 'koishi' {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Cache {
interface Tables {
challongeData: any;
lateDeclarationTime: FromAndToTimeUnix;
}
}
}
export class YGOTournamentPlugin {
private s3: S3Client;
private config: YGOTournamentPluginConfig;
private ctx: Context;
private async getChallongeCache() {
const data = this.ctx.cache.get(
'challongeData',
this.config.tournament.challongeTournamentId,
);
if (data) {
return plainToClass(TournamentWrapper, data);
}
}
private async deleteChallongeCache() {
return this.ctx.cache.del(
'challongeData',
this.config.tournament.challongeTournamentId,
);
}
private async setChallongeCache(data: TournamentWrapper) {
return this.ctx.cache.set(
'challongeData',
this.config.tournament.challongeTournamentId,
classToPlain(data),
);
}
private async fetchChallongeData() {
const cached = await this.getChallongeCache();
if (cached) {
return cached;
}
const plain = await this.ctx.http.get(
`${this.config.tournament.getChallongeUrl()}.json`,
{
params: {
api_key: this.config.tournament.challongeKey,
include_participants: 1,
include_matches: 1,
},
},
);
const data = plainToClass(TournamentWrapper, plain);
await this.setChallongeCache(data);
return data;
}
private async onUserQuit(userId: string) {
const tournament = await this.fetchChallongeData();
const participant = tournament.getParticipantFromId(userId);
if (!participant) {
return '未找到您的参赛信息。';
}
// const participantName = participant.getNameMatching().userName;
this.ctx
.logger('challonge')
.info(`Player ${participant.getDisplayName()} requested for quit.`);
const currentMatch = tournament.getCurrentMatchFromId(
participant.participant.id,
);
if (currentMatch) {
const scores_csv =
participant.participant.id === currentMatch.match.player2_id
? '2--1'
: '-1-2';
const winner_id = currentMatch
.getPlayerIds()
.find((id) => id !== participant.participant.id);
this.ctx
.logger('challonge')
.info(
`Cleaning remaining match for player ${participant.getDisplayName()}.`,
);
await this.ctx.http.put(
`${this.config.tournament.getChallongeUrl()}/matches/${
currentMatch.match.id
}.json`,
{
api_key: this.config.tournament.challongeKey,
match: { scores_csv, winner_id },
},
);
this.ctx
.logger('challonge')
.info(
`Cleaned remaining match for player ${participant.participant.name}.`,
);
}
await this.ctx.http.delete(
`${this.config.tournament.getChallongeUrl()}/participants/${
participant.participant.id
}.json`,
{
params: {
api_key: this.config.tournament.challongeKey,
},
},
);
this.ctx
.logger('challonge')
.info(`Player ${participant.getDisplayName()} quited.`);
await this.deleteChallongeCache();
return '退赛成功。';
}
private async onUserGetCurrentMatch(userId: string) {
const tournament = await this.fetchChallongeData();
const participant = tournament.getParticipantFromId(userId);
if (!participant) {
return '未找到您的参赛信息。';
}
const currentMatch = tournament.getCurrentMatchFromId(
participant.participant.id,
true,
);
if (!currentMatch) {
return '您没有正在进行的比赛。';
}
return `您当前的对局信息:\n${tournament.displayMatch(currentMatch)}`;
}
private async fetchSRVProRoomlist() {
const rawRoomlist = await this.config.tournament.fetchRooms(this.ctx);
return plainToClass(SRVProRoomInfo, rawRoomlist);
}
private async onUserDeclareLate(userId: string) {
const timeUnix = await this.ctx.cache.get('lateDeclarationTime', 'current');
// this.ctx.logger('test').warn(JSON.stringify(timeUnix));
if (
!timeUnix ||
!moment().isBetween(
moment.unix(timeUnix.fromTime),
moment.unix(timeUnix.toTime),
)
) {
return '现在不是允许迟到杀的时间。';
}
const tournament = await this.fetchChallongeData();
const participant = tournament.getParticipantFromId(userId);
if (!participant) {
return '未找到您的参赛信息。';
}
const participantName = participant.getNameMatching().userName;
const currentMatch = tournament.getCurrentMatchFromId(
participant.participant.id,
);
if (!currentMatch) {
return '你没有当前轮次的比赛。';
}
if (!currentMatch.isClean()) {
return '你涉及的比赛似乎已经有结果了,请联系裁判处理。';
}
const roomlist = await this.fetchSRVProRoomlist();
const roomsWithPlayer = roomlist.searchForUser(participantName);
if (!roomsWithPlayer.length) {
return '请先进入房间并打勾确认。';
}
if (
roomsWithPlayer.some((r) => r.istart !== 'wait' || r.users.length > 1)
) {
return '对局已经开始,不能迟到杀。';
}
const scores_csv =
participant.participant.id === currentMatch.match.player1_id
? '2--1'
: '-1-2';
const rivalId = currentMatch
.getPlayerIds()
.find((id) => id !== participant.participant.id);
const rival = tournament.tournament.participants.find(
(p) => p.participant.id === rivalId,
);
this.ctx
.logger('challonge')
.info(
`Player ${participant.getDisplayName()} requested for a late declaration against ${rival?.getDisplayName()}.`,
);
const result = await this.ctx.http.put(
`${this.config.tournament.getChallongeUrl()}/matches/${
currentMatch.match.id
}.json`,
{
api_key: this.config.tournament.challongeKey,
match: { scores_csv, winner_id: participant.participant.id },
},
);
this.ctx
.logger('challonge')
.info(
`Player ${participant.getDisplayName()} declared late against ${rival?.getDisplayName()}.`,
);
await Promise.all([
this.deleteChallongeCache(),
...roomsWithPlayer.map((r) =>
this.config.tournament.kickRoom(this.ctx, r.roomid),
),
]);
return '迟到杀成功。';
}
private async getZombieMatches() {
const tournament = await this.fetchChallongeData();
const matches = tournament.getZombieMatches();
if (!matches.length) {
return { tournament, matches };
}
const roomlist = await this.fetchSRVProRoomlist();
const zombieMatches = matches.filter(
(m) =>
!roomlist.rooms.some(
(r) =>
r.istart !== 'wait' && r.roomname.endsWith(m.match.id.toString()),
),
);
return { tournament, matches: zombieMatches };
}
private async cleanZombieMatch(match: MatchWrapper) {
await this.ctx.http.put(
`${this.config.tournament.getChallongeUrl()}/matches/${
match.match.id
}.json`,
{
api_key: this.config.tournament.challongeKey,
match: { scores_csv: '0-0', winner_id: 'tie' },
},
);
}
private initializeDeckFetch() {
if (!this.config.isDeckFetchEnabled()) {
return;
}
this.s3 = this.config.deckFetch.S3Client();
this.ctx
.command('tournament/deck', '获取自己的卡组')
.action(async ({ session }) => {
const userId = session.userId;
try {
const { Contents } = await this.s3.send(
this.config.deckFetch.listCommand(),
);
const deck = Contents.find(
(c) => c.Key.endsWith('.ydk') && c.Key.includes(userId),
);
if (!deck) {
return '未找到您的卡组。';
}
const url = await getSignedUrl(
this.s3,
this.config.deckFetch.getObjectCommand(deck.Key),
{
expiresIn: this.config.deckFetch.urlAge,
extraHeaders: this.config.deckFetch.host && {
host: this.config.deckFetch.host,
},
},
);
return `获取卡组成功。您可以在下列地址下载您的卡组:\n${url}`;
} catch (e) {
this.ctx
.logger('deckfetch')
.error(`Failed to fetch deck of ${userId}: ${e.toString()}`);
return '获取卡组出现了问题。请与技术人员联系。';
}
});
}
initializeTournament() {
if (!this.config.isTournamentEnabled()) {
return;
}
this.ctx.cache.table('lateDeclarationTime', { maxAge: 3600 * 1000 });
this.ctx
.command('tournament/currentmatch', '获取当前对局')
.shortcut('获取当前对局')
.usage('获取自己的当前对局和比分。')
.action(async ({ session }) => {
try {
return await this.onUserGetCurrentMatch(session.userId);
} catch (e) {
this.ctx
.logger('challonge')
.error(
`Failed to fetch current match of ${
session.userId
}: ${e.toString()}`,
);
return '获取比赛出现了一些问题,请与技术人员联系。';
}
});
this.ctx
.command('tournament/late', '迟到杀')
.shortcut('迟到杀')
.usage('迟到杀需要选手在房间内,且只有1人才可以迟到杀。')
.action(async ({ session }) => {
try {
return await this.onUserDeclareLate(session.userId);
} catch (e) {
this.ctx
.logger('challonge')
.error(`Failed to quit user ${session.userId}: ${e.toString()}`);
return '迟到杀出现了一些问题,请与技术人员联系。';
}
});
this.ctx
.command('tournament/quit', '退赛')
.shortcut('退赛')
.usage('退赛需要慎重,会取消后续的比赛资格。')
.action(async ({ session }) => {
await session.send('确定要退赛吗?输入 yes 以确认。');
const reply = await session.prompt();
if (reply !== 'yes') {
return '退赛被取消,接下来要继续努力哦。';
}
try {
return await this.onUserQuit(session.userId);
} catch (e) {
this.ctx
.logger('challonge')
.error(`Failed to quit user ${session.userId}: ${e.toString()}`);
return '退赛出现了一些问题,请与技术人员联系。';
}
});
const judgeCommand = this.ctx
.select(this.config.judgeSelection)
.command('tournament/judge', '裁判操作')
.usage('需要有裁判权限才能执行这些操作。');
judgeCommand
.subcommand('.enablelate', '开启迟到杀')
.usage('允许选手使用指令来进行迟到杀。')
.option('delay', '-d <time:posint> 在指定分钟后开启迟到杀。', {
fallback: 0,
})
.option('duration', '-t <time:posint> 迟到杀允许的分钟数。', {
fallback: 30,
})
.action(async ({ session, options }) => {
const fromTime = moment().add(options.delay, 'minutes');
const toTime = fromTime.clone().add(options.duration, 'minutes');
await this.ctx.cache.set(
'lateDeclarationTime',
'current',
{
fromTime: fromTime.unix(),
toTime: toTime.unix(),
},
(options.delay + options.duration) * 60000,
);
return `设置成功。将允许在 ${fromTime.format(
'HH:mm:ss',
)}${toTime.format('HH:mm:ss')} 期间允许迟到杀。`;
});
judgeCommand
.subcommand('.disablelate', '关闭迟到杀')
.usage('不再允许选手进行迟到杀操作。')
.action(async () => {
await this.ctx.cache.del('lateDeclarationTime', 'current');
return '设置成功。选手不再允许进行迟到杀操作。';
});
judgeCommand
.subcommand('.refresh', '清理 Challonge 缓存')
.action(async () => {
await this.ctx.cache.del(
'challongeData',
this.config.tournament.challongeTournamentId,
);
return '清理缓存成功。';
});
judgeCommand
.subcommand('.cleanzombie', '清理僵尸对局')
.usage('会清理所有没有开始的对局,统一设置为 0-0 平。')
.action(async ({ session }) => {
try {
const { tournament, matches } = await this.getZombieMatches();
if (!matches.length) {
return '未找到僵尸对局。';
}
await session.send(
`找到了 ${matches.length} 个僵尸对局:\n${matches
.map((m) => tournament.displayMatch(m))
.join('\n')}\n\n输入 yes 进行清理。`,
);
const reply = await session.prompt();
if (reply !== 'yes') {
return '清理被取消。';
}
const logger = this.ctx.logger('challonge');
logger.info(`Cleaning ${matches.length} zombie matches.`);
await Promise.all(matches.map((m) => this.cleanZombieMatch(m)));
logger.info(`Cleaned ${matches.length} zombie matches.`);
return `清理成功,清理了 ${matches.length} 个僵尸对局。`;
} catch (e) {
this.ctx
.logger('challonge')
.error(`Failed to clean zombie matches: ${e.toString()}`);
}
});
}
name = 'ygotournament-main';
schema = YGOTournamentPluginConfig;
apply(ctx: Context, config: YGOTournamentPluginConfig) {
this.ctx = ctx;
this.config = config;
this.ctx.command('tournament', 'YGOPro 比赛相关命令');
this.initializeTournament();
this.initializeDeckFetch();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment