add rich presence

This commit is contained in:
Ryan Cao 2022-06-10 20:03:47 +08:00
parent 6df4c6f6e2
commit dcd1d2a17d
No known key found for this signature in database
GPG key ID: 528A2C1B6656B97F
2 changed files with 22 additions and 0 deletions

View file

@ -0,0 +1,15 @@
import fetch from 'node-fetch';
interface SimplifiedMetaVersion {
recommended: boolean;
type: 'release' | 'snapshot';
version: string;
}
export const getLatestMinecraft = async () => {
const meta = (await fetch(
'https://meta.polymc.org/v1/net.minecraft/index.json'
).then((r) => r.json())) as { versions: SimplifiedMetaVersion[] };
return meta.versions.filter((v) => v.recommended)[0].version;
};