diff --git a/src/api/routes/guilds/#guild_id/stickers.ts b/src/api/routes/guilds/#guild_id/stickers.ts
index b0ac01a2..07fbfd58 100644
--- a/src/api/routes/guilds/#guild_id/stickers.ts
+++ b/src/api/routes/guilds/#guild_id/stickers.ts
@@ -27,6 +27,8 @@ import {
StickerType,
emitEvent,
uploadFile,
+ Config,
+ DiscordApiErrors,
} from "@spacebar/util";
import { Request, Response, Router } from "express";
import { HTTPError } from "lambert-server";
@@ -87,6 +89,16 @@ router.post(
const body = req.body as ModifyGuildStickerSchema;
const id = Snowflake.generate();
+ const sticker_count = await Sticker.count({
+ where: { guild_id: guild_id },
+ });
+ const { maxStickers } = Config.get().limits.guild;
+
+ if (sticker_count >= maxStickers)
+ throw DiscordApiErrors.MAXIMUM_STICKERS.withParams(
+ maxStickers,
+ );
+
const [sticker] = await Promise.all([
Sticker.create({
...body,
diff --git a/src/util/config/types/subconfigurations/limits/GuildLimits.ts b/src/util/config/types/subconfigurations/limits/GuildLimits.ts
index e77cf424..48c575b0 100644
--- a/src/util/config/types/subconfigurations/limits/GuildLimits.ts
+++ b/src/util/config/types/subconfigurations/limits/GuildLimits.ts
@@ -19,6 +19,7 @@
export class GuildLimits {
maxRoles: number = 1000;
maxEmojis: number = 2000;
+ maxStickers: number = 500;
maxMembers: number = 25000000;
maxChannels: number = 65535;
maxBulkBanUsers: number = 200;
|