Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gateway): use user in question as join/leave author #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ wss.on("connection", function connection(ws: ChatClient, req) {
sendMessage({
type: MessageTypes.Leave,
userInfo: {
username: "System",
roles: Role.System,
id: "1"
username: ws.username,
roles: Role.System | ws.roles,
id: ws.id,
},
content: `${ws.username} has left the chat.\nCurrently ${wss.clients.size} user${
wss.clients.size === 1 ? " is" : "s are"
Expand Down
16 changes: 8 additions & 8 deletions src/opcodes/accountInitialisation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ export async function accountInitialisation(client: ChatClient, d: any) {
);
sendMessage({
type: 1,
userInfo: {
username: "System",
roles: Role.System,
id: "1"
},
userInfo: {
username: client.username!,
roles: Role.System | client.roles!,
id: client.id!,
},
content: `${client.username} *(guest)* has joined the chat. Say hi!\nCurrently ${
wss.clients.size
} user${wss.clients.size === 1 ? " is" : "s are"} online.`,
Expand Down Expand Up @@ -132,9 +132,9 @@ export async function accountInitialisation(client: ChatClient, d: any) {
sendMessage({
type: MessageTypes.Join,
userInfo: {
username: "System",
roles: Role.System,
id: "1"
username: client.username!,
roles: Role.System | client.roles!,
id: client.id!,
},
content: `${client.username} has joined the chat. Say hi!\nCurrently ${
wss.clients.size
Expand Down