mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 18:27:59 -05:00
Begin work on a data request API (#4045)
[Core] Data Deletion And Disclosure APIs - Adds a Data Deletion API - Deletion comes in a few forms based on who is requesting - Deletion must be handled by 3rd party - Adds a Data Collection Disclosure Command - Provides a dynamically generated statement from 3rd party extensions - Modifies the always available commands to be cog compatible - Also prevents them from being unloaded accidentally
This commit is contained in:
@@ -138,12 +138,19 @@ class CogOrCommand(NamedTuple):
|
||||
# noinspection PyArgumentList
|
||||
@classmethod
|
||||
async def convert(cls, ctx: commands.Context, arg: str) -> "CogOrCommand":
|
||||
cog = ctx.bot.get_cog(arg)
|
||||
if cog:
|
||||
return cls(type="COG", name=cog.__class__.__name__, obj=cog)
|
||||
cmd = ctx.bot.get_command(arg)
|
||||
if cmd:
|
||||
return cls(type="COMMAND", name=cmd.qualified_name, obj=cmd)
|
||||
ret = None
|
||||
if cog := ctx.bot.get_cog(arg):
|
||||
ret = cls(type="COG", name=cog.qualified_name, obj=cog)
|
||||
|
||||
elif cmd := ctx.bot.get_command(arg):
|
||||
ret = cls(type="COMMAND", name=cmd.qualified_name, obj=cmd)
|
||||
|
||||
if ret:
|
||||
if isinstance(ret.obj, commands.commands._RuleDropper):
|
||||
raise commands.BadArgument(
|
||||
"You cannot apply permission rules to this cog or command."
|
||||
)
|
||||
return ret
|
||||
|
||||
raise commands.BadArgument(
|
||||
_(
|
||||
|
||||
Reference in New Issue
Block a user