Skip to content

Fix DM handling for code snippets.#2086

Merged
ChrisLovering merged 4 commits into
mainfrom
fix-bot-2081
Mar 4, 2022
Merged

Fix DM handling for code snippets.#2086
ChrisLovering merged 4 commits into
mainfrom
fix-bot-2081

Conversation

@TizzySaurus
Copy link
Copy Markdown
Contributor

@TizzySaurus TizzySaurus commented Feb 14, 2022

Closes #2081.

Catches error raised when trying to edit message in DM fails (we still try to edit so we can ensure the message hasn't been deleted).

If the error was raised by a message inside the guild, then we reraise the error since that's unexpected behaviour (would mean that the bot has missing permissions).

Also only checks if we need to send to #bot-commands when the message was sent in the guild.

NB: Currently untested.

@TizzySaurus TizzySaurus added t: bug Something isn't working p: 3 - low Low Priority a: information Related to information commands: (doc, help, information, reddit, site, tags) s: needs review Author is waiting for someone to review and approve labels Feb 14, 2022
@Xithrius Xithrius requested review from Bluenix2 and removed request for Den4200 February 14, 2022 16:11
Copy link
Copy Markdown
Contributor

@ToxicKidz ToxicKidz left a comment

Choose a reason for hiding this comment

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

There's one line that causes an error, but other than that this looks good.

Comment thread bot/exts/info/code_snippets.py Outdated
Comment thread bot/exts/info/code_snippets.py
- Changed `destination.guild` to `message.guild` since `DMChannel` doesn't have a "guild" attribute

- Only call `wait_for_deletion` when inside a guild.
@ToxicKidz ToxicKidz added s: waiting for author Waiting for author to address a review or respond to a comment and removed s: needs review Author is waiting for someone to review and approve labels Feb 18, 2022
Copy link
Copy Markdown
Contributor

@Bluenix2 Bluenix2 left a comment

Choose a reason for hiding this comment

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

I do have one comment you can implement if there comes other feedback, it's not a big deal overall. I can't manage to trigger the codepath that sends the ouput to bot-commands, but this fixes the issue listed.

Thank you for this Tizzy!

Comment thread bot/exts/info/code_snippets.py Outdated
@ToxicKidz ToxicKidz self-assigned this Feb 28, 2022
@ToxicKidz ToxicKidz requested review from ChrisLovering and removed request for ToxicKidz February 28, 2022 21:07
@ToxicKidz ToxicKidz added s: needs review Author is waiting for someone to review and approve and removed s: waiting for author Waiting for author to address a review or respond to a comment labels Feb 28, 2022
@ChrisLovering ChrisLovering enabled auto-merge March 4, 2022 10:03
@ChrisLovering ChrisLovering merged commit 34a650a into main Mar 4, 2022
@ChrisLovering ChrisLovering deleted the fix-bot-2081 branch March 4, 2022 10:04
@Xithrius Xithrius removed the s: needs review Author is waiting for someone to review and approve label Mar 23, 2022
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) p: 3 - low Low Priority t: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot suppress embeds in a DM channel

7 participants