-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
190 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,55 @@ | ||
import express from "express"; | ||
import { prisma, log, client } from "utils"; | ||
const router = express.Router(); | ||
|
||
import web from "./web"; | ||
type acc = { | ||
Username: string; | ||
Nickname: string | null; | ||
Image: string; | ||
ID: string; | ||
Bot: boolean; | ||
Roles: { | ||
Role: string; | ||
ID: string; | ||
Icon: string | null; | ||
Position: number; | ||
}[]; | ||
CustomData: {} | null; | ||
}[]; | ||
|
||
router.use("/web", web); | ||
router.get("/", async (req, res) => { | ||
if (!req.query.q || typeof req.query.q !== "string") { | ||
return res.status(400).send("Invalid query"); | ||
} | ||
|
||
const Members = await client.guilds.cache | ||
.get(req.query.q.trim()) | ||
?.members.fetch(); | ||
|
||
const Users = await prisma.user.findMany(); | ||
|
||
const data = Members?.reduce((acc: acc, member) => { | ||
acc.push({ | ||
Username: member.user.username, | ||
Nickname: member.nickname, | ||
Image: member.user.displayAvatarURL(), | ||
ID: member.user.id, | ||
Bot: member.user.bot, | ||
Roles: member.roles.cache.map((role) => { | ||
return { | ||
Role: role.name, | ||
ID: role.id, | ||
Icon: role.iconURL(), | ||
Position: role.position, | ||
}; | ||
}), | ||
CustomData: Users.find((a) => a.userid === member.user.id) || null, | ||
}); | ||
return acc; | ||
}); | ||
|
||
log("Experimental Roles sent"); | ||
return res.send(data); | ||
}); | ||
|
||
export default router; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
openapi: "3.0.0" | ||
info: | ||
title: "RED Modding Tools Backend Api" | ||
description: "This is the RED Modding Tools Backend Api documentation" | ||
version: "0.2.0" | ||
|
||
servers: | ||
- url: "http://localhost:3000/api" | ||
description: "Local server" | ||
|
||
paths: | ||
/bot/commands/core-versions: | ||
get: | ||
summary: Github Core Plugin Versions | ||
tags: | ||
- Bot | ||
|
||
/bot/commands/core-versions/update: | ||
get: | ||
summary: Manuel Updater for Core Plugin Versions | ||
tags: | ||
- Bot | ||
/bot/commands/quotes: | ||
get: | ||
summary: Bot. | ||
description: Quotes | ||
tags: | ||
- Bot | ||
/bot/commands/respond: | ||
get: | ||
summary: Bot. | ||
description: Responses | ||
tags: | ||
- Bot | ||
/bot/commands/trivia: | ||
get: | ||
summary: Bot. | ||
description: Trivia | ||
tags: | ||
- Bot | ||
/bot/commands/user: | ||
get: | ||
summary: Bot. | ||
description: Quotes | ||
tags: | ||
- Bot | ||
/bot/dev/user: | ||
get: | ||
summary: Bot. | ||
description: Quotes | ||
tags: | ||
- Bot | ||
/bot/team/pass: | ||
get: | ||
summary: Bot. | ||
description: Quotes | ||
tags: | ||
- Bot | ||
|
||
/discord: | ||
get: | ||
summary: Discord. | ||
description: Get the Discord invite link. | ||
tags: | ||
- Discord | ||
|
||
/endpoint: | ||
get: | ||
summary: Endpoint. | ||
description: Get the endpoint. | ||
tags: | ||
- Endpoint | ||
|
||
/metrics: | ||
get: | ||
summary: Prometheus Metrics. | ||
description: Get the Prometheus metrics. | ||
tags: | ||
- Metrics |