Skip to content

Commit c2b75dc

Browse files
committed
Clearer error messages on reply fails.
1 parent fe11448 commit c2b75dc

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ however, insignificant breaking changes do not guarantee a major version bump, s
2121

2222
- Added command validation to `autotrigger add/edit`.
2323
- `GITHUB_TOKEN` is now no longer required in Heroku setups.
24+
- Clearer error messages on reply fails.
2425

2526
### Fixed
2627

core/thread.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -747,16 +747,21 @@ async def reply(
747747
anonymous=anonymous,
748748
plain=plain,
749749
)
750-
except Exception:
750+
except Exception as e:
751751
logger.error("Message delivery failed:", exc_info=True)
752+
if isinstance(e, discord.Forbidden):
753+
description = ("Your message could not be delivered as "
754+
"the recipient is only accepting direct "
755+
"messages from friends, or the bot was "
756+
"blocked by the recipient.")
757+
else:
758+
description = ("Your message could not be delivered due "
759+
"to an unknown error. ")
752760
tasks.append(
753761
message.channel.send(
754762
embed=discord.Embed(
755763
color=self.bot.error_color,
756-
description="Your message could not be delivered as "
757-
"the recipient is only accepting direct "
758-
"messages from friends, or the bot was "
759-
"blocked by the recipient.",
764+
description=description,
760765
)
761766
)
762767
)

0 commit comments

Comments
 (0)