mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-09 19:59:27 +02:00
Fixed chat symbols bug
Короче баг был, который при отсылании миллиарда символов чат схлопывал. Бл, Рафаелло постоянно просил переделывать, наконец то сделал то, что он принял и залил, всем спасибо за внимание
This commit is contained in:
@@ -69,14 +69,37 @@ export default {
|
||||
return msg.msg.includes(GetCookie("SpUserName"));
|
||||
},
|
||||
ClaimDatamsg(msg) {
|
||||
const now = Date.now();
|
||||
if (!this.lastMsgTime || now - this.lastMsgTime >= 1000) {
|
||||
SendMessageToChat(msg[0]);
|
||||
this.lastMsgTime = now;
|
||||
} else {
|
||||
alert("Вы не можете отправлять сообщения так часто");
|
||||
}
|
||||
},
|
||||
const now = Date.now();
|
||||
if (!this.lastMsgTime || now - this.lastMsgTime >= 1000) {
|
||||
const processedMsg = this.processMessage(msg[0]);
|
||||
|
||||
SendMessageToChat(processedMsg);
|
||||
this.lastMsgTime = now;
|
||||
} else {
|
||||
alert("Вы не можете отправлять сообщения так часто");
|
||||
}
|
||||
},
|
||||
processMessage(message) {
|
||||
const maxLength = 5; // Тут макс допустимых символов писать
|
||||
const processedMessage = [];
|
||||
let currentSymbol = "";
|
||||
let count = 0;
|
||||
|
||||
for (let i = 0; i < message.length; i++) {
|
||||
if (message[i] === currentSymbol) {
|
||||
count++;
|
||||
} else {
|
||||
currentSymbol = message[i];
|
||||
count = 1;
|
||||
}
|
||||
|
||||
if (count <= maxLength) {
|
||||
processedMessage.push(message[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return processedMessage.join("");
|
||||
},
|
||||
muteChat() {
|
||||
// Mute the chat by disabling the event listener for incoming messages.
|
||||
this.eventBus.$off("dataChat");
|
||||
@@ -110,29 +133,52 @@ export default {
|
||||
});
|
||||
},
|
||||
created() {
|
||||
GetChatHistory().then((response) => {
|
||||
if (response && response.length) {
|
||||
response.forEach((element) => {
|
||||
let imageUrl =
|
||||
"https://avatar.spworlds.ru/face/55/" + element.userName;
|
||||
GetChatHistory().then((response) => {
|
||||
if (response && response.length) {
|
||||
response.forEach((element) => {
|
||||
let imageUrl =
|
||||
"https://avatar.spworlds.ru/face/55/" + element.userName;
|
||||
|
||||
const MsgUser = {
|
||||
id: this.id + 1,
|
||||
msg: element.message,
|
||||
username: element.userName,
|
||||
icon: imageUrl,
|
||||
};
|
||||
const processedMsg = this.processMessage(element.message); // Process the message
|
||||
|
||||
if (MsgUser.username === "🛠️ System") {
|
||||
MsgUser.icon = "https://avatar.spworlds.ru/face/55/CONSOLE";
|
||||
}
|
||||
const MsgUser = {
|
||||
id: this.id + 1,
|
||||
msg: processedMsg, // Use the processed message
|
||||
username: element.userName,
|
||||
icon: imageUrl,
|
||||
};
|
||||
|
||||
this.array.push(MsgUser);
|
||||
});
|
||||
this.ScrollToBottom();
|
||||
}
|
||||
});
|
||||
},
|
||||
if (MsgUser.username === "🛠️ System") {
|
||||
MsgUser.icon = "https://avatar.spworlds.ru/face/55/CONSOLE";
|
||||
}
|
||||
|
||||
this.array.push(MsgUser);
|
||||
});
|
||||
this.ScrollToBottom();
|
||||
}
|
||||
});
|
||||
},
|
||||
processMessage(message) {
|
||||
const maxLength = 5; // Тут макс допустимых символов писать
|
||||
const processedMessage = [];
|
||||
let currentSymbol = "";
|
||||
let count = 0;
|
||||
|
||||
for (let i = 0; i < message.length; i++) {
|
||||
if (message[i] === currentSymbol) {
|
||||
count++;
|
||||
} else {
|
||||
currentSymbol = message[i];
|
||||
count = 1;
|
||||
}
|
||||
|
||||
if (count <= maxLength) {
|
||||
processedMessage.push(message[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return processedMessage.join("");
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
<section class="crash-game__players" v-if="crashObject && crashObject.Players">
|
||||
<div class="crash-game-players__content">
|
||||
<div class="crash__history">
|
||||
<div class="crash-history__component"> <h2>{{ game.winX }}</h2> </div>
|
||||
<div class="crash-history__component"> <h2></h2> </div>
|
||||
<div class="crash-history__component"></div>
|
||||
<div class="crash-history__component"></div>
|
||||
<div class="crash-history__component"></div>
|
||||
@@ -121,7 +121,6 @@ export default {
|
||||
components: { HeaderComponent, AsideBarComponent, ChatComponent, CrashGraphComponent },
|
||||
data() {
|
||||
return {
|
||||
winX,
|
||||
SaperNumbers,
|
||||
clickedBtn: null,
|
||||
ErrorClick: false,
|
||||
@@ -242,14 +241,6 @@ export default {
|
||||
}
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
if (GetCookie('AUTHTOKEN') && GetCookie('SearchToken')) {
|
||||
await GetCurrentMoney(GetCookie('AUTHTOKEN'), GetCookie('SearchToken'))
|
||||
.then((response) => {
|
||||
this.balance = response.currentMoney
|
||||
})
|
||||
}
|
||||
},
|
||||
props: ["payments"],
|
||||
async created() {
|
||||
this.CHistory = await CrashHistory();
|
||||
|
||||
Reference in New Issue
Block a user