This commit is contained in:
Slipstream 2025-04-30 13:50:21 -06:00
parent 1e46054b04
commit ae54167cc4
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD
2 changed files with 16 additions and 6 deletions

View File

@ -963,11 +963,16 @@ def create_tools_list():
tool_declarations.append(
FunctionDeclaration(
name="run_git_pull",
description="Runs 'git pull' in the bot's current working directory on the host machine and returns the output.",
description="Runs 'git pull' in the bot's current working directory on the host machine. Requires authorization via user_id. Returns the output and status.",
parameters={
"type": "object",
"properties": {},
"required": []
"properties": {
"user_id": {
"type": "string",
"description": "The Discord user ID of the user requesting the git pull. Required for authorization."
}
},
"required": ["user_id"]
}
)
)

View File

@ -1093,12 +1093,17 @@ async def restart_gurt_bot(cog: commands.Cog, channel_id: str = None) -> Dict[st
except Exception as e:
return {"status": "error", "error": f"Failed to restart: {str(e)}"}
async def run_git_pull(cog: commands.Cog) -> Dict[str, Any]:
async def run_git_pull(cog: commands.Cog, user_id: str) -> Dict[str, Any]:
"""
Runs 'git pull' in the bot's current working directory on the host machine.
Returns the output and status.
Requires authorization via user_id. Returns the output and status.
"""
return await execute_internal_command(cog, "git pull")
return await execute_internal_command(cog=cog, command="git pull", user_id=user_id)
async def send_discord_message(cog: commands.Cog, channel_id: str, message_content: str) -> Dict[str, Any]:
"""Sends a message to a specified Discord channel."""
print(f"Attempting to send message to channel {channel_id}: {message_content[:100]}...")
# Ensure this function doesn't contain the logic accidentally put in the original run_git_pull
if not message_content:
return {"error": "Message content cannot be empty."}
# Limit message length