mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 09:16:19 +00:00
🐛 fix(functionscalls.py): await the moderate function calls to properly handle asynchronous moderation checks
This commit is contained in:
@@ -342,11 +342,11 @@ async def call_function(message: discord.Message, function_call, api_key):
|
|||||||
if name not in functions_matching:
|
if name not in functions_matching:
|
||||||
raise FuntionCallError("Invalid function name")
|
raise FuntionCallError("Invalid function name")
|
||||||
function = functions_matching[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"]
|
api_key=api_key, text=arguments["message"]
|
||||||
):
|
):
|
||||||
return "Message blocked by the moderation system. Please try again."
|
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"]
|
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."
|
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."
|
||||||
|
|||||||
Reference in New Issue
Block a user