diff options
| author | 2021-01-05 20:35:08 +0200 | |
|---|---|---|
| committer | 2021-01-05 20:35:08 +0200 | |
| commit | 8760cf4523a096eb041d100342fb3106283d3e53 (patch) | |
| tree | 7c7bfa4b5b27b83ce8ebef7342ecd73af16a9899 | |
| parent | Remove unnecessary Keys import from utils cog (diff) | |
| parent | Merge pull request #1340 from python-discord/ks123/raw-fix (diff) | |
Merge branch 'master' into branding-manager
| -rw-r--r-- | Pipfile | 2 | ||||
| -rw-r--r-- | Pipfile.lock | 4 | ||||
| -rw-r--r-- | bot/exts/info/information.py | 8 | ||||
| -rw-r--r-- | bot/exts/moderation/watchchannels/talentpool.py | 16 |
4 files changed, 17 insertions, 13 deletions
@@ -14,7 +14,7 @@ beautifulsoup4 = "~=4.9" colorama = {version = "~=0.4.3",sys_platform = "== 'win32'"} coloredlogs = "~=14.0" deepdiff = "~=4.0" -"discord.py" = {git = "https://github.com/Rapptz/discord.py.git", ref = "93f102ca907af6722ee03638766afd53dfe93a7f"} +"discord.py" = {git = "https://github.com/Rapptz/discord.py.git", ref = "94f76e63947b102e5de6dae9a2cd687b308033"} feedparser = "~=5.2" fuzzywuzzy = "~=0.17" lxml = "~=4.4" diff --git a/Pipfile.lock b/Pipfile.lock index a4b7ed5b5..6f0f762f6 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -240,11 +240,11 @@ }, "discord-py": { "git": "https://github.com/Rapptz/discord.py.git", - "ref": "93f102ca907af6722ee03638766afd53dfe93a7f" + "ref": "94f76e63947b102e5de6dae9a2cd687b308033dd" }, "discord.py": { "git": "https://github.com/Rapptz/discord.py.git", - "ref": "93f102ca907af6722ee03638766afd53dfe93a7f" + "ref": "94f76e63947b102e5de6dae9a2cd687b308033" }, "docutils": { "hashes": [ diff --git a/bot/exts/info/information.py b/bot/exts/info/information.py index b2138b03f..38e760ee3 100644 --- a/bot/exts/info/information.py +++ b/bot/exts/info/information.py @@ -419,10 +419,14 @@ class Information(Cog): return out.rstrip() @cooldown_with_role_bypass(2, 60 * 3, BucketType.member, bypass_roles=constants.STAFF_ROLES) - @group(invoke_without_command=True, enabled=False) + @group(invoke_without_command=True) @in_whitelist(channels=(constants.Channels.bot_commands,), roles=constants.STAFF_ROLES) async def raw(self, ctx: Context, *, message: Message, json: bool = False) -> None: """Shows information about the raw API response.""" + 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 + # I *guess* it could be deleted right as the command is invoked but I felt like it wasn't worth handling # doing this extra request is also much easier than trying to convert everything back into a dictionary again raw_data = await ctx.bot.http.get_message(message.channel.id, message.id) @@ -454,7 +458,7 @@ class Information(Cog): for page in paginator.pages: await ctx.send(page) - @raw.command(enabled=False) + @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) diff --git a/bot/exts/moderation/watchchannels/talentpool.py b/bot/exts/moderation/watchchannels/talentpool.py index a77dbe156..df2ce586e 100644 --- a/bot/exts/moderation/watchchannels/talentpool.py +++ b/bot/exts/moderation/watchchannels/talentpool.py @@ -64,12 +64,12 @@ class TalentPool(WatchChannel, Cog, name="Talentpool"): @nomination_group.command(name='watch', aliases=('w', 'add', 'a'), root_aliases=("nominate",)) @has_any_role(*STAFF_ROLES) - async def watch_command(self, ctx: Context, user: FetchedMember, *, reason: str) -> None: + async def watch_command(self, ctx: Context, user: FetchedMember, *, reason: str = '') -> None: """ Relay messages sent by the given `user` to the `#talent-pool` channel. - A `reason` for adding the user to the talent pool is required and will be displayed - in the header when relaying messages of this user to the channel. + A `reason` for adding the user to the talent pool is optional. + If given, it will be displayed in the header when relaying messages of this user to the channel. """ if user.bot: await ctx.send(f":x: I'm sorry {ctx.author}, I'm afraid I can't do that. I only watch humans.") @@ -202,7 +202,7 @@ class TalentPool(WatchChannel, Cog, name="Talentpool"): f"{self.api_endpoint}/{nomination_id}", json={field: reason} ) - + await self.fetch_user_cache() # Update cache. await ctx.send(f":white_check_mark: Updated the {field} of the nomination!") @Cog.listener() @@ -243,8 +243,8 @@ class TalentPool(WatchChannel, Cog, name="Talentpool"): actor = guild.get_member(actor_id) active = nomination_object["active"] - log.debug(active) - log.debug(type(nomination_object["inserted_at"])) + + reason = nomination_object["reason"] or "*None*" start_date = time.format_infraction(nomination_object["inserted_at"]) if active: @@ -254,7 +254,7 @@ class TalentPool(WatchChannel, Cog, name="Talentpool"): Status: **Active** Date: {start_date} Actor: {actor.mention if actor else actor_id} - Reason: {nomination_object["reason"]} + Reason: {reason} Nomination ID: `{nomination_object["id"]}` =============== """ @@ -267,7 +267,7 @@ class TalentPool(WatchChannel, Cog, name="Talentpool"): Status: Inactive Date: {start_date} Actor: {actor.mention if actor else actor_id} - Reason: {nomination_object["reason"]} + Reason: {reason} End date: {end_date} Unwatch reason: {nomination_object["end_reason"]} |