WIP no guest msg flagger
This commit is contained in:
parent
43e6ec24f5
commit
66a9947197
7 changed files with 85 additions and 7 deletions
|
|
@ -79,6 +79,7 @@ declare module 'fastify' {
|
|||
io: Server<{
|
||||
MsgObjectServer: (data: { message: ClientMessage }) => void;
|
||||
privMessage: (data: string) => void;
|
||||
guestmsg: (data: string) => void;
|
||||
profilMessage: (data: ClientProfil) => void;
|
||||
inviteGame: (data: ClientProfil) => void;
|
||||
blockUser: (data: ClientProfil) => void;
|
||||
|
|
@ -255,6 +256,24 @@ async function onReady(fastify: FastifyInstance) {
|
|||
}
|
||||
});
|
||||
|
||||
socket.on('guestmsg', (data) => {
|
||||
const clientName: string = clientChat.get(socket.id)?.user || '';
|
||||
const profile: ClientProfil = JSON.parse(data) || '';
|
||||
const users: User[] = fastify.db.getAllUsers() ?? [];
|
||||
const user: User | null = getUserByName(users, clientName);
|
||||
if (!user) return;
|
||||
if (clientName !== null) {
|
||||
|
||||
if (profile.guestmsg) {console.log('Data TRUE:', clientName);} else {console.log('Data FALSE'); };
|
||||
|
||||
|
||||
if(fastify.db.getGuestMessage(user?.id)) {console.log('TRUE')};
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
socket.on('profilMessage', async (data: string) => {
|
||||
const clientName: string = clientChat.get(socket.id)?.user || '';
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ export type ClientProfil = {
|
|||
SenderID: string,
|
||||
Sendertext: string,
|
||||
innerHtml?: string,
|
||||
guestmsg?: boolean,
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue