fix: Use original username for references
This commit is contained in:
@@ -130,18 +130,21 @@ class VoiceFixCog(LionCog):
|
|||||||
def prepare_content(self, message, target_chid):
|
def prepare_content(self, message, target_chid):
|
||||||
reference = None
|
reference = None
|
||||||
if message.reference:
|
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
|
# Look up message from cache in this channel
|
||||||
refid = message.reference.message_id
|
refid = message.reference.message_id
|
||||||
if origid := self.wmessages.get(refid, None):
|
if origid := self.wmessages.get(refid, None):
|
||||||
if sent := self.message_cache.get(origid, None):
|
if sent := self.message_cache.get(origid, None):
|
||||||
this_ch_msg = next(
|
this_ch_msg = None
|
||||||
(msg for chid, msg in sent if chid == target_chid),
|
for chid, msg in sent:
|
||||||
None
|
if chid == target_chid:
|
||||||
)
|
this_ch_msg = msg
|
||||||
|
if msg.id == origid:
|
||||||
|
author = msg.author.display_name
|
||||||
if this_ch_msg:
|
if this_ch_msg:
|
||||||
reference = this_ch_msg
|
reference = this_ch_msg
|
||||||
original = message.reference.cached_message
|
|
||||||
author = original.author.display_name if original else 'Unknown'
|
|
||||||
forward_str = ''
|
forward_str = ''
|
||||||
if reference:
|
if reference:
|
||||||
forward_str = f"-# Replying to {author} in {reference.jump_url}"
|
forward_str = f"-# Replying to {author} in {reference.jump_url}"
|
||||||
|
|||||||
Reference in New Issue
Block a user