使用方法:
安装 </s>Nodejs<e>
≥ 13.14.0
执行 `npm install fs [email protected]`
保存下面内容为 `index.js`
```js
const fs = require('fs');
const fetch = require('node-fetch');
let userId = 9904;
try {
userId = require(‘./config.json’);
} catch (error) {}
async function save() {
fs.writeFileSync(‘./config.json’, JSON.stringify(userId), ‘utf-8’);
}
async function sub(id) {
let req = await fetch(https://www.nodeloc.com/api/users/${id}
);
if ((await req.json()).data) {
return await sub(id + 1);
}
return id - 1;
}
async function updateUserId() {
userId = await sub(userId);
await save();
}
async function render() {
await updateUserId();
console.clear();
console.log(UserId: ${userId}
);
}
setInterval(render, 3000);
render();
```
执行 `node index.js`
enjoy~
