From 6b0133b833d2b31a27c696c02055424d9dd980a1 Mon Sep 17 00:00:00 2001 From: Paillat Date: Fri, 3 Mar 2023 13:39:10 +0100 Subject: [PATCH] fixed bug with special characters --- code/makeprompt.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/makeprompt.py b/code/makeprompt.py index 4b5c2f0..de758cc 100644 --- a/code/makeprompt.py +++ b/code/makeprompt.py @@ -92,6 +92,9 @@ async def chat_process(self, message): else: role = "user" name = msg.author.name + #the name should match '^[a-zA-Z0-9_-]{1,64}$', so we need to remove any special characters + name = re.sub(r"[^a-zA-Z0-9_-]", "", name) + msgs.append({"role": role, "content": f"{content}", "name": name}) if message.content.lower().find("undude") != -1: # prompt += "System: Undude detected. Botator is now mad. He will start talking in capital letters.\n"