Fix application icons (#1110)

Co-authored-by: Madeline <46743919+MaddyUnderStars@users.noreply.github.com>
This commit is contained in:
BoryaGames 2024-02-11 04:39:09 +05:00 committed by GitHub
parent 105b3de19e
commit 3eb5a3f420
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 4 deletions

BIN
package-lock.json generated

Binary file not shown.

View File

@ -55,9 +55,9 @@
"@types/probe-image-size": "^7.2.0", "@types/probe-image-size": "^7.2.0",
"@types/sharp": "^0.31.1", "@types/sharp": "^0.31.1",
"@types/ws": "^8.5.5", "@types/ws": "^8.5.5",
"@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^5.62.0", "@typescript-eslint/parser": "^6.21.0",
"eslint": "^8.46.0", "eslint": "^8.56.0",
"express": "^4.18.2", "express": "^4.18.2",
"husky": "^8.0.3", "husky": "^8.0.3",
"prettier": "^2.8.8", "prettier": "^2.8.8",

View File

@ -21,6 +21,7 @@ import {
Application, Application,
ApplicationModifySchema, ApplicationModifySchema,
DiscordApiErrors, DiscordApiErrors,
handleFile,
} from "@spacebar/util"; } from "@spacebar/util";
import { Request, Response, Router } from "express"; import { Request, Response, Router } from "express";
import { HTTPError } from "lambert-server"; import { HTTPError } from "lambert-server";
@ -83,6 +84,13 @@ router.patch(
) )
throw new HTTPError(req.t("auth:login.INVALID_TOTP_CODE"), 60008); throw new HTTPError(req.t("auth:login.INVALID_TOTP_CODE"), 60008);
if (body.icon) {
body.icon = await handleFile(
`/app-icons/${app.id}`,
body.icon as string,
);
}
if (app.bot) { if (app.bot) {
app.bot.assign({ bio: body.description }); app.bot.assign({ bio: body.description });
await app.bot.save(); await app.bot.save();

View File

@ -195,7 +195,7 @@ router.delete(
async (req: Request, res: Response) => { async (req: Request, res: Response) => {
const { guild_id, user_id } = req.params; const { guild_id, user_id } = req.params;
const ban = await Ban.findOneOrFail({ await Ban.findOneOrFail({
where: { guild_id: guild_id, user_id: user_id }, where: { guild_id: guild_id, user_id: user_id },
}); });