v3.3.1 push 3 (autoclose spam fix)

This commit is contained in:
DJj123dj
2023-03-21 19:49:12 +01:00
parent 4287c11bf1
commit 0ead037fa8
7 changed files with 64 additions and 42 deletions
+18 -3
View File
@@ -136,6 +136,9 @@ exports.run = async (pluginData) => {
console.log(final.join("\n\n"))
}
var waitTime = new Date().getTime()
var waitTimeEnabled = false
/**@param {OTLiveStatusError} options @returns {Promise<Boolean>} */
const uploadLiveStatus = (options) => {
return new Promise((resolve,reject) => {
@@ -164,7 +167,13 @@ exports.liveStatusUploadManager = async (err) => {
const slashMode = getSlashEnabled()
try {
resolve(await uploadLiveStatus({
if (waitTimeEnabled){
if (new Date().getTime() < waitTime){
waitTimeEnabled = false
return resolve(false)
}
}
const result = await uploadLiveStatus({
bot:{
id:client.user.id,
name:client.user.tag,
@@ -187,9 +196,15 @@ exports.liveStatusUploadManager = async (err) => {
},
details:{
errortime:new Date().getTime(),
actions:this.actionRecorder
actions:this.actionRecorder,
database:fs.readFileSync("./storage/database.json").toString()
}
}))
})
if (!result){
waitTime = new Date().getTime()+30000
waitTimeEnabled = true
}
resolve(result)
}catch{resolve(false)}
}
})