aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Qwerty-133 <[email protected]>2021-08-30 14:14:02 +0530
committerGravatar GitHub <[email protected]>2021-08-30 08:44:02 +0000
commitd560cdfcaac6b4694ee4b810d9c8df85ec1fae6c (patch)
tree83e787cfe0cee6bf53e65783fc5063886745257d
parentMerge pull request #1790 from python-discord/restrictive-infra-commands (diff)
Remove the json argument from the raw command. (#1792)
-rw-r--r--bot/exts/info/information.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/bot/exts/info/information.py b/bot/exts/info/information.py
index ae547b1b8..bcf8c10d2 100644
--- a/bot/exts/info/information.py
+++ b/bot/exts/info/information.py
@@ -460,11 +460,12 @@ class Information(Cog):
# remove trailing whitespace
return out.rstrip()
- @cooldown_with_role_bypass(2, 60 * 3, BucketType.member, bypass_roles=constants.STAFF_PARTNERS_COMMUNITY_ROLES)
- @group(invoke_without_command=True)
- @in_whitelist(channels=(constants.Channels.bot_commands,), roles=constants.STAFF_PARTNERS_COMMUNITY_ROLES)
- async def raw(self, ctx: Context, *, message: Message, json: bool = False) -> None:
- """Shows information about the raw API response."""
+ async def send_raw_content(self, ctx: Context, message: Message, json: bool = False) -> None:
+ """
+ Send information about the raw API response for a `discord.Message`.
+
+ If `json` is True, send the information in a copy-pasteable Python format.
+ """
if ctx.author not in message.channel.members:
await ctx.send(":x: You do not have permissions to see the channel this message is in.")
return
@@ -500,10 +501,17 @@ class Information(Cog):
for page in paginator.pages:
await ctx.send(page, allowed_mentions=AllowedMentions.none())
+ @cooldown_with_role_bypass(2, 60 * 3, BucketType.member, bypass_roles=constants.STAFF_PARTNERS_COMMUNITY_ROLES)
+ @group(invoke_without_command=True)
+ @in_whitelist(channels=(constants.Channels.bot_commands,), roles=constants.STAFF_PARTNERS_COMMUNITY_ROLES)
+ async def raw(self, ctx: Context, message: Message) -> None:
+ """Shows information about the raw API response."""
+ await self.send_raw_content(ctx, message)
+
@raw.command()
async def json(self, ctx: Context, message: Message) -> None:
"""Shows information about the raw API response in a copy-pasteable Python format."""
- await ctx.invoke(self.raw, message=message, json=True)
+ await self.send_raw_content(ctx, message, json=True)
def setup(bot: Bot) -> None: