@zhin.js/plugin-game-hub 1.1.18 → 1.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
2
|
import { createMessages } from 'zhin.js/i18n';
|
|
3
3
|
import { defineCommand } from 'zhin.js/command';
|
|
4
|
-
import { channelKey, gameFeatureId,
|
|
4
|
+
import { channelKey, gameFeatureId, gamePlayerFromInput, } from '@zhin.js/game-kit';
|
|
5
5
|
function formatStats(index, stats, locale, menu) {
|
|
6
6
|
if (!stats.length)
|
|
7
7
|
return messages(locale, 'empty') + (menu ? messages(locale, 'menu', { command: menu }) : '');
|
|
@@ -18,8 +18,8 @@ export default defineCommand({
|
|
|
18
18
|
description: '查看本人在本群的游戏战绩', descriptionI18n: { en: "View your game statistics in this group" },
|
|
19
19
|
async execute({ input, project, locale, formatCommand }) {
|
|
20
20
|
const index = project(gameFeatureId);
|
|
21
|
-
const message =
|
|
22
|
-
const stats = await index.getUserStats(message
|
|
21
|
+
const message = gamePlayerFromInput(input, { locale, formatCommand });
|
|
22
|
+
const stats = await index.getUserStats(message.sender.id, channelKey(message));
|
|
23
23
|
return formatStats(index, stats, locale, formatCommand?.('games'));
|
|
24
24
|
},
|
|
25
25
|
});
|
|
@@ -3,7 +3,7 @@ import { defineCommand } from 'zhin.js/command';
|
|
|
3
3
|
import {
|
|
4
4
|
channelKey,
|
|
5
5
|
gameFeatureId,
|
|
6
|
-
|
|
6
|
+
gamePlayerFromInput,
|
|
7
7
|
type GameIndex,
|
|
8
8
|
type UserGameStats,
|
|
9
9
|
} from '@zhin.js/game-kit';
|
|
@@ -24,8 +24,8 @@ export default defineCommand({
|
|
|
24
24
|
description: '查看本人在本群的游戏战绩', descriptionI18n: { en: "View your game statistics in this group" },
|
|
25
25
|
async execute({ input, project, locale, formatCommand }) {
|
|
26
26
|
const index = project<GameIndex>(gameFeatureId);
|
|
27
|
-
const message =
|
|
28
|
-
const stats = await index.getUserStats(message
|
|
27
|
+
const message = gamePlayerFromInput(input, { locale, formatCommand });
|
|
28
|
+
const stats = await index.getUserStats(message.sender.id, channelKey(message));
|
|
29
29
|
return formatStats(index, stats, locale, formatCommand?.('games'));
|
|
30
30
|
},
|
|
31
31
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
2
|
import { createMessages } from 'zhin.js/i18n';
|
|
3
3
|
import { defineCommand } from 'zhin.js/command';
|
|
4
|
-
import { channelKey, gameFeatureId,
|
|
4
|
+
import { channelKey, gameFeatureId, gamePlayerFromInput, } from '@zhin.js/game-kit';
|
|
5
5
|
function formatLeaderboard(index, gameId, entries, locale, menu) {
|
|
6
6
|
const g = index.get(gameId);
|
|
7
7
|
const title = g ? `${g.icon} ${g.titleI18n?.[locale] ?? g.title}` : gameId;
|
|
@@ -37,7 +37,7 @@ export default defineCommand({
|
|
|
37
37
|
}
|
|
38
38
|
gameId = hit.id;
|
|
39
39
|
}
|
|
40
|
-
const message =
|
|
40
|
+
const message = gamePlayerFromInput(input, { locale, formatCommand });
|
|
41
41
|
const board = await index.getLeaderboard(gameId, channelKey(message));
|
|
42
42
|
return formatLeaderboard(index, gameId, board, locale, formatCommand?.('games'));
|
|
43
43
|
},
|
|
@@ -3,7 +3,7 @@ import { defineCommand } from 'zhin.js/command';
|
|
|
3
3
|
import {
|
|
4
4
|
channelKey,
|
|
5
5
|
gameFeatureId,
|
|
6
|
-
|
|
6
|
+
gamePlayerFromInput,
|
|
7
7
|
type LeaderboardEntry,
|
|
8
8
|
type GameIndex,
|
|
9
9
|
} from '@zhin.js/game-kit';
|
|
@@ -46,7 +46,7 @@ export default defineCommand({
|
|
|
46
46
|
}
|
|
47
47
|
gameId = hit.id;
|
|
48
48
|
}
|
|
49
|
-
const message =
|
|
49
|
+
const message = gamePlayerFromInput(input, { locale, formatCommand });
|
|
50
50
|
const board = await index.getLeaderboard(gameId, channelKey(message));
|
|
51
51
|
return formatLeaderboard(index, gameId, board, locale, formatCommand?.('games'));
|
|
52
52
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/plugin-game-hub",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.20",
|
|
4
4
|
"description": "Zhin.js 游戏大厅 — 列出已加载的游戏插件 (Plugin Runtime)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
],
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@zhin.js/game-kit": "1.1.
|
|
25
|
+
"@zhin.js/game-kit": "1.1.20"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"typescript": "^6.0.3",
|
|
29
29
|
"vitest": "^4.1.10",
|
|
30
|
-
"zhin.js": "1.1.
|
|
30
|
+
"zhin.js": "1.1.20"
|
|
31
31
|
},
|
|
32
32
|
"repository": {
|
|
33
33
|
"type": "git",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"plugins": []
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@zhin.js/command": "^1.1.
|
|
64
|
-
"zhin.js": "^1.1.
|
|
63
|
+
"@zhin.js/command": "^1.1.13",
|
|
64
|
+
"zhin.js": "^1.1.20"
|
|
65
65
|
},
|
|
66
66
|
"peerDependenciesMeta": {
|
|
67
67
|
"@zhin.js/command": {
|