feat: kick_player can target a publicId (admin bot) (#4403)

## Description:

Add an optional `targetPublicId` to KickPlayerIntent; the server
resolves it against the connected clients to the live clientID, then
kicks as before. Existing clientID targeting (lobby / in-game kick) is
unchanged. That way you can kick player with both the clientID and
playerID

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory

## Please put your Discord username so you can be contacted if a bug or
regression is found:

zixer._
This commit is contained in:
Zixer1
2026-06-24 14:34:17 -07:00
committed by GitHub
parent 82efcecb80
commit 8ce5f3439c
5 changed files with 49 additions and 8 deletions
+27 -2
View File
@@ -115,7 +115,7 @@ describe("GameServer.handleIntent (admin bot)", () => {
const spy = vi.spyOn(game, "kickClient");
const result = apply(game, {
type: "kick_player",
target: "abcdABCD",
targetClientID: "abcdABCD",
} as any);
expect(result.status).toBe(200);
expect(spy).toHaveBeenCalledWith("abcdABCD", expect.any(String));
@@ -126,10 +126,35 @@ describe("GameServer.handleIntent (admin bot)", () => {
expect(
apply(game, {
type: "kick_player",
target: "abcdABCD",
targetClientID: "abcdABCD",
} as any).status,
).toBe(403);
});
it("resolves a publicID target to the connected client's clientID", () => {
const game = makeGame();
(game as any).activeClients.push({
clientID: "liveCID1",
publicId: "pubABCD1",
});
const spy = vi.spyOn(game, "kickClient");
const result = apply(game, {
type: "kick_player",
targetPublicID: "pubABCD1",
} as any);
expect(result.status).toBe(200);
expect(spy).toHaveBeenCalledWith("liveCID1", expect.any(String));
});
it("404s when no connected client matches the publicID", () => {
const game = makeGame();
expect(
apply(game, {
type: "kick_player",
targetPublicID: "nobodyXX",
} as any).status,
).toBe(404);
});
});
describe("toggle_pause", () => {