[Core] Add error handling when [p]load tries to load "locales" (#6466)

This commit is contained in:
sravan 2024-10-21 01:50:29 +05:30 committed by GitHub
parent d3887b595f
commit 4e27059209
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -258,6 +258,12 @@ class CogManager:
try: try:
mod = import_module(real_name, package=package) mod = import_module(real_name, package=package)
if mod.__spec__.name == "redbot.cogs.locales":
raise NoSuchCog(
"No core cog by the name of '{}' could be found.".format(name),
path=mod.__spec__.origin,
name=name,
)
except ImportError as e: except ImportError as e:
if e.name == package + real_name: if e.name == package + real_name:
raise NoSuchCog( raise NoSuchCog(