From 5ad1cb46ca931ec0f1e197f510a89282440c7a2e Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Wed, 22 Oct 2025 18:00:00 +0200 Subject: [PATCH 1/4] fix: add `BulkApplicationCommandCreateSchema` --- assets/openapi.json | Bin 1382990 -> 1384361 bytes assets/schemas.json | Bin 4233209 -> 4239069 bytes .../#application_id/commands/index.ts | 2 +- .../guilds/#guild_id/commands/index.ts | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/openapi.json b/assets/openapi.json index bb8268f57b5999904fcacf777f76380eb755ee19..d2bc69f3ab085b33073332b026936b90f85f036f 100644 GIT binary patch delta 699 zcmX@NC1mCPkcJk<7N!>FEiBIF_8IxPsrt#4NvTEpF8SG|xv6<2mHO$KCAtMg`B|yS zCB^y$MVV!ZC8_$w1&PV2Nr^?eC8@^J!7A)%1{gv4{r?1gqzr9_7gZ(ojrAC8XyKwpjEfJ~d0Z#-trw6#O$WJ#& zW}h_O!H%76`&w@HqimGg0doE<9%`6^5(qky>?gNZE3#kNNU70~D4TMby?x4M4j|?P zVlE)&24Wr{=G{K!G9RDOBtd=_r_!A4=?Q!w1_=(9?LgggnWi_G t^ILA;@Pt2*aoR4C#O?EMi$qDGD&l3HuFx$aKE3|9i0t-dKSWk20s!D(4MYF{ delta 443 zcmZ3vKjhq&kcJk<7N!>FEiBIF@+pZWiTYq7IX_pgB(*5Fv_d~EGbgoJKO;Xkb-JK1 zyIT7Sa~2?G-M+${&FmZ@E!%-wEEuPMuwYT2ejtOBbGnZv`|a%s9PFPN326n{ws3mG zc22430jHTbrYCT7D@?zT%sy%Q13PxM?YunfN7)FO0kVD;4>77x9Jxl4{p5COCH5;D z32B7{NyruU_K+(aK+FlmTtLhX#5_REyFKIzAD_{5fv@~r?f&fiKr8^nfCR>4fD-3f;GIuf`Q@^bpBHw{?O$iW`k zs**fW4KSm$4}y;<3#7hK&y?==zihnh|49XouHB2^*r9X~+@xBMYtLe4r3c}-|IG3> zOMgu(?Gg@$CfWFb?pJ&|50U_ruFad)X{1L6WJD&!ATugPC8!ixkQLcb87fB==p?E{ zc2tEN$cbF&6skrws20_sdend#(P?xBH6b@*5r;ge8J$JvPz!2BZKxe}pibmP=g|e! zg?zGU-M^iMU7e4HOLKe+#HSrTDQ7K)!8zU_ZMZBj{j$D63Y2RP?vw+s_Xi-CYH&g3 zp1BG~BMFSfp9N2;aR5A9I4J{JvkBgPV(k#mI?5y?i(&(eb@g0=6M|{y`bx{ZU&Fl(JHm+U4@I?eM=iKZbLH!muxJg21{ruV5m4;nBpVg zS>RoT_rX!!49+`NLK-nz3-!!n%>bk}yfo}A@bv<@v8h$uQ~ks_MXLXx+%3SEjn zctHdqLM2~EDRi!bc&i|SxR}AA5CU#>GvHK&)+hc0m!&v-Zn=l!`QBZju&Vs|xvDIi z7E>`ROsi=#Rnxww{TT7j&o0dBx67Q73N9o*r53;F?>;0GpY``fDnUEfEFyd{?X^-? zln@Qm?|!w8c8|J8){M9Y4q?REo3!+VqL-T@Gs=IU5^-RGeW}`uCkLit~N#m4yy|MVo2#(4mpB zuT9YMbR { const applicationExists = await Application.exists({ where: { id: req.params.application_id } }); diff --git a/src/api/routes/applications/#application_id/guilds/#guild_id/commands/index.ts b/src/api/routes/applications/#application_id/guilds/#guild_id/commands/index.ts index 111c26f4..7c2a29bf 100644 --- a/src/api/routes/applications/#application_id/guilds/#guild_id/commands/index.ts +++ b/src/api/routes/applications/#application_id/guilds/#guild_id/commands/index.ts @@ -123,7 +123,7 @@ router.post( router.put( "/", route({ - // requestBody: "ApplicationCommandCreateSchema", // How to make this array? + requestBody: "BulkApplicationCommandCreateSchema", }), async (req: Request, res: Response) => { const applicationExists = await Application.exists({ where: { id: req.params.application_id } }); From a024d6343c672d15754e14ef3d183eee02b5432f Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Wed, 22 Oct 2025 18:00:16 +0200 Subject: [PATCH 2/4] fix: add `BulkApplicationCommandCreateSchema` --- src/schemas/api/bots/ApplicationCommandCreateSchema.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/schemas/api/bots/ApplicationCommandCreateSchema.ts b/src/schemas/api/bots/ApplicationCommandCreateSchema.ts index 0217d889..a03b81cd 100644 --- a/src/schemas/api/bots/ApplicationCommandCreateSchema.ts +++ b/src/schemas/api/bots/ApplicationCommandCreateSchema.ts @@ -17,3 +17,5 @@ export interface ApplicationCommandCreateSchema { contexts?: InteractionContextType[]; handler?: ApplicationCommandHandlerType; } + +export type BulkApplicationCommandCreateSchema = ApplicationCommandCreateSchema[]; From 97eef84e8cd9dde2bdb8e04525e46afc04d8e26c Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Wed, 22 Oct 2025 18:00:42 +0200 Subject: [PATCH 3/4] fix: add `author` to interaction message --- src/api/routes/interactions/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/routes/interactions/index.ts b/src/api/routes/interactions/index.ts index 3423ed73..6c192c69 100644 --- a/src/api/routes/interactions/index.ts +++ b/src/api/routes/interactions/index.ts @@ -91,7 +91,7 @@ router.post("/", route({}), async (req: Request, res: Response) => { } if (body.type === InteractionType.MessageComponent || body.data.type === InteractionType.ModalSubmit) { - interactionData.message = await Message.findOneOrFail({ where: { id: body.message_id } }); + interactionData.message = await Message.findOneOrFail({ where: { id: body.message_id }, relations: ["author"] }); } emitEvent({ From f24ec09f2a14e5f7f64f668c04175cc109dc1453 Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Wed, 22 Oct 2025 18:02:23 +0200 Subject: [PATCH 4/4] fix: trim more --- .../#application_id/commands/#command_id/index.ts | 2 +- .../routes/applications/#application_id/commands/index.ts | 8 ++++---- .../guilds/#guild_id/commands/#command_id/index.ts | 7 +++++-- .../#application_id/guilds/#guild_id/commands/index.ts | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/api/routes/applications/#application_id/commands/#command_id/index.ts b/src/api/routes/applications/#application_id/commands/#command_id/index.ts index b478fdd5..7907c1ba 100644 --- a/src/api/routes/applications/#application_id/commands/#command_id/index.ts +++ b/src/api/routes/applications/#application_id/commands/#command_id/index.ts @@ -95,7 +95,7 @@ router.patch( version: Snowflake.generate(), }; - await ApplicationCommand.update({ name: body.name }, commandForDb); + await ApplicationCommand.update({ name: body.name.trim() }, commandForDb); res.send(commandForDb); }, ); diff --git a/src/api/routes/applications/#application_id/commands/index.ts b/src/api/routes/applications/#application_id/commands/index.ts index 94c1983f..97753f00 100644 --- a/src/api/routes/applications/#application_id/commands/index.ts +++ b/src/api/routes/applications/#application_id/commands/index.ts @@ -83,10 +83,10 @@ router.post( version: Snowflake.generate(), }; - const commandExists = await ApplicationCommand.exists({ where: { application_id: req.params.application_id, name: body.name } }); + const commandExists = await ApplicationCommand.exists({ where: { application_id: req.params.application_id, name: body.name.trim() } }); if (commandExists) { - await ApplicationCommand.update({ application_id: req.params.application_id, name: body.name }, commandForDb); + await ApplicationCommand.update({ application_id: req.params.application_id, name: body.name.trim() }, commandForDb); } else { commandForDb.id = Snowflake.generate(); // Have to be done that way so the id doesn't change await ApplicationCommand.save(commandForDb); @@ -154,10 +154,10 @@ router.put( version: Snowflake.generate(), }; - const commandExists = await ApplicationCommand.exists({ where: { application_id: req.params.application_id, name: command.name } }); + const commandExists = await ApplicationCommand.exists({ where: { application_id: req.params.application_id, name: command.name.trim() } }); if (commandExists) { - await ApplicationCommand.update({ application_id: req.params.application_id, name: command.name }, commandForDb); + await ApplicationCommand.update({ application_id: req.params.application_id, name: command.name.trim() }, commandForDb); } else { commandForDb.id = Snowflake.generate(); // Have to be done that way so the id doesn't change await ApplicationCommand.save(commandForDb); diff --git a/src/api/routes/applications/#application_id/guilds/#guild_id/commands/#command_id/index.ts b/src/api/routes/applications/#application_id/guilds/#guild_id/commands/#command_id/index.ts index 94a2171c..2570358d 100644 --- a/src/api/routes/applications/#application_id/guilds/#guild_id/commands/#command_id/index.ts +++ b/src/api/routes/applications/#application_id/guilds/#guild_id/commands/#command_id/index.ts @@ -113,7 +113,7 @@ router.patch( }; const commandExists = await ApplicationCommand.exists({ - where: { application_id: req.params.application_id, guild_id: req.params.guild_id, id: req.params.command_id, name: body.name }, + where: { application_id: req.params.application_id, guild_id: req.params.guild_id, id: req.params.command_id, name: body.name.trim() }, }); if (!commandExists) { @@ -121,7 +121,10 @@ router.patch( return; } - await ApplicationCommand.update({ application_id: req.params.application_id, guild_id: req.params.guild_id, id: req.params.command_id, name: body.name }, commandForDb); + await ApplicationCommand.update( + { application_id: req.params.application_id, guild_id: req.params.guild_id, id: req.params.command_id, name: body.name.trim() }, + commandForDb, + ); res.send(commandForDb); }, ); diff --git a/src/api/routes/applications/#application_id/guilds/#guild_id/commands/index.ts b/src/api/routes/applications/#application_id/guilds/#guild_id/commands/index.ts index 7c2a29bf..1639e7be 100644 --- a/src/api/routes/applications/#application_id/guilds/#guild_id/commands/index.ts +++ b/src/api/routes/applications/#application_id/guilds/#guild_id/commands/index.ts @@ -107,10 +107,10 @@ router.post( version: Snowflake.generate(), }; - const commandExists = await ApplicationCommand.exists({ where: { application_id: req.params.application_id, guild_id: req.params.guild_id, name: body.name } }); + const commandExists = await ApplicationCommand.exists({ where: { application_id: req.params.application_id, guild_id: req.params.guild_id, name: body.name.trim() } }); if (commandExists) { - await ApplicationCommand.update({ application_id: req.params.application_id, guild_id: req.params.guild_id, name: body.name }, commandForDb); + await ApplicationCommand.update({ application_id: req.params.application_id, guild_id: req.params.guild_id, name: body.name.trim() }, commandForDb); } else { commandForDb.id = Snowflake.generate(); // Have to be done that way so the id doesn't change await ApplicationCommand.save(commandForDb);