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:
Michael H
2020-08-03 09:09:07 -04:00
committed by GitHub
parent bb1a256295
commit c0b1e50a5f
38 changed files with 1761 additions and 222 deletions

View File

@@ -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(
_(