From e8a6db05590acf992ac99a23f3d589f08b29a3e8 Mon Sep 17 00:00:00 2001 From: wlinator Date: Thu, 4 Apr 2024 13:09:11 +0200 Subject: [PATCH] Limit XP rewards per guild to 25 --- services/xp_service.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/xp_service.py b/services/xp_service.py index e795d66..8e27ba9 100644 --- a/services/xp_service.py +++ b/services/xp_service.py @@ -3,6 +3,7 @@ import os import time from dotenv import load_dotenv +from discord.ext import commands from db import database @@ -171,6 +172,10 @@ class XpRewardService: return rewards def add_reward(self, level: int, role_id: int, persistent: bool): + + if len(self.rewards) >= 25: + raise commands.BadArgument("a server can't have more than 25 xp rewards.") + query = """ INSERT INTO level_rewards (guild_id, level, role_id, persistent) VALUES (%s, %s, %s, %s)