add admin to init message

This commit is contained in:
Elijah R 2024-07-12 02:07:25 -04:00
parent 3525fdcff4
commit 7771251f4f
3 changed files with 5 additions and 3 deletions

View file

@ -45,7 +45,8 @@ export interface MSAgentInitMessage extends MSAgentProtocolMessage {
charlimit: number
users: {
username: string,
agent: string
agent: string,
admin: boolean
}[]
}
}

View file

@ -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
}
})
}

View file

@ -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);