first commit

This commit is contained in:
MoonDev
2025-05-21 07:55:46 +03:00
commit 96ea504b10
28 changed files with 919 additions and 0 deletions

21
callbacks/lock.py Normal file
View File

@@ -0,0 +1,21 @@
import ctypes
from typing import Dict, Any
async def lock_computer(args: Dict[str, Any]) -> Dict[str, Any]:
"""
Locks the Windows computer screen using the LockWorkStation API.
Args:
args: Dictionary of arguments (not used in this implementation).
Returns:
Dictionary with status message and input arguments.
Raises:
OSError: If the lock operation fails or the platform is not Windows.
"""
try:
# Use Windows API to lock the screen
result = ctypes.WinDLL('user32.dll').LockWorkStation()
if not result:
raise OSError("Failed to lock the Windows screen")
return {"message": "Windows screen locked successfully", "args": args}
except Exception as e:
raise OSError(f"Error while locking the Windows screen: {str(e)}")