fix: Prevent users from sending blank messages
This commit is contained in:
parent
3dc59bf4f1
commit
92cf5a8af2
@ -15,7 +15,9 @@ export function startupSocketIOServer(httpServer: HttpServer | null) {
|
|||||||
console.log(`[ws:kit] client connected (${socket.id})`);
|
console.log(`[ws:kit] client connected (${socket.id})`);
|
||||||
// Runs on message receive
|
// Runs on message receive
|
||||||
socket.on('message', async (msg) => {
|
socket.on('message', async (msg) => {
|
||||||
console.log(`[ws:kit] message from ${socket.id}: ${msg}`);
|
// If message not empty
|
||||||
|
if (msg.content !== "") {
|
||||||
|
console.log(`[ws:kit] message from ${socket.id}: ${msg.content}`);
|
||||||
// Store the message in the database
|
// Store the message in the database
|
||||||
await createChannel(client, '000');
|
await createChannel(client, '000');
|
||||||
await storeMessage(client, '000', msg.content, msg.id, uuidv4());
|
await storeMessage(client, '000', msg.content, msg.id, uuidv4());
|
||||||
@ -24,6 +26,7 @@ export function startupSocketIOServer(httpServer: HttpServer | null) {
|
|||||||
message: msg.content,
|
message: msg.content,
|
||||||
imageSrc: 'https://www.arithefirst.com/images/pfp.png',
|
imageSrc: 'https://www.arithefirst.com/images/pfp.png',
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Runs on client disconnect
|
// Runs on client disconnect
|
||||||
|
Loading…
Reference in New Issue
Block a user