diff --git a/redbot/core/core_commands.py b/redbot/core/core_commands.py index 1b780b1ff..13c3d4c86 100644 --- a/redbot/core/core_commands.py +++ b/redbot/core/core_commands.py @@ -117,6 +117,7 @@ _ = i18n.Translator("Core", __file__) TokenConverter = commands.get_dict_converter(delims=[" ", ",", ";"]) MAX_PREFIX_LENGTH = 25 +MINIMUM_PREFIX_LENGTH = 1 class CoreLogic: @@ -4052,6 +4053,24 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): _("Prefixes cannot start with '/', as it conflicts with Discord's slash commands.") ) return + if any(len(x) < MINIMUM_PREFIX_LENGTH for x in prefixes): + await ctx.send( + _( + "Warning: A prefix is below the recommended length (1 character).\n" + "Do you want to continue?" + ) + + " (yes/no)" + ) + pred = MessagePredicate.yes_or_no(ctx) + try: + await self.bot.wait_for("message", check=pred, timeout=30) + except asyncio.TimeoutError: + await ctx.send(_("Response timed out.")) + return + else: + if pred.result is False: + await ctx.send(_("Cancelled.")) + return if any(len(x) > MAX_PREFIX_LENGTH for x in prefixes): await ctx.send( _( @@ -4111,6 +4130,9 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): _("Prefixes cannot start with '/', as it conflicts with Discord's slash commands.") ) return + if any(len(x) < MINIMUM_PREFIX_LENGTH for x in prefixes): + await ctx.send(_("You cannot have a prefix shorter than 1 character.")) + return if any(len(x) > MAX_PREFIX_LENGTH for x in prefixes): await ctx.send(_("You cannot have a prefix longer than 25 characters.")) return