Skip to content

Commit 99c3c99

Browse files
committed
Finding linked messages in replies work now, resolves #2920
1 parent e31b07d commit 99c3c99

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ however, insignificant breaking changes do not guarantee a major version bump, s
3030
- `?blocked` now no longers show blocks that have expired.
3131
- Blocked roles will no longer trigger an error during unblock.
3232
- Custom emojis are now supported in `confirm_thread_creation_deny`. ([GH #2916](https://github.com/kyb3r/modmail/issues/2916))
33+
- Finding linked messages in replies work now. ([GH #2920](https://github.com/kyb3r/modmail/issues/2920), [Jerrie-Aries](https://github.com/kyb3r/modmail/issues/2920#issuecomment-751530495))
3334

3435
### Internal
3536

core/thread.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,8 +660,10 @@ async def delete_message(
660660
async def find_linked_message_from_dm(self, message, either_direction=False):
661661
if either_direction and message.embeds:
662662
compare_url = message.embeds[0].author.url
663+
compare_id = compare_url.split('#')[-1]
663664
else:
664665
compare_url = None
666+
compare_id = None
665667

666668
if self.channel is not None:
667669
async for linked_message in self.channel.history():
@@ -679,6 +681,11 @@ async def find_linked_message_from_dm(self, message, either_direction=False):
679681
msg_id = int(msg_id)
680682
if int(msg_id) == message.id:
681683
return linked_message
684+
685+
if compare_id is not None and compare_id.isdigit():
686+
if int(msg_id) == int (compare_id):
687+
return linked_message
688+
682689
raise ValueError("Thread channel message not found.")
683690

684691
async def edit_dm_message(self, message: discord.Message, content: str) -> None:

0 commit comments

Comments
 (0)