mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-05 17:02:32 -05:00
Prevent / being used in bot or server prefixes (#5693)
* Update `[p]set prefix`/`[p]set serverprefix` * Update cli * style * update __main__ * style * improve checks * Raise in Red.set_prefixes, update responses * uniform responses * Fixes * Keep generator variable names consistent across files
This commit is contained in:
@@ -45,6 +45,10 @@ class PrefixManager:
|
||||
prefixes = prefixes or []
|
||||
if not isinstance(prefixes, list) and not all(isinstance(pfx, str) for pfx in prefixes):
|
||||
raise TypeError("Prefixes must be a list of strings")
|
||||
if any(prefix.startswith("/") for prefix in prefixes):
|
||||
raise ValueError(
|
||||
"Prefixes cannot start with '/', as it conflicts with Discord's slash commands."
|
||||
)
|
||||
prefixes = sorted(prefixes, reverse=True)
|
||||
if gid is None:
|
||||
if not prefixes:
|
||||
|
||||
Reference in New Issue
Block a user