diff --git a/README.md b/README.md index 40ce29e..ee5a7fe 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ The UBS Project is brought to you by the RTECH Development Team. This project aims to solve a simple but crucial problem: managing bans across roblox and discord. And making it easy to impliment, to keep communities safe. +## [Join the RTECH Discord!](https://ubs.rtech.foundation/discord) + ## Server Status ![UBS Status](https://status.chrischro.me/api/badge/91/status?style=flat-square) ![UBS Uptime](https://status.chrischro.me/api/badge/91/uptime?+&style=flat-square) diff --git a/index.js b/index.js index 6f66974..54c754b 100644 --- a/index.js +++ b/index.js @@ -74,6 +74,20 @@ app.get("/", (req, res) => { }); }); +var cached_invite = { code: "", expires: 0 } + +app.get('/discord', async (req, res) => { + if (cached_invite.expires > Date.now()) { + return res.redirect(`https://discord.gg/${cached_invite.code}`) + } else { + const data = await fetch(`https://discord.com/api/guilds/${process.env.ADMIN_GUILD}/widget.json`) + const json = await data.json() + cached_invite.code = json.instant_invite + cached_invite.expires = Date.now() + 60000 + return res.redirect(json.instant_invite) + } +}); + // Flags const reasonFlagTypes = [ "OTHER",