mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-10 04:09:29 +02:00
Add time check for message sending
This commit is contained in:
@@ -43,6 +43,7 @@ export default {
|
||||
return {
|
||||
array: [],
|
||||
id: 0,
|
||||
lastMsgTime: null,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@@ -53,8 +54,13 @@ export default {
|
||||
});
|
||||
},
|
||||
ClaimDatamsg(msg) {
|
||||
SendMessageToChat(msg[0]);
|
||||
|
||||
const now = Date.now();
|
||||
if (!this.lastMsgTime || now - this.lastMsgTime >= 2000) {
|
||||
SendMessageToChat(msg[0]);
|
||||
this.lastMsgTime = now;
|
||||
} else {
|
||||
alert("Вы не можете отправлять сообщения чаще, чем раз в 2 секунды.");
|
||||
}
|
||||
// if(this.array.length > 7) {
|
||||
// this.array.shift()
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user