From 7771251f4f959267825200715fe7127ecf9b24da Mon Sep 17 00:00:00 2001 From: Elijah R Date: Fri, 12 Jul 2024 02:07:25 -0400 Subject: [PATCH] add admin to init message --- protocol/src/protocol.ts | 3 ++- server/src/room.ts | 3 ++- webapp/src/ts/client.ts | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/protocol/src/protocol.ts b/protocol/src/protocol.ts index a2e5d9a..44f0264 100644 --- a/protocol/src/protocol.ts +++ b/protocol/src/protocol.ts @@ -45,7 +45,8 @@ export interface MSAgentInitMessage extends MSAgentProtocolMessage { charlimit: number users: { username: string, - agent: string + agent: string, + admin: boolean }[] } } diff --git a/server/src/room.ts b/server/src/room.ts index 2885e03..48204f6 100644 --- a/server/src/room.ts +++ b/server/src/room.ts @@ -46,7 +46,8 @@ export class MSAgentChatRoom { users: this.clients.filter(c => c.username !== null).map(c => { return { username: c.username!, - agent: c.agent! + agent: c.agent!, + admin: c.admin } }) } diff --git a/webapp/src/ts/client.ts b/webapp/src/ts/client.ts index fb855e5..e701bae 100644 --- a/webapp/src/ts/client.ts +++ b/webapp/src/ts/client.ts @@ -225,7 +225,7 @@ export class MSAgentClient { this.charlimit = initMsg.data.charlimit; for (let _user of initMsg.data.users) { let agent = await agentCreateCharacterFromUrl(this.url + '/api/agents/' + _user.agent); - agent.setUsername(_user.username, "#000000"); + agent.setUsername(_user.username, _user.admin ? "#FF0000" : "#000000"); agent.addToDom(this.agentContainer); agent.show(); let user = new User(_user.username, agent);