Compare commits
No commits in common. "cdec8b72a96fbd8f9353c619a6755feca86e70a5" and "bc434bfaed3250b0af7a7757d000d84d2aed0b45" have entirely different histories.
cdec8b72a9
...
bc434bfaed
2 changed files with 2 additions and 50 deletions
|
@ -184,16 +184,6 @@ const setupChatboxEvents = (socket) => {
|
||||||
);
|
);
|
||||||
handled = true;
|
handled = true;
|
||||||
break;
|
break;
|
||||||
case "/votekiss":
|
|
||||||
printChatMessage(
|
|
||||||
"vote-kiss",
|
|
||||||
"/votekiss",
|
|
||||||
"b57fdc",
|
|
||||||
document.createTextNode("you voted to kiss " + args)
|
|
||||||
);
|
|
||||||
handled = false;
|
|
||||||
// we also handle this on receive
|
|
||||||
break;
|
|
||||||
case "/help":
|
case "/help":
|
||||||
const helpMessageContent = document.createElement("span");
|
const helpMessageContent = document.createElement("span");
|
||||||
helpMessageContent.innerHTML =
|
helpMessageContent.innerHTML =
|
||||||
|
@ -201,8 +191,7 @@ const setupChatboxEvents = (socket) => {
|
||||||
" <code>/help</code> - display this help message<br>" +
|
" <code>/help</code> - display this help message<br>" +
|
||||||
" <code>/ping [message]</code> - ping all viewers<br>" +
|
" <code>/ping [message]</code> - ping all viewers<br>" +
|
||||||
" <code>/sync</code> - resyncs you with other viewers<br>" +
|
" <code>/sync</code> - resyncs you with other viewers<br>" +
|
||||||
" <code>/shrug</code> - appends ¯\\_(ツ)_/¯ to your message" +
|
" <code>/shrug</code> - appends ¯\\_(ツ)_/¯ to your message";
|
||||||
" <code>/votekiss</code> - like votekick but gay";
|
|
||||||
|
|
||||||
printChatMessage(
|
printChatMessage(
|
||||||
"command-message",
|
"command-message",
|
||||||
|
@ -338,32 +327,6 @@ const formatTime = (ms) => {
|
||||||
}:${seconds < 10 ? "0" + seconds : seconds}`;
|
}:${seconds < 10 ? "0" + seconds : seconds}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
let kisses = {};
|
|
||||||
function handleClientCommand(content, user) {
|
|
||||||
let handled = false;
|
|
||||||
if (content.startsWith("/")) {
|
|
||||||
const command = content.toLowerCase().match(/^\/\S+/)[0];
|
|
||||||
const args = content.slice(command.length).trim();
|
|
||||||
switch (command) {
|
|
||||||
case "/votekiss":
|
|
||||||
kisses[args] = kisses[args] || {};
|
|
||||||
kisses[args][user] = true;
|
|
||||||
if (Object.keys(kisses[args]).length > 3) {
|
|
||||||
printChatMessage(
|
|
||||||
"user-kissed",
|
|
||||||
args,
|
|
||||||
"ff6094",
|
|
||||||
document.createTextNode("was kissed 💋")
|
|
||||||
);
|
|
||||||
kisses[args] = {};
|
|
||||||
}
|
|
||||||
handled = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const logEventToChat = async (event) => {
|
export const logEventToChat = async (event) => {
|
||||||
if (checkDebounce(event)) {
|
if (checkDebounce(event)) {
|
||||||
return;
|
return;
|
||||||
|
@ -386,15 +349,12 @@ export const logEventToChat = async (event) => {
|
||||||
event.colour,
|
event.colour,
|
||||||
document.createTextNode("left")
|
document.createTextNode("left")
|
||||||
);
|
);
|
||||||
for(let kissed in kisses) delete kisses[kissed][user]
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "ChatMessage": {
|
case "ChatMessage": {
|
||||||
const messageContent = document.createElement("span");
|
const messageContent = document.createElement("span");
|
||||||
messageContent.classList.add("message-content");
|
messageContent.classList.add("message-content");
|
||||||
if (handleClientCommand(event.data, event.user)) break;
|
|
||||||
messageContent.append(...(await emojify(event.data)));
|
messageContent.append(...(await emojify(event.data)));
|
||||||
|
|
||||||
printChatMessage(
|
printChatMessage(
|
||||||
"chat-message",
|
"chat-message",
|
||||||
event.user,
|
event.user,
|
||||||
|
@ -473,10 +433,7 @@ const beep = () => {
|
||||||
oscillator.stop(context.currentTime + 0.22);
|
oscillator.stop(context.currentTime + 0.22);
|
||||||
};
|
};
|
||||||
|
|
||||||
let viewers = [];
|
|
||||||
|
|
||||||
export const updateViewerList = (viewers) => {
|
export const updateViewerList = (viewers) => {
|
||||||
viewers = _viewers;
|
|
||||||
const listContainer = document.querySelector("#viewer-list");
|
const listContainer = document.querySelector("#viewer-list");
|
||||||
|
|
||||||
// empty out the current list
|
// empty out the current list
|
||||||
|
|
|
@ -188,15 +188,10 @@ button.small-button {
|
||||||
|
|
||||||
.chat-message.user-join,
|
.chat-message.user-join,
|
||||||
.chat-message.user-leave,
|
.chat-message.user-leave,
|
||||||
.chat-message.ping,
|
.chat-message.ping {
|
||||||
.chat-message.user-kissed {
|
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-message.user-kissed {
|
|
||||||
color: #ff6094;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-message.set-time,
|
.chat-message.set-time,
|
||||||
.chat-message.set-playing {
|
.chat-message.set-playing {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
|
|
Loading…
Reference in a new issue