Implement strike message failover#573
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. 📢 Thoughts on this report? Let us know! |
99f886b to
f66692f
Compare
CarrotManMatt
left a comment
There was a problem hiding this comment.
Please could utils/tex_bot.py line 507 also have a newline added after it.
I'd do it but then it would break the PR review.
Co-authored-by: Matt Norton <matt@carrotmanmatt.com> Signed-off-by: Matty Widdop <18513864+MattyTheHacker@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR enhances error handling for sending strike confirmation messages by adding failover logic when direct messages (DMs) are forbidden and formatting adjustments to notification messages.
- Wraps DM channel creation and message sends in
try/except discord.Forbidden, falling back to a log/webhook channel or aborting the operation. - Adjusts f-string formatting for clarity in user notifications.
- Suppresses a linter warning (
PLR0915) to allow a large handler function.
Comments suppressed due to low confidence (1)
cogs/strike.py:462
- No tests cover the scenario where creating a DM channel raises
discord.Forbiddenand triggers the webhook fallback; consider adding unit tests or integration tests for this failure path to ensure the fallback works as intended.
except discord.Forbidden:
CarrotManMatt
left a comment
There was a problem hiding this comment.
Please could
utils/tex_bot.pyline 507 also have a newline added after it.
I'd do it but then it would break the PR review.
out of scope babes xx |
|
Nah nah akchually cos you added Line 466 in 28941b7 Don't make me do a one line formatting PR |
Adds error handling to DM messages and allows use of webhook if failure