Add private chat to multiplayer rooms
This commit is contained in:
@@ -9,6 +9,28 @@ export const createRoomSchema = z.object({
|
||||
playerLimit: z.number().int().min(2).max(16),
|
||||
});
|
||||
export const joinRoomSchema = z.object({ displayName: displayNameSchema });
|
||||
export const chatMessageSchema = z.object({
|
||||
clientId: z.string().uuid(),
|
||||
text: z
|
||||
.string()
|
||||
.trim()
|
||||
.min(1)
|
||||
.max(500)
|
||||
.refine(
|
||||
(text) =>
|
||||
!/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/u.test(text),
|
||||
"Messages cannot contain hidden controls",
|
||||
),
|
||||
});
|
||||
export type RoomChat = {
|
||||
messages: {
|
||||
id: string;
|
||||
playerId: string;
|
||||
name: string;
|
||||
text: string;
|
||||
createdAt: string;
|
||||
}[];
|
||||
};
|
||||
export const roomRoundSchema = z.object({
|
||||
round: z.number().int().min(0).max(4),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user