Commit 70f94e19 authored by nanahira's avatar nanahira

add PutGuild

parent b8712432
......@@ -35,7 +35,7 @@
"typescript": "^4.5.5"
},
"peerDependencies": {
"koishi": "^4.2.0"
"koishi": "^4.2.1"
}
},
"node_modules/@babel/code-frame": {
......@@ -998,14 +998,14 @@
}
},
"node_modules/@koishijs/core": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.2.0.tgz",
"integrity": "sha512-kL92JnrPTGb7kMcgGh1FmKfg1Hah22J4Fd1LKmD7JRs6Gum8SpdPMrBl+APd5qrwOQIykWdieAb9GuW1PmAIYA==",
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.2.1.tgz",
"integrity": "sha512-ZbFquhAP+IPzRp6qHmiMJdkhqR2ai90ROqRiZZijfDliwlsHwsavYx22b+H9eUthCYBbMBjjGjxtdzX5tdpWVg==",
"peer": true,
"dependencies": {
"@koishijs/utils": "^5.0.0",
"@koishijs/utils": "^5.0.1",
"fastest-levenshtein": "^1.0.12",
"schemastery": "^2.4.1"
"schemastery": "^2.4.2"
},
"engines": {
"node": ">=12.0.0"
......@@ -1055,9 +1055,9 @@
}
},
"node_modules/@koishijs/utils": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.0.0.tgz",
"integrity": "sha512-3ng7VkQZAP+EHdRLSbio5H36LDKRxy4OfooRKgol+gef2Yd0KOKYbVmGVud7/mZZExCPkaZVCwocKB/bKA4Xvw==",
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.0.1.tgz",
"integrity": "sha512-usWsR//YsvepI65+KN7ma2sxYF8Nlq5V88BbJS0X8l2+E/NEetSKYJqtwUX2TgtDW+tHxbje0IoHVccJMDRmyg==",
"peer": true,
"dependencies": {
"supports-color": "^8.1.0"
......@@ -4730,14 +4730,14 @@
}
},
"node_modules/koishi": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.2.0.tgz",
"integrity": "sha512-7HD4BQWsTwMs98LjWwntbT23YLxxA1NN9N1o7Oy4ZQp21xA3fqEL5BdcZbTgjji2SQW0L/kWsAW4B8Orel74zA==",
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.2.1.tgz",
"integrity": "sha512-E68YfIMUnL05gIX7KXsyj2IXSCu+QKyOaANbyHAy0t+FO0o7CepsFxRP4BHTtcX/KwoELLOu670KT5DMQvb2nw==",
"peer": true,
"dependencies": {
"@koa/router": "^10.1.1",
"@koishijs/core": "^4.2.0",
"@koishijs/utils": "^5.0.0",
"@koishijs/core": "^4.2.1",
"@koishijs/utils": "^5.0.1",
"@types/koa": "*",
"@types/koa__router": "*",
"@types/ws": "^8.2.2",
......@@ -7527,14 +7527,14 @@
}
},
"@koishijs/core": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.2.0.tgz",
"integrity": "sha512-kL92JnrPTGb7kMcgGh1FmKfg1Hah22J4Fd1LKmD7JRs6Gum8SpdPMrBl+APd5qrwOQIykWdieAb9GuW1PmAIYA==",
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.2.1.tgz",
"integrity": "sha512-ZbFquhAP+IPzRp6qHmiMJdkhqR2ai90ROqRiZZijfDliwlsHwsavYx22b+H9eUthCYBbMBjjGjxtdzX5tdpWVg==",
"peer": true,
"requires": {
"@koishijs/utils": "^5.0.0",
"@koishijs/utils": "^5.0.1",
"fastest-levenshtein": "^1.0.12",
"schemastery": "^2.4.1"
"schemastery": "^2.4.2"
}
},
"@koishijs/plugin-adapter-onebot": {
......@@ -7564,9 +7564,9 @@
"requires": {}
},
"@koishijs/utils": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.0.0.tgz",
"integrity": "sha512-3ng7VkQZAP+EHdRLSbio5H36LDKRxy4OfooRKgol+gef2Yd0KOKYbVmGVud7/mZZExCPkaZVCwocKB/bKA4Xvw==",
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.0.1.tgz",
"integrity": "sha512-usWsR//YsvepI65+KN7ma2sxYF8Nlq5V88BbJS0X8l2+E/NEetSKYJqtwUX2TgtDW+tHxbje0IoHVccJMDRmyg==",
"peer": true,
"requires": {
"supports-color": "^8.1.0"
......@@ -10392,14 +10392,14 @@
}
},
"koishi": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.2.0.tgz",
"integrity": "sha512-7HD4BQWsTwMs98LjWwntbT23YLxxA1NN9N1o7Oy4ZQp21xA3fqEL5BdcZbTgjji2SQW0L/kWsAW4B8Orel74zA==",
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.2.1.tgz",
"integrity": "sha512-E68YfIMUnL05gIX7KXsyj2IXSCu+QKyOaANbyHAy0t+FO0o7CepsFxRP4BHTtcX/KwoELLOu670KT5DMQvb2nw==",
"peer": true,
"requires": {
"@koa/router": "^10.1.1",
"@koishijs/core": "^4.2.0",
"@koishijs/utils": "^5.0.0",
"@koishijs/core": "^4.2.1",
"@koishijs/utils": "^5.0.1",
"@types/koa": "*",
"@types/koa__router": "*",
"@types/ws": "^8.2.2",
......
......@@ -65,6 +65,6 @@
"typed-reflector": "^1.0.9"
},
"peerDependencies": {
"koishi": "^4.2.0"
"koishi": "^4.2.1"
}
}
......@@ -171,6 +171,9 @@ export const PutUser = (field: FieldCollector<'user'>) =>
export const PutChannel = (field: FieldCollector<'channel'>) =>
CommandPut.decorate('channel', field);
export const PutGuild = (field: FieldCollector<'channel'>) =>
CommandPut.decorate('guild', field);
export const PutUserName = (useDatabase = true) =>
CommandPut.decorate('username', useDatabase);
......
......@@ -17,6 +17,7 @@ export namespace CommandPut {
option: CommandOptionConfig;
user: FieldCollector<'user'>;
channel: FieldCollector<'channel'>;
guild: FieldCollector<'channel'>;
username: boolean;
sessionField: keyof Session;
}
......@@ -57,6 +58,7 @@ export namespace CommandPut {
registry.extend('option', (data, argv, args) => argv.options[data.name]);
registry.extend('user', (data, argv, args) => argv.session.user);
registry.extend('channel', (data, argv, args) => argv.session.channel);
registry.extend('guild', (data, argv, args) => argv.session.guild);
registry.extend('username', (useDatabase, argv, args) => {
if (useDatabase) {
const user = argv.session.user as User.Observed<'name'>;
......
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