更新 'mcbbs/vending-machine.user.js'

This commit is contained in:
502647092 2023-07-06 02:18:15 +00:00
parent 2810c11346
commit ece4dc34de

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name MCBBS自动售卖机
// @namespace https://miaowoo.cc/
// @version 0.8.1
// @version 0.8.2
// @description 自动售卖道具
// @author MiaoWoo
// @match https://www.mcbbs.net/home.php?mod=magic**
@ -16,7 +16,7 @@
let stock = 0
let messagetext = undefined
let storeUsername = undefined
let gateway = "https://reward.yumc.pw"
let gateway = "https://s.yumc.pw"
async function sleep(time) {
return new Promise((resolve, reject) => setTimeout(resolve, time))
}
@ -96,6 +96,9 @@
break
}
}
async function heartbeat() {
return fetch('https://kuma.yumc.pw/api/push/D611iEI4zy?status=up&msg=OK&ping=').then(r=>r.json()).catch(e=>console.log(e))
}
async function needReplenishment() {
let timeoutTask = setTimeout(() => { refresh() }, 120000)
if (stock == 0) { return }
@ -198,6 +201,7 @@
refresh()
}
async function sendOrderAction(openFn, back = false) {
heartbeat()
let timeoutTask = setTimeout(() => { refresh() }, 45000)
let count = 0
if (stock < 50) {