mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 09:16:19 +00:00
🔧 fix(functionscalls.py): fix typo in FunctionCallError class name
✨ feat(functionscalls.py): add call_function function to handle function calls with name and arguments 🔧 fix(makeprompt.py): remove individual function imports from functionscalls and use call_function instead
This commit is contained in:
@@ -299,6 +299,17 @@ async def send_ascii_art_image(
|
||||
await message_in_channel_in_wich_to_send.channel.send(message)
|
||||
|
||||
|
||||
async def call_function(message: discord.Message, function_call):
|
||||
name = function_call.get("name", "")
|
||||
if name == "":
|
||||
raise FuntionCallError("No name provided")
|
||||
arguments = function_call.get("arguments", {})
|
||||
if name not in functions_matching:
|
||||
raise FuntionCallError("Invalid function name")
|
||||
function = functions_matching[name]
|
||||
await function(message, arguments)
|
||||
|
||||
|
||||
functions_matching = {
|
||||
"add_reaction_to_last_message": add_reaction_to_last_message,
|
||||
"reply_to_last_message": reply_to_last_message,
|
||||
|
||||
Reference in New Issue
Block a user