diff --git a/assets/openapi.json b/assets/openapi.json index 78204cc..19447b1 100644 --- a/assets/openapi.json +++ b/assets/openapi.json @@ -3997,6 +3997,9 @@ }, "username": { "type": "string" + }, + "banner": { + "type": "string" } } }, diff --git a/assets/schemas.json b/assets/schemas.json index 6d334cf..d3b2404 100644 --- a/assets/schemas.json +++ b/assets/schemas.json @@ -4234,6 +4234,9 @@ }, "username": { "type": "string" + }, + "banner": { + "type": "string" } }, "additionalProperties": false, diff --git "a/src/api/routes/applications/\043application_id/bot/index.ts" "b/src/api/routes/applications/\043application_id/bot/index.ts" index 901f386..7f5369a 100644 --- "a/src/api/routes/applications/\043application_id/bot/index.ts" +++ "b/src/api/routes/applications/\043application_id/bot/index.ts" @@ -17,7 +17,7 @@ */ import { route } from "@spacebar/api"; -import { Application, DiscordApiErrors, User, createAppBotUser, generateToken, handleFile } from "@spacebar/util"; +import { Application, DiscordApiErrors, FieldErrors, User, createAppBotUser, generateToken, handleFile } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import { verifyToken } from "node-2fa"; @@ -100,6 +100,15 @@ const body = req.body as BotModifySchema; if (!body.avatar?.trim()) delete body.avatar; + if (body.username?.trim() == "") { + throw FieldErrors({ + username: { + code: "BASE_TYPE_REQUIRED", + message: req.t("common:field.BASE_TYPE_REQUIRED"), + }, + }); + } + const app = await Application.findOneOrFail({ where: { id: req.params.application_id }, relations: { bot: true, owner: true }, diff --git a/src/schemas/uncategorised/BotModifySchema.ts b/src/schemas/uncategorised/BotModifySchema.ts index 2127602..d1bbab8 100644 --- a/src/schemas/uncategorised/BotModifySchema.ts +++ b/src/schemas/uncategorised/BotModifySchema.ts @@ -19,4 +19,5 @@ export interface BotModifySchema { avatar?: string; username?: string; + banner?: string; }