From 70d089f5de64f5af53cf62190f18a497bf2c3a8b Mon Sep 17 00:00:00 2001 From: Interitio Date: Thu, 18 Sep 2025 13:34:32 +1000 Subject: [PATCH] fix: Use original username for references --- voicefix/cog.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/voicefix/cog.py b/voicefix/cog.py index 44390a6..9196e3a 100644 --- a/voicefix/cog.py +++ b/voicefix/cog.py @@ -130,18 +130,21 @@ class VoiceFixCog(LionCog): def prepare_content(self, message, target_chid): reference = None if message.reference: + original = message.reference.cached_message + author = original.author.display_name if original else 'Unknown' + # Look up message from cache in this channel refid = message.reference.message_id if origid := self.wmessages.get(refid, None): if sent := self.message_cache.get(origid, None): - this_ch_msg = next( - (msg for chid, msg in sent if chid == target_chid), - None - ) + this_ch_msg = None + for chid, msg in sent: + if chid == target_chid: + this_ch_msg = msg + if msg.id == origid: + author = msg.author.display_name if this_ch_msg: reference = this_ch_msg - original = message.reference.cached_message - author = original.author.display_name if original else 'Unknown' forward_str = '' if reference: forward_str = f"-# Replying to {author} in {reference.jump_url}"