From abc3929654fa00fc124f196b3f32f4a3d819d48a Mon Sep 17 00:00:00 2001 From: Jason <81298350+Deutscher775@users.noreply.github.com> Date: Sun, 17 Nov 2024 22:01:34 +0100 Subject: [PATCH] fixed format spitting out %XXX for characters that got formatted --- src/api.py | 2 +- src/astroidapi/formatter.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api.py b/src/api.py index ed6058f..eb14994 100644 --- a/src/api.py +++ b/src/api.py @@ -443,7 +443,7 @@ async def post_endpoint( message_reply_message=message_reply_message, message_reply_author=message_reply_author, message_author_id=message_author_id, - message_content=message_content, + message_content=astroidapi.formatter.Format.unformat_urlsafe(message_content), message_attachments=message_attachments, message_embed=message_embed, selfuse=selfuse, diff --git a/src/astroidapi/formatter.py b/src/astroidapi/formatter.py index e4ec39c..164ff29 100644 --- a/src/astroidapi/formatter.py +++ b/src/astroidapi/formatter.py @@ -11,3 +11,7 @@ def format_username(cls, username: str): @classmethod def format_urlsafe(cls, message: str): message = message.replace("?", "%3F").replace("&", "%26") + + @classmethod + def unformat_urlsafe(cls, message: str): + message = message.replace("%3F", "?").replace("%26", "&")