Commit 441dbc7f authored by nanahira's avatar nanahira

bump and fix selfId conflict

parent 32317064
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
"ws": "^8.11.0" "ws": "^8.11.0"
}, },
"peerDependencies": { "peerDependencies": {
"koishi": "^4.10.6", "koishi": "^4.10.10",
"koishi-plugin-cache-aragami": "^2.5.0" "koishi-plugin-cache-aragami": "^2.5.0"
} }
}, },
...@@ -1096,14 +1096,14 @@ ...@@ -1096,14 +1096,14 @@
} }
}, },
"node_modules/@koishijs/core": { "node_modules/@koishijs/core": {
"version": "4.10.6", "version": "4.10.10",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.10.6.tgz", "resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.10.10.tgz",
"integrity": "sha512-5rOr40u41SZzCvQObqGf2DANakFWWRvDditZG+0Z1/zczX6o+UJy9TXZUHEpTMfvMMEG7+DNECPZz8F6X8drLw==", "integrity": "sha512-LooBZCQSm91TL7aBBECjaFaROn+udCAavOwi+AWzbFPBfcuF4ZHFGpQ112yWK70xbQ7YhHUueueqJpkAGOy4RA==",
"peer": true, "peer": true,
"dependencies": { "dependencies": {
"@koishijs/utils": "^6.3.4", "@koishijs/utils": "^6.3.4",
"@minatojs/core": "^2.0.3", "@minatojs/core": "^2.0.3",
"@satorijs/core": "^1.4.10", "@satorijs/core": "^1.4.11",
"cordis": "^2.6.0", "cordis": "^2.6.0",
"cosmokit": "^1.3.6", "cosmokit": "^1.3.6",
"fastest-levenshtein": "^1.0.16" "fastest-levenshtein": "^1.0.16"
...@@ -1186,12 +1186,12 @@ ...@@ -1186,12 +1186,12 @@
} }
}, },
"node_modules/@satorijs/core": { "node_modules/@satorijs/core": {
"version": "1.4.10", "version": "1.4.11",
"resolved": "https://registry.npmjs.org/@satorijs/core/-/core-1.4.10.tgz", "resolved": "https://registry.npmjs.org/@satorijs/core/-/core-1.4.11.tgz",
"integrity": "sha512-eTHYuoW6KAh6Fko874b9/50hq+CGD2FMFTT2K2htNdMFhKdGYkum3vpqmudPlThCefH4608rR5jU1vsebsKTrQ==", "integrity": "sha512-8EsVA5esShEqYMwwXipGwx7obwVb3Lc0NwBmjZWNj2++WYKYg+jQ0Iatgd2jcJhNX2H9ziqnwu05aHtWo+mSsA==",
"peer": true, "peer": true,
"dependencies": { "dependencies": {
"@satorijs/element": "^2.2.1", "@satorijs/element": "^2.2.2",
"cordis": "^2.6.0", "cordis": "^2.6.0",
"cordis-axios": "^2.1.6", "cordis-axios": "^2.1.6",
"cosmokit": "^1.3.6", "cosmokit": "^1.3.6",
...@@ -1201,29 +1201,29 @@ ...@@ -1201,29 +1201,29 @@
} }
}, },
"node_modules/@satorijs/element": { "node_modules/@satorijs/element": {
"version": "2.2.1", "version": "2.2.2",
"resolved": "https://registry.npmjs.org/@satorijs/element/-/element-2.2.1.tgz", "resolved": "https://registry.npmjs.org/@satorijs/element/-/element-2.2.2.tgz",
"integrity": "sha512-4oINBNinlxUQL+lsGKkGYgITNSGRfDeUUmE2lzHYbg/WSVg2eK11pNHtwGbud0KxnmNG687NxyF9czgd7t/4hg==", "integrity": "sha512-t6K0weO+GwqHhP/C9GTchck0jDk8c63kiAr9hHEVQX3nx/+fjGquTDGzBc4WzOVc105wePWRvV1UtvRaa0I9FQ==",
"peer": true, "peer": true,
"dependencies": { "dependencies": {
"cosmokit": "^1.3.6" "cosmokit": "^1.3.6"
} }
}, },
"node_modules/@satorijs/satori": { "node_modules/@satorijs/satori": {
"version": "1.4.10", "version": "1.4.11",
"resolved": "https://registry.npmjs.org/@satorijs/satori/-/satori-1.4.10.tgz", "resolved": "https://registry.npmjs.org/@satorijs/satori/-/satori-1.4.11.tgz",
"integrity": "sha512-6rT02tmMyv/Tw0o9xaCH+uW8c947LcvLI2pDD/RG01X+hyh8OfGbeAK59GtKcIY9lnA3Rma7jCIB7dkMjPpt0w==", "integrity": "sha512-nQHch/Ya1ClsNO9anJYfNnpiMFHCc1ihxdWuVKKpGOXRxuGMOtnbkB/Qa+NuBT+887E2NsFfTBoFgt8vuExxew==",
"peer": true, "peer": true,
"dependencies": { "dependencies": {
"@koa/router": "^10.1.1", "@koa/router": "^10.1.1",
"@satorijs/core": "1.4.10", "@satorijs/core": "1.4.11",
"@types/koa": "*", "@types/koa": "*",
"@types/koa__router": "*", "@types/koa__router": "*",
"@types/ws": "^8.5.3", "@types/ws": "^8.5.3",
"agent-base": "^6.0.2", "agent-base": "^6.0.2",
"http-proxy-agent": "^5.0.0", "http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.1", "https-proxy-agent": "^5.0.1",
"koa": "^2.13.4", "koa": "^2.14.1",
"koa-bodyparser": "^4.3.0", "koa-bodyparser": "^4.3.0",
"parseurl": "^1.3.3", "parseurl": "^1.3.3",
"path-to-regexp": "^6.2.1", "path-to-regexp": "^6.2.1",
...@@ -5794,14 +5794,14 @@ ...@@ -5794,14 +5794,14 @@
} }
}, },
"node_modules/koishi": { "node_modules/koishi": {
"version": "4.10.6", "version": "4.10.10",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.10.6.tgz", "resolved": "https://registry.npmjs.org/koishi/-/koishi-4.10.10.tgz",
"integrity": "sha512-s/VDoMKihMsjodSU9Vhs1Kkk3psQ6/sNx7MNuxAFo5KsXIJOgAQnJ+5TZxiqyGgxNT7NVNB4RHdQVDkYydbG1Q==", "integrity": "sha512-92VxR/7AL8l2eyd0MOWi5Nc/nLe2lX9ftglsMkqHvvImFkQma+2kSuexuxVLjcDmkAL6LWI27VxyuUH35jl5PQ==",
"peer": true, "peer": true,
"dependencies": { "dependencies": {
"@koishijs/core": "^4.10.6", "@koishijs/core": "^4.10.10",
"@koishijs/utils": "^6.3.4", "@koishijs/utils": "^6.3.4",
"@satorijs/satori": "^1.4.10", "@satorijs/satori": "^1.4.11",
"file-type": "^16.5.4", "file-type": "^16.5.4",
"ns-require": "^1.1.4" "ns-require": "^1.1.4"
}, },
...@@ -8984,14 +8984,14 @@ ...@@ -8984,14 +8984,14 @@
} }
}, },
"@koishijs/core": { "@koishijs/core": {
"version": "4.10.6", "version": "4.10.10",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.10.6.tgz", "resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.10.10.tgz",
"integrity": "sha512-5rOr40u41SZzCvQObqGf2DANakFWWRvDditZG+0Z1/zczX6o+UJy9TXZUHEpTMfvMMEG7+DNECPZz8F6X8drLw==", "integrity": "sha512-LooBZCQSm91TL7aBBECjaFaROn+udCAavOwi+AWzbFPBfcuF4ZHFGpQ112yWK70xbQ7YhHUueueqJpkAGOy4RA==",
"peer": true, "peer": true,
"requires": { "requires": {
"@koishijs/utils": "^6.3.4", "@koishijs/utils": "^6.3.4",
"@minatojs/core": "^2.0.3", "@minatojs/core": "^2.0.3",
"@satorijs/core": "^1.4.10", "@satorijs/core": "^1.4.11",
"cordis": "^2.6.0", "cordis": "^2.6.0",
"cosmokit": "^1.3.6", "cosmokit": "^1.3.6",
"fastest-levenshtein": "^1.0.16" "fastest-levenshtein": "^1.0.16"
...@@ -9060,12 +9060,12 @@ ...@@ -9060,12 +9060,12 @@
} }
}, },
"@satorijs/core": { "@satorijs/core": {
"version": "1.4.10", "version": "1.4.11",
"resolved": "https://registry.npmjs.org/@satorijs/core/-/core-1.4.10.tgz", "resolved": "https://registry.npmjs.org/@satorijs/core/-/core-1.4.11.tgz",
"integrity": "sha512-eTHYuoW6KAh6Fko874b9/50hq+CGD2FMFTT2K2htNdMFhKdGYkum3vpqmudPlThCefH4608rR5jU1vsebsKTrQ==", "integrity": "sha512-8EsVA5esShEqYMwwXipGwx7obwVb3Lc0NwBmjZWNj2++WYKYg+jQ0Iatgd2jcJhNX2H9ziqnwu05aHtWo+mSsA==",
"peer": true, "peer": true,
"requires": { "requires": {
"@satorijs/element": "^2.2.1", "@satorijs/element": "^2.2.2",
"cordis": "^2.6.0", "cordis": "^2.6.0",
"cordis-axios": "^2.1.6", "cordis-axios": "^2.1.6",
"cosmokit": "^1.3.6", "cosmokit": "^1.3.6",
...@@ -9075,29 +9075,29 @@ ...@@ -9075,29 +9075,29 @@
} }
}, },
"@satorijs/element": { "@satorijs/element": {
"version": "2.2.1", "version": "2.2.2",
"resolved": "https://registry.npmjs.org/@satorijs/element/-/element-2.2.1.tgz", "resolved": "https://registry.npmjs.org/@satorijs/element/-/element-2.2.2.tgz",
"integrity": "sha512-4oINBNinlxUQL+lsGKkGYgITNSGRfDeUUmE2lzHYbg/WSVg2eK11pNHtwGbud0KxnmNG687NxyF9czgd7t/4hg==", "integrity": "sha512-t6K0weO+GwqHhP/C9GTchck0jDk8c63kiAr9hHEVQX3nx/+fjGquTDGzBc4WzOVc105wePWRvV1UtvRaa0I9FQ==",
"peer": true, "peer": true,
"requires": { "requires": {
"cosmokit": "^1.3.6" "cosmokit": "^1.3.6"
} }
}, },
"@satorijs/satori": { "@satorijs/satori": {
"version": "1.4.10", "version": "1.4.11",
"resolved": "https://registry.npmjs.org/@satorijs/satori/-/satori-1.4.10.tgz", "resolved": "https://registry.npmjs.org/@satorijs/satori/-/satori-1.4.11.tgz",
"integrity": "sha512-6rT02tmMyv/Tw0o9xaCH+uW8c947LcvLI2pDD/RG01X+hyh8OfGbeAK59GtKcIY9lnA3Rma7jCIB7dkMjPpt0w==", "integrity": "sha512-nQHch/Ya1ClsNO9anJYfNnpiMFHCc1ihxdWuVKKpGOXRxuGMOtnbkB/Qa+NuBT+887E2NsFfTBoFgt8vuExxew==",
"peer": true, "peer": true,
"requires": { "requires": {
"@koa/router": "^10.1.1", "@koa/router": "^10.1.1",
"@satorijs/core": "1.4.10", "@satorijs/core": "1.4.11",
"@types/koa": "*", "@types/koa": "*",
"@types/koa__router": "*", "@types/koa__router": "*",
"@types/ws": "^8.5.3", "@types/ws": "^8.5.3",
"agent-base": "^6.0.2", "agent-base": "^6.0.2",
"http-proxy-agent": "^5.0.0", "http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.1", "https-proxy-agent": "^5.0.1",
"koa": "^2.13.4", "koa": "^2.14.1",
"koa-bodyparser": "^4.3.0", "koa-bodyparser": "^4.3.0",
"parseurl": "^1.3.3", "parseurl": "^1.3.3",
"path-to-regexp": "^6.2.1", "path-to-regexp": "^6.2.1",
...@@ -12525,14 +12525,14 @@ ...@@ -12525,14 +12525,14 @@
} }
}, },
"koishi": { "koishi": {
"version": "4.10.6", "version": "4.10.10",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.10.6.tgz", "resolved": "https://registry.npmjs.org/koishi/-/koishi-4.10.10.tgz",
"integrity": "sha512-s/VDoMKihMsjodSU9Vhs1Kkk3psQ6/sNx7MNuxAFo5KsXIJOgAQnJ+5TZxiqyGgxNT7NVNB4RHdQVDkYydbG1Q==", "integrity": "sha512-92VxR/7AL8l2eyd0MOWi5Nc/nLe2lX9ftglsMkqHvvImFkQma+2kSuexuxVLjcDmkAL6LWI27VxyuUH35jl5PQ==",
"peer": true, "peer": true,
"requires": { "requires": {
"@koishijs/core": "^4.10.6", "@koishijs/core": "^4.10.10",
"@koishijs/utils": "^6.3.4", "@koishijs/utils": "^6.3.4",
"@satorijs/satori": "^1.4.10", "@satorijs/satori": "^1.4.11",
"file-type": "^16.5.4", "file-type": "^16.5.4",
"ns-require": "^1.1.4" "ns-require": "^1.1.4"
} }
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
"testEnvironment": "node" "testEnvironment": "node"
}, },
"peerDependencies": { "peerDependencies": {
"koishi": "^4.10.6", "koishi": "^4.10.10",
"koishi-plugin-cache-aragami": "^2.5.0" "koishi-plugin-cache-aragami": "^2.5.0"
}, },
"devDependencies": { "devDependencies": {
......
...@@ -95,7 +95,7 @@ export class WeComBotConfig { ...@@ -95,7 +95,7 @@ export class WeComBotConfig {
platform = 'wecom'; platform = 'wecom';
get selfId() { get selfId() {
return this.agentId; return `${this.corpId}:${this.agentId}`;
} }
} }
...@@ -183,7 +183,7 @@ export default class WeComBot extends Bot<Partial<WeComBotConfig>> { ...@@ -183,7 +183,7 @@ export default class WeComBot extends Bot<Partial<WeComBotConfig>> {
const tokenObject = new WeComToken(); const tokenObject = new WeComToken();
tokenObject.token = data.access_token; tokenObject.token = data.access_token;
tokenObject.agentId = this.selfId; tokenObject.selfId = this.selfId;
await this.aragami.set(tokenObject, { ttl: data.expires_in * 1000 }); await this.aragami.set(tokenObject, { ttl: data.expires_in * 1000 });
return data.access_token; return data.access_token;
} catch (e) { } catch (e) {
...@@ -253,14 +253,14 @@ export default class WeComBot extends Bot<Partial<WeComBotConfig>> { ...@@ -253,14 +253,14 @@ export default class WeComBot extends Bot<Partial<WeComBotConfig>> {
return; return;
} }
const agent = data.agentlist.find( const agent = data.agentlist.find(
(a) => a.agentid.toString() === this.selfId, (a) => a.agentid.toString() === this.config.agentId,
); );
if (!agent) { if (!agent) {
// special things // special things
return { userId: this.selfId }; return { userId: this.config.selfId };
} }
const self: Universal.User = { const self: Universal.User = {
userId: agent.agentid.toString(), userId: this.config.selfId,
username: agent.name, username: agent.name,
avatar: agent.square_logo_url, avatar: agent.square_logo_url,
}; };
......
...@@ -26,7 +26,7 @@ export class WeComMessenger extends Messenger<WeComBot> { ...@@ -26,7 +26,7 @@ export class WeComMessenger extends Messenger<WeComBot> {
return undefined; return undefined;
} }
const payload = { const payload = {
agentid: this.bot.selfId, agentid: this.bot.config.agentId,
touser: this.channelId, touser: this.channelId,
...messageInfo, ...messageInfo,
}; };
......
...@@ -151,7 +151,7 @@ export function dispatchSession(bot: WeComBot, message: WecomEventResponse) { ...@@ -151,7 +151,7 @@ export function dispatchSession(bot: WeComBot, message: WecomEventResponse) {
export class WeComToken { export class WeComToken {
@CacheKey() @CacheKey()
agentId: string; selfId: string;
token: string; token: string;
} }
......
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