aboutsummaryrefslogtreecommitdiffstats
path: root/bot
diff options
context:
space:
mode:
authorGravatar AG_1436 <[email protected]>2020-01-25 15:33:59 +0530
committerGravatar GitHub <[email protected]>2020-01-25 15:33:59 +0530
commit9c4cf670fff767569fb4d29c7c4108f88e82015b (patch)
treeec009a81c6d1454ce7b90b39d9e592eebbb7014d /bot
parentMerge pull request #337 from AG4lyf/bookmark-patch (diff)
Added permission check for staff channels message leak.
Diffstat (limited to 'bot')
-rw-r--r--bot/seasons/evergreen/bookmark.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/bot/seasons/evergreen/bookmark.py b/bot/seasons/evergreen/bookmark.py
index 0197f9f4..3fe1d12c 100644
--- a/bot/seasons/evergreen/bookmark.py
+++ b/bot/seasons/evergreen/bookmark.py
@@ -25,6 +25,18 @@ class Bookmark(commands.Cog):
) -> None:
"""Send the author a link to `target_message` via DMs."""
log.info(f"{ctx.author} bookmarked {target_message.jump_url} with title '{title}'")
+ permissions = ctx.author.permissions_in(target_message.channel)
+ if not permissions.read_messages:
+ embed = discord.Embed(
+ title=random.choice(ERROR_REPLIES),
+ color=Colours.soft_red,
+ description="You don't have permission to see what's in the channel so you can't "
+ "bookmark a message from it."
+ )
+ embed.set_author(name=ctx.author.name, icon_url=ctx.author.avatar_url)
+ await ctx.send(embed=embed)
+ return
+
embed = discord.Embed(
title=title,
colour=Colours.soft_green,