Commit fba3555b authored by nanahira's avatar nanahira

add pics component support

parent 01899cb8
import { Awaitable, Context, Schema } from 'koishi';
import { Awaitable, Context, Schema, segment } from 'koishi';
import {
DefinePlugin,
MultiInstancePlugin,
......@@ -65,6 +65,8 @@ export default class ExtrasInDev {
isDefault: true,
// endpoint: 'https://cdn02.moecube.com:444',
});
ctx.command('pic2').action(() => segment('pics'));
}
static using = ['pics'] as const;
......
......@@ -10,13 +10,13 @@
"license": "MIT",
"dependencies": {
"@koishijs/assets": "^1.0.1",
"koishi-thirdeye": "^11.1.14",
"koishi-thirdeye": "^11.1.17",
"lodash": "^4.17.21"
},
"devDependencies": {
"@koishijs/plugin-console": "^4.7.1",
"@koishijs/plugin-console": "^5.0.0",
"@koishijs/plugin-database-memory": "^2.0.1",
"@koishijs/plugin-sandbox": "^2.4.0",
"@koishijs/plugin-sandbox": "^2.5.0",
"@types/jest": "^29.2.0",
"@types/lodash": "^4.14.176",
"@types/node": "^16.11.4",
......@@ -39,7 +39,7 @@
"ws": "^8.3.0"
},
"peerDependencies": {
"koishi": "^4.10.4"
"koishi": "^4.10.10"
}
},
"node_modules/@ampproject/remapping": {
......@@ -1398,23 +1398,23 @@
}
},
"node_modules/@koishijs/core": {
"version": "4.10.4",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.10.4.tgz",
"integrity": "sha512-uhR2RoslHs3ynhElWP+jIwzqn8PprlPGF10qWQvTpW1l5XmPr+PiWgf5HmAGt1XucWcuij9n1Z179yqZs6xLNg==",
"version": "4.10.10",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.10.10.tgz",
"integrity": "sha512-LooBZCQSm91TL7aBBECjaFaROn+udCAavOwi+AWzbFPBfcuF4ZHFGpQ112yWK70xbQ7YhHUueueqJpkAGOy4RA==",
"peer": true,
"dependencies": {
"@koishijs/utils": "^6.2.6",
"@minatojs/core": "^2.0.1",
"@satorijs/core": "^1.4.3",
"@koishijs/utils": "^6.3.4",
"@minatojs/core": "^2.0.3",
"@satorijs/core": "^1.4.11",
"cordis": "^2.6.0",
"cosmokit": "^1.3.3",
"cosmokit": "^1.3.6",
"fastest-levenshtein": "^1.0.16"
}
},
"node_modules/@koishijs/plugin-console": {
"version": "4.7.1",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-console/-/plugin-console-4.7.1.tgz",
"integrity": "sha512-pkoWnR1j/XQkZ3veUypmtaeyH21Fo3BIPRGN5Ct1TVFzMrj/d553hc4EmHXO2Qi2HEQnYYMaVSY3ApWWHLUVzA==",
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-console/-/plugin-console-5.0.0.tgz",
"integrity": "sha512-6jLYse2EYgoNcOvOfKWWBnMXEfY8E9NCKpLrr8ts7PmY+8ot9ZsO4SbEEDYB1VgKMfkKm1zY12Jsa+ziNIiG1Q==",
"dev": true,
"dependencies": {
"open": "^8.4.0",
......@@ -1422,7 +1422,7 @@
"ws": "^8.11.0"
},
"peerDependencies": {
"koishi": "^4.10.4"
"koishi": "^4.10.6"
}
},
"node_modules/@koishijs/plugin-database-memory": {
......@@ -1438,31 +1438,31 @@
}
},
"node_modules/@koishijs/plugin-sandbox": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-sandbox/-/plugin-sandbox-2.4.0.tgz",
"integrity": "sha512-HUsxONww1CUwA18b1cGsGRFA0p1e9B1nYMek5iUQc7eCxkTjRmnmwjcskOmvOPlLqlziE59NV82jD7M/aUd9Rg==",
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-sandbox/-/plugin-sandbox-2.5.0.tgz",
"integrity": "sha512-9sRLvSmHP8s6mkegGOedQocSDwhtULeoWEUH+CMoLPltIPCy2zam7ZA/+1Te2hNcRqN2NbhS/rOWAO6XeQ1PTg==",
"dev": true,
"peerDependencies": {
"@koishijs/plugin-console": "^4.6.12",
"koishi": "^4.10.2"
"@koishijs/plugin-console": "^5.0.0",
"koishi": "^4.10.6"
}
},
"node_modules/@koishijs/utils": {
"version": "6.2.6",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-6.2.6.tgz",
"integrity": "sha512-JAqzAmTLwLwd4LHRoLjMvCojHeyDiGaKqgpd7p3/PMeXL7aHtN+owPv0xtn9jB375llGHYQT51PMkiLMbAIpYw==",
"version": "6.3.4",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-6.3.4.tgz",
"integrity": "sha512-P8hQOTVYsk5rCkBcYbIKKKBm58etGlY/Q3xOuMEyz6BlTe0V8A6lFv56nInuPIaTOf4XprTceZBE6Oe3lC8RuQ==",
"peer": true,
"dependencies": {
"cosmokit": "^1.3.3",
"cosmokit": "^1.3.6",
"inaba": "^1.1.1",
"reggol": "^1.3.2",
"schemastery": "^3.5.4"
"reggol": "^1.3.3",
"schemastery": "^3.6.1"
}
},
"node_modules/@minatojs/core": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@minatojs/core/-/core-2.0.2.tgz",
"integrity": "sha512-pkjdHhcTuQ1QQdBCTXQLKudm2l4JBtxwLdAtmYqCK+dUxJlAod2t7eDkCFpzcUXbQzsXWJplvs7uYSIPQUYSyA==",
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@minatojs/core/-/core-2.0.3.tgz",
"integrity": "sha512-VZo1sDl9jLcejMyEfd/A+yZt/qre3vB+woSIZmWCm78zBR+CkFPk56y5EAMnu0cW9kgtq0p/KHa2VUVXyN71Bw==",
"dependencies": {
"cosmokit": "^1.3.4"
}
......@@ -1515,48 +1515,48 @@
}
},
"node_modules/@satorijs/core": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/@satorijs/core/-/core-1.4.3.tgz",
"integrity": "sha512-L0VJVq3jlb8r4IaYlNBMfh4A3vskDMeQwl9Y5lgXBlShxsMzn2XcgtDKfa4WgNH4HzRFjS8iLkVBSo9jDW+3TA==",
"version": "1.4.11",
"resolved": "https://registry.npmjs.org/@satorijs/core/-/core-1.4.11.tgz",
"integrity": "sha512-8EsVA5esShEqYMwwXipGwx7obwVb3Lc0NwBmjZWNj2++WYKYg+jQ0Iatgd2jcJhNX2H9ziqnwu05aHtWo+mSsA==",
"peer": true,
"dependencies": {
"@satorijs/element": "^2.1.7",
"@satorijs/element": "^2.2.2",
"cordis": "^2.6.0",
"cordis-axios": "^2.1.5",
"cosmokit": "^1.3.3",
"reggol": "^1.3.2",
"schemastery": "^3.5.4",
"cordis-axios": "^2.1.6",
"cosmokit": "^1.3.6",
"reggol": "^1.3.3",
"schemastery": "^3.6.1",
"ws": "^8.11.0"
}
},
"node_modules/@satorijs/element": {
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@satorijs/element/-/element-2.1.8.tgz",
"integrity": "sha512-a1/ClyPKJQdv07RgUANdOahULTiJE7H7TRaP6w6d+DB46rh9KAvZyhp3tDgMBKBm/3bOvfpieXWExgDdQVgsBA==",
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/@satorijs/element/-/element-2.2.2.tgz",
"integrity": "sha512-t6K0weO+GwqHhP/C9GTchck0jDk8c63kiAr9hHEVQX3nx/+fjGquTDGzBc4WzOVc105wePWRvV1UtvRaa0I9FQ==",
"peer": true,
"dependencies": {
"cosmokit": "^1.3.3"
"cosmokit": "^1.3.6"
}
},
"node_modules/@satorijs/satori": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/@satorijs/satori/-/satori-1.4.3.tgz",
"integrity": "sha512-XgMolxa9/9gWf4+VKqLioBkzuZA0QXQIMWZHFET1dVvQjbxNhaETF0NBmwFSjbVBOWvTN8vecTGTSLc3pQn+Rw==",
"version": "1.4.11",
"resolved": "https://registry.npmjs.org/@satorijs/satori/-/satori-1.4.11.tgz",
"integrity": "sha512-nQHch/Ya1ClsNO9anJYfNnpiMFHCc1ihxdWuVKKpGOXRxuGMOtnbkB/Qa+NuBT+887E2NsFfTBoFgt8vuExxew==",
"peer": true,
"dependencies": {
"@koa/router": "^10.1.1",
"@satorijs/core": "1.4.3",
"@satorijs/core": "1.4.11",
"@types/koa": "*",
"@types/koa__router": "*",
"@types/ws": "^8.5.3",
"agent-base": "^6.0.2",
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.1",
"koa": "^2.13.4",
"koa": "^2.14.1",
"koa-bodyparser": "^4.3.0",
"parseurl": "^1.3.3",
"path-to-regexp": "^6.2.1",
"schemastery": "^3.5.4",
"schemastery": "^3.6.1",
"socks-proxy-agent": "^5.0.1",
"ws": "^8.11.0"
},
......@@ -2907,16 +2907,16 @@
}
},
"node_modules/cordis-axios": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/cordis-axios/-/cordis-axios-2.1.5.tgz",
"integrity": "sha512-L5cHolNBlo4MxhfWRETpz1G20jF6J0Hu+5zPxebo0XJthqO0eI6U/2DrbQvXARnyMhuQIIZfoPJLvSNgd0Rjzw==",
"version": "2.1.6",
"resolved": "https://registry.npmjs.org/cordis-axios/-/cordis-axios-2.1.6.tgz",
"integrity": "sha512-GaJq5zoh4XRAFHEOyCLyU7kIcRrV7hqDVEh5kF4t047TmROAUaLukPKSMeMVMNohpKW4Vz+tj2FGEqMx5NuBQg==",
"peer": true,
"dependencies": {
"axios": "~1.1.3",
"cosmokit": "^1.3.3",
"cosmokit": "^1.3.4",
"file-type": "^16.5.4",
"mime-db": "^1.52.0",
"schemastery": "^3.5.4"
"schemastery": "^3.6.1"
},
"engines": {
"node": ">=12.0.0"
......@@ -2943,9 +2943,9 @@
}
},
"node_modules/cosmokit": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.3.4.tgz",
"integrity": "sha512-E4G29C9xwvi1mcihAYz1R0NGbu8lYkxi/MRtnfG8qJ10OGJNhgdvgE3X7XgpMHEFkhEGT+YTnjUvQA53gI7Vog=="
"version": "1.3.6",
"resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.3.6.tgz",
"integrity": "sha512-buZvC7fuqBbSimJfkaaTJmlelpgj56L7VybjNkCy5UVvShMVQHi/bTZcuBfYLBwpuebSfvDZPwwHS5IfcoAnxg=="
},
"node_modules/create-require": {
"version": "1.1.1",
......@@ -6024,9 +6024,9 @@
}
},
"node_modules/koa": {
"version": "2.13.4",
"resolved": "https://registry.npmjs.org/koa/-/koa-2.13.4.tgz",
"integrity": "sha512-43zkIKubNbnrULWlHdN5h1g3SEKXOEzoAlRsHOTFpnlDu8JlAOZSMJBLULusuXRequboiwJcj5vtYXKB3k7+2g==",
"version": "2.14.1",
"resolved": "https://registry.npmjs.org/koa/-/koa-2.14.1.tgz",
"integrity": "sha512-USJFyZgi2l0wDgqkfD27gL4YGno7TfUkcmOe6UOLFOVuN+J7FwnNu4Dydl4CUQzraM1lBAiGed0M9OVJoT0Kqw==",
"peer": true,
"dependencies": {
"accepts": "^1.3.5",
......@@ -6099,14 +6099,14 @@
}
},
"node_modules/koishi": {
"version": "4.10.4",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.10.4.tgz",
"integrity": "sha512-06ylHCmyyj8buQxPcnuSap7Yco6HtzC0o61AwBuBOikdILQj2WicexztohuLhQ/9ElA3pEOsJaHzDa/9Lh71Ng==",
"version": "4.10.10",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.10.10.tgz",
"integrity": "sha512-92VxR/7AL8l2eyd0MOWi5Nc/nLe2lX9ftglsMkqHvvImFkQma+2kSuexuxVLjcDmkAL6LWI27VxyuUH35jl5PQ==",
"peer": true,
"dependencies": {
"@koishijs/core": "^4.10.4",
"@koishijs/utils": "^6.2.6",
"@satorijs/satori": "^1.4.3",
"@koishijs/core": "^4.10.10",
"@koishijs/utils": "^6.3.4",
"@satorijs/satori": "^1.4.11",
"file-type": "^16.5.4",
"ns-require": "^1.1.4"
},
......@@ -6115,16 +6115,16 @@
}
},
"node_modules/koishi-thirdeye": {
"version": "11.1.14",
"resolved": "https://registry.npmjs.org/koishi-thirdeye/-/koishi-thirdeye-11.1.14.tgz",
"integrity": "sha512-poQZwMfkiurvDMdEhfa0TnhRhe/7VNismNDo6xcZAZVUfDl4Q8USCYEVwlmUvi6GSWl4X+4a51YL3VUZQX+GrA==",
"version": "11.1.17",
"resolved": "https://registry.npmjs.org/koishi-thirdeye/-/koishi-thirdeye-11.1.17.tgz",
"integrity": "sha512-Ij65qf1pLO1kQMrs2RNRVUdalmb2lL8tcxGVl79cDqW/V6ECjPgaSVIPuUT3uxI6FAaQHq9dXHMF54Iw05W8+Q==",
"dependencies": {
"minato-decorators": "^2.2.1",
"rxjs": "^7.5.6",
"satori-decorators": "^1.1.1"
},
"peerDependencies": {
"koishi": "^4.10.4"
"koishi": "^4.10.10"
}
},
"node_modules/leven": {
......@@ -6985,12 +6985,12 @@
}
},
"node_modules/reggol": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/reggol/-/reggol-1.3.2.tgz",
"integrity": "sha512-vI+nWzdBJlO9OsrDCJ/z5NS4/o1mzHjwrZcn6LoESHn2get7LrbZ0TZB/dEkCtUlah324rxd5E2zciT/98Op1Q==",
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/reggol/-/reggol-1.3.3.tgz",
"integrity": "sha512-AmFo4aBBLwd1IosfkQ9cnWJF+RDXjrfmY2pFeRXSLlvi1UoqMYLsltR/514R8Dr/ZfAYdcD75V/vFDK60hgyOQ==",
"peer": true,
"dependencies": {
"cosmokit": "^1.3.3",
"cosmokit": "^1.3.6",
"object-inspect": "^1.12.2",
"supports-color": "^8.1.1"
}
......@@ -7181,12 +7181,12 @@
}
},
"node_modules/schemastery": {
"version": "3.5.4",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.5.4.tgz",
"integrity": "sha512-YPr+tR4fFt/d1gH0AXQjlr+Luw5+3Hz75tWT8g8Iqt1wnNTys3+TB2wAaekrTKhgnWhQPCHwDfLF1KZHNTNquw==",
"version": "3.6.1",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.6.1.tgz",
"integrity": "sha512-Igh4oqaHco1AYmqpSgYgg411gNomSI9xE35Xo/FuzJZTMYWA5W1o+82Q5qMnt9FAQ76gZig0pea9OcHl0AM/Lw==",
"peer": true,
"dependencies": {
"cosmokit": "^1.2.1"
"cosmokit": "^1.3.4"
}
},
"node_modules/schemastery-gen": {
......@@ -9406,23 +9406,23 @@
}
},
"@koishijs/core": {
"version": "4.10.4",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.10.4.tgz",
"integrity": "sha512-uhR2RoslHs3ynhElWP+jIwzqn8PprlPGF10qWQvTpW1l5XmPr+PiWgf5HmAGt1XucWcuij9n1Z179yqZs6xLNg==",
"version": "4.10.10",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.10.10.tgz",
"integrity": "sha512-LooBZCQSm91TL7aBBECjaFaROn+udCAavOwi+AWzbFPBfcuF4ZHFGpQ112yWK70xbQ7YhHUueueqJpkAGOy4RA==",
"peer": true,
"requires": {
"@koishijs/utils": "^6.2.6",
"@minatojs/core": "^2.0.1",
"@satorijs/core": "^1.4.3",
"@koishijs/utils": "^6.3.4",
"@minatojs/core": "^2.0.3",
"@satorijs/core": "^1.4.11",
"cordis": "^2.6.0",
"cosmokit": "^1.3.3",
"cosmokit": "^1.3.6",
"fastest-levenshtein": "^1.0.16"
}
},
"@koishijs/plugin-console": {
"version": "4.7.1",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-console/-/plugin-console-4.7.1.tgz",
"integrity": "sha512-pkoWnR1j/XQkZ3veUypmtaeyH21Fo3BIPRGN5Ct1TVFzMrj/d553hc4EmHXO2Qi2HEQnYYMaVSY3ApWWHLUVzA==",
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-console/-/plugin-console-5.0.0.tgz",
"integrity": "sha512-6jLYse2EYgoNcOvOfKWWBnMXEfY8E9NCKpLrr8ts7PmY+8ot9ZsO4SbEEDYB1VgKMfkKm1zY12Jsa+ziNIiG1Q==",
"dev": true,
"requires": {
"open": "^8.4.0",
......@@ -9440,28 +9440,28 @@
}
},
"@koishijs/plugin-sandbox": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-sandbox/-/plugin-sandbox-2.4.0.tgz",
"integrity": "sha512-HUsxONww1CUwA18b1cGsGRFA0p1e9B1nYMek5iUQc7eCxkTjRmnmwjcskOmvOPlLqlziE59NV82jD7M/aUd9Rg==",
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-sandbox/-/plugin-sandbox-2.5.0.tgz",
"integrity": "sha512-9sRLvSmHP8s6mkegGOedQocSDwhtULeoWEUH+CMoLPltIPCy2zam7ZA/+1Te2hNcRqN2NbhS/rOWAO6XeQ1PTg==",
"dev": true,
"requires": {}
},
"@koishijs/utils": {
"version": "6.2.6",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-6.2.6.tgz",
"integrity": "sha512-JAqzAmTLwLwd4LHRoLjMvCojHeyDiGaKqgpd7p3/PMeXL7aHtN+owPv0xtn9jB375llGHYQT51PMkiLMbAIpYw==",
"version": "6.3.4",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-6.3.4.tgz",
"integrity": "sha512-P8hQOTVYsk5rCkBcYbIKKKBm58etGlY/Q3xOuMEyz6BlTe0V8A6lFv56nInuPIaTOf4XprTceZBE6Oe3lC8RuQ==",
"peer": true,
"requires": {
"cosmokit": "^1.3.3",
"cosmokit": "^1.3.6",
"inaba": "^1.1.1",
"reggol": "^1.3.2",
"schemastery": "^3.5.4"
"reggol": "^1.3.3",
"schemastery": "^3.6.1"
}
},
"@minatojs/core": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@minatojs/core/-/core-2.0.2.tgz",
"integrity": "sha512-pkjdHhcTuQ1QQdBCTXQLKudm2l4JBtxwLdAtmYqCK+dUxJlAod2t7eDkCFpzcUXbQzsXWJplvs7uYSIPQUYSyA==",
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@minatojs/core/-/core-2.0.3.tgz",
"integrity": "sha512-VZo1sDl9jLcejMyEfd/A+yZt/qre3vB+woSIZmWCm78zBR+CkFPk56y5EAMnu0cW9kgtq0p/KHa2VUVXyN71Bw==",
"requires": {
"cosmokit": "^1.3.4"
}
......@@ -9502,48 +9502,48 @@
}
},
"@satorijs/core": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/@satorijs/core/-/core-1.4.3.tgz",
"integrity": "sha512-L0VJVq3jlb8r4IaYlNBMfh4A3vskDMeQwl9Y5lgXBlShxsMzn2XcgtDKfa4WgNH4HzRFjS8iLkVBSo9jDW+3TA==",
"version": "1.4.11",
"resolved": "https://registry.npmjs.org/@satorijs/core/-/core-1.4.11.tgz",
"integrity": "sha512-8EsVA5esShEqYMwwXipGwx7obwVb3Lc0NwBmjZWNj2++WYKYg+jQ0Iatgd2jcJhNX2H9ziqnwu05aHtWo+mSsA==",
"peer": true,
"requires": {
"@satorijs/element": "^2.1.7",
"@satorijs/element": "^2.2.2",
"cordis": "^2.6.0",
"cordis-axios": "^2.1.5",
"cosmokit": "^1.3.3",
"reggol": "^1.3.2",
"schemastery": "^3.5.4",
"cordis-axios": "^2.1.6",
"cosmokit": "^1.3.6",
"reggol": "^1.3.3",
"schemastery": "^3.6.1",
"ws": "^8.11.0"
}
},
"@satorijs/element": {
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@satorijs/element/-/element-2.1.8.tgz",
"integrity": "sha512-a1/ClyPKJQdv07RgUANdOahULTiJE7H7TRaP6w6d+DB46rh9KAvZyhp3tDgMBKBm/3bOvfpieXWExgDdQVgsBA==",
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/@satorijs/element/-/element-2.2.2.tgz",
"integrity": "sha512-t6K0weO+GwqHhP/C9GTchck0jDk8c63kiAr9hHEVQX3nx/+fjGquTDGzBc4WzOVc105wePWRvV1UtvRaa0I9FQ==",
"peer": true,
"requires": {
"cosmokit": "^1.3.3"
"cosmokit": "^1.3.6"
}
},
"@satorijs/satori": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/@satorijs/satori/-/satori-1.4.3.tgz",
"integrity": "sha512-XgMolxa9/9gWf4+VKqLioBkzuZA0QXQIMWZHFET1dVvQjbxNhaETF0NBmwFSjbVBOWvTN8vecTGTSLc3pQn+Rw==",
"version": "1.4.11",
"resolved": "https://registry.npmjs.org/@satorijs/satori/-/satori-1.4.11.tgz",
"integrity": "sha512-nQHch/Ya1ClsNO9anJYfNnpiMFHCc1ihxdWuVKKpGOXRxuGMOtnbkB/Qa+NuBT+887E2NsFfTBoFgt8vuExxew==",
"peer": true,
"requires": {
"@koa/router": "^10.1.1",
"@satorijs/core": "1.4.3",
"@satorijs/core": "1.4.11",
"@types/koa": "*",
"@types/koa__router": "*",
"@types/ws": "^8.5.3",
"agent-base": "^6.0.2",
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.1",
"koa": "^2.13.4",
"koa": "^2.14.1",
"koa-bodyparser": "^4.3.0",
"parseurl": "^1.3.3",
"path-to-regexp": "^6.2.1",
"schemastery": "^3.5.4",
"schemastery": "^3.6.1",
"socks-proxy-agent": "^5.0.1",
"ws": "^8.11.0"
}
......@@ -10649,16 +10649,16 @@
}
},
"cordis-axios": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/cordis-axios/-/cordis-axios-2.1.5.tgz",
"integrity": "sha512-L5cHolNBlo4MxhfWRETpz1G20jF6J0Hu+5zPxebo0XJthqO0eI6U/2DrbQvXARnyMhuQIIZfoPJLvSNgd0Rjzw==",
"version": "2.1.6",
"resolved": "https://registry.npmjs.org/cordis-axios/-/cordis-axios-2.1.6.tgz",
"integrity": "sha512-GaJq5zoh4XRAFHEOyCLyU7kIcRrV7hqDVEh5kF4t047TmROAUaLukPKSMeMVMNohpKW4Vz+tj2FGEqMx5NuBQg==",
"peer": true,
"requires": {
"axios": "~1.1.3",
"cosmokit": "^1.3.3",
"cosmokit": "^1.3.4",
"file-type": "^16.5.4",
"mime-db": "^1.52.0",
"schemastery": "^3.5.4"
"schemastery": "^3.6.1"
}
},
"cordis-decorators": {
......@@ -10675,9 +10675,9 @@
}
},
"cosmokit": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.3.4.tgz",
"integrity": "sha512-E4G29C9xwvi1mcihAYz1R0NGbu8lYkxi/MRtnfG8qJ10OGJNhgdvgE3X7XgpMHEFkhEGT+YTnjUvQA53gI7Vog=="
"version": "1.3.6",
"resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.3.6.tgz",
"integrity": "sha512-buZvC7fuqBbSimJfkaaTJmlelpgj56L7VybjNkCy5UVvShMVQHi/bTZcuBfYLBwpuebSfvDZPwwHS5IfcoAnxg=="
},
"create-require": {
"version": "1.1.1",
......@@ -12899,9 +12899,9 @@
"dev": true
},
"koa": {
"version": "2.13.4",
"resolved": "https://registry.npmjs.org/koa/-/koa-2.13.4.tgz",
"integrity": "sha512-43zkIKubNbnrULWlHdN5h1g3SEKXOEzoAlRsHOTFpnlDu8JlAOZSMJBLULusuXRequboiwJcj5vtYXKB3k7+2g==",
"version": "2.14.1",
"resolved": "https://registry.npmjs.org/koa/-/koa-2.14.1.tgz",
"integrity": "sha512-USJFyZgi2l0wDgqkfD27gL4YGno7TfUkcmOe6UOLFOVuN+J7FwnNu4Dydl4CUQzraM1lBAiGed0M9OVJoT0Kqw==",
"peer": true,
"requires": {
"accepts": "^1.3.5",
......@@ -12964,22 +12964,22 @@
}
},
"koishi": {
"version": "4.10.4",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.10.4.tgz",
"integrity": "sha512-06ylHCmyyj8buQxPcnuSap7Yco6HtzC0o61AwBuBOikdILQj2WicexztohuLhQ/9ElA3pEOsJaHzDa/9Lh71Ng==",
"version": "4.10.10",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.10.10.tgz",
"integrity": "sha512-92VxR/7AL8l2eyd0MOWi5Nc/nLe2lX9ftglsMkqHvvImFkQma+2kSuexuxVLjcDmkAL6LWI27VxyuUH35jl5PQ==",
"peer": true,
"requires": {
"@koishijs/core": "^4.10.4",
"@koishijs/utils": "^6.2.6",
"@satorijs/satori": "^1.4.3",
"@koishijs/core": "^4.10.10",
"@koishijs/utils": "^6.3.4",
"@satorijs/satori": "^1.4.11",
"file-type": "^16.5.4",
"ns-require": "^1.1.4"
}
},
"koishi-thirdeye": {
"version": "11.1.14",
"resolved": "https://registry.npmjs.org/koishi-thirdeye/-/koishi-thirdeye-11.1.14.tgz",
"integrity": "sha512-poQZwMfkiurvDMdEhfa0TnhRhe/7VNismNDo6xcZAZVUfDl4Q8USCYEVwlmUvi6GSWl4X+4a51YL3VUZQX+GrA==",
"version": "11.1.17",
"resolved": "https://registry.npmjs.org/koishi-thirdeye/-/koishi-thirdeye-11.1.17.tgz",
"integrity": "sha512-Ij65qf1pLO1kQMrs2RNRVUdalmb2lL8tcxGVl79cDqW/V6ECjPgaSVIPuUT3uxI6FAaQHq9dXHMF54Iw05W8+Q==",
"requires": {
"minato-decorators": "^2.2.1",
"rxjs": "^7.5.6",
......@@ -13616,12 +13616,12 @@
"dev": true
},
"reggol": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/reggol/-/reggol-1.3.2.tgz",
"integrity": "sha512-vI+nWzdBJlO9OsrDCJ/z5NS4/o1mzHjwrZcn6LoESHn2get7LrbZ0TZB/dEkCtUlah324rxd5E2zciT/98Op1Q==",
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/reggol/-/reggol-1.3.3.tgz",
"integrity": "sha512-AmFo4aBBLwd1IosfkQ9cnWJF+RDXjrfmY2pFeRXSLlvi1UoqMYLsltR/514R8Dr/ZfAYdcD75V/vFDK60hgyOQ==",
"peer": true,
"requires": {
"cosmokit": "^1.3.3",
"cosmokit": "^1.3.6",
"object-inspect": "^1.12.2",
"supports-color": "^8.1.1"
},
......@@ -13755,12 +13755,12 @@
}
},
"schemastery": {
"version": "3.5.4",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.5.4.tgz",
"integrity": "sha512-YPr+tR4fFt/d1gH0AXQjlr+Luw5+3Hz75tWT8g8Iqt1wnNTys3+TB2wAaekrTKhgnWhQPCHwDfLF1KZHNTNquw==",
"version": "3.6.1",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.6.1.tgz",
"integrity": "sha512-Igh4oqaHco1AYmqpSgYgg411gNomSI9xE35Xo/FuzJZTMYWA5W1o+82Q5qMnt9FAQ76gZig0pea9OcHl0AM/Lw==",
"peer": true,
"requires": {
"cosmokit": "^1.2.1"
"cosmokit": "^1.3.4"
}
},
"schemastery-gen": {
......
......@@ -28,13 +28,13 @@
"homepage": "https://github.com/koishijs/koishi-plugin-pics",
"dependencies": {
"@koishijs/assets": "^1.0.1",
"koishi-thirdeye": "^11.1.14",
"koishi-thirdeye": "^11.1.17",
"lodash": "^4.17.21"
},
"devDependencies": {
"@koishijs/plugin-console": "^4.7.1",
"@koishijs/plugin-console": "^5.0.0",
"@koishijs/plugin-database-memory": "^2.0.1",
"@koishijs/plugin-sandbox": "^2.4.0",
"@koishijs/plugin-sandbox": "^2.5.0",
"@types/jest": "^29.2.0",
"@types/lodash": "^4.14.176",
"@types/node": "^16.11.4",
......@@ -57,7 +57,7 @@
"ws": "^8.3.0"
},
"peerDependencies": {
"koishi": "^4.10.4"
"koishi": "^4.10.10"
},
"jest": {
"moduleFileExtensions": [
......
// import 'source-map-support/register';
import { Context, Random, Logger, Bot, remove } from 'koishi';
import { Context, Random, Logger, Bot, remove, Session, Dict } from 'koishi';
import { PicsPluginConfig } from './config';
import _ from 'lodash';
import { segment, Quester } from 'koishi';
import { segment, Quester, Element } from 'koishi';
import {
StarterPlugin,
Caller,
......@@ -14,11 +14,11 @@ import {
LifecycleEvents,
Provide,
PutArgs,
PutBot,
PutOption,
PutRenderer,
Renderer,
UseCommand,
UseComponent,
} from 'koishi-thirdeye';
import { AxiosRequestConfig } from 'axios';
import { PicAssetsTransformMiddleware } from './middlewares/assets';
......@@ -322,4 +322,19 @@ export default class PicsContainer
this._http = this.http.extend(this.config.httpConfig);
this.installDefaultMiddlewares();
}
@UseComponent('pics')
async picsComponent(attrs: Dict<any>, children: Element[], session: Session) {
const tags = attrs.tags?.split(/[ ,+\uFF0C\uFF0B\u3001]/) || [];
const sourceTags = attrs.source?.split(/[ ,+\uFF0C\uFF0B\u3001]/) || [];
const result = await this.randomPic(tags, sourceTags);
if (!result) {
return attrs.fallback || '';
}
const segment = await this.getSegment(result.url);
if (result.description) {
segment.attrs.description = result.description;
}
return segment;
}
}
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