From fa3eb3da0aa241fc71a4b91417521a528646c293 Mon Sep 17 00:00:00 2001 From: Paillat Date: Wed, 16 Aug 2023 09:25:43 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(functionscalls.py):=20await?= =?UTF-8?q?=20the=20moderate=20function=20calls=20to=20properly=20handle?= =?UTF-8?q?=20asynchronous=20moderation=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/functionscalls.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/functionscalls.py b/src/functionscalls.py index a10dabf..c7da912 100644 --- a/src/functionscalls.py +++ b/src/functionscalls.py @@ -342,11 +342,11 @@ async def call_function(message: discord.Message, function_call, api_key): if name not in functions_matching: raise FuntionCallError("Invalid function name") function = functions_matching[name] - if arguments.get("message", "") != "" and moderate( + if arguments.get("message", "") != "" and await moderate( api_key=api_key, text=arguments["message"] ): return "Message blocked by the moderation system. Please try again." - if arguments.get("query", "") != "" and moderate( + if arguments.get("query", "") != "" and await moderate( api_key=api_key, text=arguments["query"] ): return "Query blocked by the moderation system. If the user asked for something edgy, please tell them in a funny way that you won't do it, but do not specify that it was blocked by the moderation system."