Skip to content

Added suppress for NotFound error#1976

Merged
ChrisLovering merged 2 commits into
python-discord:mainfrom
Hashed0719:main
Nov 24, 2021
Merged

Added suppress for NotFound error#1976
ChrisLovering merged 2 commits into
python-discord:mainfrom
Hashed0719:main

Conversation

@Hashed0719
Copy link
Copy Markdown
Contributor

@Hashed0719 Hashed0719 commented Nov 23, 2021

Solves BOT-1QH
Solves #1963
issue reference

Copy link
Copy Markdown
Contributor

@jchristgit jchristgit left a comment

Choose a reason for hiding this comment

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

Thank you for your PR!

I think we can leave out the suppress in one of the two spots, I left a comment there. Otherwise, this looks great.

Comment thread bot/exts/moderation/clean.py Outdated
Comment on lines +286 to +289
if len(to_delete) == 100:
# Only up to 100 messages can be deleted in a bulk
await channel.delete_messages(to_delete)
with suppress(NotFound):
await channel.delete_messages(to_delete)
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.

I believe in this case we can leave out the suppress, as we know it will be a bulk delete per len(to_delete) == 100, which doesn't care that the messages are absent.

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.

I agree.

image
My bad I missed, it was specified there.

@ichard26 ichard26 added a: moderation Related to community moderation functionality: (moderation, defcon, verification) a: utility Related to utility commands: (bot, eval, extensions, jams, reminders, snekbox, utils) p: 2 - normal Normal Priority s: needs review Author is waiting for someone to review and approve and removed a: moderation Related to community moderation functionality: (moderation, defcon, verification) labels Nov 24, 2021
Copy link
Copy Markdown
Contributor

@ichard26 ichard26 left a comment

Choose a reason for hiding this comment

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

SGTM, thank you!

@ChrisLovering ChrisLovering merged commit 2024766 into python-discord:main Nov 24, 2021
@Xithrius Xithrius removed the s: needs review Author is waiting for someone to review and approve label Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: utility Related to utility commands: (bot, eval, extensions, jams, reminders, snekbox, utils) p: 2 - normal Normal Priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants