From 2e57c2d1fc2c025e6713a8934cd3844d3088ca48 Mon Sep 17 00:00:00 2001 From: git-bruh Date: Sun, 29 Nov 2020 20:05:27 +0530 Subject: [PATCH] Basic implementation of discord replies --- main.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 96ce69c..755f871 100644 --- a/main.py +++ b/main.py @@ -97,6 +97,14 @@ async def get_channel(): async def process_discord(message): content = message.clean_content + reply = message.reference + replied = "" + if reply: + replied_message = await message.channel.fetch_message(reply.message_id) + replied_content = replied_message.content + replied_author = replied_message.author.name + replied = f"Replying to {replied_author}: {replied_content}\n" + # Replace emote IDs with names content = re.sub(r"", r"\g<1>", content) @@ -104,7 +112,7 @@ async def process_discord(message): for attachment in message.attachments: content += f"\n{attachment.url}" - content = f"<{message.author.name}> {content}" + content = f"<{message.author.name}> {replied} {content}" return content