Home
/
risinglegends.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6cd0480
)
test functionality for server broadcast
author
xangelo
<git@xangelo.ca>
Fri, 2 Jun 2023 10:03:13 +0000
(06:03 -0400)
committer
xangelo
<git@xangelo.ca>
Fri, 2 Jun 2023 10:03:13 +0000
(06:03 -0400)
src/server/api.ts
patch
|
blob
|
history
diff --git
a/src/server/api.ts
b/src/server/api.ts
index 85ba258baec428e18919ec38dbb6f56bea3db8ce..0e4d905b8848a26477320f50e3ea1fcf4678ca16 100644
(file)
--- a/
src/server/api.ts
+++ b/
src/server/api.ts
@@
-99,7
+99,15
@@
io.on('connection', async socket => {
socket.on('chat', (msg: string) => {
if(msg.length > 0) {
- const message = broadcastMessage(player.username, msg);
+
+ let message;
+ if(msg.startsWith('/server lmnop')) {
+ message = broadcastMessage('server', msg.split('/server lmnop ')[1]);
+ }
+ else {
+ message = broadcastMessage(player.username, msg);
+ }
+
chatHistory.push(message);
chatHistory.slice(-10);
io.emit('chat', message);