Skip to content

Add check does user have permission to get raw message and re-enable raw command#1340

Merged
Akarys42 merged 4 commits into
masterfrom
ks123/raw-fix
Jan 4, 2021
Merged

Add check does user have permission to get raw message and re-enable raw command#1340
Akarys42 merged 4 commits into
masterfrom
ks123/raw-fix

Conversation

@ks129
Copy link
Copy Markdown
Contributor

@ks129 ks129 commented Dec 27, 2020

Check is command invoker in message.channel.members (there is members who can see this channel) and when user is not, give feedback to user and return early. After this, I re-enabled command.

@ks129 ks129 added the a: information Related to information commands: (doc, help, information, reddit, site, tags) label Dec 27, 2020
@coveralls
Copy link
Copy Markdown

coveralls commented Dec 27, 2020

Coverage Status

Coverage decreased (-0.02%) to 56.424% when pulling a76c6ce on ks123/raw-fix into ef12689 on master.

Copy link
Copy Markdown
Contributor

@Xithrius Xithrius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just one change on the error message.

Comment thread bot/exts/info/information.py Outdated
@Xithrius Xithrius added the a: utility Related to utility commands: (bot, eval, extensions, jams, reminders, snekbox, utils) label Dec 28, 2020
Co-authored-by: Xithrius <15021300+Xithrius@users.noreply.github.com>
@ks129 ks129 requested a review from Xithrius December 28, 2020 11:02
Copy link
Copy Markdown
Contributor

@Xithrius Xithrius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

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.")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use an error embed here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many other error messages in this cog use same format.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point.

Copy link
Copy Markdown
Contributor

@Akarys42 Akarys42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

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.")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point.

@Akarys42 Akarys42 merged commit 3906fb4 into master Jan 4, 2021
@Akarys42 Akarys42 deleted the ks123/raw-fix branch January 4, 2021 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: information Related to information commands: (doc, help, information, reddit, site, tags) a: utility Related to utility commands: (bot, eval, extensions, jams, reminders, snekbox, utils)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants